Page MenuHomePhabricator

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkSurfaceModifier.h b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkSurfaceModifier.h
index 802f140dcb..0f834ef497 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkSurfaceModifier.h
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkSurfaceModifier.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSurfaceModifier_H_HEADER_INCLUDED_
#define MITKSurfaceModifier_H_HEADER_INCLUDED_
//mitk headers
#include <mitkCommon.h>
#include <mitkPointSet.h>
#include <mitkSurface.h>
//itk headers
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMersenneTwisterRandomVariateGenerator.h>
class vtkPolyDataNormals;
namespace mitk {
/** Documentation
* @brief This class offer some methods to modify a surface.
*/
class SurfaceModifier : public itk::Object
{
public:
- mitkClassMacro(SurfaceModifier, itk::Object);
+ mitkClassMacroItkParent(SurfaceModifier, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Adds gaussian noise to a surface (means to all vertexes).
* @param maxNoiseVectorLenght Limits the length of the noise vector of each vertex. Value -1 disables the limit. Default value is also -1.
*/
bool PerturbeSurface(mitk::Surface::Pointer surface, double varianceX, double varianceY, double varianceZ, double maxNoiseVectorLenght = -1);
/** @brief Adds gaussian noise to a part of the vertexes of the surface.
@param outlierChance The chance to perturbe a vertex. Consequently this is also approximately the percentage of vertexes that will be perturbed.
*/
bool AddOutlierToSurface(mitk::Surface::Pointer surface, double varianceX, double varianceY, double varianceZ, double outlierChance);
/** @brief Transforms a surface with a given transform. This method transforms the vertexes which means manipulating the vtkPolyData.
* In some cases this is needed, for example if you want to use the transformed polydata later on.
*/
bool TransformSurface(mitk::Surface::Pointer surface, itk::Matrix<double,3,3> TransformationR, itk::Vector<double,3> TransformationT);
/** @brief Transforms a surface with a given transform (uses the center of gravity of the surface as origin). This method transforms the vertexes which means manipulating the vtkPolyData.
* In some cases this is needed, for example if you want to use the transformed polydata later on.
* @param OverallTransformationR Returns the overall transformation in world coordinates. (rotation)
* @param OverallTransformationT Returns the overall transformation in world coordinates. (translation)
*/
bool TransformSurfaceCoGCoordinates(mitk::Surface::Pointer surface, itk::Matrix<double,3,3> TransformationR, itk::Vector<double,3> TransformationT, itk::Matrix<double,3,3> &OverallTransformationR, itk::Vector<double,3> &OverallTransformationT);
/** @brief Moves the surface (respectively its center of gravity) to the center of the coordinate system. */
bool MoveSurfaceToCenter(mitk::Surface::Pointer surface);
/** @brief Moves the surface (respectively its center of gravity) to the center of the coordinate system.
@param TransformR (return value) returns the rotation of the transform which was applied to the surface to move it to the origin.
@param TransformT (return value) returns the translation of the transform which was applied to the surface to move it to the origin.
*/
bool MoveSurfaceToCenter(mitk::Surface::Pointer surface, itk::Matrix<double,3,3> &TransformR, itk::Vector<double,3> &TransformT);
/** @brief Creates a deep copy (clone) of the given surface and returns it */
mitk::Surface::Pointer DeepCopy(mitk::Surface::Pointer surface);
protected:
SurfaceModifier();
~SurfaceModifier();
/**
* @param maxNoiseVectorLenght Limits the length of the noise vector. Value -1 disables the limit. Default value is also -1.
*/
mitk::Point3D PerturbePoint(mitk::Point3D point, double varianceX, double varianceY, double varianceZ, double maxNoiseVectorLenght = -1);
/** @brief perturbes a point along the given axis */
mitk::Point3D PerturbePointAlongAxis(mitk::Point3D point, mitk::Vector3D axis, double variance);
mitk::Point3D TransformPoint(mitk::Point3D point, itk::Matrix<double,3,3> TransformationR, itk::Vector<double,3> TransformationT);
mitk::Point3D GetCenterOfGravity(mitk::Surface::Pointer surface);
itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer m_myRandomGenerator;
};
} // namespace mitk
#endif /* MITKSurfaceModifier_H_HEADER_INCLUDED_ */
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkTargetPointsCalculator.h b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkTargetPointsCalculator.h
index 330f40c608..329420630d 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkTargetPointsCalculator.h
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/surfaceutilities/mitkTargetPointsCalculator.h
@@ -1,106 +1,106 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTARGETPOINTSCALCULATOR_H_HEADER_INCLUDED_
#define MITKTARGETPOINTSCALCULATOR_H_HEADER_INCLUDED_
//mitk headers
#include "mitkCommon.h"
#include "mitkSurface.h"
#include "mitkPointSet.h"
#include "mitkImage.h"
//itk headers
#include "itkObject.h"
#include <itkObjectFactory.h>
namespace mitk
{
/**
* @brief This class offers methods to automatically calculate target points inside a (closed) surface.
*/
class TargetPointsCalculator : public itk::Object
{
public:
- mitkClassMacro(TargetPointsCalculator, itk::Object);
+ mitkClassMacroItkParent(TargetPointsCalculator, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief identifier for target point calculation method */
enum TargetPointCalculationMethod
{
EvenlyDistributedTargetPoints,
OneTargetPointInCenterOfGravity
};
/** @brief Sets the method for the target point calculation. Default value is EvenlyDistributedTargetPoints. */
void SetTargetPointCalculationMethod(TargetPointCalculationMethod method);
/** @brief Sets the inter point distance (in mm), which is a parameter for the evenly distributed target points.
* This parameter is only used if the method is set to EvenlyDistributedTargetPoints. Default value is 20.
*/
void SetInterPointDistance(int d);
/** @brief Sets the input surface. This parameter must be set before calculation is started. */
void SetInput(mitk::Surface::Pointer input);
/** @brief Calculates the target points.
* @return Returns true if calculation was successful. False if not, you can get an error message in this case.
*/
bool DoCalculate();
/** @return Returns the calculated target points. Returns null if no target points are calculated yet. */
mitk::PointSet::Pointer GetOutput();
/** @return Returns the last error message. Returns an empty string if there was no error yet. */
std::string GetErrorMessage();
protected:
TargetPointsCalculator();
~TargetPointsCalculator();
typedef itk::Image<unsigned char, 3> ImageType;
int m_InterPointDistance;
mitk::PointSet::Pointer m_Output;
mitk::Surface::Pointer m_Input;
std::string m_ErrorMessage;
TargetPointCalculationMethod m_Method;
mitk::Image::Pointer CreateBinaryImage(mitk::Surface::Pointer input);
mitk::PointSet::Pointer CreateTargetPoints(mitk::Image::Pointer binaryImage);
bool isInside(ImageType::Pointer currentImageAsitkImage, mitk::Point3D p);
int RoundUpToGatter(int i, int gatter);
int RoundUpToCentimeters(int i);
mitk::PointSet::Pointer CreateTargetPointInCOG(mitk::Surface::Pointer surface);
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkAnisotropicIterativeClosestPointRegistration.h b/Modules/AlgorithmsExt/include/mitkAnisotropicIterativeClosestPointRegistration.h
index 894673ad74..8dae61e5a6 100644
--- a/Modules/AlgorithmsExt/include/mitkAnisotropicIterativeClosestPointRegistration.h
+++ b/Modules/AlgorithmsExt/include/mitkAnisotropicIterativeClosestPointRegistration.h
@@ -1,325 +1,325 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __ANISOTROPICITERATIVECLOSESTPOINTREGISTRATION_H__
#define __ANISOTROPICITERATIVECLOSESTPOINTREGISTRATION_H__
//MITK
#include <mitkCommon.h>
#include <mitkVector.h>
//EXPORTS
#include "MitkAlgorithmsExtExports.h"
// STL
#include <vector>
// ITK
#include <itkMatrix.h>
// forward declarations
class vtkPoints;
class vtkKdTreePointLocator;
namespace mitk
{
class Surface;
class WeightedPointTransform;
/**
* \ingroup AnisotropicRegistration
*
* @brief Implementation of the anisotropic iterative closest point (A-ICP)
* algoritm.
*
* This class implements the anisotropic interative closest point (A-ICP)
* algorithm presented in L. Maier-Hein et al. in "Convergent Iterative
* Closest-Point Algorithm to Accomodate Anisotropic and Inhomogenous
* Localization Error.", IEEE T Pattern Anal 34 (8), 1520-1532, 2012.
* The algorithm computes the optimal transformation to align two surfaces.
* In addition to the surfaces a list of covariance matrices is used as
* input for every surface. Each covariance matrix represents the error of
* a specific vertex in the Surface. The covariance matrices
* for each surface can be defined by the user, or calculated
* by the CovarianceMatrixCalculator. In addition a trimmed algorithm version
* is provided to compute the registration of partial overlapping surfaces.
* The algorithm needs a clean surface non manifold edges and without duplicated
* vertices. In addition vtkCleanPolyData can be used to ensure a correct
* Surface representation.
*
* \note The correspondence search is accelerated when OpenMP is enabled.
*
* \b Example:
*
*
* \code
* typedef itk::Matrix < double, 3, 3 > Matrix3x3;
* typedef itk::Vector < double, 3 > Vector3;
* typedef std::vector < Matrix3x3 > CovarianceMatrixList;
*
* // compute the covariance matrices
* mitk::CovarianceMatrixCalculator::Pointer matrixCalculator =
* mitk::CovarianceMatrixCalculator::New();
*
* // compute the covariance matrices for the moving surface (X)
* matrixCalculator->SetInputSurface(movingSurface);
* matrixCalculator->ComputeCovarianceMatrices();
* CovarianceMatrixList sigmas_X = matrixCalculator->GetCovarianceMatrices();
* double meanVarX = matrixCalculator->GetMeanVariance();
*
* // compute the covariance matrices for the fixed surface (Y)
* matrixCalculator->SetInputSurface(fixedSurface);
* matrixCalculator->ComputeCovarianceMatrices();
* CovarianceMatrixList sigmas_Y = matrixCalculator->GetCovarianceMatrices();
* double meanVarY = matrixCalculator->GetMeanVariance();
*
* // the FRE normalization factor
* double normalizationFactor = sqrt( meanVarX + meanVarY);
*
* // A-ICP algorithm
* mitk::AnisotropicIterativeClosestPointRegistration::Pointer aICP =
* mitk::AnisotropicIterativeClosestPointRegistration::New();
*
* // set up parameters
* aICP->SetMovingSurface(movingSurface);
* aICP->SetFixedSurface(fixedSurface);
* aICP->SetCovarianceMatricesMovingSurface(sigmas_X);
* aICP->SetCovarianceMatricesFixedSurface(sigmas_Y);
* aICP->SetFRENormalizationFactor(normalizationFactor);
*
* // Trimming is enabled if a fator > 0.0 is set.
* // 40 percent of the moving point set
* // will be used for registration in this example.
* // To disable trimming set the trim factor back to 0.0
* aICP->SetTrimmFactor(0.4);
*
* // run the algorithm
* aICP->Update();
*
* // retrieve the computed transformation
* Matrix3x3 rotation = aICP->GetRotation();
* Vector3 translation = aICP->GetTranslation();
* \endcode
*
*/
class MITKALGORITHMSEXT_EXPORT AnisotropicIterativeClosestPointRegistration : public itk::Object
{
protected:
/** Definition of a 3x3 covariance matrix.*/
typedef itk::Matrix < double, 3, 3 > CovarianceMatrix;
/** Definition of a list of covariance matrices.*/
typedef std::vector< CovarianceMatrix > CovarianceMatrixList;
/** Definition of a translation vector.*/
typedef mitk::Vector3D Translation;
/** Definition of a 3x3 rotation matrix.*/
typedef CovarianceMatrix Rotation;
/** Definition of a correspondeces, index and distance.*/
typedef std::pair < unsigned int, double > Correspondence;
/** Definition of a list of correspondences.*/
typedef std::vector < Correspondence > CorrespondenceList;
AnisotropicIterativeClosestPointRegistration();
~AnisotropicIterativeClosestPointRegistration();
/** Max amount of iterations. Default is 1000.*/
unsigned int m_MaxIterations;
/** Threshold used for termination. Default is 1.0e-6.*/
double m_Threshold;
/** Normalization factor for the feducial registration error. default is 0.0.*/
double m_FRENormalizationFactor;
/** Search radius for the correspondence search. Default is 30.*/
double m_SearchRadius;
/** The maximum number of iterations in the weighted point based
* registration. Default is 1000.
*/
double m_MaxIterationsInWeightedPointTransform;
/** The fiducial registration error (FRE).*/
double m_FRE;
/** Trimmfactor for partial overlapping registration. Default is 0.*/
double m_TrimmFactor;
/** Amount of iterations used by the algorithm.*/
unsigned int m_NumberOfIterations;
/** Moving surface that is transformed on the fixed surface.*/
itk::SmartPointer < Surface > m_MovingSurface;
/** The fixed / target surface.*/
itk::SmartPointer < Surface > m_FixedSurface;
/** The weighted point based registration algorithm.*/
itk::SmartPointer < WeightedPointTransform > m_WeightedPointTransform;
/** The covariance matrices belonging to the moving surface (X).*/
CovarianceMatrixList m_CovarianceMatricesMovingSurface;
/** The covariance matrices belonging to the moving surface (Y).*/
CovarianceMatrixList m_CovarianceMatricesFixedSurface;
/** The computed 3x1 translation vector.*/
Translation m_Translation;
/** The computed 3x3 rotation matrix.*/
Rotation m_Rotation;
/**
* Method that computes the correspondences between the moving point set X
* and the fixed point set Y. The distances between the points
* are weighted with weight matrices that are computed from the covariances
* along the surfaces axes. This method implements the runtime optimization
* presented by L. Maier-Hein et al.. The correspondences are computed with
* the help of a kd tree. The correspondences are searched in a given radius
* in the euklidian space. Every correspondence found in this radius is
* weighted based on the covariance matrices and the best weighting will be
* used as a correspondence.
*
* @param X The moving point set.
* @param Z The returned correspondences from the fixed point set.
* @param Y The fixed point set saved in a kd tree.
* @param sigma_X Covariance matrices belonging to the moving point set.
* @param sigma_Y Covariance matrices belonging to the fixed point set.
* @param sigma_Z Covariance matrices belonging to the correspondences found.
* @param correspondences Saved correspondences, in a pair containing the
* their index in Y and distance.
* @param radius The search radius used in in kd tree.
*
*/
void ComputeCorrespondences ( vtkPoints* X,
vtkPoints* Z,
vtkKdTreePointLocator *Y,
const CovarianceMatrixList& sigma_X,
const CovarianceMatrixList& sigma_Y,
CovarianceMatrixList& sigma_Z,
CorrespondenceList &correspondences,
const double radius
);
public:
- mitkClassMacro(AnisotropicIterativeClosestPointRegistration, itk::Object)
+ mitkClassMacroItkParent(AnisotropicIterativeClosestPointRegistration, itk::Object)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Set the maximum amount of iterations used by the algorithm. */
itkSetMacro(MaxIterations, unsigned int)
/** Set the threshold used to terminate the algorithm.*/
itkSetMacro(Threshold, double)
/** Set the normalization factor for the fiducial registration error (FRE).
* The normalization factor is computed with the help of the mean variance
* of both CovarianceMatrixList that can be obtained when the covariance
* matrices are calculated with the CovarianceMatrixCalculator:
*
* \code{.cpp}
* double FRENormalizationFactor = sqrt ( MeanVarianceX + MeanVarianceY );
* \endcode
*
* if no FRE normalization is used the normalization factor is set to 1.0
* as default value.
*/
itkSetMacro(FRENormalizationFactor, double)
/** Set search radius for the correspondence search.*/
itkSetMacro(SearchRadius, double)
/** Set the maximim number of iterations used by the point based registration
* algorithm.
*/
itkSetMacro(MaxIterationsInWeightedPointTransform, double)
/** Get the fiducial registration error (FRE).*/
itkGetMacro(FRE,double)
/** Get the number of iterations used by the algorithm.*/
itkGetMacro(NumberOfIterations, unsigned int)
/**
* Factor that trimms the point set in percent for
* partial overlapping surfaces. E.g. 0.4 will use 40 precent
* of the point set. To enable the trimmed version a
* factor > 0 and < 1 must be set. The default value is 0.0.
*/
itkSetMacro(TrimmFactor,double)
/**
* Set moving surface that includes the point set (X).
*/
itkSetMacro(MovingSurface,itk::SmartPointer<Surface>)
/**
* Set fixed surface that includes the point set (Y).
*/
itkSetMacro(FixedSurface,itk::SmartPointer<Surface>)
/**
* Returns the 3x1 translation vector computed by the algorithm.
*/
itkGetConstReferenceMacro(Translation,Translation)
/**
* Returns the 3x3 rotation matrix computed by the algorithm.
*/
itkGetConstReferenceMacro(Rotation,Rotation)
/**
* Set the covariance matrices of the moving surface. The algorithm
* need the same amount of covariance and points available in the surface.
* The covariance matrix for every vertex in a Surface can be calculated by
* the CovarianceMatrixCalculator. It is also possible to define
* arbitrary matrices by hand.
*/
void SetCovarianceMatricesMovingSurface( CovarianceMatrixList& list )
{
m_CovarianceMatricesMovingSurface = list;
}
/**
* Set the covariance matrices of the fixed surface. The algorithm
* need the same amount of covariance and points available in the surface.
* The covariance matrix for every vertex in a Surface can be calculated by
* the CovarianceMatrixCalculator. It is also possible to define
* arbitrary matrices by hand.
*/
void SetCovarianceMatricesFixedSurface( CovarianceMatrixList& list )
{
m_CovarianceMatricesFixedSurface = list;
}
/**
* This method executes the algorithm.
*
* @warning The algorithm is only a simple calculation filter and can not be
* used in a mitk filter pipline.
*
* @throws Exception if the search radius was doubled more than 20 times to
* prevent endless loops. Re-run the with a different search radius that
* will find the correspondences.
*/
void Update();
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkAutoCropImageFilter.h b/Modules/AlgorithmsExt/include/mitkAutoCropImageFilter.h
index 1011799bca..5d07641b8c 100644
--- a/Modules/AlgorithmsExt/include/mitkAutoCropImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkAutoCropImageFilter.h
@@ -1,129 +1,129 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkAutoCropImageFilter_h_
#define __mitkAutoCropImageFilter_h_
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkSubImageSelector.h"
#include "mitkImageTimeSelector.h"
#include <itkImageRegion.h>
#include <itkImage.h>
namespace mitk {
/**
*
* @brief Shrink the image borders to a minimum considering a background color.
*
* This filter determines the smallest bounding box of all pixels different
* from the background, and returns an output image which has been cropped to this size.
* The box calculated this way is not the smallest possible box, but the box with the
* smallest sides perpendicular to the world coordinate system.
*
* The filter works on 3D and 4D image data. For the 4D case, the smallest box is
* calculated with side lengths as the maximum of single side lengths from all time steps.
*
* 2D images are not supported, and will never be.
*
* It is also possible to set the region to be cropped manually using the
* SetCroppingRegion() method.
*
* A margin can be set to enlarge the cropped region with a constant factor in all
* directions around the smallest possible.
*
*
* @ingroup Process
*
* @author Thomas Boettger; revised by Tobias Schwarz and Daniel Stein; Division of Medical
* and Biological Informatics
*
*/
class MITKALGORITHMSEXT_EXPORT AutoCropImageFilter : public SubImageSelector
{
public:
typedef itk::ImageRegion<3> RegionType;
mitkClassMacro(AutoCropImageFilter, SubImageSelector);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetConstMacro(BackgroundValue,float);
itkSetMacro(BackgroundValue,float);
itkGetConstMacro(MarginFactor,float);
itkSetMacro(MarginFactor,float);
itkGetMacro(CroppingRegion, RegionType);
// Use this method to manually set a region
void SetCroppingRegion(RegionType overrideRegion);
virtual const PixelType GetOutputPixelType();
protected:
// default constructor
AutoCropImageFilter();
// default destructor
virtual ~AutoCropImageFilter();
// This method calculates the actual smallest box
void ComputeNewImageBounds();
// Crops the image using the itk::RegionOfInterestImageFilter and creates the new output image
template < typename TPixel, unsigned int VImageDimension>
void ITKCrop3DImage( itk::Image< TPixel, VImageDimension >* inputItkImage, unsigned int timestep );
// Here, the output image is initialized by the input and the newly calculated region
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
// Purposely not implemented
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
// Crops the image on all time steps
- virtual void GenerateData();
+ virtual void GenerateData() override;
float m_BackgroundValue;
RegionType m_CroppingRegion;
float m_MarginFactor;
typedef itk::Image<float,3> ImageType;
typedef ImageType::Pointer ImagePointer;
RegionType::SizeType m_RegionSize;
RegionType::IndexType m_RegionIndex;
mitk::ImageTimeSelector::Pointer m_TimeSelector;
mitk::SlicedData::RegionType m_InputRequestedRegion;
itk::TimeStamp m_TimeOfHeaderInitialization;
bool m_OverrideCroppingRegion;
};
} // namespace mitk
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkBoundingObjectCutter.h b/Modules/AlgorithmsExt/include/mitkBoundingObjectCutter.h
index cb35b230f2..1606b6717a 100644
--- a/Modules/AlgorithmsExt/include/mitkBoundingObjectCutter.h
+++ b/Modules/AlgorithmsExt/include/mitkBoundingObjectCutter.h
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD
#define BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkBoundingObject.h"
#include "mitkImageTimeSelector.h"
#include "itkImage.h"
namespace mitk {
//##Documentation
//## @brief Cuts an Boundingobject out of an mitk Image
//##
//## Input Parameters are a mitk::BoundingObject and optionally an mitk::Image
//## if no mitk::Image is provided, the resulting image will have m_InsideValue as pixelvalue on inside pixel,
//## otherwise it will have the pixelvalue of the input image.
//## Pixel on the outside of the BoundingObject will have a pixelvalue of m_OutsideValue
//## \todo What Image resolution/spacing should be used, if no input image is given?
//## @ingroup Process
class MITKALGORITHMSEXT_EXPORT BoundingObjectCutter : public ImageToImageFilter
{
public:
mitkClassMacro(BoundingObjectCutter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetBoundingObject( const mitk::BoundingObject* boundingObject );
const mitk::BoundingObject* GetBoundingObject() const;
//##Description
//## @brief Set for inside pixels, used when m_UseInsideValue is @a true
itkSetMacro(InsideValue, ScalarType);
itkGetMacro(InsideValue, ScalarType);
//##Description
//## @brief Set value for outside pixels, used when m_AutoOutsideValue is \a false
itkSetMacro(OutsideValue, ScalarType);
itkGetMacro(OutsideValue, ScalarType);
itkSetMacro(UseInsideValue, bool);
itkGetMacro(UseInsideValue, bool);
itkBooleanMacro(UseInsideValue);
//##Description
//## @brief If set to \a true the minimum of the ouput pixel type is
//## used as outside value.
itkSetMacro(AutoOutsideValue, bool);
itkGetMacro(AutoOutsideValue, bool);
itkBooleanMacro(AutoOutsideValue);
itkGetMacro(InsidePixelCount, unsigned int);
itkGetMacro(OutsidePixelCount, unsigned int);
itkSetMacro(UseWholeInputRegion, bool);
itkGetMacro(UseWholeInputRegion, bool);
protected:
BoundingObjectCutter();
virtual ~BoundingObjectCutter();
virtual const PixelType GetOutputPixelType();
- virtual void GenerateInputRequestedRegion();
- virtual void GenerateOutputInformation();
- virtual void GenerateData();
+ virtual void GenerateInputRequestedRegion() override;
+ virtual void GenerateOutputInformation() override;
+ virtual void GenerateData() override;
template < typename TPixel, unsigned int VImageDimension, typename TOutputPixel >
friend void CutImageWithOutputTypeSelect( itk::Image< TPixel, VImageDimension >* inputItkImage, mitk::BoundingObjectCutter* cutter, int boTimeStep, TOutputPixel* dummy );
template < typename TPixel, unsigned int VImageDimension, typename TOutputPixel >
friend void CutImageWithOutputTypeSelect( itk::VectorImage< TPixel, VImageDimension >* inputItkImage, mitk::BoundingObjectCutter* cutter, int boTimeStep, TOutputPixel* dummy );
template < typename TPixel, unsigned int VImageDimension >
friend void CutImage( itk::Image< TPixel, VImageDimension >* itkImage, mitk::BoundingObjectCutter* cutter, int boTimeStep );
template < typename TPixel, unsigned int VImageDimension >
friend void CutImage( itk::VectorImage< TPixel, VImageDimension >* itkImage, mitk::BoundingObjectCutter* cutter, int boTimeStep );
virtual void ComputeData(mitk::Image* input3D, int boTimeStep);
//##Description
//## @brief BoundingObject that will be cut
mitk::BoundingObject::Pointer m_BoundingObject;
//##Description
//## @brief Value for inside pixels, used when m_UseInsideValue is @a true
//##
//## \sa m_UseInsideValue
ScalarType m_InsideValue;
//##Description
//## @brief Value for outside pixels (default: 0)
//##
//## Used only if m_AutoOutsideValue is \a false.
ScalarType m_OutsideValue;
//##Description
//## @brief If \a true the minimum of the ouput pixel type is
//## used as outside value (default: \a false)
bool m_AutoOutsideValue;
//##Description
//## @brief Use m_InsideValue for inside pixels (default: \a false)
//##
//## If @a true, pixels that are inside m_BoundingObject
//## will get m_InsideValue in the cutting process
//## If @a false, they keep their original value.
//## \sa m_InsideValue
bool m_UseInsideValue;
unsigned int m_OutsidePixelCount;
unsigned int m_InsidePixelCount;
//##Description
//## @brief Region of input needed for cutting
mitk::SlicedData::RegionType m_InputRequestedRegion;
//##Description
//## @brief Time when Header was last initialized
itk::TimeStamp m_TimeOfHeaderInitialization;
mitk::ImageTimeSelector::Pointer m_InputTimeSelector;
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector;
bool m_UseWholeInputRegion;
};
} // namespace mitk
#endif /* BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD */
diff --git a/Modules/AlgorithmsExt/include/mitkBoundingObjectToSegmentationFilter.h b/Modules/AlgorithmsExt/include/mitkBoundingObjectToSegmentationFilter.h
index 17e05024f8..c3b496bbc4 100644
--- a/Modules/AlgorithmsExt/include/mitkBoundingObjectToSegmentationFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkBoundingObjectToSegmentationFilter.h
@@ -1,43 +1,43 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKBOUNDINGOBJECTTOSEGMENTATIONFILTER_H
#define MITKBOUNDINGOBJECTTOSEGMENTATIONFILTER_H
#include <mitkImageToImageFilter.h>
#include <mitkBoundingObjectGroup.h>
#include <MitkAlgorithmsExtExports.h>
namespace mitk{
class MITKALGORITHMSEXT_EXPORT BoundingObjectToSegmentationFilter : public ImageToImageFilter
{
public:
mitkClassMacro(BoundingObjectToSegmentationFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetBoundingObject(mitk::BoundingObject::Pointer boundingObject);
protected:
BoundingObjectToSegmentationFilter();
virtual ~BoundingObjectToSegmentationFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
mitk::BoundingObjectGroup::Pointer m_boundingObjectGroup;
};//class
}//namespace
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h b/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
index 9b8aad3e9c..979af37edf 100644
--- a/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
+++ b/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
@@ -1,130 +1,130 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __MITK_COVARIANCEMATRIXCALCULATOR_H__
#define __MITK_COVARIANCEMATRIXCALCULATOR_H__
// exports
#include "MitkAlgorithmsExtExports.h"
#include <mitkCommon.h>
#include <itkObjectFactory.h>
#include <vector>
#include <itkMatrix.h>
namespace mitk
{
// forward declarations
class Surface;
struct CovarianceMatrixCalculatorData;
/**
* \ingroup AnisotropicRegistration
*
* @brief Class that computes the covariance matrices for every point in a
* {@link Surface} used in the A-ICP algorithm.
*
* Computes a covariance matrix for every vertex in a given {@link Surface}
* based on it's direct neighbours and saves them into a CovarianceMatrixList.
* The Class implements the CM_PCA method presented by
* L. Maier-Hein et al. in "Convergent Iterative Closest-Point Algorithm
* to Accomodate Anisotropic and Inhomogenous Localization Error.",
* IEEE T Pattern Anal 34 (8), 1520-1532, 2012. The algorithm needs
* a clean Surface with non manifold edges and no duplicated vertices. To
* ensure a clean Surface representation use vtkCleanPolyData.
*/
class MITKALGORITHMSEXT_EXPORT CovarianceMatrixCalculator : public itk::Object
{
private:
/** Pimpl to hold private data.*/
CovarianceMatrixCalculatorData* d;
protected:
// local typedefs
/** Definition of the covariance matrix.*/
typedef itk::Matrix<double,3,3> CovarianceMatrix;
/** Definition of a list of covariance matrices */
typedef std::vector<CovarianceMatrix> CovarianceMatrixList;
typedef double Vertex[3];
/** List that stores the computed covariance matrices. */
CovarianceMatrixList m_CovarianceMatrixList;
/** This method projects all surrounding vertices of given vertex in a Surface
* in the normal direction onto a plane and computes a primary component
* analysis on the projected vertices. In the next step a orthonormal
* system is created.
*
* @param The index of the input Vertex in the Surface.
* @param The normal of the input Vertex.
* @param Output CovarianceMatrix of the principal component analysis.
* @param Output. Variances along the axes of the createt Orthonormal system.
* @param Output. The current Vertex in the surface
*
*/
void ComputeOrthonormalCoordinateSystem( const int index,
Vertex normal,
CovarianceMatrix &principalComponents,
Vertex variances,
Vertex curVertex);
CovarianceMatrixCalculator();
~CovarianceMatrixCalculator();
public:
- mitkClassMacro(CovarianceMatrixCalculator, itk::Object)
+ mitkClassMacroItkParent(CovarianceMatrixCalculator, itk::Object)
itkFactorylessNewMacro (Self)
itkCloneMacro(Self)
/** Sets the scaling factor for the voronoi area.
* @param factor The scaling factor.
*/
void SetVoronoiScalingFator( const double factor );
/** Enables/disables the covariance matrix normalization.
* @param state Enables the covariance matrix normalization.
*/
void EnableNormalization( bool state );
/** Returns the mean of variance of all computed covariance matrices.
* @return The mean variance.
*/
double GetMeanVariance() const;
/** Returns a reference to the CovarianceMatrixList with the computed covariance matrices.
* @return A CovarianceMatrixList.
*/
const CovarianceMatrixList& GetCovarianceMatrices() const;
/** Sets the input {@link Surface} for which the covariance matrices will be calculated.
* @param input A {@link Surface}.
*/
void SetInputSurface (Surface *input);
/** Method that computes the covariance matrices for the input surface.
* @throws std::exception If the input surface is not set.
*/
void ComputeCovarianceMatrices();
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkGeometryClipImageFilter.h b/Modules/AlgorithmsExt/include/mitkGeometryClipImageFilter.h
index 2a705ca5c8..fb1407008a 100644
--- a/Modules/AlgorithmsExt/include/mitkGeometryClipImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkGeometryClipImageFilter.h
@@ -1,181 +1,181 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
#define MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "mitkGeometryData.h"
namespace itk {
template <class TPixel, unsigned int VImageDimension> class ITK_EXPORT Image;
}
namespace mitk {
//##Documentation
//## @brief Filter for clipping an image with a PlaneGeometry
//##
//## The given geometry for clipping can be either a PlaneGeometry
//## or a TimeGeometry containing multiple instances
//## of PlaneGeometry
//##
//## \todo add AutoOrientLabels, which makes the "left" side (minimum X value) side of the image get one defined label.
//## left-most because vtkPolyDataNormals uses the same definition and this filter is used for visualization of
//## front/back side of curved planes
//##
//## @ingroup Process
class MITKALGORITHMSEXT_EXPORT GeometryClipImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(GeometryClipImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Set the geometry to be used for clipping
*
* The given geometry for clipping must be a PlaneGeometry.
*/
void SetClippingGeometry(const mitk::BaseGeometry* aClippingGeometry);
/**
* Set the geometry to be used for clipping
*
* The given geometry for clipping must a
* TimeGeometry containing multiple instances
* of PlaneGeometry
*/
void SetClippingGeometry(const mitk::TimeGeometry* aClippingGeometry);
const mitk::BaseGeometry* GetClippingGeometry() const;
const mitk::TimeGeometry* GetClippingTimeGeometry() const;
//##Description
//## @brief Get whether the part above or below the geometry
//## shall be clipped (default: @a true)
itkGetConstMacro(ClipPartAboveGeometry, bool);
//## @brief Set whether the part above or below the geometry
//## shall be clipped (default: @a true)
itkSetMacro(ClipPartAboveGeometry, bool);
//## @brief Set whether the part above or below the geometry
//## shall be clipped (default: @a true)
itkBooleanMacro(ClipPartAboveGeometry);
//##Description
//## @brief Set value for outside pixels (default: 0),
//## used when m_AutoOutsideValue is \a false
itkSetMacro(OutsideValue, ScalarType);
itkGetConstMacro(OutsideValue, ScalarType);
//##Description
//## @brief If set to \a true the minimum of the ouput pixel type is
//## used as outside value (default: \a false)
itkSetMacro(AutoOutsideValue, bool);
itkGetConstMacro(AutoOutsideValue, bool);
itkBooleanMacro(AutoOutsideValue);
itkSetMacro(AutoOrientLabels, bool);
itkGetConstMacro(AutoOrientLabels, bool);
//##Description
//## @brief If set to \a true both sides of the clipping
//## geometry will be labeld using m_AboveGeometryLabel and
//## m_BelowGeometryLabel
itkSetMacro(LabelBothSides, bool);
itkGetConstMacro(LabelBothSides, bool);
itkBooleanMacro(LabelBothSides);
//##Description
//## @brief Set for voxels above the clipping geometry.
//## This value is only used, if m_LabelBothSides is set to true.
itkSetMacro(AboveGeometryLabel, ScalarType);
itkGetConstMacro(AboveGeometryLabel, ScalarType);
//##Description
//## @brief Set for voxels below the clipping geometry.
//## This value is only used, if m_LabelBothSides is set to true.
itkSetMacro(BelowGeometryLabel, ScalarType);
itkGetConstMacro(BelowGeometryLabel, ScalarType);
protected:
GeometryClipImageFilter();
~GeometryClipImageFilter();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
template < typename TPixel, unsigned int VImageDimension >
friend void _InternalComputeClippedImage(itk::Image<TPixel, VImageDimension>* itkImage, mitk::GeometryClipImageFilter* geometryClipper, const mitk::PlaneGeometry* clippingPlaneGeometry);
mitk::BaseGeometry::ConstPointer m_ClippingGeometry;
mitk::GeometryData::Pointer m_ClippingGeometryData;
mitk::TimeGeometry::ConstPointer m_TimeClippingGeometry;
mitk::ImageTimeSelector::Pointer m_InputTimeSelector;
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector;
//##Description
//## @brief Defines whether the part above or below the geometry
//## shall be clipped (default: @a true)
bool m_ClipPartAboveGeometry;
//##Description
//## @brief Value for outside pixels (default: 0)
//##
//## Used only if m_AutoOutsideValue is \a false.
ScalarType m_OutsideValue;
//##Description
//## @brief If \a true the minimum of the ouput pixel type is
//## used as outside value (default: \a false)
bool m_AutoOutsideValue;
//##Description
//## @brief If \a true all pixels above and below the geometry
//## are labeled with m_AboveGeometryLabel and m_BelowGeometryLabel
bool m_LabelBothSides;
/**
* \brief Orient above like vtkPolyDataNormals does with AutoOrientNormals
*/
bool m_AutoOrientLabels;
//##Description
//## @brief Is used for labeling all pixels above the geometry
//## when m_LabelBothSides is on
ScalarType m_AboveGeometryLabel;
//##Description
//## @brief Is used for labeling all pixels below the geometry
//## when m_LabelBothSides is on
ScalarType m_BelowGeometryLabel;
//##Description
//## @brief Time when Header was last initialized
itk::TimeStamp m_TimeOfHeaderInitialization;
};
} // namespace mitk
#endif /* MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22 */
diff --git a/Modules/AlgorithmsExt/include/mitkGeometryDataSource.h b/Modules/AlgorithmsExt/include/mitkGeometryDataSource.h
index 80c8dc77b0..18ea9288ea 100644
--- a/Modules/AlgorithmsExt/include/mitkGeometryDataSource.h
+++ b/Modules/AlgorithmsExt/include/mitkGeometryDataSource.h
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRYDATASOURCE_H_HEADER_INCLUDED_C10B4740
#define MITKGEOMETRYDATASOURCE_H_HEADER_INCLUDED_C10B4740
#include "mitkBaseDataSource.h"
#include "MitkAlgorithmsExtExports.h"
namespace mitk {
class GeometryData;
/**
* @brief Superclass of all classes generating GeometryData (instances of class
* GeometryData) 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::GeometryDataSource.
* @ingroup Process
*/
class MITKALGORITHMSEXT_EXPORT GeometryDataSource : public BaseDataSource
{
public:
mitkClassMacro(GeometryDataSource, BaseDataSource)
itkNewMacro(Self)
typedef mitk::GeometryData OutputType;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
GeometryDataSource();
virtual ~GeometryDataSource();
};
} // namespace mitk
#endif /* MITKGEOMETRYDATASOURCE_H_HEADER_INCLUDED_C10B4740 */
diff --git a/Modules/AlgorithmsExt/include/mitkHeightFieldSurfaceClipImageFilter.h b/Modules/AlgorithmsExt/include/mitkHeightFieldSurfaceClipImageFilter.h
index dd8975e2b0..4e9004d487 100644
--- a/Modules/AlgorithmsExt/include/mitkHeightFieldSurfaceClipImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkHeightFieldSurfaceClipImageFilter.h
@@ -1,156 +1,156 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKHEIGHTFIELDSURFACECLIPIMAGEFILTER_H_HEADER_INCLUDED
#define MITKHEIGHTFIELDSURFACECLIPIMAGEFILTER_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "mitkSurface.h"
#include "mitkGeometry3D.h"
namespace itk {
template <class TPixel, unsigned int VImageDimension> class ITK_EXPORT Image;
}
namespace mitk {
/**
* \brief Filter for clipping an image with an height-field represented by
* an mitk::Surface.
*
* The filter assumes that the surface represents a height field as seen from
* the plane defined by (1.0/0.0/0.0), (0.0/1.0/0.0). All voxels lying on one
* side of the height field will be clipped, i.e., set to 0. In addition, any
* voxels which are out of bounds when projected on this plane will be clipped
* as well.
*
* \ingroup Process
*/
class MITKALGORITHMSEXT_EXPORT HeightFieldSurfaceClipImageFilter : public ImageToImageFilter
{
public:
typedef std::vector<mitk::Surface*> ClippingPlaneList;
mitkClassMacro(HeightFieldSurfaceClipImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Set/Get the surface defining a height field as a triangle mesh */
void SetClippingSurface( Surface *clippingSurface );
/** \brief Set/Get the surfaces defining a height field as a triangle mesh */
void SetClippingSurfaces( ClippingPlaneList planeList );
/** \brief Set/Get the surface defining a height field as a triangle mesh */
const Surface *GetClippingSurface() const;
enum
{
CLIPPING_MODE_CONSTANT = 0,
CLIPPING_MODE_MULTIPLYBYFACTOR,
CLIPPING_MODE_MULTIPLANE
};
/** \brief Specifies whether clipped part of the image shall be replaced
* by a constant or multiplied by a user-set factor */
void SetClippingMode( int mode );
/** \brief Specifies whether clipped part of the image shall be replaced
* by a constant or multiplied by a user-set factor */
int GetClippingMode();
/** \brief Specifies whether clipped part of the image shall be replaced
* by a constant or multiplied by a user-set factor */
void SetClippingModeToConstant();
/** \brief Specifies whether clipped part of the image shall be replaced
* by a constant or multiplied by a user-set factor */
void SetClippingModeToMultiplyByFactor();
void SetClippingModeToMultiPlaneValue();
/** \brief Set/Get constant gray-value for clipping in CONSTANT mode */
itkSetMacro( ClippingConstant, ScalarType );
/** \brief Set/Get constant gray-value for clipping in CONSTANT mode */
itkGetConstMacro( ClippingConstant, ScalarType );
/** \brief Set/Get multiplaction factor for clipping in MULTIPLYBYFACTOR mode */
itkSetMacro( MultiplicationFactor, ScalarType );
/** \brief Set/Get multiplaction factor for clipping in MULTIPLYBYFACTOR mode */
itkGetConstMacro( MultiplicationFactor, ScalarType );
/** \brief Set/Get x-resolution of height-field sampling (default: 256). */
itkSetMacro( HeightFieldResolutionX, unsigned int );
/** \brief Set/Get x-resolution of height-field sampling (default: 256). */
itkGetConstMacro( HeightFieldResolutionX, unsigned int );
/** \brief Set/Get y-resolution of height-field sampling (default: 256). */
itkSetMacro( HeightFieldResolutionY, unsigned int );
/** \brief Set/Get y-resolution of height-field sampling (default: 256). */
itkGetConstMacro( HeightFieldResolutionY, unsigned int );
protected:
HeightFieldSurfaceClipImageFilter();
~HeightFieldSurfaceClipImageFilter();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
template < typename TPixel, unsigned int VImageDimension >
void _InternalComputeClippedImage(
itk::Image< TPixel, VImageDimension > *itkImage,
HeightFieldSurfaceClipImageFilter *clipImageFilter,
vtkPolyData *clippingPolyData,
AffineTransform3D *imageToPlaneTransform );
ImageTimeSelector::Pointer m_InputTimeSelector;
ImageTimeSelector::Pointer m_OutputTimeSelector;
int m_ClippingMode;
ScalarType m_ClippingConstant;
ScalarType m_MultiplicationFactor;
unsigned m_MultiPlaneValue;
unsigned int m_HeightFieldResolutionX;
unsigned int m_HeightFieldResolutionY;
double m_MaxHeight;
/** \brief Time when Header was last initialized */
itk::TimeStamp m_TimeOfHeaderInitialization;
};
} // namespace mitk
#endif /* MITKHEIGHTFIELDSURFACECLIPIMAGEFILTER_H_HEADER_INCLUDED */
diff --git a/Modules/AlgorithmsExt/include/mitkImageToUnstructuredGridFilter.h b/Modules/AlgorithmsExt/include/mitkImageToUnstructuredGridFilter.h
index 69dd0939f3..d48bf433fc 100644
--- a/Modules/AlgorithmsExt/include/mitkImageToUnstructuredGridFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkImageToUnstructuredGridFilter.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKIMAGETOUNSTRUCTUREDGRIDFILTER_h__
#define _MITKIMAGETOUNSTRUCTUREDGRIDFILTER_h__
#include <MitkAlgorithmsExtExports.h>
#include <mitkCommon.h>
#include <mitkUnstructuredGrid.h>
#include <mitkUnstructuredGridSource.h>
#include <mitkImage.h>
namespace mitk {
/**
* @brief Converts an Image into an UnstructuredGrid represented by Points.
* The filter uses a Threshold to extract every pixel, with value higher than
* the threshold, as point.
* If no threshold is set, every pixel is extracted as a point.
*/
class MITKALGORITHMSEXT_EXPORT ImageToUnstructuredGridFilter
: public UnstructuredGridSource
{
public:
mitkClassMacro(ImageToUnstructuredGridFilter, UnstructuredGridSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** This method is called by Update(). */
- virtual void GenerateData();
+ virtual void GenerateData() override;
/** Initializes the output information */
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/** Returns a const reference to the input image */
const mitk::Image* GetInput(void);
/** Set the source image. As input every mitk 3D image can be used. */
using itk::ProcessObject::SetInput;
virtual void SetInput(const mitk::Image *image);
/**
* Set the threshold for extracting points. Every pixel, which value
* is higher than this value, will be a point.
*/
void SetThreshold(double threshold);
/** Returns the threshold */
double GetThreshold();
itkGetMacro(NumberOfExtractedPoints, int)
protected:
/** Constructor */
ImageToUnstructuredGridFilter();
/** Destructor */
virtual ~ImageToUnstructuredGridFilter();
/**
* Access method for extracting the points from the input image
*/
template<typename TPixel, unsigned int VImageDimension>
void ExtractPoints(const itk::Image<TPixel, VImageDimension>* image);
private:
/**
* Geometry of the input image, needed to tranform the image points
* into world points
*/
mitk::BaseGeometry* m_Geometry;
/** The number of points extracted by the filter */
int m_NumberOfExtractedPoints;
/** Threshold for extracting the points */
double m_Threshold;
/** The output of the filter, which contains the extracted points */
mitk::UnstructuredGrid::Pointer m_UnstructGrid;
};
} // namespace mitk
#endif //_MITKIMAGETOUNSTRUCTUREDGRIDFILTER_h__
diff --git a/Modules/AlgorithmsExt/include/mitkLabeledImageToSurfaceFilter.h b/Modules/AlgorithmsExt/include/mitkLabeledImageToSurfaceFilter.h
index 0f079992ac..58fbfe6cc6 100644
--- a/Modules/AlgorithmsExt/include/mitkLabeledImageToSurfaceFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkLabeledImageToSurfaceFilter.h
@@ -1,172 +1,172 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitk_labeled_image_to_surface_filter__h_
#define _mitk_labeled_image_to_surface_filter__h_
#include <mitkImageToSurfaceFilter.h>
#include "MitkAlgorithmsExtExports.h"
#include <vtkImageData.h>
#include <map>
namespace mitk
{
/**
* Calculates surfaces for labeled images.
* If you have a labeled image containing 5 different labeled regions
* plus the background, this class creates 5 surface representations
* from the regions. Each surface is assigned to one output of the
* filter. You can figure out, which label corresponds to which
* output using the GetLabelForNthOutput() method.
* If you want to calculate a surface representation only for one
* specific label, you may call GenerateAllLabelsOff() and set the
* desired label by SetLabel(label).
*/
class MITKALGORITHMSEXT_EXPORT LabeledImageToSurfaceFilter : public ImageToSurfaceFilter
{
public:
mitkClassMacro( LabeledImageToSurfaceFilter, ImageToSurfaceFilter );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef int LabelType;
typedef std::map<LabelType, unsigned long> LabelMapType;
typedef std::map<unsigned int, LabelType> IdxToLabelMapType;
/**
* Set whether you want to extract all (true) or only
* a specific label (false)
* @param _arg true by default
*/
itkSetMacro( GenerateAllLabels, bool );
/**
* @returns if all labels or only a specific label should be
* extracted.
*/
itkGetMacro( GenerateAllLabels, bool );
itkBooleanMacro( GenerateAllLabels );
/**
* Set the label you want to extract. This method only has an effect,
* if GenerateAllLabels() is set to false
* @param _arg the label to extract, by default 1
*/
itkSetMacro( Label, LabelType );
/**
* Returns the label you want to extract. This method only has an effect,
* if GenerateAllLabels() is set to false
* @returns _arg the label to extract, by default 1
*/
itkGetMacro( Label, LabelType );
/**
* Set the label of the background. No surface will be generated for this label!
* @param _arg the label of the background, by default 0
*/
itkSetMacro( BackgroundLabel, LabelType );
/**
* Returns the label of the background. No surface will be generated for this label!
* @returns the label of the background, by default 0
*/
itkGetMacro( BackgroundLabel, LabelType );
/**
* Set standard deviation for Gaussian Filter.
* @param _arg by default 1.5
*/
itkSetMacro( GaussianStandardDeviation, double );
/**
* Returns the standard deviation of the Gaussian filter which will be
* used when filter is enabled.
*/
itkGetMacro( GaussianStandardDeviation, double );
/**
* Lets you retrieve the label which was used for generating the Nth output of this filter.
* If GenerateAllLabels() is set to false, this filter only knows about the label provided
* via SetLabel(). All other labels in the image are not known.
* @param i the index of the Nth output.
* @returns the label used for calculating the Nth output of the filter. If i is out of
* range, itk::NumericLimits<LabelType>::max() is returned.
*/
LabelType GetLabelForNthOutput( const unsigned int& i );
/**
* Lets you retrieve the volume in milliliters of the region used to generate the Nth output.
* @param i the index of the Nth output.
* @returns the volume of the region used to generate the Nth output of the filter. If
* i is out of range, 0.0 is returned.
*/
mitk::ScalarType GetVolumeForNthOutput( const unsigned int& i );
/**
* Lets you retrieve the volume in milliliters of the region with the given label. If
* GenerateAllLabels is set to false, you may only call this method for the label provided
* using the SetLabel() method.
* @param label the label of the region you want to get the volume of
* @returns the volume of the region with the given label. If
* label is invalid, 0.0 is returned.
*/
mitk::ScalarType GetVolumeForLabel( const LabelType& label );
protected:
double m_GaussianStandardDeviation;
bool m_GenerateAllLabels;
LabelType m_Label;
LabelType m_BackgroundLabel;
LabelMapType m_AvailableLabels;
IdxToLabelMapType m_IdxToLabels;
- virtual void GenerateData();
+ virtual void GenerateData() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
virtual void CreateSurface( int time, vtkImageData *vtkimage, mitk::Surface * surface, LabelType label );
virtual LabelMapType GetAvailableLabels();
LabeledImageToSurfaceFilter();
virtual ~LabeledImageToSurfaceFilter();
private:
itkSetMacro(Threshold, ScalarType);
itkGetConstMacro(Threshold, ScalarType);
virtual void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface * surface, const ScalarType threshold);
};
} // end of namespace mitk
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkMaskAndCutRoiImageFilter.h b/Modules/AlgorithmsExt/include/mitkMaskAndCutRoiImageFilter.h
index 1060607ee9..7737e3c798 100644
--- a/Modules/AlgorithmsExt/include/mitkMaskAndCutRoiImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkMaskAndCutRoiImageFilter.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMASKANDCUTROIIMAGEFILTER_H
#define MITKMASKANDCUTROIIMAGEFILTER_H
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkBoundingObject.h"
#include "mitkDataNode.h"
#include "mitkAutoCropImageFilter.h"
#include "itkRegionOfInterestImageFilter.h"
#include "mitkMaskImageFilter.h"
namespace mitk
{
/**
\brief Cuts a region of interest (ROI) out of an image
In the first step, this filter reduces the image region of the given ROI to a minimum. Using this region, a subvolume ist cut out of the given input image.
The ROI is then used to mask the subvolume. Pixel inside the ROI will have their original value, pixel outside will be replaced by m_OutsideValue
*/
class MITKALGORITHMSEXT_EXPORT MaskAndCutRoiImageFilter : public ImageToImageFilter
{
typedef itk::Image<short, 3> ItkImageType;
typedef itk::Image<unsigned char, 3> ItkMaskType;
typedef itk::ImageRegion<3> RegionType;
typedef itk::RegionOfInterestImageFilter<ItkImageType, ItkImageType> ROIFilterType;
public:
mitkClassMacro(MaskAndCutRoiImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro(MaxValue, mitk::ScalarType);
itkGetMacro(MinValue, mitk::ScalarType);
void SetRegionOfInterest(mitk::BaseData* roi);
//void SetRegionOfInterest(Image::Pointer image);
//void SetRegionOfInterest(BoundingObject::Pointer boundingObject);
//void SetRegionOfInterestByNode(mitk::DataNode::Pointer node);
//temporary fix for bug #
mitk::Image::Pointer GetOutput();
protected:
MaskAndCutRoiImageFilter();
~MaskAndCutRoiImageFilter();
- void GenerateData();
+ void GenerateData() override;
ROIFilterType::Pointer m_RoiFilter;
mitk::AutoCropImageFilter::Pointer m_CropFilter;
mitk::MaskImageFilter::Pointer m_MaskFilter;
//needed for temporary fix
mitk::Image::Pointer m_outputImage;
mitk::ScalarType m_MaxValue;
mitk::ScalarType m_MinValue;
};//class
}//namespace
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkMaskImageFilter.h b/Modules/AlgorithmsExt/include/mitkMaskImageFilter.h
index b2d8c12052..ff42a5a39f 100644
--- a/Modules/AlgorithmsExt/include/mitkMaskImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkMaskImageFilter.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMASKIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
#define MITKMASKIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "itkImage.h"
namespace mitk {
//##Documentation
//## @brief
//## @ingroup Process
class MITKALGORITHMSEXT_EXPORT MaskImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(MaskImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetMask( const mitk::Image* mask );
const mitk::Image* GetMask() const;
/**
* get/set the min Value of the original image in the masked area
**/
itkGetMacro(MinValue, mitk::ScalarType);
itkSetMacro(MinValue, mitk::ScalarType);
/**
* get/set the max Value of the original image in the masked area
**/
itkGetMacro(MaxValue, mitk::ScalarType);
itkSetMacro(MaxValue, mitk::ScalarType);
/**
* This value is used as outside value. This only works
* if OverrideOutsideValue is set to true. Default is 0.
**/
itkSetMacro( OutsideValue, mitk::ScalarType );
/**
* This value is used as outside value. This only works
* if OverrideOutsideValue is set to true. Default is 0.
*/
itkGetMacro( OutsideValue, mitk::ScalarType );
/**
* If OverrideOutsideValue is set to false, this minimum
* of the pixel type of the output image is taken as outside
* value. If set to true, the value set via SetOutsideValue is
* used as background.
*/
itkSetMacro( OverrideOutsideValue, bool );
/**
* If OverrideOutsideValue is set to false, this minimum
* of the pixel type of the output image is taken as outside
* value. If set to true, the value set via SetOutsideValue is
* used as background.
*/
itkGetMacro( OverrideOutsideValue, bool );
itkBooleanMacro( OverrideOutsideValue );
protected:
MaskImageFilter();
~MaskImageFilter();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
template < typename TPixel, unsigned int VImageDimension >
void InternalComputeMask(itk::Image<TPixel, VImageDimension>* itkImage);
mitk::Image::Pointer m_Mask;
mitk::ImageTimeSelector::Pointer m_InputTimeSelector;
mitk::ImageTimeSelector::Pointer m_MaskTimeSelector;
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector;
//##Description
//## @brief Time when Header was last initialized
itk::TimeStamp m_TimeOfHeaderInitialization;
mitk::ScalarType m_OutsideValue;
mitk::ScalarType m_MinValue;
mitk::ScalarType m_MaxValue;
bool m_OverrideOutsideValue;
};
} // namespace mitk
#endif /* MITKMASKIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22 */
diff --git a/Modules/AlgorithmsExt/include/mitkMovieGenerator.h b/Modules/AlgorithmsExt/include/mitkMovieGenerator.h
index 49254e3dfc..f3d7af0098 100755
--- a/Modules/AlgorithmsExt/include/mitkMovieGenerator.h
+++ b/Modules/AlgorithmsExt/include/mitkMovieGenerator.h
@@ -1,97 +1,97 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MOVIEGENERATOR_H_HEADER_INCLUDED
#define MOVIEGENERATOR_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkStepper.h"
#include "mitkBaseRenderer.h"
namespace mitk {
class MITKALGORITHMSEXT_EXPORT MovieGenerator : public itk::LightObject
{
public:
- mitkClassMacro(MovieGenerator, itk::LightObject);
+ mitkClassMacroItkParent(MovieGenerator, itk::LightObject);
// delivers Win32 or Linux-versions of MovieGenerator
static Pointer New(void);
//! stepper used to control movie generation
virtual void SetStepper( Stepper *stepper ) { m_stepper = stepper; }
//! renderer to record
virtual void SetRenderer( BaseRenderer *renderer ) { m_renderer = renderer; }
//! filename under which movie is saved
virtual void SetFileName( const char *fileName ) { strcpy( m_fileName, fileName ); }
//! uses given stepper and filename to create a movie from the active OpenGL context
virtual bool WriteMovie();
//! alternative way, which does not use a stepper;
// it adds a single frame to a movie each time the function is called
// Initialization is done with first function call; Renderer and Filename have to be set up properly before.
virtual bool WriteCurrentFrameToMovie();
//! releases a movie writer after usage of WriteCurrentFrameToMovie()
virtual void ReleaseMovieWriter();
virtual void SetFrameRate(unsigned int rate);
unsigned int GetFrameRate();
protected:
//! default constructor
MovieGenerator();
//! called directly before the first frame is added, determines movie size from renderer
virtual bool InitGenerator() = 0;
//! used to add a frame
virtual bool AddFrame( void *data ) = 0;
//! called after the last frame is added
virtual bool TerminateGenerator() = 0;
//! stores the movie filename
char m_fileName[1024];
//! stores the used stepper
Stepper *m_stepper;
//! stores the uses renderer
BaseRenderer *m_renderer;
//! InitGenerator() stores movie size in those variables
int m_width, m_height;
bool m_initialized;
unsigned int m_FrameRate;
};
} //namespace mitk
#endif /* MOVIEGENERATOR_H_HEADER_INCLUDED */
diff --git a/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithm.h b/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithm.h
index 7b064ac7e5..563117571e 100644
--- a/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithm.h
+++ b/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithm.h
@@ -1,243 +1,243 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_NON_BLOCKING_ALGORITHM_H_INCLUDED_DFARdfWN1tr
#define MITK_NON_BLOCKING_ALGORITHM_H_INCLUDED_DFARdfWN1tr
#include <itkObjectFactory.h>
#include "MitkAlgorithmsExtExports.h"
#include <itkMacro.h>
#include <itkMultiThreader.h>
#include <itkFastMutexLock.h>
#include <itkImage.h>
#include "mitkCommon.h"
#include "mitkPropertyList.h"
#include "mitkProperties.h"
#include "mitkSmartPointerProperty.h"
#include "mitkDataStorage.h"
#include "mitkWeakPointer.h"
#include "mitkImage.h"
#include "mitkSurface.h"
#include <string>
#include <stdexcept>
/// from itkNewMacro(), additionally calls Initialize(), because this couldn't be done from the constructor of NonBlockingAlgorithm
/// (you can't call virtual functions from the constructor of the superclass)
#define mitkAlgorithmNewMacro( classname ) \
static Pointer New(void) { \
classname* rawPtr = new classname(); \
Pointer smartPtr = rawPtr; \
rawPtr->UnRegister(); \
rawPtr->Initialize(); \
return smartPtr; \
}\
-virtual ::itk::LightObject::Pointer CreateAnother(void) const\
+virtual ::itk::LightObject::Pointer CreateAnother(void) const override\
{\
Pointer smartPtr = classname::New();\
::itk::LightObject::Pointer lightPtr = smartPtr.GetPointer();\
smartPtr->Initialize(this);\
return lightPtr;\
}
namespace mitk
{
/*!
Invokes ResultsAvailable with each new result
<b>done</b> centralize use of itk::MultiThreader in this class
@todo do the property-handling in this class
@todo process "incoming" events in this class
@todo sollen segmentierungs-dinger von mitk::ImageSource erben? Ivo fragen, wie das mit AllocateOutputs, etc. gehen soll
eine ImageSourceAlgorithm koennte dann die noetigen Methoden wie GenerateData(), GetOutput() ueberschreiben, so
dass von dort aus die Methoden von NonBlockingAlgorithm aufgerufen werden.
Erben v.a. um die Output-Sachen zu uebernehmen, die Anpassungen das einfuehren einer Zwischenklasse, um die Interaces zu verheiraten.
*/
class MITKALGORITHMSEXT_EXPORT NonBlockingAlgorithm : public itk::Object
{
public:
// for threading
class MITKALGORITHMSEXT_EXPORT ThreadParameters
{
public:
itk::SmartPointer<NonBlockingAlgorithm> m_Algorithm;
};
- mitkClassMacro( NonBlockingAlgorithm, itk::Object )
+ mitkClassMacroItkParent( NonBlockingAlgorithm, itk::Object )
void SetDataStorage(DataStorage& storage);
DataStorage* GetDataStorage();
// parameter setting
/// For any kind of normal types
template <typename T>
void SetParameter(const char* parameter, const T& value)
{
//MITK_INFO << "SetParameter(" << parameter << ") " << typeid(T).name() << std::endl;
//m_ParameterListMutex->Lock();
m_Parameters->SetProperty(parameter, GenericProperty<T>::New(value) );
//m_ParameterListMutex->Unlock();
}
/// For any kind of smart pointers
template <typename T>
void SetPointerParameter(const char* parameter, const itk::SmartPointer<T>& value)
{
//MITK_INFO << this << "->SetParameter smartpointer(" << parameter << ") " << typeid(itk::SmartPointer<T>).name() << std::endl;
m_ParameterListMutex->Lock();
m_Parameters->SetProperty(parameter, SmartPointerProperty::New(value.GetPointer()) );
m_ParameterListMutex->Unlock();
}
//virtual void SetParameter( const char*, mitk::BaseProperty* ); // for "number of iterations", ...
// create some property observing to inform algorithm object about changes
// perhaps some TriggerParameter(string) macro that creates an observer for changes in a specific property like "2ndPoint" for LineAlgorithms
/// For any kind of BaseData, like Image, Surface, etc. Will be stored inside some SmartPointerProperty
void SetPointerParameter(const char* parameter, BaseData* value);
/// For any kind of ITK images (C pointers)
template <typename TPixel, unsigned int VImageDimension>
void SetItkImageAsMITKImagePointerParameter(const char* parameter, itk::Image<TPixel, VImageDimension>* itkImage)
{
//MITK_INFO << "SetParameter ITK image(" << parameter << ") " << typeid(itk::Image<TPixel, VImageDimension>).name() << std::endl;
// create an MITK image for that
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitkImage = ImportItkImage( itkImage );
SetPointerParameter( parameter, mitkImage );
}
/// For any kind of ITK images (smartpointers)
template <typename TPixel, unsigned int VImageDimension>
void SetItkImageAsMITKImagePointerParameter(const char* parameter, const itk::SmartPointer<itk::Image<TPixel, VImageDimension> >& itkImage)
{
//MITK_INFO << "SetParameter ITK image(" << parameter << ") " << typeid(itk::SmartPointer<itk::Image<TPixel, VImageDimension> >).name() << std::endl;
// create an MITK image for that
mitk::Image::Pointer mitkImage = mitk::Image::New();
mitkImage = ImportItkImage( itkImage );
SetPointerParameter( parameter, mitkImage );
}
// parameter getting
template <typename T>
void GetParameter(const char* parameter, T& value) const
{
//MITK_INFO << "GetParameter normal(" << parameter << ") " << typeid(T).name() << std::endl;
//m_ParameterListMutex->Lock();
BaseProperty* p = m_Parameters->GetProperty(parameter);
GenericProperty<T>* gp = dynamic_cast< GenericProperty<T>* >( p );
if ( gp )
{
value = gp->GetValue();
//m_ParameterListMutex->Unlock();
return;
}
//m_ParameterListMutex->Unlock();
std::string error("There is no parameter \"");
error += parameter;
error += '"';
throw std::invalid_argument( error );
}
template <typename T>
void GetPointerParameter(const char* parameter, itk::SmartPointer<T>& value) const
{
//MITK_INFO << this << "->GetParameter smartpointer(" << parameter << ") " << typeid(itk::SmartPointer<T>).name() << std::endl;
//m_ParameterListMutex->Lock();
BaseProperty* p = m_Parameters->GetProperty(parameter);
if (p)
{
SmartPointerProperty* spp = dynamic_cast< SmartPointerProperty* >( p );
if ( spp )
{
T* t = dynamic_cast<T*>( spp->GetSmartPointer().GetPointer() );
value = t;
//m_ParameterListMutex->Unlock();
return;
}
}
//m_ParameterListMutex->Unlock();
std::string error("There is no parameter \"");
error += parameter;
error += '"';
throw std::invalid_argument( error );
}
// start/stop functions
virtual void Reset();
void StartAlgorithm(); // for those who want to trigger calculations on their own
// --> need for an OPTION: manual/automatic starting
void StartBlockingAlgorithm(); // for those who want to trigger calculations on their own
void StopAlgorithm();
void TriggerParameterModified(const itk::EventObject&);
void ThreadedUpdateSuccessful(const itk::EventObject&);
void ThreadedUpdateFailed(const itk::EventObject&);
protected:
NonBlockingAlgorithm(); // use smart pointers
virtual ~NonBlockingAlgorithm();
void DefineTriggerParameter(const char*);
void UnDefineTriggerParameter(const char*);
virtual void Initialize(const NonBlockingAlgorithm* other = NULL);
virtual bool ReadyToRun();
virtual bool ThreadedUpdateFunction(); // will be called from a thread after calling StartAlgorithm
virtual void ThreadedUpdateSuccessful(); // will be called after the ThreadedUpdateFunction() returned
virtual void ThreadedUpdateFailed(); // will when ThreadedUpdateFunction() returns false
PropertyList::Pointer m_Parameters;
WeakPointer<DataStorage> m_DataStorage;
private:
static ITK_THREAD_RETURN_TYPE StaticNonBlockingAlgorithmThread(void* param);
typedef std::map< std::string, unsigned long > MapTypeStringUInt;
MapTypeStringUInt m_TriggerPropertyConnections;
itk::FastMutexLock::Pointer m_ParameterListMutex;
int m_ThreadID;
int m_UpdateRequests;
ThreadParameters m_ThreadParameters;
itk::MultiThreader::Pointer m_MultiThreader;
bool m_KillRequest;
};
} // namespace
#include "mitkNonBlockingAlgorithmEvents.h"
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithmEvents.h b/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithmEvents.h
index 5087127f78..775c386d24 100644
--- a/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithmEvents.h
+++ b/Modules/AlgorithmsExt/include/mitkNonBlockingAlgorithmEvents.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED
#define MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED
#include <itkEventObject.h>
namespace mitk {
class NonBlockingAlgorithm;
class NonBlockingAlgorithmEvent : public itk::AnyEvent
{
public:
typedef NonBlockingAlgorithmEvent Self;
typedef itk::AnyEvent Superclass;
NonBlockingAlgorithmEvent( const NonBlockingAlgorithm* algorithm = NULL )
: m_Algorithm(algorithm) {}
virtual ~NonBlockingAlgorithmEvent() {}
- virtual const char * GetEventName() const
+ virtual const char * GetEventName() const override
{
return "NonBlockingAlgorithmEvent";
}
- virtual bool CheckEvent(const ::itk::EventObject* e) const
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{
return dynamic_cast<const Self*>(e);
}
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{
return new Self( m_Algorithm );
}
const mitk::NonBlockingAlgorithm* GetAlgorithm() const
{
return m_Algorithm.GetPointer();
}
NonBlockingAlgorithmEvent(const Self& s) : itk::AnyEvent(s), m_Algorithm(s.m_Algorithm) {};
protected:
mitk::NonBlockingAlgorithm::ConstPointer m_Algorithm;
private:
void operator=(const Self&);
};
class ResultAvailable : public NonBlockingAlgorithmEvent
{
public:
ResultAvailable( const NonBlockingAlgorithm* algorithm = NULL )
: NonBlockingAlgorithmEvent(algorithm)
{
}
virtual ~ResultAvailable()
{
}
};
class ProcessingError : public NonBlockingAlgorithmEvent
{
public:
ProcessingError( const NonBlockingAlgorithm* algorithm = NULL )
: NonBlockingAlgorithmEvent(algorithm)
{
}
virtual ~ProcessingError()
{
}
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkPadImageFilter.h b/Modules/AlgorithmsExt/include/mitkPadImageFilter.h
index 7729b70a80..22167cb771 100644
--- a/Modules/AlgorithmsExt/include/mitkPadImageFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkPadImageFilter.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPADIMAGEFILTER_H_HEADER_INCLUDED
#define MITKPADIMAGEFILTER_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageTimeSelector.h"
#include "itkImage.h"
namespace mitk {
/**
* \brief PadImageFilter class pads the first input image to the size of the second input image.
* Two Images have to be set.
* The first image is the image to pad. The second image defines the pad size.
* It is also possible to use an included binary filter.
*
* \ingroup Process
*/
class MITKALGORITHMSEXT_EXPORT PadImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(PadImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Sets the intensity of the pixel to pad */
itkSetMacro(PadConstant, int);
/** \brief sets the binary filter ON or OFF */
itkSetMacro(BinaryFilter, bool);
/** \brief Sets the lower threshold of the included binary filter */
itkSetMacro(LowerThreshold, int);
/** \brief Sets the upper threshold of the included binary filter */
itkSetMacro(UpperThreshold, int);
protected:
PadImageFilter();
virtual ~PadImageFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
private:
bool m_BinaryFilter;
int m_PadConstant, m_LowerThreshold, m_UpperThreshold;
};
} // namespace mitk
#endif /* MITKPADIMAGEFILTER_H_HEADER_INCLUDED */
diff --git a/Modules/AlgorithmsExt/include/mitkPlaneFit.h b/Modules/AlgorithmsExt/include/mitkPlaneFit.h
index 218df0d0bd..26535dbb1d 100644
--- a/Modules/AlgorithmsExt/include/mitkPlaneFit.h
+++ b/Modules/AlgorithmsExt/include/mitkPlaneFit.h
@@ -1,148 +1,148 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#if !defined(MITK_PLANEFIT_H__INCLUDED_)
#define MITK_PLANEFIT_H__INCLUDED_
#include "mitkPointSet.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkTimeGeometry.h"
#include "mitkPlaneGeometry.h"
#include "mitkGeometryDataSource.h"
namespace mitk {
//!
// kind regards to dr. math!
// function [x0, a, d, normd] = lsplane(X)
// ---------------------------------------------------------------------
// LSPLANE.M Least-squares plane (orthogonal distance
// regression).
//
// Version 1.0
// Last amended I M Smith 27 May 2002.
// Created I M Smith 08 Mar 2002
// ---------------------------------------------------------------------
// Input
// X Array [x y z] where x = vector of x-coordinates,
// y = vector of y-coordinates and z = vector of
// z-coordinates.
// Dimension: m x 3.
//
// Output
// x0 Centroid of the data = point on the best-fit plane.
// Dimension: 3 x 1.
//
// a Direction cosines of the normal to the best-fit
// plane.
// Dimension: 3 x 1.
//
// <Optional...
// d Residuals.
// Dimension: m x 1.
//
// normd Norm of residual errors.
// Dimension: 1 x 1.
// ...>
//
// [x0, a <, d, normd >] = lsplane(X)
// ---------------------------------------------------------------------
class MITKALGORITHMSEXT_EXPORT PlaneFit : public GeometryDataSource
{
public:
mitkClassMacro( PlaneFit, GeometryDataSource);
itkNewMacro(Self);
typedef mitk::PointSet::PointDataType PointDataType;
typedef mitk::PointSet::PointDataIterator PointDataIterator;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
/*!Getter for point set.
*
*/
const mitk::PointSet *GetInput();
/*! filter initialisation.
*
*/
using mitk::GeometryDataSource::SetInput;
virtual void SetInput( const mitk::PointSet *ps );
/*! returns the center of gravity of the point set.
*
*/
virtual const mitk::Point3D &GetCentroid( int t = 0 ) const;
/*! returns the plane geometry which represents the point set.
*
*/
virtual mitk::PlaneGeometry::Pointer GetPlaneGeometry( int t = 0 );
/*! returns the normal of the plane which represents the point set.
*
*/
virtual const mitk::Vector3D &GetPlaneNormal( int t = 0 ) const;
protected:
PlaneFit();
virtual ~PlaneFit();
/*! Calculates the centroid of the point set.
* the center of gravity is calculated through the mean value of the whole point set
*/
void CalculateCentroid( int t = 0 );
/*! working with an SVD algorithm form matrix dataM.
* ITK suplies the vnl_svd to solve an plan fit eigentvector problem
* points are processed in the SVD matrix. The normal vector is the
* singular vector of dataM corresponding to its smalest singular value.
* The mehtod uses VNL library from ITK and at least the mehtod nullvector()
* to extract the normalvector.
*/
void ProcessPointSet( int t = 0 );
/*! Initialize Plane and configuration.
*
*/
void InitializePlane( int t = 0 );
private:
/*!keeps a copy of the pointset.*/
const mitk::PointSet* m_PointSet;
/* output object - a time sliced geometry.*/
mitk::TimeGeometry::Pointer m_TimeGeometry;
std::vector< mitk::PlaneGeometry::Pointer > m_Planes;
/*! the calculatet center point of all points in the point set.*/
std::vector< mitk::Point3D > m_Centroids;
/* the normal vector to descrie a plane gemoetry.*/
std::vector< mitk::Vector3D > m_PlaneVectors;
};
}//namespace mitk
#endif //MITK_PLANFIT_INCLUDE_
diff --git a/Modules/AlgorithmsExt/include/mitkPlaneLandmarkProjector.h b/Modules/AlgorithmsExt/include/mitkPlaneLandmarkProjector.h
index 0cb41731b3..7f200b3615 100644
--- a/Modules/AlgorithmsExt/include/mitkPlaneLandmarkProjector.h
+++ b/Modules/AlgorithmsExt/include/mitkPlaneLandmarkProjector.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C
#define MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C
#include "mitkLandmarkProjector.h"
#include "MitkAlgorithmsExtExports.h"
#include "mitkPointSet.h"
namespace mitk {
//##Documentation
//## @brief Thin-plate-spline-based landmark-based curved geometry
//##
//## @ingroup Geometry
class MITKALGORITHMSEXT_EXPORT PlaneLandmarkProjector : public LandmarkProjector
{
public:
mitkClassMacro(PlaneLandmarkProjector, LandmarkProjector);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//##Documentation
//## @brief Set the plane-geometry to project the target-landmarks on.
//##
itkSetConstObjectMacro(ProjectionPlane, mitk::PlaneGeometry);
//##Documentation
//## @brief Get the plane-geometry to project the target-landmarks on.
//##
itkGetConstObjectMacro(ProjectionPlane, mitk::PlaneGeometry);
- virtual void ProjectLandmarks(const mitk::PointSet::DataType::PointsContainer* targetLandmarks);
+ virtual void ProjectLandmarks(const mitk::PointSet::DataType::PointsContainer* targetLandmarks) override;
protected:
PlaneLandmarkProjector();
virtual ~PlaneLandmarkProjector();
- virtual void ComputeCompleteAbstractTransform();
+ virtual void ComputeCompleteAbstractTransform() override;
mitk::PlaneGeometry::ConstPointer m_ProjectionPlane;
};
} // namespace mitk
#endif /* MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/AlgorithmsExt/include/mitkPointLocator.h b/Modules/AlgorithmsExt/include/mitkPointLocator.h
index 4eb3f542d5..2d17536043 100644
--- a/Modules/AlgorithmsExt/include/mitkPointLocator.h
+++ b/Modules/AlgorithmsExt/include/mitkPointLocator.h
@@ -1,226 +1,226 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_LOCATOR__H__
#define _MITK_POINT_LOCATOR__H__
#include <itkObject.h>
#include "MitkAlgorithmsExtExports.h"
#include "mitkPointSet.h"
#include <vtkPoints.h>
//forward declarations
class vtkPointSet;
class ANNkd_tree;
namespace mitk
{
/**
* Convenience wrapper around ANN to provide fast nearest neighbour searches.
* Usage: set your points via SetPoints( vtkPointSet* Points ) or SetPoints(mitk::PointSet*).
* Then, you may query the closest point to an arbitrary coordinate by FindClosestPoint().
* There is no further call to update etc. needed.
* Currently only calls for 1 nearest neighbour are supported. Feel free to add functions
* for K nearest neighbours.
* NOTE: At least 1 point must be contained in the point set.
*/
class MITKALGORITHMSEXT_EXPORT PointLocator : public itk::Object
{
public:
- mitkClassMacro( PointLocator, Object );
+ mitkClassMacroItkParent( PointLocator, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef int IdType;
typedef ScalarType DistanceType;
typedef float PixelType;
typedef double CoordRepType;
typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType,
CoordRepType, PixelType> MeshTraits;
typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints( vtkPointSet* points );
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints( mitk::PointSet* points );
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param pointSet the point set containing points for nearest neighbours searches.
*/
void SetPoints( ITKPointSet* pointSet );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( const double point[3] );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param x the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param y the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param z the x coordinated of the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( double x, double y, double z );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint( mitk::PointSet::PointType point );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
* @returns the distance in world coordinates between the nearest point in point set and the given point
*/
DistanceType GetMinimalDistance( mitk::PointSet::PointType point );
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Index and minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
* @returns the index of and distance (in world coordinates) between the nearest point in point set and the given point
*/
bool FindClosestPointAndDistance( mitk::PointSet::PointType point, IdType* id, DistanceType* dist);
protected:
//
// Definition of a vector of ids
//
typedef std::vector<IdType> IdVectorType;
//
// ANN related typedefs, to prevent ANN from being in the global include path.
// Please note, that these line are prone to failure, if the point type in
// ANN changes. Please note also, that these typedefs are only used in the header
// file. The implementation always refers to the original types
//
typedef double* MyANNpoint;
typedef int MyANNidx;
typedef double MyANNdist;
typedef MyANNpoint* MyANNpointArray;
typedef MyANNidx* MyANNidxArray;
typedef MyANNdist* MyANNdistArray;
/**
* constructor
*/
PointLocator();
/**
* destructor
*/
~PointLocator();
/**
* Initializes the ann search tree using previously defined points
*/
void InitANN();
/**
* releases all memory occupied by the ann search tree and internal point set arrays
*/
void DestroyANN();
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestANNPoint( const MyANNpoint& point);
/**
* Finds the minimal distance between the given point and a point in the previously defined point set.
* The distance is returned. Please note, that there is no case, in which
* no distance is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance to a point in the previously defined point set will be determined
* @returns the squared distance in world coordinates between the given point and the nearest neighbour.
*/
DistanceType GetMinimalDistance( const MyANNpoint& point);
bool m_SearchTreeInitialized;
IdVectorType m_IndexToPointIdContainer;
vtkPoints* m_VtkPoints;
mitk::PointSet* m_MitkPoints;
ITKPointSet* m_ItkPoints;
//
// ANN related variables
//
unsigned int m_ANNK;
unsigned int m_ANNDimension;
double m_ANNEpsilon;
MyANNpointArray m_ANNDataPoints;
MyANNpoint m_ANNQueryPoint;
MyANNidxArray m_ANNPointIndexes;
MyANNdistArray m_ANNDistances;
ANNkd_tree* m_ANNTree;
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkSegmentationSink.h b/Modules/AlgorithmsExt/include/mitkSegmentationSink.h
index d9809bb25e..8c8482e21c 100644
--- a/Modules/AlgorithmsExt/include/mitkSegmentationSink.h
+++ b/Modules/AlgorithmsExt/include/mitkSegmentationSink.h
@@ -1,56 +1,56 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_SEGMENTATION_SINK_H_INCLUDET_WAD
#define MITK_SEGMENTATION_SINK_H_INCLUDET_WAD
#include "mitkNonBlockingAlgorithm.h"
#include <MitkAlgorithmsExtExports.h>
namespace mitk
{
class MITKALGORITHMSEXT_EXPORT SegmentationSink : public NonBlockingAlgorithm
{
public:
mitkClassMacro( SegmentationSink, NonBlockingAlgorithm )
mitkAlgorithmNewMacro( SegmentationSink );
protected:
SegmentationSink(); // use smart pointers
virtual ~SegmentationSink();
- virtual void Initialize(const NonBlockingAlgorithm* other = NULL);
- virtual bool ReadyToRun();
+ virtual void Initialize(const NonBlockingAlgorithm* other = NULL) override;
+ virtual bool ReadyToRun() override;
- virtual bool ThreadedUpdateFunction(); // will be called from a thread after calling StartAlgorithm
+ virtual bool ThreadedUpdateFunction() override; // will be called from a thread after calling StartAlgorithm
void InsertBelowGroupNode(mitk::DataNode* node);
DataNode* LookForPointerTargetBelowGroupNode(const char* name);
DataNode* GetGroupNode();
private:
};
} // namespace
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkSimpleHistogram.h b/Modules/AlgorithmsExt/include/mitkSimpleHistogram.h
index a068bac65e..e977426f02 100644
--- a/Modules/AlgorithmsExt/include/mitkSimpleHistogram.h
+++ b/Modules/AlgorithmsExt/include/mitkSimpleHistogram.h
@@ -1,174 +1,174 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSIMPLEHISTOGRAM_H
#define MITKSIMPLEHISTOGRAM_H
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
#include "MitkAlgorithmsExtExports.h"
#include <mitkImage.h>
#include <mitkWeakPointer.h>
#include <itkImageRegionIterator.h>
#include <itkImageRegionIteratorWithIndex.h>
namespace mitk {
//##Documentation
//## @brief Abstract superclass for histograms with double values.
//## Classes which are deriving from this class can be cached
//## in the same way.
class MITKALGORITHMSEXT_EXPORT SimpleHistogram
{
public:
/** @brief Returns the minimal value of the histogram. */
virtual double GetMin() const = 0;
/** @brief Returns the maximum value of the histogram. */
virtual double GetMax() const = 0;
/** @brief Creates a new histogram out the source. */
virtual void ComputeFromBaseData( BaseData* source ) = 0;
/** @brief TODO: (What should this method do?)*/
virtual float GetRelativeBin( double start, double end ) const = 0;
};
class MITKALGORITHMSEXT_EXPORT SimpleImageHistogram : public SimpleHistogram
{
public:
typedef itk::Statistics::Histogram<double> HistogramType;
SimpleImageHistogram()
{
valid=false;
histogram=0;
}
~SimpleImageHistogram()
{
if(histogram)
delete histogram;
}
/** @return Returns if the current histogram is valid, false if not. */
bool GetValid();
typedef itk::Image<short, 3> CTImage;
typedef itk::ImageRegionIterator< CTImage > CTIteratorType;
typedef itk::ImageRegionIteratorWithIndex< CTImage > CTIteratorIndexType;
typedef itk::Image<unsigned char, 3> BinImage;
typedef itk::ImageRegionIterator< BinImage > BinIteratorType;
typedef itk::ImageRegionIteratorWithIndex< BinImage > BinIteratorIndexType;
typedef unsigned long CountType;
protected:
CountType *histogram;
bool valid;
int first;
int last;
int min;
int max;
CountType highest;
double invLogHighest;
public:
- double GetMin() const
+ double GetMin() const override
{
if(!valid)
return 0;
return min;
}
- double GetMax() const
+ double GetMax() const override
{
if(!valid)
return 1;
return max;
}
/** @brief Creates a new histogram out the source which must be an image. Method does nothing if the image is invalid, NULL, etc.. */
- void ComputeFromBaseData( BaseData* source );
- float GetRelativeBin( double start, double end ) const;
+ void ComputeFromBaseData( BaseData* source ) override;
+ float GetRelativeBin( double start, double end ) const override;
};
class MITKALGORITHMSEXT_EXPORT SimpleHistogramCache
{
public:
static const unsigned int maxCacheSize = 64;
class MITKALGORITHMSEXT_EXPORT Element
{
public:
mitk::WeakPointer<BaseData> baseData;
itk::TimeStamp m_LastUpdateTime;
virtual ~Element();
virtual void ComputeFromBaseData(BaseData* baseData) = 0;
virtual SimpleHistogram* GetHistogram() = 0;
};
typedef std::list<Element*> CacheContainer;
CacheContainer cache;
SimpleHistogramCache()
{
}
~SimpleHistogramCache()
{
TrimCache(true);
}
SimpleHistogram *operator[](BaseData::Pointer sp_BaseData);
protected:
void TrimCache(bool full=false)
{
unsigned int targetSize = full?0:maxCacheSize;
while(cache.size()>targetSize)
{
delete cache.back();
cache.pop_back();
}
}
};
}
#endif // MITKSIMPLEHISTOGRAM_H
diff --git a/Modules/AlgorithmsExt/include/mitkSimpleUnstructuredGridHistogram.h b/Modules/AlgorithmsExt/include/mitkSimpleUnstructuredGridHistogram.h
index 97987685d1..a5a19ee0c8 100644
--- a/Modules/AlgorithmsExt/include/mitkSimpleUnstructuredGridHistogram.h
+++ b/Modules/AlgorithmsExt/include/mitkSimpleUnstructuredGridHistogram.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSIMPLEUNSTRUCTUREDGRIDHISTOGRAM_H
#define MITKSIMPLEUNSTRUCTUREDGRIDHISTOGRAM_H
#include <MitkAlgorithmsExtExports.h>
#include "mitkSimpleHistogram.h"
#include <itkListSample.h>
namespace mitk {
class MITKALGORITHMSEXT_EXPORT SimpleUnstructuredGridHistogram : public SimpleHistogram
{
public:
SimpleUnstructuredGridHistogram();
- virtual double GetMin() const;
- virtual double GetMax() const;
+ virtual double GetMin() const override;
+ virtual double GetMax() const override;
- virtual void ComputeFromBaseData( BaseData* source );
- virtual float GetRelativeBin( double start, double end ) const;
+ virtual void ComputeFromBaseData( BaseData* source ) override;
+ virtual float GetRelativeBin( double start, double end ) const override;
private:
typedef double MeasurementType;
typedef itk::Vector<MeasurementType, 1> MeasurementVectorType;
typedef itk::Statistics::ListSample<MeasurementVectorType> ListSampleType;
typedef itk::Statistics::Histogram<MeasurementType> HistogramType;
HistogramType::ConstPointer m_UGHistogram;
//UnstructuredGridHistogram::Pointer m_UGHistogram;
HistogramType::BinMinContainerType m_Mins;
HistogramType::BinMaxContainerType m_Maxs;
double m_InvMaxFrequency;
double m_BinSize;
};
}
#endif // MITKSIMPLEUNSTRUCTUREDGRIDHISTOGRAM_H
diff --git a/Modules/AlgorithmsExt/include/mitkSurfaceToPointSetFilter.h b/Modules/AlgorithmsExt/include/mitkSurfaceToPointSetFilter.h
index 9891214b34..3cebba6086 100644
--- a/Modules/AlgorithmsExt/include/mitkSurfaceToPointSetFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkSurfaceToPointSetFilter.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSURFACETOPOINTSETFILTER_H_HEADER_INCLUDED_
#define MITKSURFACETOPOINTSETFILTER_H_HEADER_INCLUDED_
// exports
#include "MitkAlgorithmsExtExports.h"
//mitk headers
#include <mitkPointSetSource.h>
#include "mitkSurface.h"
//#include <itkExtendedDoublyLinkedFaceList.h>
namespace mitk {
/** Documentation
* @brief This filter converts the input surface into a point set. The output point set contains every point exactly one time
* (no dublicated points like in the stl-format).
*/
class MITKALGORITHMSEXT_EXPORT SurfaceToPointSetFilter : public mitk::PointSetSource
{
public:
mitkClassMacro(SurfaceToPointSetFilter,mitk::PointSetSource);
itkNewMacro(Self);
using itk::ProcessObject::SetInput;
void SetInput(mitk::Surface::Pointer m_InputSurface);
std::string GetErrorMessage();
protected:
SurfaceToPointSetFilter();
~SurfaceToPointSetFilter();
/** @brief method generating the output of this filter. Called in the updated process of the pipeline. */
- virtual void GenerateData();
+ virtual void GenerateData() override;
//############### members ########################
mitk::Surface::Pointer m_InputSurface;
std::string m_ErrorMessage;
};
} // namespace mitk
#endif /* MITKSURFACETODISTANCEIMAGEFILTER_H_HEADER_INCLUDED_ */
diff --git a/Modules/AlgorithmsExt/include/mitkUnstructuredGridClusteringFilter.h b/Modules/AlgorithmsExt/include/mitkUnstructuredGridClusteringFilter.h
index 743dae16d6..4985045249 100644
--- a/Modules/AlgorithmsExt/include/mitkUnstructuredGridClusteringFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkUnstructuredGridClusteringFilter.h
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKUNSTRUCTUREDGRIDCLUSTERINGFILTER_h__
#define _MITKUNSTRUCTUREDGRIDCLUSTERINGFILTER_h__
#include <MitkAlgorithmsExtExports.h>
#include <mitkCommon.h>
#include <mitkUnstructuredGrid.h>
#include <vtkSmartPointer.h>
#include <mitkUnstructuredGridToUnstructuredGridFilter.h>
#include <vtkIdList.h>
#include <vtkPoints.h>
namespace mitk {
/**
* @brief The UnstructuredGridClusteringFilter class
*
* DBSCAN algorithm:
*
* DBSCAN(D, eps, MinPts)
* C = 0
* for each unvisited point P in dataset D
* mark P as visited
* N = D.regionQuery(P, eps)
* if sizeof(N) < MinPts
* mark P as NOISE
* else
* C = next cluster
* expandCluster(P, N, C, eps, MinPts)
*
* expandCluster(P, N, C, eps, MinPts)
* add P to cluster C
* for each point P' in N
* if P' is not visited
* mark P' as visited
* N' = D.regionQuery(P', eps)
* if sizeof(N') >= MinPts
* N = N joined with N'
* if P' is not yet member of any cluster
* add P' to cluster C
*/
class MITKALGORITHMSEXT_EXPORT UnstructuredGridClusteringFilter
: public UnstructuredGridToUnstructuredGridFilter
{
public:
mitkClassMacro(UnstructuredGridClusteringFilter, UnstructuredGridToUnstructuredGridFilter)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(eps, double)
itkGetMacro(eps, double)
itkSetMacro(MinPts, int)
itkGetMacro(MinPts, int)
itkSetMacro(Meshing, bool)
virtual std::vector< mitk::UnstructuredGrid::Pointer> GetAllClusters();
virtual int GetNumberOfFoundClusters();
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
protected:
UnstructuredGridClusteringFilter();
virtual ~UnstructuredGridClusteringFilter();
private:
void ExpandCluster(int id, vtkIdList* pointIDs, vtkPoints* cluster, vtkPoints *inpPoints);
mitk::UnstructuredGrid::Pointer m_UnstructGrid;
std::vector< vtkSmartPointer<vtkPoints> > m_Clusters;
double m_eps;
int m_MinPts;
bool m_Meshing;
};
} // namespace mitk
#endif //_MITKUNSTRUCTUREDGRIDCLUSTERINGFILTER_h__
diff --git a/Modules/AlgorithmsExt/include/mitkUnstructuredGridToUnstructuredGridFilter.h b/Modules/AlgorithmsExt/include/mitkUnstructuredGridToUnstructuredGridFilter.h
index cd7573f698..f414a2c61f 100644
--- a/Modules/AlgorithmsExt/include/mitkUnstructuredGridToUnstructuredGridFilter.h
+++ b/Modules/AlgorithmsExt/include/mitkUnstructuredGridToUnstructuredGridFilter.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKUNSTRUCTUREDGRIDTOUNSTRUCTUREDGRID_h__
#define _MITKUNSTRUCTUREDGRIDTOUNSTRUCTUREDGRID_h__
#include <MitkAlgorithmsExtExports.h>
#include <mitkCommon.h>
#include <mitkUnstructuredGrid.h>
#include <mitkUnstructuredGridSource.h>
#include <mitkImage.h>
namespace mitk {
class MITKALGORITHMSEXT_EXPORT UnstructuredGridToUnstructuredGridFilter
: public UnstructuredGridSource
{
public:
mitkClassMacro(UnstructuredGridToUnstructuredGridFilter, UnstructuredGridSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Initializes the output information */
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/** Returns a const reference to the input image */
const mitk::UnstructuredGrid* GetInput(void);
virtual const mitk::UnstructuredGrid* GetInput( unsigned int idx );
/** Set the source grid. As input every mitk unstructured grid can be used. */
using itk::ProcessObject::SetInput;
virtual void SetInput(const UnstructuredGrid *grid);
virtual void SetInput(unsigned int idx, const UnstructuredGrid *grid );
virtual void CreateOutputsForAllInputs(unsigned int idx);
protected:
/** Constructor */
UnstructuredGridToUnstructuredGridFilter();
/** Destructor */
virtual ~UnstructuredGridToUnstructuredGridFilter();
private:
/** The output of the filter */
mitk::UnstructuredGrid::Pointer m_UnstructGrid;
};
} // namespace mitk
#endif //_MITKUNSTRUCTUREDGRIDTOUNSTRUCTUREDGRID_h__
diff --git a/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h b/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
index b25e753b0d..7efab93fd6 100644
--- a/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
+++ b/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
@@ -1,259 +1,259 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __WEIGHTEDPOINTTRANSFORM_H__
#define __WEIGHTEDPOINTTRANSFORM_H__
//EXPORTS
#include "MitkAlgorithmsExtExports.h"
//ITK
#include <itkVariableSizeMatrix.h>
#include <mitkCommon.h>
#include <itkMatrix.h>
#include <vector>
#include <mitkPointSet.h>
#include <vtkSmartPointer.h>
// forward declarations
class vtkPoints;
class vtkLandmarkTransform;
namespace mitk
{
/**
* \ingroup AnisotropicRegistration
*
* @brief This class implements an extension of the
* weighted point based registration algorithm
* from A. Danilchenko, R. Balachandran and J. M. Fitzpatrick.
*
* The class implements an extension of the weighted point based registration
* from A. Danilchenko et al.
* presented by L. Maier-Hein et al. in "Convergent Iterative Closest-Point Algorithm
* to Accomodate Anisotropic and Inhomogenous Localization Error.",
* IEEE T Pattern Anal 34 (8), 1520-1532, 2012. The extension computes, in order
* to ensure the convergence of the algorithm, an isotropic estimation
* by an unweighted point based registration algorithm as an initial estimate.
* The implemantion was originally ported to C/C++ by A. Franz.
*
* \note Some methods are accelerated when OpenMP is enabled.
*
*/
class MITKALGORITHMSEXT_EXPORT WeightedPointTransform : public itk::Object
{
/** Definition of a 3x3 matrix.*/
typedef itk::Matrix<double,3,3> Matrix3x3;
/** Definition of a 3x3 Weighting matrix.*/
typedef Matrix3x3 WeightMatrix;
/** Definition of a Rotation matrix.*/
typedef Matrix3x3 Rotation;
/** Definition of a translation vector.*/
typedef itk::Vector<double,3> Translation;
/** Definition of a weight matrix list.*/
typedef std::vector<WeightMatrix> WeightMatrixList;
/** Definition of a covariance matrix list.*/
typedef std::vector<Matrix3x3> CovarianceMatrixList;
public:
- mitkClassMacro(WeightedPointTransform, itk::Object);
+ mitkClassMacroItkParent(WeightedPointTransform, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
/** @brief Method which registers both point sets. */
void ComputeTransformation();
/** @brief Sets the threshold of the registration. Default value is 0.0001.*/
itkSetMacro(Threshold,double)
/** @brief Sets the maximum number of iterations of the registration.
* Default value is 1000.
*/
itkSetMacro(MaxIterations,double)
/** @return Returns the number of iterations of the last run
* of the registration algorithm. Returns -1 if there was no
* run of the registration yet.
*/
itkGetMacro(Iterations,int);
/** @return Returns the FRE of the last run of the registration algorithm.
* Returns -1 if there was no run of the registration yet.
*/
itkGetMacro(FRE,double);
/** @brief Sets the FRE normalization factor. Default value is 1.0. */
itkSetMacro(FRENormalizationFactor,double);
/** @return Returns the current FRE normalization factor.*/
itkGetMacro(FRENormalizationFactor,double);
/** Sets the moving point set used for the registration.
* @param p The input point set.
*/
void SetMovingPointSet(vtkSmartPointer<vtkPoints> p);
/**
* Set the list of 3x3 covariance matrices belonging to the moving point set.
* @param matrices List of covariance matrices.
*/
void SetCovarianceMatricesMoving( const CovarianceMatrixList& matrices);
/** Sets the fixed point set used for the registration.
* @param p The input point set.
*/
void SetFixedPointSet(vtkSmartPointer<vtkPoints> p);
/**
* Set the list of 3x3 covariance matrices belonging to the fixed point set.
* @param matrices List of covariance matrices.
*/
void SetCovarianceMatricesFixed( const CovarianceMatrixList& matrices);
/**
* The translation vector computed by the algorithm.
* @return 3x1 translation vector.
*/
const Translation& GetTransformT() const { return m_Translation; }
/**
* The rotation matrix computed by the algorithm.
*/
const Rotation& GetTransformR() const { return m_Rotation; }
protected:
WeightedPointTransform();
~WeightedPointTransform();
/** Threshold used to terminate the algorithm.*/
double m_Threshold;
/** Max allowed iterations used by the algorithm.*/
int m_MaxIterations;
/** The amount of iterations needed by the algorithm.*/
int m_Iterations;
/** The fiducial registration error (FRE) used in the algorithm.*/
double m_FRE;
/** Normalization factor for the FRE.*/
double m_FRENormalizationFactor;
/** Isotropic point based registration used for initial estimate.*/
vtkSmartPointer<vtkLandmarkTransform> m_LandmarkTransform;
/** The fixed point set (Y).*/
vtkSmartPointer<vtkPoints> m_FixedPointSet;
/** Moving point set (X).*/
vtkSmartPointer<vtkPoints> m_MovingPointSet;
/** Covariance matrices of the moving point set (Sigma_X).*/
CovarianceMatrixList m_CovarianceMatricesMoving;
/** Covariance matrices of the moving point set (Sigma_Y).*/
CovarianceMatrixList m_CovarianceMatricesFixed;
/** 3x1 translation vector.*/
Translation m_Translation;
/** 3x3 rotation matrix.*/
Rotation m_Rotation;
/**
* original matlab-function:
*
* Constructs the C matrix of the linear version of the registration
* problem, Cq = e, where q = [delta_angle(1:3),delta_translation(1:3)] and
* e is produced by e_maker(X,Y,W)
*
* Authors: JM Fitzpatrick and R Balachandran
* Creation: February 2009
*
* --------------------------------------------
*
* converted to C++ by Alfred Franz in March/April 2010
*/
void C_maker( vtkPoints* X, const WeightMatrixList &W,
itk::VariableSizeMatrix< double >& returnValue );
/**
* original matlab-function:
*
* Constructs the e vector of the linear version of the registration
* problem, Cq = e, where q = [delta_angle(1:3),delta_translation(1:3)] and
* C is produced by C_maker(X,W)
*
* Authors: JM Fitzpatrick and R Balachandran
* Creation: February 2009
*
* --------------------------------------------
*
* converted to C++ by Alfred Franz in March/April 2010
*/
void E_maker( vtkPoints* X, vtkPoints* Y,
const WeightMatrixList &W,
vnl_vector< double >& returnValue );
/**
* This method computes the change in a root mean squared
* sense between the previous and the actual iteration.
* The computed value is used as a termination constraint of the algorithm and
* compared against the threshold.
*
* @param X The moving point set in the previous iteration step.
* @param X_new The moving point set in the actual step.
*
* @return The computed change between the two point sets.
*/
double CalculateConfigChange( vtkPoints* X, vtkPoints* X_new );
/**
* @brief This method performs a variant of the weighted point register algorithm presented by
* A. Danilchenko, R. Balachandran and J. M. Fitzpatrick in January 2010. (Modified in January 2011)
* converted to C++ by Alfred Franz in March/April 2010
*
* @param X (input) the moving point set
* @param Y (input) the fixed (static) point set
* @param Sigma_X (input) a 3-by-3-by-N array, each page containing the weighting matrix for the Nth pair of points in X
* @param Sigma_Y (input) a 3-by-3-by-N array, each page containing the weighting matrix for the Nth pair of points in Y
* @param Threshold (input) the relative size of the change to the moving set above which the iteration continues
* @param MaxIterations (input) the maximum number of iterations allowed
* @param Threshold (input) the threshold used to terminate the algorithm
* @param TransformationR (output) this variable will hold the computed rotation matrix
* @param TransformationT (output) this variable will hold the computed translation vector
* @param FRE (output) this variable will hold the computed rotation FRE of the transformation
* @param n (output) this variable will hold the number of iterations used by the algorithm
*/
void WeightedPointRegister( vtkPoints* X,
vtkPoints* Y,
const CovarianceMatrixList &Sigma_X,
const CovarianceMatrixList &Sigma_Y,
double Threshold,
int MaxIterations,
Rotation& TransformationR,
Translation& TransformationT,
double& FRE,
int& n );
};
}
#endif
diff --git a/Modules/AlgorithmsExt/src/mitkSimpleHistogram.cpp b/Modules/AlgorithmsExt/src/mitkSimpleHistogram.cpp
index f77a394c45..b862326c46 100644
--- a/Modules/AlgorithmsExt/src/mitkSimpleHistogram.cpp
+++ b/Modules/AlgorithmsExt/src/mitkSimpleHistogram.cpp
@@ -1,264 +1,264 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkSimpleHistogram.h"
#include "mitkSimpleUnstructuredGridHistogram.h"
#include "mitkUnstructuredGrid.h"
#include "mitkImageReadAccessor.h"
namespace mitk {
void SimpleImageHistogram::ComputeFromBaseData( BaseData* src )
{
valid = false;
//check if input is valid
if (src==NULL) return;
Image* source = dynamic_cast<Image*>(src);
if (source==NULL) return;
else if (source->IsEmpty()) return;
// dummy histogram
{
min=0;
max=1;
first=0;
last=1;
}
{
int typInt=0;
{
const int typ=source->GetPixelType().GetComponentType();
if (typ == itk::ImageIOBase::UCHAR) typInt=0;
else if(typ == itk::ImageIOBase::CHAR) typInt=1;
else if(typ == itk::ImageIOBase::USHORT) typInt=2;
else if(typ == itk::ImageIOBase::SHORT) typInt=3;
else if(typ == itk::ImageIOBase::INT) typInt=4;
else if(typ == itk::ImageIOBase::UINT) typInt=5;
else if(typ == itk::ImageIOBase::LONG) typInt=6;
else if(typ == itk::ImageIOBase::ULONG) typInt=7;
else if(typ == itk::ImageIOBase::FLOAT) typInt=8;
else if(typ == itk::ImageIOBase::DOUBLE) typInt=9;
else
{
MITK_WARN << "Pixel type not supported by SimpleImageHistogram";
return;
}
}
first=-32768; last=65535; // support at least full signed and unsigned short range
if(histogram)
delete histogram;
histogram = new CountType[last-first+1];
memset(histogram,0,sizeof(CountType)*(last-first+1));
highest = 0;
max = first - 1;
min = last + 1;
unsigned int num=1;
for(unsigned int r=0;r<source->GetDimension();r++)
num*=source->GetDimension(r);
// MITK_INFO << "building histogramm of integer image: 0=" << source->GetDimension(0) << " 1=" << source->GetDimension(1) << " 2=" << source->GetDimension(2) << " 3=" << source->GetDimension(3);
ImageReadAccessor sourceAcc(source);
const void *src = sourceAcc.GetData();
do
{
int value = 0;
switch(typInt)
{
case 0: { unsigned char *t=(unsigned char *)src; value=*t++; src=(void*)t; } break;
case 1: { signed char *t=( signed char *)src; value=*t++; src=(void*)t; } break;
case 2: { unsigned short *t=(unsigned short*)src; value=*t++; src=(void*)t; } break;
case 3: { signed short *t=( signed short*)src; value=*t++; src=(void*)t; } break;
case 4: { signed int *t=( signed int*)src; value=*t++; src=(void*)t; } break;
case 5: { unsigned int *t=(unsigned int*)src; value=*t++; src=(void*)t; } break;
case 6: { signed long *t=( signed long*)src; value=*t++; src=(void*)t; } break;
case 7: { unsigned long *t=(unsigned long*)src; value=*t++; src=(void*)t; } break;
case 8: { float *t=( float*)src; value=*t++; src=(void*)t; } break;
case 9: { double *t=( double*)src; value=*t++; src=(void*)t; } break;
}
if(value >= first && value <= last)
{
if(value < min) min = value;
if(value > max) max = value;
CountType tmp = ++histogram[value-first];
if(tmp > highest) highest = tmp;
}
}
while(--num);
MITK_INFO << "histogramm computed: min=" << min << " max=" << max << " highestBin=" << highest << " samples=" << num;
}
invLogHighest = 1.0/log(double(highest));
valid = true;
}
bool SimpleImageHistogram::GetValid()
{
return valid;
}
float SimpleImageHistogram::GetRelativeBin( double left, double right ) const
{
if( !valid )
return 0.0f;
int iLeft = floorf(left);
int iRight = ceilf(right);
/*
double sum = 0;
for( int r = 0 ; r < 256 ; r++)
{
int pos = left + (right-left) * r/255.0;
int posInArray = floorf(pos+0.5f) - first;
sum += float(log(double(histogram[posInArray])));
}
sum /= 256.0;
return float(sum*invLogHighest);
*/
CountType maximum = 0;
for( int i = iLeft; i <= iRight ; i++)
{
int posInArray = i - first;
if( histogram[posInArray] > maximum ) maximum = histogram[posInArray];
}
return float(log(double(maximum))*invLogHighest);
}
class ImageHistogramCacheElement : public SimpleHistogramCache::Element
{
public:
- void ComputeFromBaseData(BaseData* baseData)
+ void ComputeFromBaseData(BaseData* baseData) override
{
histogram.ComputeFromBaseData(baseData);
}
- SimpleHistogram* GetHistogram()
+ SimpleHistogram* GetHistogram() override
{
return &histogram;
}
SimpleImageHistogram histogram;
};
class UnstructuredGridHistogramCacheElement : public SimpleHistogramCache::Element
{
public:
- void ComputeFromBaseData(BaseData* baseData)
+ void ComputeFromBaseData(BaseData* baseData) override
{
histogram.ComputeFromBaseData(baseData);
}
- SimpleHistogram* GetHistogram()
+ SimpleHistogram* GetHistogram() override
{
return &histogram;
}
SimpleUnstructuredGridHistogram histogram;
};
SimpleHistogram* SimpleHistogramCache::operator[](BaseData::Pointer sp_BaseData)
{
BaseData *p_BaseData = sp_BaseData.GetPointer();
if(!p_BaseData)
{
MITK_WARN << "SimpleHistogramCache::operator[] with null base data called";
return 0;
}
Element *elementToUpdate = 0;
bool first = true;
for(CacheContainer::iterator iter = cache.begin(); iter != cache.end(); iter++)
{
Element *e = *iter;
BaseData *p_tmp = e->baseData.GetPointer();
if(p_tmp == p_BaseData)
{
if(!first)
{
cache.erase(iter);
cache.push_front(e);
}
if( p_BaseData->GetMTime() > e->m_LastUpdateTime.GetMTime())
{
elementToUpdate = e;
goto recomputeElement;
}
//MITK_INFO << "using a cached histogram";
return e->GetHistogram();
}
first = false;
}
if (dynamic_cast<Image*>(p_BaseData))
{
elementToUpdate = new ImageHistogramCacheElement();
}
else if (dynamic_cast<UnstructuredGrid*>(p_BaseData))
{
elementToUpdate = new UnstructuredGridHistogramCacheElement();
}
else
{
MITK_WARN << "not supported: " << p_BaseData->GetNameOfClass();
}
elementToUpdate->baseData = p_BaseData;
cache.push_front(elementToUpdate);
TrimCache();
recomputeElement:
//MITK_INFO << "computing a new histogram";
elementToUpdate->ComputeFromBaseData(p_BaseData);
elementToUpdate->m_LastUpdateTime.Modified();
return elementToUpdate->GetHistogram();
}
SimpleHistogramCache::Element::~Element()
{
}
}
diff --git a/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp b/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
index 00864f1dce..4c099d32d2 100644
--- a/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
@@ -1,176 +1,176 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkSurface.h>
#include <mitkIOUtil.h>
#include <vtkCleanPolyData.h>
#include <mitkTestFixture.h>
#include "mitkAnisotropicIterativeClosestPointRegistration.h"
#include "mitkCovarianceMatrixCalculator.h"
#include "mitkAnisotropicRegistrationCommon.h"
/**
* Test to verify the results of the A-ICP registration.
* The test runs the standard A-ICP and the trimmed variant.
*/
class mitkAnisotropicIterativeClosestPointRegistrationTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkAnisotropicIterativeClosestPointRegistrationTestSuite);
MITK_TEST(testAicpRegistration);
MITK_TEST(testTrimmedAicpregistration);
CPPUNIT_TEST_SUITE_END();
private:
typedef itk::Matrix < double, 3, 3 > Matrix3x3;
typedef itk::Vector < double, 3 > Vector3;
typedef std::vector < Matrix3x3 > CovarianceMatrixList;
mitk::Surface::Pointer m_MovingSurface;
mitk::Surface::Pointer m_FixedSurface;
mitk::PointSet::Pointer m_TargetsMovingSurface;
mitk::PointSet::Pointer m_TargetsFixedSurface;
CovarianceMatrixList m_SigmasMovingSurface;
CovarianceMatrixList m_SigmasFixedSurface;
double m_FRENormalizationFactor;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure
* correct and new intialization of the used members for a new test case.
* (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
mitk::CovarianceMatrixCalculator::Pointer matrixCalculator
= mitk::CovarianceMatrixCalculator::New();
m_MovingSurface = mitk::IOUtil::LoadSurface(GetTestDataFilePath("AICPRegistration/head_green.stl"));
m_FixedSurface = mitk::IOUtil::LoadSurface(GetTestDataFilePath("AICPRegistration/head_red.stl"));
m_TargetsMovingSurface = mitk::IOUtil::LoadPointSet(GetTestDataFilePath("AICPRegistration/targets_head_green.mps"));
m_TargetsFixedSurface = mitk::IOUtil::LoadPointSet(GetTestDataFilePath("AICPRegistration/targets_head_red.mps"));
// compute covariance matrices
matrixCalculator->SetInputSurface(m_MovingSurface);
matrixCalculator->ComputeCovarianceMatrices();
m_SigmasMovingSurface = matrixCalculator->GetCovarianceMatrices();
const double meanVarX = matrixCalculator->GetMeanVariance();
matrixCalculator->SetInputSurface(m_FixedSurface);
matrixCalculator->ComputeCovarianceMatrices();
m_SigmasFixedSurface = matrixCalculator->GetCovarianceMatrices();
const double meanVarY = matrixCalculator->GetMeanVariance();
m_FRENormalizationFactor = sqrt( meanVarX + meanVarY );
}
- void tearDown()
+ void tearDown() override
{
m_MovingSurface = NULL;
m_FixedSurface = NULL;
m_TargetsMovingSurface = NULL;
m_TargetsFixedSurface = NULL;
m_SigmasMovingSurface.clear();
m_SigmasFixedSurface.clear();
}
void testAicpRegistration()
{
const double expFRE = 27.5799;
const double expTRE = 1.68835;
mitk::AnisotropicIterativeClosestPointRegistration::Pointer aICP =
mitk::AnisotropicIterativeClosestPointRegistration::New();
// set up parameters
aICP->SetMovingSurface(m_MovingSurface);
aICP->SetFixedSurface(m_FixedSurface);
aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
aICP->SetThreshold(0.000001);
// run the algorithm
aICP->Update();
MITK_INFO << "FRE: Expected: " << expFRE << ", computed: " << aICP->GetFRE();
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
mitk::Equal(aICP->GetFRE(),expFRE,0.0001));
// compute the target registration Error
const double tre = mitk::AnisotropicRegistrationCommon::ComputeTargetRegistrationError(
m_TargetsMovingSurface.GetPointer(),
m_TargetsFixedSurface.GetPointer(),
aICP->GetRotation(),
aICP->GetTranslation()
);
// MITK_INFO << "R:\n" << aICP->GetRotation() << "T: "<< aICP->GetTranslation();
MITK_INFO << "TRE: Expected: " << expTRE << ", computed: " << tre;
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
mitk::Equal(tre,expTRE,0.00001));
}
void testTrimmedAicpregistration()
{
const double expFRE = 4.8912;
const double expTRE = 0.0484215;
mitk::AnisotropicIterativeClosestPointRegistration::Pointer aICP =
mitk::AnisotropicIterativeClosestPointRegistration::New();
// Swap X and Y for partial overlapping registration
aICP->SetMovingSurface(m_MovingSurface);
aICP->SetFixedSurface(m_FixedSurface);
aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
aICP->SetThreshold(0.000001);
aICP->SetTrimmFactor(0.50);
// run the algorithm
aICP->Update();
MITK_INFO << "FRE: Expected: " << expFRE << ", computed: " << aICP->GetFRE();
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
mitk::Equal(aICP->GetFRE(),expFRE,0.01));
// compute the target registration Error
const double tre = mitk::AnisotropicRegistrationCommon::ComputeTargetRegistrationError(
m_TargetsMovingSurface.GetPointer(),
m_TargetsFixedSurface.GetPointer(),
aICP->GetRotation(),
aICP->GetTranslation()
);
MITK_INFO << "TRE: Expected: " << expTRE << ", computed: " << tre;
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
mitk::Equal(tre,expTRE,0.01));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkAnisotropicIterativeClosestPointRegistration)
diff --git a/Modules/AlgorithmsExt/test/mitkCovarianceMatrixCalculatorTest.cpp b/Modules/AlgorithmsExt/test/mitkCovarianceMatrixCalculatorTest.cpp
index 35304ee9cd..6fce8ff89e 100644
--- a/Modules/AlgorithmsExt/test/mitkCovarianceMatrixCalculatorTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkCovarianceMatrixCalculatorTest.cpp
@@ -1,96 +1,96 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkSurface.h>
#include <mitkIOUtil.h>
#include <vtkCleanPolyData.h>
#include <mitkVector.h>
#include <mitkCovarianceMatrixCalculator.h>
#include <mitkTestFixture.h>
/** Test class to test the computation of covariance matrices
* for the A-ICP algorithm. The test runs the CM_PCA method.
*/
class mitkCovarianceMatrixCalculatorTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkCovarianceMatrixCalculatorTestSuite);
MITK_TEST(testCovarianceMatrixCalculation_CM_PCA);
CPPUNIT_TEST_SUITE_END();
private:
typedef itk::Matrix<double,3,3> CovarianceMatrix;
typedef std::vector<CovarianceMatrix> CovarianceMatrixList;
mitk::Surface::Pointer m_Surface;
CovarianceMatrixList m_Reference;
public:
- void setUp()
+ void setUp() override
{
m_Surface = mitk::IOUtil::LoadSurface(GetTestDataFilePath(
"RenderingTestData/Stanford_bunny.stl"
));
// saved results
CovarianceMatrix m1,m2,m3;
// set 3 reference results into the vector. The first in the array, one from
// the middle and the last one
m1[0][0] = 366.169; m1[1][0] = 39.5242; m1[2][0] = 102.368;
m1[0][1] = 39.5242; m1[1][1] = 6.97979; m1[2][1] = 6.91726;
m1[0][2] = 102.368; m1[1][2] = 6.91726; m1[2][2] = 389.481;
m_Reference.push_back(m1);
m2[0][0] = 107.999; m2[1][0] = 71.6708; m2[2][0] = -0.908269;
m2[0][1] = 71.6708 ; m2[1][1] = 133.407; m2[2][1] = 40.8706;
m2[0][2] = -0.908269; m2[1][2] = 40.8706; m2[2][2] = 25.1825;
m_Reference.push_back(m2);
m3[0][0] = 177.916; m3[1][0] = 4.92498; m3[2][0] = 5.86319;
m3[0][1] = 4.92498; m3[1][1] = 0.214147; m3[2][1] = -1.98345;
m3[0][2] = 5.86319; m3[1][2] = -1.98345; m3[2][2] = 232.092;
m_Reference.push_back(m3);
}
- void tearDown()
+ void tearDown() override
{
m_Surface = NULL;
m_Reference.clear();
}
void testCovarianceMatrixCalculation_CM_PCA()
{
mitk::CovarianceMatrixCalculator::Pointer matrixCalculator =
mitk::CovarianceMatrixCalculator::New();
matrixCalculator->SetInputSurface(m_Surface);
matrixCalculator->ComputeCovarianceMatrices();
CovarianceMatrixList result = matrixCalculator->GetCovarianceMatrices();
CPPUNIT_ASSERT_MESSAGE("mitkCovarianceMatrixCalculatorTestSuite test first matrix",
mitk::MatrixEqualElementWise(result.at(0),m_Reference.at(0),0.001));
CPPUNIT_ASSERT_MESSAGE("mitkCovarianceMatrixCalculatorTestSuite test middle matrix",
mitk::MatrixEqualElementWise(result.at(result.size()/2),m_Reference.at(1),0.001));
CPPUNIT_ASSERT_MESSAGE("mitkCovarianceMatrixCalculatorTestSuite test last matrix",
mitk::MatrixEqualElementWise(result.at((result.size() - 1)),m_Reference.at(2),0.001));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkCovarianceMatrixCalculator)
diff --git a/Modules/AlgorithmsExt/test/mitkImageToUnstructuredGridFilterTest.cpp b/Modules/AlgorithmsExt/test/mitkImageToUnstructuredGridFilterTest.cpp
index fc27e7a298..4d5ed0bb7e 100644
--- a/Modules/AlgorithmsExt/test/mitkImageToUnstructuredGridFilterTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkImageToUnstructuredGridFilterTest.cpp
@@ -1,89 +1,89 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkImageToUnstructuredGridFilter.h>
#include <mitkTestFixture.h>
#include <mitkIOUtil.h>
class mitkImageToUnstructuredGridFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageToUnstructuredGridFilterTestSuite);
MITK_TEST(testImageToUnstructuredGridFilterInitialization);
MITK_TEST(testInput);
MITK_TEST(testUnstructuredGridGeneration);
MITK_TEST(testThreshold);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
mitk::Image::Pointer m_BallImage;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_BallImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("BallBinary30x30x30.nrrd"));
}
void testImageToUnstructuredGridFilterInitialization()
{
mitk::ImageToUnstructuredGridFilter::Pointer testFilter = mitk::ImageToUnstructuredGridFilter::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of test object", testFilter.IsNotNull());
CPPUNIT_ASSERT_MESSAGE("Testing initialization of threshold member variable",testFilter->GetThreshold() == -0.1);
}
void testInput()
{
mitk::ImageToUnstructuredGridFilter::Pointer testFilter = mitk::ImageToUnstructuredGridFilter::New();
testFilter->SetInput(m_BallImage);
CPPUNIT_ASSERT_MESSAGE("Testing set / get input!", testFilter->GetInput() == m_BallImage);
}
void testUnstructuredGridGeneration()
{
mitk::ImageToUnstructuredGridFilter::Pointer testFilter = mitk::ImageToUnstructuredGridFilter::New();
testFilter->SetInput(m_BallImage);
testFilter->Update();
CPPUNIT_ASSERT_MESSAGE("Testing surface generation!", testFilter->GetOutput() != NULL);
}
void testThreshold()
{
mitk::ImageToUnstructuredGridFilter::Pointer testFilter1 = mitk::ImageToUnstructuredGridFilter::New();
testFilter1->SetInput(m_BallImage);
testFilter1->Update();
int numberOfPoints1 = testFilter1->GetNumberOfExtractedPoints();
mitk::ImageToUnstructuredGridFilter::Pointer testFilter2 = mitk::ImageToUnstructuredGridFilter::New();
testFilter2->SetInput(m_BallImage);
testFilter2->SetThreshold(1.0);
testFilter2->Update();
int numberOfPoints2 = testFilter2->GetNumberOfExtractedPoints();
CPPUNIT_ASSERT_MESSAGE("Testing Threshold", numberOfPoints1 > numberOfPoints2);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkImageToUnstructuredGridFilter)
diff --git a/Modules/AlgorithmsExt/test/mitkUnstructuredGridClusteringFilterTest.cpp b/Modules/AlgorithmsExt/test/mitkUnstructuredGridClusteringFilterTest.cpp
index 8f2409f9e7..e4bc6b88d4 100644
--- a/Modules/AlgorithmsExt/test/mitkUnstructuredGridClusteringFilterTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkUnstructuredGridClusteringFilterTest.cpp
@@ -1,129 +1,129 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkUnstructuredGridClusteringFilter.h>
#include <mitkUnstructuredGridToUnstructuredGridFilter.h>
#include <mitkTestFixture.h>
#include <mitkUnstructuredGrid.h>
#include <mitkIOUtil.h>
#include <vtkSmartPointer.h>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDebugLeaks.h>
class mitkUnstructuredGridClusteringFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkUnstructuredGridClusteringFilterTestSuite);
vtkDebugLeaks::SetExitError(0);
MITK_TEST(testUnstructuredGridClusteringFilterInitialization);
MITK_TEST(testInput);
MITK_TEST(testUnstructuredGridGeneration);
MITK_TEST(testReturnedCluster);
MITK_TEST(testClusterVector);
MITK_TEST(testGetNumberOfFoundClusters);
CPPUNIT_TEST_SUITE_END();
private:
mitk::UnstructuredGrid::Pointer m_UnstructuredGrid;
public:
- void setUp()
+ void setUp() override
{
m_UnstructuredGrid = mitk::UnstructuredGrid::New();
//Loading the test data
std::vector< mitk::BaseData::Pointer > vector = mitk::IOUtil::Load(GetTestDataFilePath("UnstructuredGrid/scoredGrid.vtu"));
mitk::BaseData::Pointer base = vector.at(0);
m_UnstructuredGrid = dynamic_cast<mitk::UnstructuredGrid*>(base.GetPointer());
}
void testUnstructuredGridClusteringFilterInitialization()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of filter object", clusterFilter.IsNotNull());
}
void testInput()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
clusterFilter->SetInput(m_UnstructuredGrid);
CPPUNIT_ASSERT_MESSAGE("Testing set / get input!", clusterFilter->GetInput() == m_UnstructuredGrid);
}
void testUnstructuredGridGeneration()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
clusterFilter->SetInput(m_UnstructuredGrid);
clusterFilter->SetMeshing(false);
clusterFilter->SetMinPts(4);
clusterFilter->Seteps(1.2);
clusterFilter->Update();
CPPUNIT_ASSERT_MESSAGE("Testing output generation!", clusterFilter->GetOutput() != NULL);
}
void testReturnedCluster()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
clusterFilter->SetInput(m_UnstructuredGrid);
clusterFilter->SetMeshing(false);
clusterFilter->SetMinPts(4);
clusterFilter->Seteps(1.2);
clusterFilter->Update();
mitk::UnstructuredGrid::Pointer cluster = clusterFilter->GetOutput();
CPPUNIT_ASSERT_MESSAGE("Testing the output cluster!", cluster->GetVtkUnstructuredGrid()->GetPoints()->GetNumberOfPoints() == 620);
}
void testClusterVector()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
clusterFilter->SetInput(m_UnstructuredGrid);
clusterFilter->SetMeshing(false);
clusterFilter->SetMinPts(4);
clusterFilter->Seteps(1.2);
clusterFilter->Update();
std::vector< mitk::UnstructuredGrid::Pointer > clustervector = clusterFilter->GetAllClusters();
//test that all clusters have points:
bool havePoints = true;
for(unsigned int i=0; i<clustervector.size(); i++)
{
mitk::UnstructuredGrid::Pointer grid = clustervector.at(i);
if(grid->GetVtkUnstructuredGrid()->GetPoints()->GetNumberOfPoints()<1)
havePoints = false;
}
CPPUNIT_ASSERT_MESSAGE("Testing number of found clusters!", havePoints && clustervector.size() == 17);
}
void testGetNumberOfFoundClusters()
{
mitk::UnstructuredGridClusteringFilter::Pointer clusterFilter = mitk::UnstructuredGridClusteringFilter::New();
clusterFilter->SetInput(m_UnstructuredGrid);
clusterFilter->SetMeshing(false);
clusterFilter->SetMinPts(4);
clusterFilter->Seteps(1.2);
clusterFilter->Update();
CPPUNIT_ASSERT_MESSAGE("Testing number of found clusters!", clusterFilter->GetNumberOfFoundClusters() == 17);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkUnstructuredGridClusteringFilter)
diff --git a/Modules/AlgorithmsExt/test/mitkUnstructuredGridToUnstructuredGridFilterTest.cpp b/Modules/AlgorithmsExt/test/mitkUnstructuredGridToUnstructuredGridFilterTest.cpp
index c362993974..7cc350d1b7 100644
--- a/Modules/AlgorithmsExt/test/mitkUnstructuredGridToUnstructuredGridFilterTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkUnstructuredGridToUnstructuredGridFilterTest.cpp
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkUnstructuredGridToUnstructuredGridFilter.h>
#include <mitkTestFixture.h>
#include <mitkUnstructuredGrid.h>
#include <mitkIOUtil.h>
#include <vtkSmartPointer.h>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDebugLeaks.h>
class mitkUnstructuredGridToUnstructuredGridFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkUnstructuredGridToUnstructuredGridFilterTestSuite);
vtkDebugLeaks::SetExitError(0);
MITK_TEST(testUnstructuredGridToUnstructuredGridFilterInitialization);
MITK_TEST(testInput);
MITK_TEST(testMultipleInputs);
MITK_TEST(testUnstructuredGridGeneration);
CPPUNIT_TEST_SUITE_END();
private:
mitk::UnstructuredGrid::Pointer m_UnstructuredGrid;
mitk::UnstructuredGrid::Pointer m_2ndUnstructuredGrid;
public:
- void setUp()
+ void setUp() override
{
m_UnstructuredGrid = mitk::UnstructuredGrid::New();
m_2ndUnstructuredGrid = mitk::UnstructuredGrid::New();
vtkSmartPointer<vtkUnstructuredGrid> vtkGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkUnstructuredGrid> vtkGrid2 = vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> points2 = vtkSmartPointer<vtkPoints>::New();
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
for(int k=0; k<3; k++)
{
mitk::Point3D point;
point[0]=i;
point[1]=j;
point[2]=k;
points->InsertNextPoint(point[0],point[1],point[2]);
points2->InsertNextPoint(point[0]+5,point[1]+5,point[2]+5);
}
}
}
vtkGrid->SetPoints(points);
vtkGrid2->SetPoints(points2);
m_UnstructuredGrid->SetVtkUnstructuredGrid(vtkGrid);
m_2ndUnstructuredGrid->SetVtkUnstructuredGrid(vtkGrid2);
}
void testUnstructuredGridToUnstructuredGridFilterInitialization()
{
mitk::UnstructuredGridToUnstructuredGridFilter::Pointer testFilter = mitk::UnstructuredGridToUnstructuredGridFilter::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of test object", testFilter.IsNotNull());
}
void testInput()
{
mitk::UnstructuredGridToUnstructuredGridFilter::Pointer testFilter = mitk::UnstructuredGridToUnstructuredGridFilter::New();
testFilter->SetInput(m_UnstructuredGrid);
CPPUNIT_ASSERT_MESSAGE("Testing set / get input!", testFilter->GetInput() == m_UnstructuredGrid);
}
void testMultipleInputs()
{
mitk::UnstructuredGridToUnstructuredGridFilter::Pointer testFilter = mitk::UnstructuredGridToUnstructuredGridFilter::New();
testFilter->SetInput(0, m_UnstructuredGrid);
testFilter->SetInput(1, m_2ndUnstructuredGrid);
CPPUNIT_ASSERT_MESSAGE("Testing first input!", testFilter->GetInput(0) == m_UnstructuredGrid);
CPPUNIT_ASSERT_MESSAGE("Testing second input!", testFilter->GetInput(1) == m_2ndUnstructuredGrid);
}
void testUnstructuredGridGeneration()
{
mitk::UnstructuredGridToUnstructuredGridFilter::Pointer testFilter = mitk::UnstructuredGridToUnstructuredGridFilter::New();
testFilter->SetInput(m_UnstructuredGrid);
testFilter->Update();
CPPUNIT_ASSERT_MESSAGE("Testing unstructured grid generation!", testFilter->GetOutput() != NULL);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkUnstructuredGridToUnstructuredGridFilter)
diff --git a/Modules/AppUtil/include/mitkBaseApplication.h b/Modules/AppUtil/include/mitkBaseApplication.h
new file mode 100644
index 0000000000..bf797f8ae7
--- /dev/null
+++ b/Modules/AppUtil/include/mitkBaseApplication.h
@@ -0,0 +1,322 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef MITKBASEAPPLICATION_H
+#define MITKBASEAPPLICATION_H
+
+#include <MitkAppUtilExports.h>
+
+#include <Poco/Util/Application.h>
+
+#include <QHash>
+#include <QString>
+#include <QScopedPointer>
+#include <QSharedPointer>
+
+class QCoreApplication;
+
+class ctkPluginContext;
+class ctkPluginFramework;
+
+namespace mitk {
+
+/**
+ * A utility classes for starting up BlueBerry applications.
+ *
+ * In the simplest case, a user creates an instance of this
+ * class and just calls run() which launches a CTK Plugin
+ * Framework instance and executes the default application
+ * registered by a plug-in via the org.blueberry.osgi.applications
+ * extension point.
+ *
+ * This class contains many convenience methods to:
+ * - Put the application in \emph{safe mode} which catches unhandled
+ * exceptions thrown in the Qt event loop and displays an error
+ * message
+ * - Put the application in \emph{single mode} which by default
+ * sends the command line arguments to an already running instance
+ * of the same application instead of creating a second instance.
+ * - Add a list of library names which should be pre-loaded at
+ * application start-up, e.g. to speed up the initial launch during
+ * the caching process of the plug-in meta-data.
+ * - Set a custom provisioning file to start a specific set of CTK
+ * plug-ins during application start-up.
+ * - Set and get CTK Plugin Framework properties
+ *
+ * The behavior can further be customized by deriving from
+ * BaseApplication and overriding specific methods, such as:
+ * - initializeLibraryPaths() to add specific library / plugin search
+ * paths
+ * - defineOptions(Poco::Util::OptionSet&) to define a custom set
+ * of command line options
+ * - getQApplication() to provide a custom QCoreApplication instance
+ *
+ * A simple but complete usage example:
+ * <code>
+ * #include <mitkBaseApplication.h>
+ *
+ * int main(int argc, char** argv)
+ * {
+ * mitk::BaseApplication app(argc, argv);
+ * app.setApplicationName("MyApp");
+ * app.setOrganizationName("MyOrganization");
+ *
+ * // Run the workbench
+ * return app.run();
+ * }
+ * </code>
+ */
+class MITKAPPUTIL_EXPORT BaseApplication : public Poco::Util::Application
+{
+public:
+
+ // Command line arguments
+
+ static QString ARG_NEWINSTANCE;
+ static QString ARG_CLEAN;
+ static QString ARG_APPLICATION;
+ static QString ARG_HOME;
+ static QString ARG_STORAGE_DIR;
+ static QString ARG_PLUGIN_CACHE;
+ static QString ARG_PLUGIN_DIRS;
+ static QString ARG_FORCE_PLUGIN_INSTALL;
+ static QString ARG_PRELOAD_LIBRARY;
+ static QString ARG_PROVISIONING;
+ static QString ARG_DEBUG;
+
+ static QString ARG_CONSOLELOG;
+ static QString ARG_TESTPLUGIN;
+ static QString ARG_TESTAPPLICATION;
+
+ static QString ARG_NO_REGISTRY_CACHE;
+ static QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
+ static QString ARG_REGISTRY_MULTI_LANGUAGE;
+
+ static QString ARG_XARGS;
+
+ // BlueBerry specific Plugin Framework properties
+
+ static QString PROP_NEWINSTANCE;
+ static QString PROP_FORCE_PLUGIN_INSTALL;
+ static QString PROP_NO_REGISTRY_CACHE;
+ static QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING;
+ static QString PROP_REGISTRY_MULTI_LANGUAGE;
+
+ static QString PROP_APPLICATION;
+ static QString PROP_TESTPLUGIN;
+ static QString PROP_TESTAPPLICATION;
+
+
+ BaseApplication(int argc, char** argv);
+ ~BaseApplication();
+
+ /**
+ * Initialize the Qt library such that a QCoreApplication
+ * instance is available and e.g. Qt Widgets can be created.
+ *
+ * This is usually not called directly by the user.
+ */
+ void initializeQt();
+
+ /**
+ * Launches the BlueBerry framework and runs the default application
+ * or the one specified in the PROP_APPLICATION framework property.
+ *
+ * @return The return code of the application after it was shut down.
+ */
+ int run() override;
+
+ void printHelp(const std::string& name, const std::string& value);
+
+ /**
+ * Set the application name. Same as QCoreApplication::setApplicationName.
+ * @param name The application name.
+ */
+ void setApplicationName(const QString& name);
+ QString getApplicationName() const;
+
+ /**
+ * Set the organization name. Same as QCoreApplication::setOrganizationName.
+ * @param name The organization name.
+ */
+ void setOrganizationName(const QString& name);
+ QString getOrganizationName() const;
+
+ /**
+ * Set the organization domain. Same as QCoreApplication::setOrganizationDomain.
+ * @param name The organization domain.
+ */
+ void setOrganizationDomain(const QString& name);
+ QString getOrganizationDomain() const;
+
+ /**
+ * Put the application in single mode, which by default only allows
+ * a single instance of the application to be created.
+ *
+ * Calling this method after run() has been called has no effect.
+ *
+ * @param singleMode
+ */
+ void setSingleMode(bool singleMode);
+ bool getSingleMode() const;
+
+ /**
+ * Put the application in safe mode, catching exceptions from the
+ * Qt event loop.
+ *
+ * @param safeMode
+ */
+ void setSafeMode(bool safeMode);
+ bool getSafeMode() const;
+
+ /**
+ * Set a list of library names or absoulte file paths
+ * which should be loaded at application start-up. The name
+ * and file path may contain a library version appended at the
+ * end and separated by a '$' charactger.
+ *
+ * For example <code>liborg_mitk_gui_qt_common$1.0</code>.
+ * Platform specific suffixes are appended automatically.
+ *
+ * @param libraryBaseNames A list of library base names.
+ */
+ void setPreloadLibraries(const QStringList& libraryBaseNames);
+
+ /**
+ * Get the list of library base names which should be pre-loaded.
+ *
+ * @return A list of pre-loaded libraries.
+ */
+ QStringList getPreloadLibraries() const;
+
+ /**
+ * Set the path to the provisioning file.
+ *
+ * By default a provisioning file located in the same directory
+ * as the executable and named <executable>.provisioning
+ * is loaded if it exists. To disable parsing of provisioning
+ * files, use an empty string as the argument. Use a
+ * null QString (<code>QString::null</code>) to reset to the
+ * default behaviour.
+ *
+ * @param filePath An absolute file path to the provisioning file.
+ */
+ void setProvisioningFilePath(const QString& filePath);
+
+ /**
+ * Get the file path to the provisioning file.
+ * @return The provisioning file path.
+ */
+ QString getProvisioningFilePath() const;
+
+ void setProperty(const QString& property, const QVariant& value);
+ QVariant getProperty(const QString& property) const;
+
+protected:
+
+ void initialize(Poco::Util::Application& self) override;
+ void uninitialize() override;
+
+ int getArgc() const;
+ char** getArgv() const;
+
+ /**
+ * Get the framework storage directory for the CTK plugin
+ * framework. This method is called in the initialize(Poco::Util::Application&)
+ * method. It must not be called without a QCoreApplications instance.
+ *
+ * @return The CTK Plugin Framework storage directory.
+ */
+ virtual QString getCTKFrameworkStorageDir() const;
+
+ /**
+ * Initialize the CppMicroServices library.
+ *
+ * The default implementation set the CppMicroServices storage
+ * path to the current ctkPluginConstants::FRAMEWORK_STORAGE property
+ * value.
+ *
+ * This method is called in the initialize(Poco::Util::Application&)
+ * after the CTK Plugin Framework storage directory property
+ * was set.
+ */
+ virtual void initializeCppMicroServices();
+
+ /**
+ * Get the QCoreApplication object.
+ *
+ * This method is called in the initialize(Poco::Util::Application&)
+ * method and must create a QCoreApplication instance if the
+ * global qApp variable is not initialized yet.
+ *
+ * @return The current QCoreApplication instance. This method
+ * never returns null.
+ */
+ virtual QCoreApplication* getQApplication() const;
+
+ /**
+ * Add plugin library search paths to the CTK Plugin Framework.
+ *
+ * This method is called in the nitialize(Poco::Util::Application&)
+ * method after getQApplication() was called.
+ */
+ virtual void initializeLibraryPaths();
+
+ /**
+ * Runs the application for which the platform was started. The platform
+ * must be running.
+ * <p>
+ * The given argument is passed to the application being run. If it is an invalid QVariant
+ * then the command line arguments used in starting the platform, and not consumed
+ * by the platform code, are passed to the application as a <code>QStringList</code>.
+ * </p>
+ * @param argument the argument passed to the application. May be <code>invalid</code>
+ * @return the result of running the application
+ * @throws std::exception if anything goes wrong
+ */
+ int main(const std::vector<std::string>& args) override;
+
+ /**
+ * Define command line arguments
+ * @param options
+ */
+ void defineOptions(Poco::Util::OptionSet& options) override;
+
+ QSharedPointer<ctkPluginFramework> getFramework() const;
+ ctkPluginContext* getFrameworkContext() const;
+
+ /**
+ * Get the initial properties for the CTK plugin framework.
+ *
+ * The returned map contains the initial framework properties for
+ * initializing the CTK plugin framework. The value of specific
+ * properties may change at runtime and differ from the initial
+ * value.
+ *
+ * @return The initial CTK Plugin Framework properties.
+ */
+ QHash<QString, QVariant> getFrameworkProperties() const;
+
+private:
+
+ struct Impl;
+ QScopedPointer<Impl> d;
+
+};
+
+}
+
+#endif // MITKBASEAPPLICATION_H
diff --git a/Modules/CameraCalibration/mitkCameraIntrinsics.h b/Modules/CameraCalibration/mitkCameraIntrinsics.h
index 4e086159de..84a26c53ab 100644
--- a/Modules/CameraCalibration/mitkCameraIntrinsics.h
+++ b/Modules/CameraCalibration/mitkCameraIntrinsics.h
@@ -1,144 +1,144 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCameraIntrinsics_h
#define mitkCameraIntrinsics_h
#include <mitkCommon.h>
#include <mitkNumericTypes.h>
#include <itkDataObject.h>
#include <itkFastMutexLock.h>
#include <cv.h>
#include <vnl/vnl_matrix_fixed.h>
#include "mitkXMLSerializable.h"
#include <MitkCameraCalibrationExports.h>
int mitkCameraIntrinsicsTest(int argc, char* argv[]);
namespace mitk
{
///
/// \brief class representing camera intrinsics and related functions
///
class MITKCAMERACALIBRATION_EXPORT CameraIntrinsics: virtual public itk::Object,
virtual public mitk::XMLSerializable
{
public:
///
/// for testing purposes
///
friend int mitkCameraIntrinsicsTest(int argc, char* argv[]);
///
/// smartpointer typedefs
///
- mitkClassMacro(CameraIntrinsics, itk::Object);
+ mitkClassMacroItkParent(CameraIntrinsics, itk::Object);
///
/// the static new function
///
itkFactorylessNewMacro(Self);
///
/// make a clone of this intrinsics
///
itkCloneMacro(Self)
///
/// copy information from other to this
///
void Copy(const CameraIntrinsics* other);
///
/// checks two intrinsics for equality
///
bool Equals( const CameraIntrinsics* other ) const;
///
/// \return the intrinsic parameter matrix as a 3x3 vnl matrix
///
vnl_matrix_fixed<mitk::ScalarType, 3, 3> GetVnlCameraMatrix() const;
///
/// \return the intrinsic parameter matrix as a 3x4 vnl matrix
/// (the last column only containing zeros)
///
vnl_matrix_fixed<mitk::ScalarType, 3, 4> GetVnlCameraMatrix3x4() const;
///
/// \return true if the intrinsics are set (some plausibility checks
/// may be done here)
///
bool IsValid() const;
void SetValid(bool valid);
cv::Mat GetCameraMatrix() const;
cv::Mat GetDistorsionCoeffs();
cv::Mat GetDistorsionCoeffs() const;
void ToXML(TiXmlElement* elem) const;
std::string ToString() const;
std::string GetString();
double GetFocalLengthX() const;
double GetFocalLengthY() const;
double GetPrincipalPointX() const;
double GetPrincipalPointY() const;
mitk::Point4D GetDistorsionCoeffsAsPoint4D() const;
mitk::Point3D GetFocalPoint() const;
mitk::Point3D GetPrincipalPoint() const;
vnl_vector_fixed<mitk::ScalarType, 2> GetFocalPointAsVnlVector() const;
vnl_vector_fixed<mitk::ScalarType, 2> GetPrincipalPointAsVnlVector() const;
///
/// set a new camera matrix utilizing a vnl matrix
///
void SetCameraMatrix( const vnl_matrix_fixed<mitk::ScalarType, 3, 3>&
_CameraMatrix );
void SetIntrinsics( const cv::Mat& _CameraMatrix
, const cv::Mat& _DistorsionCoeffs);
void SetFocalLength( double x, double y );
void SetPrincipalPoint( double x, double y );
void SetDistorsionCoeffs( double k1, double k2, double p1, double p2 );
void SetIntrinsics( const mitk::Point3D& focalPoint,
const mitk::Point3D& principalPoint,
const mitk::Point4D& distortionCoefficients);
void FromXML(TiXmlElement* elem);
void FromGMLCalibrationXML(TiXmlElement* elem);
std::string ToOctaveString(const std::string& varName="CameraIntrinsics");
virtual ~CameraIntrinsics();
protected:
CameraIntrinsics();
CameraIntrinsics(const CameraIntrinsics& other);
cv::Mat m_CameraMatrix;
cv::Mat m_DistorsionCoeffs;
bool m_Valid;
itk::FastMutexLock::Pointer m_Mutex;
private:
virtual itk::LightObject::Pointer InternalClone() const;
};
} // namespace mitk
MITKCAMERACALIBRATION_EXPORT std::ostream& operator<<
(std::ostream& os, mitk::CameraIntrinsics::Pointer p);
#endif // mitkCameraIntrinsics_h
diff --git a/Modules/CameraCalibration/mitkTransform.h b/Modules/CameraCalibration/mitkTransform.h
index 1ff56b4ba5..719c0ef521 100644
--- a/Modules/CameraCalibration/mitkTransform.h
+++ b/Modules/CameraCalibration/mitkTransform.h
@@ -1,305 +1,305 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRANSFORM_H
#define MITKTRANSFORM_H
#include <itkObject.h>
#include <cv.h>
#include <mitkCommon.h>
#include <mitkNumericTypes.h>
#include <mitkNavigationData.h>
#include <tinyxml.h>
#include <sstream>
#include <vtkMatrix4x4.h>
#include <mitkXMLSerializable.h>
#include <MitkCameraCalibrationExports.h>
namespace mitk {
///
/// \brief class representing a transfrom in 3D
///
/// internally it stores a mitk navigation data. this is more
/// or less a wrapper for navigation data for easy casting
/// between opencv/vnl/mitk/xml representations of transform
/// data
///
class MITKCAMERACALIBRATION_EXPORT Transform: public itk::Object,
public XMLSerializable
{
public:
- mitkClassMacro(Transform, itk::Object);
+ mitkClassMacroItkParent(Transform, itk::Object);
itkFactorylessNewMacro(Transform);
mitkNewMacro1Param(Transform, const mitk::NavigationData*);
mitkNewMacro1Param(Transform, const std::string&);
///
/// constants describing the type of transform
/// represented here
///
static const std::string UNKNOWN_TYPE;
static const std::string ENDOSCOPE_SCOPE_TOOL;
static const std::string ENDOSCOPE_CAM_TOOL;
static const std::string CHESSBOARD_TOOL;
static const std::string POINTER_TOOL;
static const std::string POINTER_TO_CHESSBOARD_ORIGIN;
static const std::string POINTER_TO_CHESSBOARD_X_SUPPORT_POINT;
static const std::string POINTER_TO_CHESSBOARD_Y_SUPPORT_POINT;
static const std::string BOARD_TO_BOARD_TOOL;
static const std::string REFERENCE_CAMERA_TRANSFORM;
static const std::string REFERENCE_SCOPE_TRANSFORM;
static const std::string EYE_TO_HAND_TRANSFORM;
static const std::string CAMERA_EXTRINSICS;
itkGetConstMacro(Type, std::string);
itkSetMacro(Type, std::string&);
///
/// Copies the content of transform to this
/// instance
///
void Copy( const mitk::Transform* transform );
///
/// Copies the content of transform to this
/// instance
///
void Copy( const mitk::NavigationData* transform );
///
/// Inverts the rotation of this transform
/// (Polaris navigation Data have inverted rotation
/// so you may want to call this function when using
/// polaris data)
///
void TransposeRotation();
///
/// get a copy of this transform
///
mitk::Transform::Pointer Clone() const;
///
/// concatenate this transform with the given one,
/// i.e. this transform is done first, then transform
/// ( if x is this transform, y is transform, then this will be y*x)
/// post multiply semantics!
/// \see vtkTransform
///
void Concatenate( mitk::Transform* transform );
///
/// same as above with vnl mat argument
///
void Concatenate( const vnl_matrix_fixed<mitk::ScalarType, 4, 4>& transform );
///
/// same as above with vtk mat argument
///
void Concatenate( const vtkMatrix4x4* transform );
///
/// invert this transform
///
void Invert();
///
/// resets the internal variables except type
///
void Reset();
///
/// read from xml
///
void FromXML(TiXmlElement* elem);
///
/// read csv file
///
void FromCSVFile(const std::string& file);
///
/// grafts the data from naviData to this transform
///
void SetNavigationData( const mitk::NavigationData* naviData );
///
/// method to set orientation quat
///
void SetOrientation( const vnl_quaternion<mitk::ScalarType>& orientation);
///
/// method to set float valued orientation quat
///
void SetOrientation( const vnl_quaternion<float>& orientation);
///
/// method to set translation
///
void SetTranslation( const vnl_vector_fixed<mitk::ScalarType, 3>& transl);
///
/// method to set a vector of doubles as translation
///
void SetTranslation( const vnl_vector<double>& transl);
///
/// method to set a mitk::Point3D as position
///
void SetPosition( const mitk::Point3D& transl);
///
/// sets rotation with a rotation matrix
///
void SetRotation( vnl_matrix_fixed<mitk::ScalarType, 3, 3>& mat);
///
/// sets rotation with a non fixed rotation matrix
///
void SetRotation( vnl_matrix<mitk::ScalarType>& mat);
///
/// sets rotation and translation with a transformation matrix
///
void SetMatrix( const vnl_matrix_fixed<mitk::ScalarType, 4, 4>& mat);
///
/// sets rotation and translation with a vtk transformation matrix
///
void SetMatrix( const vtkMatrix4x4* mat);
///
/// sets translation from a POD vector
///
void SetTranslation( float* array );
///
/// sets translation from a POD vector. this must be a
/// 3x3=9 sized vector in row major format (first row = first
/// three elements)
///
void SetRotation( float* array );
///
/// sets translation from a POD vector
///
void SetTranslation( double array[3] );
///
/// sets translation from a POD vector
///
void SetRotation( double array[3][3] );
///
/// method to set translation by cv vector
///
void SetTranslation( const cv::Mat& transl);
///
/// sets rotation with a rotation matrix
///
void SetRotation( const cv::Mat& mat );
///
/// sets rotation with a rodrigues rotation vector
///
void SetRotationVector( const cv::Mat& rotVec);
///
/// \return the navigation data that stores all information
///
mitk::NavigationData::Pointer GetNavigationData() const;
///
/// calls navigationdata::GetPosition()
///
mitk::Point3D GetPosition() const;
///
/// same as GetPosition
///
mitk::Point3D GetTranslation() const;
///
/// calls navigationdata::IsValid()
///
bool IsValid() const;
///
/// calls navigationdata::SetValid()
///
void SetValid(bool valid);
///
/// calls navigationdata::GetOrientation()
///
mitk::Quaternion GetOrientation() const;
///
/// \return the homogeneous matrix representing this transform
///
vnl_matrix_fixed<mitk::ScalarType, 4, 4> GetMatrix() const;
///
/// \return the homogeneous vtk matrix representing this transform
///
void GetMatrix(vtkMatrix4x4* matrix) const;
///
/// \return the homogeneous vtk matrix representing this transform
/// in !OpenGL! left handed coordinate system
///
void GetVtkOpenGlMatrix(vtkMatrix4x4* matrix) const;
mitk::Point3D TransformPoint(mitk::Point3D point) const;
///
/// create xml representation
///
void ToXML(TiXmlElement* elem) const;
///
/// create string representation
///
std::string ToString() const;
///
/// create string csv representation (only the transformation values!!!!)
///
std::string ToCSVString() const;
///
/// create matlab representation
///
std::string ToMatlabString(const std::string& varname="transform",
bool printLastRow=true) const;
///
/// write csv representation to file (only the transformation values!!!!)
///
void ToCSVFile(const std::string& file) const;
///
/// write matlab representation to file
///
void ToMatlabFile(const std::string& file
, const std::string& varname="transform") const;
///
/// conversion to cv types
///
cv::Mat GetCvTranslation() const;
cv::Mat GetCvRotationVector() const;
cv::Mat GetCvRotationMatrix() const;
cv::Mat GetCvMatrix() const;
///
/// conversion to vnl types
///
vnl_vector_fixed<mitk::ScalarType, 3> GetVnlTranslation() const;
vnl_vector_fixed<double, 3> GetVnlDoubleTranslation() const;
vnl_quaternion<double> GetVnlDoubleQuaternion() const;
vnl_matrix_fixed<mitk::ScalarType, 3, 3> GetVnlRotationMatrix() const;
vnl_matrix_fixed<double, 4, 4> GetVnlDoubleMatrix() const;
protected:
Transform();
Transform(const mitk::NavigationData* nd);
Transform(const std::string& s);
// everything is stored here
mitk::NavigationData::Pointer m_NavData;
///
/// saves the type of the transform (Default is UNKNOWN_TYPE)
///
std::string m_Type;
};
} // namespace mitk
MITKCAMERACALIBRATION_EXPORT std::ostream& operator<<
(std::ostream& os, mitk::Transform::Pointer p);
#endif // MITKTRANSFORM_H
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelSetSource.h b/Modules/ContourModel/Algorithms/mitkContourModelSetSource.h
index 1f5c6182a5..b1162105b5 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelSetSource.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelSetSource.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ContourModelSetSource_H
#define _MITK_ContourModelSetSource_H
#include <MitkContourModelExports.h>
#include "mitkBaseDataSource.h"
#include "mitkContourModelSet.h"
namespace mitk
{
/**
* @brief Superclass of all classes generating ContourModels.
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelSetSource : public BaseDataSource
{
public:
mitkClassMacro( ContourModelSetSource, BaseDataSource )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef ContourModelSet OutputType;
typedef OutputType::Pointer OutputTypePointer;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
ContourModelSetSource();
virtual ~ContourModelSetSource();
};
}
#endif // #_MITK_CONTOURMODEL_SOURCE_H
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelSource.h b/Modules/ContourModel/Algorithms/mitkContourModelSource.h
index 5b910cac2c..d46229bc12 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelSource.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelSource.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_SOURCE_H
#define _MITK_CONTOURMODEL_SOURCE_H
#include <MitkContourModelExports.h>
#include "mitkBaseDataSource.h"
#include "mitkContourModel.h"
namespace mitk
{
/**
* @brief Superclass of all classes generating ContourModels.
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelSource : public BaseDataSource
{
public:
mitkClassMacro( ContourModelSource, BaseDataSource )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef ContourModel OutputType;
typedef OutputType::Pointer OutputTypePointer;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
ContourModelSource();
virtual ~ContourModelSource();
};
}
#endif // #_MITK_CONTOURMODEL_SOURCE_H
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelSubDivisionFilter.h b/Modules/ContourModel/Algorithms/mitkContourModelSubDivisionFilter.h
index c2ba95d3d6..d724a6be30 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelSubDivisionFilter.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelSubDivisionFilter.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkContourModelSubDivisionFilter_h__
#define _mitkContourModelSubDivisionFilter_h__
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
namespace mitk {
/**
*
* \brief This filter interpolates a subdivision curve between control points of the contour.
* For inserting subpoints Dyn-Levin-Gregory (DLG) interpolation scheme is used.
* Interpolating a cruve subdivision is done by:
* F2i = Ci
* F2i+1 = -1/16Ci-1 + 9/16Ci + 9/16Ci+1 - 1/16Ci+2
*
* The number of interpolation iterations can be set via SetNumberOfIterations(int) which are 4 by dafault.
*
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelSubDivisionFilter : public ContourModelSource
{
public:
mitkClassMacro(ContourModelSubDivisionFilter, ContourModelSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef ContourModel OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef mitk::ContourModel InputType;
/**
* \brief Set the number of iterations for inserting new interpolated control points.
*
*/
void SetNumberOfIterations( int iterations)
{
this->m_InterpolationIterations = iterations;
}
using Superclass::SetInput;
virtual void SetInput( const InputType *input);
virtual void SetInput( unsigned int idx, const InputType * input);
const InputType* GetInput(void);
const InputType* GetInput(unsigned int idx);
protected:
ContourModelSubDivisionFilter();
virtual ~ContourModelSubDivisionFilter();
- void GenerateOutputInformation() {};
+ void GenerateOutputInformation() override {};
- void GenerateData();
+ void GenerateData() override;
int m_InterpolationIterations;
};
}
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelToPointSetFilter.h b/Modules/ContourModel/Algorithms/mitkContourModelToPointSetFilter.h
index 4d24327067..5e9ee79924 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelToPointSetFilter.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelToPointSetFilter.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkContourModelToPointSetFilter_h__
#define _mitkContourModelToPointSetFilter_h__
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkPointSet.h"
#include "mitkPointSetSource.h"
#include "mitkContourModel.h"
namespace mitk {
/**
*
* @brief Converts a contour set to a point set.
*
* The resulting pointset consists of sample points of all the contours
*
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelToPointSetFilter : public PointSetSource
{
public:
mitkClassMacro(ContourModelToPointSetFilter, PointSetSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef PointSet OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef mitk::ContourModel InputType;
protected:
ContourModelToPointSetFilter();
virtual ~ContourModelToPointSetFilter();
- void GenerateOutputInformation() {}
+ void GenerateOutputInformation() override {}
- void GenerateData();
+ void GenerateData() override;
};
}
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelToSurfaceFilter.h b/Modules/ContourModel/Algorithms/mitkContourModelToSurfaceFilter.h
index 058444665a..ccb151eec5 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelToSurfaceFilter.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelToSurfaceFilter.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_TO_Surface_FILTER_H_
#define _MITK_CONTOURMODEL_TO_Surface_FILTER_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
#include <mitkSurfaceSource.h>
namespace mitk {
class MITKCONTOURMODEL_EXPORT ContourModelToSurfaceFilter : public SurfaceSource
{
public:
/** Standard class typedefs. */
mitkClassMacro( ContourModelToSurfaceFilter, SurfaceSource );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::Surface OutputType;
typedef mitk::ContourModel InputType;
- void GenerateOutputInformation();
+ void GenerateOutputInformation() override;
/** Set/Get the image input of this process object. */
using Superclass::SetInput;
virtual void SetInput( const InputType *input);
virtual void SetInput( unsigned int idx, const InputType * input);
const InputType * GetInput(void);
const InputType * GetInput(unsigned int idx);
protected:
ContourModelToSurfaceFilter();
~ContourModelToSurfaceFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
};
}
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
index a62c453b29..e2ad466393 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkContourModelUtilshIncludett
#define mitkContourModelUtilshIncludett
#include "mitkImage.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include <itkImage.h>
namespace mitk
{
/**
* \brief Helpful methods for working with contours and images
*
*
*/
class MITKCONTOURMODEL_EXPORT ContourModelUtils : public itk::Object
{
public:
- mitkClassMacro(ContourModelUtils, itk::Object);
+ mitkClassMacroItkParent(ContourModelUtils, itk::Object);
/**
\brief Projects a contour onto an image point by point. Converts from world to index coordinates.
\param correctionForIpSegmentation adds 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)
*/
static ContourModel::Pointer ProjectContourTo2DSlice(Image* slice, ContourModel* contourIn3D, bool correctionForIpSegmentation, bool constrainToInside);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
\param correctionForIpSegmentation subtracts 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)
*/
static ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry* sliceGeometry, ContourModel* contourIn2D, bool correctionForIpSegmentation = false);
/**
\brief Fill a contour in a 2D slice with a specified pixel value at time step 0.
*/
static void FillContourInSlice( ContourModel* projectedContour, Image* sliceImage, int paintingPixelValue = 1 );
/**
\brief Fill a contour in a 2D slice with a specified pixel value at a given time step.
*/
static void FillContourInSlice( ContourModel* projectedContour, unsigned int timeStep, Image* sliceImage, int paintingPixelValue = 1 );
protected:
ContourModelUtils();
virtual ~ContourModelUtils();
};
}
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkContourObjectFactory.h b/Modules/ContourModel/Algorithms/mitkContourObjectFactory.h
index a450376359..ff3696fe1c 100644
--- a/Modules/ContourModel/Algorithms/mitkContourObjectFactory.h
+++ b/Modules/ContourModel/Algorithms/mitkContourObjectFactory.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SEGMENTATIONOBJECTFACTORY_H_INCLUDED
#define SEGMENTATIONOBJECTFACTORY_H_INCLUDED
#include "mitkCoreObjectFactoryBase.h"
#include <MitkContourModelExports.h>
namespace mitk {
class MITKCONTOURMODEL_EXPORT ContourObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(ContourObjectFactory,CoreObjectFactoryBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
- virtual void SetDefaultProperties(mitk::DataNode* node);
- virtual const char* GetFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
- virtual const char* GetSaveFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
+ virtual const char* GetFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
+ virtual const char* GetSaveFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
/** \deprecatedSince{2013_09} */
DEPRECATED(void RegisterIOFactories());
protected:
ContourObjectFactory();
~ContourObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
private:
};
}
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkImageToContourModelFilter.h b/Modules/ContourModel/Algorithms/mitkImageToContourModelFilter.h
index 923036640a..caa9e990bb 100644
--- a/Modules/ContourModel/Algorithms/mitkImageToContourModelFilter.h
+++ b/Modules/ContourModel/Algorithms/mitkImageToContourModelFilter.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkImageToContourModelFilter_h__
#define _mitkImageToContourModelFilter_h__
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
#include <mitkImage.h>
namespace mitk {
/**
*
* \brief Base class for all filters with mitk::Image as input and mitk::ContourModel
*
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ImageToContourModelFilter : public ContourModelSource
{
public:
mitkClassMacro(ImageToContourModelFilter, ContourModelSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::Image InputType;
using Superclass::SetInput;
virtual void SetInput( const InputType *input);
virtual void SetInput( unsigned int idx, const InputType * input);
const InputType* GetInput(void);
const InputType* GetInput(unsigned int idx);
protected:
ImageToContourModelFilter();
virtual ~ImageToContourModelFilter();
- void GenerateData();
+ void GenerateData() override;
template<typename TPixel, unsigned int VImageDimension>
void Itk2DContourExtraction (const itk::Image<TPixel, VImageDimension>* sliceImage);
private:
const BaseGeometry* m_SliceGeometry;
};
}
#endif
diff --git a/Modules/ContourModel/DataManagement/mitkContourElement.h b/Modules/ContourModel/DataManagement/mitkContourElement.h
index cd82ca08bd..d338ae36b1 100644
--- a/Modules/ContourModel/DataManagement/mitkContourElement.h
+++ b/Modules/ContourModel/DataManagement/mitkContourElement.h
@@ -1,269 +1,269 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkContourElement_H_
#define _mitkContourElement_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include <mitkNumericTypes.h>
//#include <ANN/ANN.h>
#include <deque>
namespace mitk
{
/** \brief Represents a contour in 3D space.
A ContourElement is consisting of linked vertices implicitely defining the contour.
They are stored in a double ended queue making it possible to add vertices at front and
end of the contour and to iterate in both directions.
To mark a vertex as a special one it can be set as a control point.
\Note It is highly not recommend to use this class directly as no secure mechanism is used here.
Use mitk::ContourModel instead providing some additional features.
*/
class MITKCONTOURMODEL_EXPORT ContourElement : public itk::LightObject
{
public:
- mitkClassMacro(ContourElement, itk::LightObject);
+ mitkClassMacroItkParent(ContourElement, itk::LightObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Data container representing vertices
/** \brief Represents a single vertex of contour.
*/
struct ContourModelVertex
{
ContourModelVertex(mitk::Point3D &point, bool active=false)
: IsControlPoint(active), Coordinates(point)
{
}
ContourModelVertex( const ContourModelVertex &other)
: IsControlPoint(other.IsControlPoint), Coordinates(other.Coordinates)
{
}
/** \brief Treat point special. */
bool IsControlPoint;
/** \brief Coordinates in 3D space. */
mitk::Point3D Coordinates;
};
// END Data container representing vertices
typedef ContourModelVertex VertexType;
typedef std::deque<VertexType*> VertexListType;
typedef VertexListType::iterator VertexIterator;
typedef VertexListType::const_iterator ConstVertexIterator;
// start of inline methods
/** \brief Return a const iterator a the front.
*/
virtual ConstVertexIterator ConstIteratorBegin()
{
return this->m_Vertices->begin();
}
/** \brief Return a const iterator a the end.
*/
virtual ConstVertexIterator ConstIteratorEnd()
{
return this->m_Vertices->end();
}
/** \brief Return an iterator a the front.
*/
virtual VertexIterator IteratorBegin()
{
return this->m_Vertices->begin();
}
/** \brief Return an iterator a the end.
*/
virtual VertexIterator IteratorEnd()
{
return this->m_Vertices->end();
}
/** \brief Returns the number of contained vertices.
*/
virtual int GetSize()
{
return this->m_Vertices->size();
}
// end of inline methods
/** \brief Add a vertex at the end of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a special control point.
*/
virtual void AddVertex(mitk::Point3D &point, bool isControlPoint);
/** \brief Add a vertex at the end of the contour
\param vertex - a contour element vertex.
*/
virtual void AddVertex(VertexType &vertex);
/** \brief Add a vertex at the front of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a control point.
*/
virtual void AddVertexAtFront(mitk::Point3D &point, bool isControlPoint);
/** \brief Add a vertex at the front of the contour
\param vertex - a contour element vertex.
*/
virtual void AddVertexAtFront(VertexType &vertex);
/** \brief Add a vertex at a given index of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a special control point.
\param index - the index to be inserted at.
*/
virtual void InsertVertexAtIndex(mitk::Point3D &point, bool isControlPoint, int index);
/** \brief Set coordinates a given index.
\param pointId Index of vertex.
\param point Coordinates.
*/
virtual void SetVertexAt(int pointId, const mitk::Point3D &point);
/** \brief Set vertex a given index.
\param pointId Index of vertex.
\param vertex Vertex.
*/
virtual void SetVertexAt(int pointId, const VertexType* vertex);
/** \brief Returns the vertex a given index
\param index
*/
virtual VertexType* GetVertexAt(int index);
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
virtual VertexType* GetVertexAt(const mitk::Point3D &point, float eps);
/** \brief Returns the index of the given vertex within the contour.
\param vertex - the vertex to be searched.
\return index of vertex. -1 if not found.
*/
virtual int GetIndex(const VertexType* vertex);
/** \brief Returns the container of the vertices.
*/
VertexListType* GetVertexList();
/** \brief Returns whether the contour element is empty.
*/
bool IsEmpty();
/** \brief Returns if the conour is closed or not.
*/
virtual bool IsClosed();
/** \brief Returns whether a given point is near a contour, according to eps.
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
virtual bool IsNearContour(const mitk::Point3D &point, float eps);
/** \brief Close the contour.
Connect first with last element.
*/
virtual void Close();
/** \brief Open the contour.
Disconnect first and last element.
*/
virtual void Open();
/** \brief Set the contours IsClosed property.
\param isClosed - true = closed; false = open;
*/
virtual void SetClosed(bool isClosed);
/** \brief Concatenate the contuor with a another contour.
All vertices of the other contour will be added after last vertex.
\param other - the other contour
\param check - set it true to avoid intersections
*/
void Concatenate(mitk::ContourElement* other, bool check);
/** \brief Remove the given vertex from the container if exists.
\param vertex - the vertex to be removed.
*/
virtual bool RemoveVertex(const VertexType* vertex);
/** \brief Remove a vertex at given index within the container if exists.
\param index - the index where the vertex should be removed.
*/
virtual bool RemoveVertexAt(int index);
/** \brief Remove the approximate nearest vertex at given position in 3D space if one exists.
\param point - query point in 3D space.
\param eps - error bound for search algorithm.
*/
virtual bool RemoveVertexAt(mitk::Point3D &point, float eps);
/** \brief Clear the storage container.
*/
virtual void Clear();
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
VertexType* BruteForceGetVertexAt(const mitk::Point3D &point, float eps);
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
//VertexType* OptimizedGetVertexAt(const mitk::Point3D &point, float eps);
VertexListType* GetControlVertices();
/** \brief Uniformly redistribute control points with a given period (in number of vertices)
\param vertex - the vertex around which the redistribution is done.
\param period - number of vertices between control points.
*/
void RedistributeControlVertices(const VertexType* vertex, int period);
protected:
mitkCloneMacro(Self);
ContourElement();
ContourElement(const mitk::ContourElement &other);
virtual ~ContourElement();
VertexListType* m_Vertices; //double ended queue with vertices
bool m_IsClosed;
};
} // namespace mitk
#endif // _mitkContourElement_H_
diff --git a/Modules/ContourModel/DataManagement/mitkContourModel.h b/Modules/ContourModel/DataManagement/mitkContourModel.h
index 1b09ff8ed4..3334f033fa 100644
--- a/Modules/ContourModel/DataManagement/mitkContourModel.h
+++ b/Modules/ContourModel/DataManagement/mitkContourModel.h
@@ -1,474 +1,474 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_H_
#define _MITK_CONTOURMODEL_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkBaseData.h"
#include <mitkContourElement.h>
namespace mitk
{
/**
\brief ContourModel is a structure of linked vertices defining a contour in 3D space.
The vertices are stored in a mitk::ContourElement is stored for each timestep.
The contour line segments are implicitly defined by the given linked vertices.
By default two control points are are linked by a straight line.It is possible to add
vertices at front and end of the contour and to iterate in both directions.
Points are specified containing coordinates and additional (data) information,
see mitk::ContourElement.
For accessing a specific vertex either an index or a position in 3D Space can be used.
The vertices are best accessed by using a VertexIterator.
Interaction with the contour is thus available without any mitk interactor class using the
api of ContourModel. It is possible to shift single vertices also as shifting the whole
contour.
A contour can be either open like a single curved line segment or
closed. A closed contour can for example represent a jordan curve.
\section mitkContourModelDisplayOptions Display Options
The default mappers for this data structure are mitk::ContourModelGLMapper2D and
mitk::ContourModelMapper3D. See these classes for display options which can
can be set via properties.
*/
class MITKCONTOURMODEL_EXPORT ContourModel : public BaseData
{
public:
mitkClassMacro(ContourModel, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*+++++++++++++++ typedefs +++++++++++++++++++++++++++++++*/
typedef mitk::ContourElement::VertexType VertexType;
typedef mitk::ContourElement::VertexListType VertexListType;
typedef mitk::ContourElement::VertexIterator VertexIterator;
typedef mitk::ContourElement::ConstVertexIterator ConstVertexIterator;
typedef std::vector< mitk::ContourElement::Pointer > ContourModelSeries;
/*+++++++++++++++ END typedefs ++++++++++++++++++++++++++++*/
/** \brief Possible interpolation of the line segments between control points */
enum LineSegmentInterpolation{
LINEAR, B_SPLINE
};
/*++++++++++++++++ inline methods +++++++++++++++++++++++*/
/** \brief Get the current selected vertex.
*/
VertexType* GetSelectedVertex()
{
return this->m_SelectedVertex;
}
/** \brief Deselect vertex.
*/
void Deselect()
{
this->m_SelectedVertex = NULL;
}
/** \brief Set selected vertex as control point
*/
void SetSelectedVertexAsControlPoint(bool isControlPoint=true)
{
if (this->m_SelectedVertex)
{
m_SelectedVertex->IsControlPoint = isControlPoint;
this->Modified();
}
}
/** \brief Set the interpolation of the line segments between control points.
*/
void SetLineSegmentInterpolation(LineSegmentInterpolation interpolation)
{
this->m_lineInterpolation = interpolation;
this->Modified();
}
/** \brief Get the interpolation of the line segments between control points.
*/
LineSegmentInterpolation GetLineSegmentInterpolation()
{
return this->m_lineInterpolation;
}
/*++++++++++++++++ END inline methods +++++++++++++++++++++++*/
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(mitk::Point3D &vertex, int timestep=0);
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(VertexType &vertex, int timestep=0);
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeSlicedGeometry will not be expanded.
*/
void AddVertex(const VertexType* vertex, int timestep=0);
/** \brief Add a vertex to the contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
\param isControlPoint - specifies the vertex to be handled in a special way (e.g. control points
will be rendered).
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(mitk::Point3D &vertex, bool isControlPoint, int timestep=0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
The vertex is added at the FRONT of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(mitk::Point3D &vertex, int timestep=0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
The vertex is added at the FRONT of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(VertexType &vertex, int timestep=0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
\param isControlPoint - specifies the vertex to be handled in a special way (e.g. control points
will be rendered).
@Note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(mitk::Point3D &vertex, bool isControlPoint, int timestep=0);
/** \brief Insert a vertex at given index.
*/
void InsertVertexAtIndex(mitk::Point3D &vertex, int index, bool isControlPoint=false, int timestep=0);
/** \brief Set a coordinates for point at given index.
*/
bool SetVertexAt(int pointId, const mitk::Point3D &point, unsigned int timestep=0);
/** \brief Set a coordinates for point at given index.
*/
bool SetVertexAt(int pointId, const VertexType* vertex, unsigned int timestep=0);
/** \brief Return if the contour is closed or not.
*/
bool IsClosed( int timestep=0) const;
/** \brief Concatenate two contours.
The starting control point of the other will be added at the end of the contour.
\pararm timestep - the timestep at which the vertex will be add ( default 0)
\pararm check - check for intersections ( default false)
*/
void Concatenate(mitk::ContourModel* other, int timestep=0, bool check=false);
/** \brief Returns a const VertexIterator at the start element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator Begin( int timestep=0) const;
/** \brief Returns a const VertexIterator at the start element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator IteratorBegin( int timestep=0) const;
/** \brief Returns a const VertexIterator at the end element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator End( int timestep=0) const;
/** \brief Returns a const VertexIterator at the end element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator IteratorEnd( int timestep=0) const;
/** \brief Close the contour.
The last control point will be linked with the first point.
*/
virtual void Close( int timestep=0);
/** \brief Set isClosed to false contour.
The link between the last control point the first point will be removed.
*/
virtual void Open( int timestep=0);
/** \brief Set closed property to given boolean.
false - The link between the last control point the first point will be removed.
true - The last control point will be linked with the first point.
*/
virtual void SetClosed(bool isClosed, int timestep=0);
/** \brief Returns the number of vertices at a given timestep.
\param timestep - default = 0
*/
int GetNumberOfVertices( int timestep=0) const;
/** \brief Returns whether the contour model is empty at a given timestep.
\pararm timestep - default = 0
*/
virtual bool IsEmpty( int timestep) const;
/** \brief Returns whether the contour model is empty.
*/
- virtual bool IsEmpty() const;
+ virtual bool IsEmpty() const override;
/** \brief Returns the vertex at the index position within the container.
*/
virtual const VertexType* GetVertexAt(int index, int timestep=0) const;
/** \brief Remove a vertex at given timestep within the container.
\return index of vertex. -1 if not found.
*/
int GetIndex(const VertexType* vertex, int timestep=0);
/** \brief Check if there isn't something at this timestep.
*/
- virtual bool IsEmptyTimeStep(unsigned int t) const;
+ virtual bool IsEmptyTimeStep(unsigned int t) const override;
/** \brief Check if mouse cursor is near the contour.
*/
virtual bool IsNearContour(mitk::Point3D &point, float eps, int timestep);
/** \brief Mark a vertex at an index in the container as selected.
*/
bool SelectVertexAt(int index, int timestep=0);
/** \brief Mark a vertex at an index in the container as control point.
*/
bool SetControlVertexAt(int index, int timestep=0);
/** \brief Mark a vertex at a given position in 3D space.
\param point - query point in 3D space
\param eps - radius for nearest neighbour search (error bound).
\param timestep - search at this timestep
@return true = vertex found; false = no vertex found
*/
bool SelectVertexAt(mitk::Point3D &point, float eps, int timestep=0);
/*
\pararm point - query point in 3D space
\pararm eps - radius for nearest neighbour search (error bound).
\pararm timestep - search at this timestep
@return true = vertex found; false = no vertex found
*/
bool SetControlVertexAt(mitk::Point3D &point, float eps, int timestep=0);
/** \brief Remove a vertex at given index within the container.
@return true = the vertex was successfuly removed; false = wrong index.
*/
bool RemoveVertexAt(int index, int timestep=0);
/** \brief Remove a vertex at given timestep within the container.
@return true = the vertex was successfuly removed.
*/
bool RemoveVertex(const VertexType* vertex, int timestep=0);
/** \brief Remove a vertex at a query position in 3D space.
The vertex to be removed will be search by nearest neighbour search.
Note that possibly no vertex at this position and eps is stored inside
the contour.
@return true = the vertex was successfuly removed; false = no vertex found.
*/
bool RemoveVertexAt(mitk::Point3D &point, float eps, int timestep=0);
/** \brief Shift the currently selected vertex by a translation vector.
\param translate - the translation vector.
*/
void ShiftSelectedVertex(mitk::Vector3D &translate);
/** \brief Shift the whole contour by a translation vector at given timestep.
\param translate - the translation vector.
\param timestep - at this timestep the contour will be shifted.
*/
void ShiftContour(mitk::Vector3D &translate, int timestep=0);
/** \brief Clear the storage container at given timestep.
All control points are removed at
timestep.
*/
virtual void Clear(int timestep);
/** \brief Initialize all data objects
*/
- virtual void Initialize();
+ virtual void Initialize() override;
/** \brief Initialize object with specs of other contour.
Note: No data will be copied.
*/
void Initialize(mitk::ContourModel &other);
/*++++++++++++++++++ method inherit from base data +++++++++++++++++++++++++++*/
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
- virtual void SetRequestedRegionToLargestPossibleRegion ();
+ virtual void SetRequestedRegionToLargestPossibleRegion () override;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion ();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion () override;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
- virtual bool VerifyRequestedRegion ();
+ virtual bool VerifyRequestedRegion () override;
/**
\brief Get the updated geometry with recomputed bounds.
*/
virtual const mitk::BaseGeometry* GetUpdatedGeometry (int t=0);
/**
\brief Get the BaseGeometry for timestep t.
*/
virtual mitk::BaseGeometry* GetGeometry (int t=0) const;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
/**
\brief Expand the timebounds of the TimeGeometry to given number of timesteps.
*/
- virtual void Expand( unsigned int timeSteps );
+ virtual void Expand( unsigned int timeSteps ) override;
/**
\brief Update the OutputInformation of a ContourModel object
The BoundingBox of the contour will be updated, if necessary.
*/
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
/**
\brief Clear the storage container.
The object is set to initial state. All control points are removed and the number of
timesteps are set to 1.
*/
- virtual void Clear();
+ virtual void Clear() override;
/**
\brief overwrite if the Data can be called by an Interactor (StateMachine).
*/
- void ExecuteOperation(Operation* operation);
+ void ExecuteOperation(Operation* operation) override;
/** \brief Redistributes ontrol vertices with a given period (as number of vertices)
\param period - the number of vertices between control points.
\param timestep - at this timestep all lines will be rebuilt.
*/
virtual void RedistributeControlVertices(int period, int timestep);
protected:
mitkCloneMacro(Self);
ContourModel();
ContourModel(const mitk::ContourModel &other);
virtual ~ContourModel();
//inherit from BaseData. called by Clear()
- virtual void ClearData();
+ virtual void ClearData() override;
//inherit from BaseData. Initial state of a contour with no vertices and a single timestep.
- virtual void InitializeEmpty();
+ virtual void InitializeEmpty() override;
//Shift a vertex
void ShiftVertex(VertexType* vertex, mitk::Vector3D &vector);
//Storage with time resolved support.
ContourModelSeries m_ContourSeries;
//The currently selected vertex.
VertexType* m_SelectedVertex;
//The interpolation of the line segment between control points.
LineSegmentInterpolation m_lineInterpolation;
//only update the bounding geometry if necessary
bool m_UpdateBoundingBox;
};
itkEventMacro( ContourModelEvent, itk::AnyEvent );
itkEventMacro( ContourModelShiftEvent, ContourModelEvent );
itkEventMacro( ContourModelSizeChangeEvent, ContourModelEvent );
itkEventMacro( ContourModelAddEvent, ContourModelSizeChangeEvent );
itkEventMacro( ContourModelRemoveEvent, ContourModelSizeChangeEvent );
itkEventMacro( ContourModelExpandTimeBoundsEvent, ContourModelEvent );
itkEventMacro( ContourModelClosedEvent, ContourModelEvent );
}
#endif
diff --git a/Modules/ContourModel/DataManagement/mitkContourModelSet.h b/Modules/ContourModel/DataManagement/mitkContourModelSet.h
index 0ec9e8a939..93cb0fa9ec 100644
--- a/Modules/ContourModel/DataManagement/mitkContourModelSet.h
+++ b/Modules/ContourModel/DataManagement/mitkContourModelSet.h
@@ -1,143 +1,143 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkContourModelSet_H_
#define _mitkContourModelSet_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include <deque>
namespace mitk
{
/** \brief
*/
class MITKCONTOURMODEL_EXPORT ContourModelSet : public mitk::BaseData
{
public:
mitkClassMacro(ContourModelSet, mitk::BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef std::deque<mitk::ContourModel::Pointer> ContourModelListType;
typedef ContourModelListType::iterator ContourModelSetIterator;
// start of inline methods
/** \brief Return an iterator a the front.
*/
virtual ContourModelSetIterator Begin()
{
return this->m_Contours.begin();
}
/** \brief Return an iterator a the front.
*/
virtual ContourModelSetIterator End()
{
return this->m_Contours.end();
}
/** \brief Returns the number of contained contours.
*/
virtual int GetSize() const
{
return this->m_Contours.size();
}
// end of inline methods
/** \brief Add a ContourModel to the container.
*/
virtual void AddContourModel(mitk::ContourModel &contourModel);
/** \brief Add a ContourModel to the container.
*/
virtual void AddContourModel(mitk::ContourModel::Pointer contourModel);
/** \brief Returns the ContourModel a given index
\param index
*/
virtual mitk::ContourModel* GetContourModelAt(int index) const;
/** \brief Returns the container of the contours.
*/
ContourModelListType* GetContourModelList();
/** \brief Returns a bool whether the container is empty or not.
*/
- bool IsEmpty() const;
+ bool IsEmpty() const override;
/** \brief Remove the given ContourModel from the container if exists.
\param ContourModel - the ContourModel to be removed.
*/
virtual bool RemoveContourModel(mitk::ContourModel* contourModel);
/** \brief Remove a ContourModel at given index within the container if exists.
\param index - the index where the ContourModel should be removed.
*/
virtual bool RemoveContourModelAt(int index);
/** \brief Clear the storage container.
*/
- virtual void Clear();
+ virtual void Clear() override;
//////////////// inherit from mitk::BaseData ////////////////////
/* NO support for regions ! */
- void SetRequestedRegionToLargestPossibleRegion(){}
+ void SetRequestedRegionToLargestPossibleRegion() override{}
- bool RequestedRegionIsOutsideOfTheBufferedRegion(){return false;}
+ bool RequestedRegionIsOutsideOfTheBufferedRegion() override{return false;}
- bool VerifyRequestedRegion(){return true;}
+ bool VerifyRequestedRegion() override{return true;}
- void SetRequestedRegion(const itk::DataObject* ){}
+ void SetRequestedRegion(const itk::DataObject* ) override{}
/**
\brief Update the OutputInformation of a ContourModel object
The BoundingBox of the contour will be updated, if necessary.
*/
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
//////////////// END inherit from mitk::BaseData ////////////////////
protected:
mitkCloneMacro(Self);
ContourModelSet();
ContourModelSet(const mitk::ContourModelSet &other);
virtual ~ContourModelSet();
//inherit from BaseData. Initial state with no contours and a single timestep.
- virtual void InitializeEmpty();
+ virtual void InitializeEmpty() override;
ContourModelListType m_Contours;
//only update the bounding geometry if necessary
bool m_UpdateBoundingBox;
};
} // namespace mitk
#endif // _mitkContourModelSet_H_
diff --git a/Modules/ContourModel/IO/mitkContourModelReader.h b/Modules/ContourModel/IO/mitkContourModelReader.h
index b398bc3e35..5b921d958b 100644
--- a/Modules/ContourModel/IO/mitkContourModelReader.h
+++ b/Modules/ContourModel/IO/mitkContourModelReader.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_READER__H_
#define _MITK_CONTOURMODEL_READER__H_
// MITK
#include <mitkAbstractFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
#include <mitkContourModel.h>
#include <string>
#include <stack>
#include <vtkXMLParser.h>
#include <tinyxml.h>
namespace mitk
{
/**
* @brief
* @ingroup MitkContourModelModule
*/
class ContourModelReader : public mitk::AbstractFileReader
{
public:
ContourModelReader(const ContourModelReader& other);
ContourModelReader();
virtual ~ContourModelReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
protected:
virtual void ReadPoints(mitk::ContourModel::Pointer newContourModel,
TiXmlElement* currentTimeSeries, unsigned int currentTimeStep);
private:
- ContourModelReader* Clone() const;
+ ContourModelReader* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
}
#endif
diff --git a/Modules/ContourModel/IO/mitkContourModelSerializer.h b/Modules/ContourModel/IO/mitkContourModelSerializer.h
index 86ac3059f8..759bb83b27 100644
--- a/Modules/ContourModel/IO/mitkContourModelSerializer.h
+++ b/Modules/ContourModel/IO/mitkContourModelSerializer.h
@@ -1,46 +1,46 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCONTOURMODELSERIALIZER_H
#define MITKCONTOURMODELSERIALIZER_H
#include <mitkBaseDataSerializer.h>
#include <MitkContourModelExports.h>
namespace mitk
{
class MITKCONTOURMODEL_EXPORT ContourModelSerializer : public BaseDataSerializer
{
public:
mitkClassMacro(ContourModelSerializer, BaseDataSerializer);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
ContourModelSerializer();
virtual ~ContourModelSerializer();
};
}
#endif // MITKCONTOURMODELSERIALIZER_H
diff --git a/Modules/ContourModel/IO/mitkContourModelSetReader.h b/Modules/ContourModel/IO/mitkContourModelSetReader.h
index 37208d7160..44f75ba994 100644
--- a/Modules/ContourModel/IO/mitkContourModelSetReader.h
+++ b/Modules/ContourModel/IO/mitkContourModelSetReader.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ContourModelSetReader__H_
#define _MITK_ContourModelSetReader__H_
// MITK
#include <mitkAbstractFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
#include <mitkContourModel.h>
#include <mitkContourModelSet.h>
#include <string>
#include <stack>
#include <vtkXMLParser.h>
#include <tinyxml.h>
namespace mitk
{
/**
* @brief
* @ingroup MitkContourModelModule
*/
class ContourModelSetReader : public mitk::AbstractFileReader
{
public:
ContourModelSetReader(const ContourModelSetReader& other);
ContourModelSetReader();
virtual ~ContourModelSetReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
protected:
private:
- ContourModelSetReader* Clone() const;
+ ContourModelSetReader* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
}
#endif
diff --git a/Modules/ContourModel/IO/mitkContourModelSetSerializer.h b/Modules/ContourModel/IO/mitkContourModelSetSerializer.h
index ef7b991ed4..68f61508a1 100644
--- a/Modules/ContourModel/IO/mitkContourModelSetSerializer.h
+++ b/Modules/ContourModel/IO/mitkContourModelSetSerializer.h
@@ -1,27 +1,27 @@
#ifndef MITKCONTOURMODELSETSERIALIZER_H
#define MITKCONTOURMODELSETSERIALIZER_H
#include <mitkBaseDataSerializer.h>
#include <MitkContourModelExports.h>
namespace mitk
{
class MITKCONTOURMODEL_EXPORT ContourModelSetSerializer : public BaseDataSerializer
{
public:
mitkClassMacro(ContourModelSetSerializer, BaseDataSerializer);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
ContourModelSetSerializer();
virtual ~ContourModelSetSerializer();
};
}
#endif // MITKCONTOURMODELSETSERIALIZER_H
diff --git a/Modules/ContourModel/IO/mitkContourModelSetWriter.h b/Modules/ContourModel/IO/mitkContourModelSetWriter.h
index c85003a8a5..be8c66b11a 100644
--- a/Modules/ContourModel/IO/mitkContourModelSetWriter.h
+++ b/Modules/ContourModel/IO/mitkContourModelSetWriter.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODELSET_WRITER__H_
#define _MITK_CONTOURMODELSET_WRITER__H_
#include <mitkAbstractFileWriter.h>
#include <mitkContourModel.h>
#include <mitkContourModelSet.h>
namespace mitk
{
/**
* @brief XML-based writer for mitk::ContourModelSet
*
* Uses the regular ContourModel writer to write each contour of the ContourModelSet to a single file.
*
* @ingroup MitkContourModelModule
*/
class ContourModelSetWriter : public mitk::AbstractFileWriter
{
public:
ContourModelSetWriter();
virtual ~ContourModelSetWriter();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
protected:
ContourModelSetWriter(const ContourModelSetWriter& other);
- virtual mitk::ContourModelSetWriter* Clone() const;
+ virtual mitk::ContourModelSetWriter* Clone() const override;
};
}
#endif
diff --git a/Modules/ContourModel/IO/mitkContourModelWriter.h b/Modules/ContourModel/IO/mitkContourModelWriter.h
index ee5633a79d..1f2d99c1d0 100644
--- a/Modules/ContourModel/IO/mitkContourModelWriter.h
+++ b/Modules/ContourModel/IO/mitkContourModelWriter.h
@@ -1,179 +1,179 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_WRITER__H_
#define _MITK_CONTOURMODEL_WRITER__H_
#include <mitkAbstractFileWriter.h>
#include <mitkContourModel.h>
//DEPRECATED
#include <mitkTimeGeometry.h>
namespace mitk
{
/**
* @brief XML-based writer for mitk::ContourModels
*
* XML-based writer for mitk::ContourModels. Multiple ContourModels can be written in
* a single XML file by simply setting multiple inputs to the filter.
*
* The xml file will look like:
*
* <?xml version="1.0" encoding="utf-8"?>
* <contourModel>
* <head>
* <geometryInfo>
* </geometryInfo>
* </head>
* <data>
* <timestep n="0">
* <controlPoints>
* <point>
* <x></x>
* <y></y>
* <z></z>
* </point>
* </controlPoint>
* </timestep>
* </data>
* </contourModel>
*
* @ingroup MitkContourModelModule
*/
class TimeSlicedGeometry;
class ContourModelWriter : public mitk::AbstractFileWriter
{
public:
ContourModelWriter();
virtual ~ContourModelWriter();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
protected:
ContourModelWriter(const ContourModelWriter& other);
- virtual mitk::ContourModelWriter* Clone() const;
+ virtual mitk::ContourModelWriter* Clone() const override;
/**
* Converts an arbitrary type to a string. The type has to
* support the << operator. This works fine at least for integral
* data types as float, int, long etc.
* @param value the value to convert
* @returns the string representation of value
*/
template < typename T>
std::string ConvertToString( T value );
/**
* Writes an XML representation of the given point set to
* an outstream. The XML-Header an root node is not included!
* @param contourModel the point set to be converted to xml
* @param out the stream to write to.
*/
void WriteXML( const mitk::ContourModel* contourModel, std::ostream& out );
/**
* Writes the geometry information of the TimeGeometry to an outstream.
* The root tag is not included.
* @param geometry the TimeGeometry of the contour.
* @param the stream to write to.
*/
void WriteGeometryInformation( const mitk::TimeGeometry* geometry, std::ostream& out );
/**
* Writes the geometry information of the TimeGeometry to an outstream.
* The root tag is not included.
* @param geometry the TimeGeometry of the contour.
* @param the stream to write to.
*
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(void WriteGeometryInformation(const mitk::TimeSlicedGeometry* geometry, std::ostream& out ));
/**
* Writes an standard xml header to the given stream.
* @param file the stream in which the header is written.
*/
void WriteXMLHeader( std::ostream &file );
/** Write a start element tag */
void WriteStartElement( const char *const tag, std::ostream &file );
void WriteStartElementWithAttribut( const char *const tag, std::vector<std::string> attributes, std::vector<std::string> values, std::ostream &file );
/**
* Write an end element tag
* End-Elements following character data should pass indent = false.
*/
void WriteEndElement( const char *const tag, std::ostream &file, const bool& indent = true );
/** Write character data inside a tag. */
void WriteCharacterData( const char *const data, std::ostream &file );
/** Write a start element tag */
void WriteStartElement( std::string &tag, std::ostream &file );
/** Write an end element tag */
void WriteEndElement( std::string &tag, std::ostream &file, const bool& indent = true );
/** Write character data inside a tag. */
void WriteCharacterData( std::string &data, std::ostream &file );
/** Writes empty spaces to the stream according to m_IndentDepth and m_Indent */
void WriteIndent( std::ostream& file );
unsigned int m_IndentDepth;
unsigned int m_Indent;
public:
static const char* XML_CONTOURMODEL;
static const char* XML_HEAD;
static const char* XML_GEOMETRY_INFO;
static const char* XML_DATA;
static const char* XML_TIME_STEP;
static const char* XML_CONTROL_POINTS;
static const char* XML_POINT;
static const char* XML_X;
static const char* XML_Y;
static const char* XML_Z;
};
}
#endif
diff --git a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2D.h b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2D.h
index 3ac8fd96ee..7bde851f50 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2D.h
+++ b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2D.h
@@ -1,79 +1,79 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_ContourModelGLMapper2D_H_
#define MITK_ContourModelGLMapper2D_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModelGLMapper2DBase.h"
#include "mitkContourModel.h"
namespace mitk {
class BaseRenderer;
class ContourModel;
/**
* @brief OpenGL-based mapper to display a mitk::Contour object in a 2D render window
*
*
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelGLMapper2D : public ContourModelGLMapper2DBase
{
public:
mitkClassMacro(ContourModelGLMapper2D, ContourModelGLMapper2DBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* reimplemented from Baseclass
*/
- virtual void Paint(BaseRenderer * renderer);
+ virtual void Paint(BaseRenderer * renderer) override;
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
ContourModelGLMapper2D();
virtual ~ContourModelGLMapper2D();
mitk::ContourModel::Pointer m_SubdivisionContour;
bool m_InitSubdivisionCurve;
private:
/**
* return a refernce of the rendered data object
*/
ContourModel* GetInput(void);
};
} // namespace mitk
#endif
diff --git a/Modules/ContourModel/Rendering/mitkContourModelMapper2D.h b/Modules/ContourModel/Rendering/mitkContourModelMapper2D.h
index 8271688cd9..4bf7039043 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelMapper2D.h
+++ b/Modules/ContourModel/Rendering/mitkContourModelMapper2D.h
@@ -1,106 +1,106 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_MAPPER_H_
#define _MITK_CONTOURMODEL_MAPPER_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkContourModel.h"
//#include "mitkContourModelToVtkPolyDataFilter.h"
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkProp.h>
#include <vtkPolyData.h>
namespace mitk {
class MITKCONTOURMODEL_EXPORT ContourModelMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( ContourModelMapper2D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
const mitk::ContourModel* GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
/*+++ methods of MITK-VTK rendering pipeline +++*/
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/*+++ END methods of MITK-VTK rendering pipeline +++*/
class MITKCONTOURMODEL_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_Actor;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
//mitk::ContourModelToVtkPolyDataFilter::Pointer m_contourToPolyData;
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage()
{
}
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
ContourModelMapper2D();
virtual ~ContourModelMapper2D();
- void GenerateDataForRenderer( mitk::BaseRenderer *renderer );
+ void GenerateDataForRenderer( mitk::BaseRenderer *renderer ) override;
virtual vtkSmartPointer<vtkPolyData> CreateVtkPolyDataFromContour(mitk::ContourModel* inputContour, mitk::BaseRenderer* renderer);
virtual void ApplyContourProperties(mitk::BaseRenderer* renderer);
};
}
#endif
diff --git a/Modules/ContourModel/Rendering/mitkContourModelMapper3D.h b/Modules/ContourModel/Rendering/mitkContourModelMapper3D.h
index f88a849531..8325879b8a 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelMapper3D.h
+++ b/Modules/ContourModel/Rendering/mitkContourModelMapper3D.h
@@ -1,111 +1,111 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_MAPPER_3D_H_
#define _MITK_CONTOURMODEL_MAPPER_3D_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkContourModel.h"
//#include "mitkContourModelToVtkPolyDataFilter.h"
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkProp.h>
#include <vtkPolyData.h>
#include <vtkTubeFilter.h>
namespace mitk {
class MITKCONTOURMODEL_EXPORT ContourModelMapper3D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( ContourModelMapper3D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
const mitk::ContourModel* GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
/*+++ methods of MITK-VTK rendering pipeline +++*/
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/*+++ END methods of MITK-VTK rendering pipeline +++*/
class MITKCONTOURMODEL_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_Actor;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
vtkSmartPointer<vtkTubeFilter> m_TubeFilter;
//mitk::ContourModelToVtkPolyDataFilter::Pointer m_contourToPolyData;
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage()
{
}
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
ContourModelMapper3D();
virtual ~ContourModelMapper3D();
- void GenerateDataForRenderer( mitk::BaseRenderer *renderer );
+ void GenerateDataForRenderer( mitk::BaseRenderer *renderer ) override;
virtual vtkSmartPointer<vtkPolyData> CreateVtkPolyDataFromContour(mitk::ContourModel* inputContour);
virtual void ApplyContourProperties(mitk::BaseRenderer* renderer);
};
}
#endif
diff --git a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h
index e36aa71874..d77f4adb88 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h
+++ b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.h
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_ContourModelSetGLMapper2D_H_
#define MITK_ContourModelSetGLMapper2D_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModelGLMapper2DBase.h"
#include "mitkContourModelSet.h"
#include "mitkBaseRenderer.h"
namespace mitk {
class BaseRenderer;
class ContourModel;
/**
* @brief OpenGL-based mapper to display a mitk::ContourModelSet object containing several contours in a 2D render window
*
*
* @ingroup MitkContourModelModule
*/
class MITKCONTOURMODEL_EXPORT ContourModelSetGLMapper2D : public ContourModelGLMapper2DBase
{
public:
mitkClassMacro(ContourModelSetGLMapper2D, ContourModelGLMapper2DBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* reimplemented from Baseclass
*/
- virtual void Paint(BaseRenderer * renderer);
+ virtual void Paint(BaseRenderer * renderer) override;
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
ContourModelSetGLMapper2D();
virtual ~ContourModelSetGLMapper2D();
- void InternalDrawContour(mitk::ContourModel* contour, mitk::BaseRenderer* renderer);
+ void InternalDrawContour(mitk::ContourModel* contour, mitk::BaseRenderer* renderer) override;
private:
/**
* return a refernce of the rendered data object
*/
ContourModelSet* GetInput(void);
};
} // namespace mitk
#endif
diff --git a/Modules/ContourModel/Rendering/mitkContourModelSetMapper3D.h b/Modules/ContourModel/Rendering/mitkContourModelSetMapper3D.h
index 6374baaaa3..c53d82d355 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelSetMapper3D.h
+++ b/Modules/ContourModel/Rendering/mitkContourModelSetMapper3D.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODELSET_MAPPER_3D_H_
#define _MITK_CONTOURMODELSET_MAPPER_3D_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkContourModel.h"
#include "mitkContourModelSet.h"
#include "mitkContourModelToSurfaceFilter.h"
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkAssembly.h>
#include <vtkProp.h>
#include <vtkPolyData.h>
#include <vtkTubeFilter.h>
namespace mitk {
class MITKCONTOURMODEL_EXPORT ContourModelSetMapper3D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( ContourModelSetMapper3D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
const mitk::ContourModelSet* GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
/*+++ methods of MITK-VTK rendering pipeline +++*/
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/*+++ END methods of MITK-VTK rendering pipeline +++*/
class MITKCONTOURMODEL_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Assembly of contours. */
vtkSmartPointer<vtkAssembly> m_Assembly;
mitk::ContourModelToSurfaceFilter::Pointer m_contourToPolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage()
{
}
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
ContourModelSetMapper3D();
virtual ~ContourModelSetMapper3D();
- void GenerateDataForRenderer( mitk::BaseRenderer *renderer );
+ void GenerateDataForRenderer( mitk::BaseRenderer *renderer ) override;
virtual vtkSmartPointer<vtkPolyData> CreateVtkPolyDataFromContour(mitk::ContourModel* inputContour,mitk::BaseRenderer* renderer);
virtual void ApplyContourProperties(mitk::BaseRenderer* renderer);
};
}
#endif
diff --git a/Modules/ContourModel/mitkContourModelActivator.cpp b/Modules/ContourModel/mitkContourModelActivator.cpp
index 8837fab77a..22ed8faecb 100644
--- a/Modules/ContourModel/mitkContourModelActivator.cpp
+++ b/Modules/ContourModel/mitkContourModelActivator.cpp
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkContourModelSetReader.h"
#include "mitkContourModelReader.h"
#include "mitkContourModelWriter.h"
#include "mitkContourModelSetWriter.h"
#include <usModuleActivator.h>
#include <usModuleContext.h>
namespace mitk {
/*
* This is the module activator for the "ContourModel" module.
*/
class ContourModelActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext* /*context*/)
+ void Load(us::ModuleContext* /*context*/) override
{
m_ContourModelReader = new ContourModelReader();
m_ContourModelSetReader = new ContourModelSetReader();
m_ContourModelWriter = new ContourModelWriter();
m_ContourModelSetWriter = new ContourModelSetWriter();
}
- void Unload(us::ModuleContext* )
+ void Unload(us::ModuleContext* ) override
{
delete m_ContourModelReader;
delete m_ContourModelSetReader;
delete m_ContourModelWriter;
delete m_ContourModelSetWriter;
}
private:
mitk::ContourModelReader* m_ContourModelReader;
mitk::ContourModelSetReader* m_ContourModelSetReader;
mitk::ContourModelWriter* m_ContourModelWriter;
mitk::ContourModelSetWriter* m_ContourModelSetWriter;
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::ContourModelActivator)
diff --git a/Modules/Core/TestingHelper/include/mitkTestCaller.h b/Modules/Core/TestingHelper/include/mitkTestCaller.h
index f238a76570..1548bd8cea 100644
--- a/Modules/Core/TestingHelper/include/mitkTestCaller.h
+++ b/Modules/Core/TestingHelper/include/mitkTestCaller.h
@@ -1,152 +1,152 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTESTCALLER_H
#define MITKTESTCALLER_H
#include "cppunit/TestCase.h"
#include <vector>
#include <string>
extern std::vector<std::string> globalCmdLineArgs;
namespace mitk {
/**
* \brief A test caller for parameterized tests.
*
* This class is not meant to be used directly. Use the
* mitk::TestFixture class and MITK_PARAMETERIZED_TEST
* instead.
*/
template<class ParameterizedFixture>
class TestCaller : public CppUnit::TestCase
{
typedef void (ParameterizedFixture::*TestMethod)();
public:
/**
* Constructor for TestCaller. This constructor builds a new ParameterizedFixture
* instance owned by the TestCaller.
* \param name name of this TestCaller
* \param test the method this TestCaller calls in runTest()
*/
TestCaller(const std::string& name, TestMethod test)
: TestCase(name)
, m_OwnFixture(true)
, m_Fixture(new ParameterizedFixture())
, m_Test(test)
{
m_Fixture->m_Parameter = globalCmdLineArgs;
}
/**
* Constructor for TestCaller.
* This constructor does not create a new ParameterizedFixture instance but accepts
* an existing one as parameter. The TestCaller will not own the
* ParameterizedFixture object.
* \param name name of this TestCaller
* \param test the method this TestCaller calls in runTest()
* \param fixture the Fixture to invoke the test method on.
*/
TestCaller(const std::string& name, TestMethod test, ParameterizedFixture& fixture)
: TestCase(name)
, m_OwnFixture(false)
, m_Fixture(&fixture)
, m_Test(test)
{
m_Fixture->m_Parameter = globalCmdLineArgs;
}
/**
* Constructor for TestCaller.
* This constructor does not create a new ParameterizedFixture instance but accepts
* an existing one as parameter. The TestCaller will own the
* ParameterizedFixture object and delete it in its destructor.
* \param name name of this TestCaller
* \param test the method this TestCaller calls in runTest()
* \param fixture the Fixture to invoke the test method on.
*/
TestCaller(const std::string& name, TestMethod test, ParameterizedFixture* fixture)
: TestCase(name)
, m_OwnFixture(true)
, m_Fixture(fixture)
, m_Test(test)
{
m_Fixture->m_Parameter = globalCmdLineArgs;
}
/**
* Constructor for TestCaller.
* This constructor does not create a new ParameterizedFixture instance but accepts
* an existing one as parameter. The TestCaller will own the
* ParameterizedFixture object and delete it in its destructor.
* \param name name of this TestCaller
* \param test the method this TestCaller calls in runTest()
* \param fixture the Fixture to invoke the test method on.
* \param param A list of string parameters for the fixture.
*/
TestCaller(const std::string& name, TestMethod test, ParameterizedFixture* fixture,
const std::vector<std::string>& param)
: TestCase(name)
, m_OwnFixture(true)
, m_Fixture(fixture)
, m_Test(test)
{
m_Fixture->m_Parameter = param;
}
~TestCaller()
{
if (m_OwnFixture)
delete m_Fixture;
}
- void runTest()
+ void runTest() override
{
(m_Fixture->*m_Test)();
}
- void setUp()
+ void setUp() override
{
m_Fixture->setUp();
}
- void tearDown()
+ void tearDown() override
{
m_Fixture->tearDown();
}
std::string toString() const
{
return "TestCaller " + getName();
}
private:
TestCaller(const TestCaller& other);
TestCaller& operator =(const TestCaller& other);
private:
bool m_OwnFixture;
ParameterizedFixture* m_Fixture;
TestMethod m_Test;
};
}
#endif // MITKTESTCALLER_H
diff --git a/Modules/Core/include/itkImportMitkImageContainer.h b/Modules/Core/include/itkImportMitkImageContainer.h
index 64333e2a41..9a3546041f 100644
--- a/Modules/Core/include/itkImportMitkImageContainer.h
+++ b/Modules/Core/include/itkImportMitkImageContainer.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __itkImportMitkImageContainer_h
#define __itkImportMitkImageContainer_h
#include <itkImportImageContainer.h>
#include <mitkImageDataItem.h>
#include <mitkImageAccessorBase.h>
namespace itk
{
/** \class ImportMitkImageContainer
* Defines an itk::Image front-end to an mitk::Image. This container
* conforms to the ImageContainerInterface. This is a full-fleged Object,
* so there is modification time, debug, and reference count information.
*
* Template parameters for ImportMitkImageContainer:
*
* TElementIdentifier =
* An INTEGRAL type for use in indexing the imported buffer.
*
* TElement =
* The element type stored in the container.
*/
template <typename TElementIdentifier, typename TElement>
class ImportMitkImageContainer: public ImportImageContainer<TElementIdentifier, TElement>
{
public:
/** Standard class typedefs. */
typedef ImportMitkImageContainer Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Save the template parameters. */
typedef TElementIdentifier ElementIdentifier;
typedef TElement Element;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Standard part of every itk Object. */
itkTypeMacro(ImportMitkImageContainer, ImportImageContainer);
///** Get the pointer from which the image data is imported. */
//TElement *GetImportPointer() {return m_ImportPointer;};
/** \brief Set the mitk::ImageDataItem to be imported */
//void SetImageDataItem(mitk::ImageDataItem* imageDataItem);
void SetImageAccessor(mitk::ImageAccessorBase* imageAccess, size_t noBytes);
protected:
ImportMitkImageContainer();
virtual ~ImportMitkImageContainer();
/** PrintSelf routine. Normally this is a protected internal method. It is
* made public here so that Image can call this method. Users should not
* call this method but should call Print() instead. */
- void PrintSelf(std::ostream& os, Indent indent) const;
+ void PrintSelf(std::ostream& os, Indent indent) const override;
private:
ImportMitkImageContainer(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
//mitk::ImageDataItem::Pointer m_ImageDataItem;
mitk::ImageAccessorBase* m_imageAccess;
};
} // end namespace itk
// Define instantiation macro for this template.
#define ITK_TEMPLATE_ImportMitkImageContainer(_, EXPORT, x, y) namespace itk { \
_(2(class EXPORT ImportMitkImageContainer< ITK_TEMPLATE_2 x >)) \
namespace Templates { typedef ImportMitkImageContainer< ITK_TEMPLATE_2 x > ImportMitkImageContainer##y; } \
}
//#if ITK_TEMPLATE_EXPLICIT
//# include "Templates/itkImportMitkImageContainer+-.h"
//#endif
#if ITK_TEMPLATE_TXX
# include "itkImportMitkImageContainer.txx"
#endif
#endif
diff --git a/Modules/Core/include/itkMITKScalarImageToHistogramGenerator.h b/Modules/Core/include/itkMITKScalarImageToHistogramGenerator.h
index 98b16064ee..4747a5849e 100644
--- a/Modules/Core/include/itkMITKScalarImageToHistogramGenerator.h
+++ b/Modules/Core/include/itkMITKScalarImageToHistogramGenerator.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __itkMITKScalarImageToHistogramGenerator_h
#define __itkMITKScalarImageToHistogramGenerator_h
#include <itkImageToListSampleAdaptor.h>
#include <itkSampleToHistogramFilter.h>
#include <itkObject.h>
namespace itk {
namespace Statistics {
template <class TImageType, class TMeasurementType = typename TImageType::PixelType>
class MITKScalarImageToHistogramGenerator : public Object
{
public:
/** Standard typedefs */
typedef MITKScalarImageToHistogramGenerator Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro(MITKScalarImageToHistogramGenerator, Object);
/** standard New() method support */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef TImageType ImageType;
typedef itk::Statistics::ImageToListSampleAdaptor<ImageType> AdaptorType;
typedef typename AdaptorType::Pointer AdaptorPointer;
typedef typename ImageType::PixelType PixelType;
typedef itk::Statistics::Histogram<TMeasurementType, itk::Statistics::DenseFrequencyContainer2> HistogramType;
typedef itk::Statistics::SampleToHistogramFilter<AdaptorType, HistogramType> GeneratorType;
typedef typename GeneratorType::Pointer GeneratorPointer;
typedef typename HistogramType::Pointer HistogramPointer;
typedef typename HistogramType::ConstPointer HistogramConstPointer;
public:
/** Triggers the Computation of the histogram */
void Compute( void );
/** Connects the input image for which the histogram is going to be computed */
void SetInput( const ImageType * );
/** Return the histogram. o
\warning This output is only valid after the Compute() method has been invoked
\sa Compute */
const HistogramType * GetOutput() const;
/** Set number of histogram bins */
void SetNumberOfBins( unsigned int numberOfBins );
/** Set marginal scale value to be passed to the histogram generator */
void SetMarginalScale( double marginalScale );
protected:
MITKScalarImageToHistogramGenerator();
virtual ~MITKScalarImageToHistogramGenerator() {};
- void PrintSelf(std::ostream& os, Indent indent) const;
+ void PrintSelf(std::ostream& os, Indent indent) const override;
private:
AdaptorPointer m_ImageToListAdaptor;
GeneratorPointer m_HistogramGenerator;
};
} // end of namespace Statistics
} // end of namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMITKScalarImageToHistogramGenerator.txx"
#endif
#endif
diff --git a/Modules/Core/include/itkVtkAbstractTransform.h b/Modules/Core/include/itkVtkAbstractTransform.h
index 91212dad3b..b443a77a1d 100644
--- a/Modules/Core/include/itkVtkAbstractTransform.h
+++ b/Modules/Core/include/itkVtkAbstractTransform.h
@@ -1,105 +1,105 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVTKABSTRACTTRANSFORM_H_HEADER_INCLUDED_C1C68A2C
#define MITKVTKABSTRACTTRANSFORM_H_HEADER_INCLUDED_C1C68A2C
#include <MitkCoreExports.h>
#include "itkTransform.h"
class vtkAbstractTransform;
namespace itk {
//##Documentation
//## @brief Adapter from vtkAbstractTransform to itk::Transform<TScalarType, 3, 3>
//## @ingroup Geometry
template <class TScalarType>
class VtkAbstractTransform : public itk::Transform<TScalarType, 3, 3>
{
public:
typedef VtkAbstractTransform Self;
typedef Transform< TScalarType, 3, 3 > Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> 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;
typedef typename Superclass::ParametersType ParametersType;
typedef typename Superclass::JacobianType JacobianType;
itkFactorylessNewMacro(Self)
itkCloneMacro(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);
using Superclass::TransformVector;
using Superclass::TransformCovariantVector;
- 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 OutputPointType TransformPoint(const InputPointType & ) const override;
+ virtual OutputVectorType TransformVector(const InputVectorType &) const override;
+ virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override;
+ virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override;
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 void SetParameters(const ParametersType&);
- virtual void SetFixedParameters(const ParametersType&);
- virtual void ComputeJacobianWithRespectToParameters(const InputPointType&, JacobianType&) const;
- virtual void ComputeJacobianWithRespectToPosition(const InputPointType&, JacobianType&) const;
+ virtual void SetParameters(const ParametersType&) override;
+ virtual void SetFixedParameters(const ParametersType&) override;
+ virtual void ComputeJacobianWithRespectToParameters(const InputPointType&, JacobianType&) const override;
+ virtual void ComputeJacobianWithRespectToPosition(const InputPointType&, JacobianType&) const override;
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
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/Modules/Core/include/mitkAbstractFileIO.h b/Modules/Core/include/mitkAbstractFileIO.h
index 4484124ddc..14ed5b6e87 100644
--- a/Modules/Core/include/mitkAbstractFileIO.h
+++ b/Modules/Core/include/mitkAbstractFileIO.h
@@ -1,184 +1,184 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKABSTRACTFILEIO_H
#define MITKABSTRACTFILEIO_H
#include "mitkAbstractFileReader.h"
#include "mitkAbstractFileWriter.h"
namespace mitk {
#ifndef DOXYGEN_SKIP
// Skip this code during Doxygen processing, because it only
// exists to resolve name clashes when inheriting from both
// AbstractFileReader and AbstractFileWriter.
class AbstractFileIOReader : public AbstractFileReader
{
public:
virtual ConfidenceLevel GetReaderConfidenceLevel() const
{
return AbstractFileReader::GetConfidenceLevel();
}
- virtual ConfidenceLevel GetConfidenceLevel() const
+ virtual ConfidenceLevel GetConfidenceLevel() const override
{
return this->GetReaderConfidenceLevel();
}
protected:
AbstractFileIOReader() {}
AbstractFileIOReader(const CustomMimeType& mimeType, const std::string& description)
: AbstractFileReader(mimeType, description) {}
private:
virtual IFileReader* ReaderClone() const = 0;
- IFileReader* Clone() const { return ReaderClone(); }
+ IFileReader* Clone() const override { return ReaderClone(); }
};
struct AbstractFileIOWriter : public AbstractFileWriter
{
virtual ConfidenceLevel GetWriterConfidenceLevel() const
{
return AbstractFileWriter::GetConfidenceLevel();
}
- virtual ConfidenceLevel GetConfidenceLevel() const
+ virtual ConfidenceLevel GetConfidenceLevel() const override
{
return this->GetWriterConfidenceLevel();
}
protected:
AbstractFileIOWriter(const std::string& baseDataType) : AbstractFileWriter(baseDataType) {}
AbstractFileIOWriter(const std::string& baseDataType, const CustomMimeType& mimeType,
const std::string& description)
: AbstractFileWriter(baseDataType, mimeType, description) {}
private:
virtual IFileWriter* WriterClone() const = 0;
- IFileWriter* Clone() const { return WriterClone(); }
+ IFileWriter* Clone() const override { return WriterClone(); }
};
#endif // DOXYGEN_SKIP
/**
* @ingroup IO
*
* @brief Abstract class for implementing a reader and writer.
*/
class MITKCORE_EXPORT AbstractFileIO : public AbstractFileIOReader, public AbstractFileIOWriter
{
public:
Options GetReaderOptions() const;
us::Any GetReaderOption(const std::string &name) const;
void SetReaderOptions(const Options& options);
void SetReaderOption(const std::string& name, const us::Any& value);
Options GetWriterOptions() const;
us::Any GetWriterOption(const std::string &name) const;
void SetWriterOptions(const Options& options);
void SetWriterOption(const std::string& name, const us::Any& value);
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
std::pair<us::ServiceRegistration<IFileReader>, us::ServiceRegistration<IFileWriter> >
RegisterService(us::ModuleContext* context = us::GetModuleContext());
protected:
AbstractFileIO(const AbstractFileIO& other);
AbstractFileIO(const std::string& baseDataType);
/**
* Associate this reader instance with the given MIME type.
*
* If the given MIME type has nothing but its name set, the according MIME type
* is looked up in the service registry.
*
* @param mimeType The MIME type this reader can read.
* @param description A human readable description of this reader.
*
* @throws std::invalid_argument if \c mimeType is empty.
*
* @see RegisterService
*/
explicit AbstractFileIO(const std::string& baseDataType, const CustomMimeType& mimeType,
const std::string& description);
void SetMimeType(const CustomMimeType& mimeType);
/**
* @return The mime-type this reader can handle.
*/
const CustomMimeType* GetMimeType() const;
void SetReaderDescription(const std::string& description);
std::string GetReaderDescription() const;
void SetWriterDescription(const std::string& description);
std::string GetWriterDescription() const;
void SetDefaultReaderOptions(const Options& defaultOptions);
Options GetDefaultReaderOptions() const;
void SetDefaultWriterOptions(const Options& defaultOptions);
Options GetDefaultWriterOptions() const;
/**
* \brief Set the service ranking for this file reader.
*
* Default is zero and should only be chosen differently for a reason.
* The ranking is used to determine which reader to use if several
* equivalent readers have been found.
* It may be used to replace a default reader from MITK in your own project.
* E.g. if you want to use your own reader for nrrd files instead of the default,
* implement it and give it a higher ranking than zero.
*/
void SetReaderRanking(int ranking);
int GetReaderRanking() const;
void SetWriterRanking(int ranking);
int GetWriterRanking() const;
private:
AbstractFileIO& operator=(const AbstractFileIO& other);
virtual AbstractFileIO* IOClone() const = 0;
- virtual IFileReader* ReaderClone() const;
- virtual IFileWriter* WriterClone() const;
+ virtual IFileReader* ReaderClone() const override;
+ virtual IFileWriter* WriterClone() const override;
};
}
#endif // MITKABSTRACTFILEIO_H
diff --git a/Modules/Core/include/mitkAbstractFileReader.h b/Modules/Core/include/mitkAbstractFileReader.h
index 58e2ffb108..0b02ed53f9 100644
--- a/Modules/Core/include/mitkAbstractFileReader.h
+++ b/Modules/Core/include/mitkAbstractFileReader.h
@@ -1,231 +1,231 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef AbstractFileReader_H_HEADER_INCLUDED_C1E7E521
#define AbstractFileReader_H_HEADER_INCLUDED_C1E7E521
// Macro
#include <MitkCoreExports.h>
// MITK
#include <mitkIFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
// Microservices
#include <usServiceRegistration.h>
#include <usServiceProperties.h>
#include <usGetModuleContext.h>
namespace us {
struct PrototypeServiceFactory;
}
namespace mitk {
class CustomMimeType;
/**
* @brief Base class for creating mitk::BaseData objects from files or streams.
* @ingroup IO
*/
class MITKCORE_EXPORT AbstractFileReader : public mitk::IFileReader
{
public:
- virtual void SetInput(const std::string& location);
+ virtual void SetInput(const std::string& location) override;
- virtual void SetInput(const std::string &location, std::istream* is);
+ virtual void SetInput(const std::string &location, std::istream* is) override;
- virtual std::string GetInputLocation() const;
+ virtual std::string GetInputLocation() const override;
- virtual std::istream* GetInputStream() const;
+ virtual std::istream* GetInputStream() const override;
MimeType GetRegisteredMimeType() const;
/**
* @brief Reads a path or stream and creates a list of BaseData objects.
*
* This method must be implemented for each specific reader. Call
* GetInputStream() first and check for a non-null stream to read from.
* If the input stream is \c NULL, use GetInputLocation() to read from a local
* file-system path.
*
* If the reader cannot use streams directly, use GetLocalFileName() instead.
*
* @return The created BaseData objects.
* @throws mitk::Exception
*
* @see GetLocalFileName()
* @see IFileReader::Read()
*/
- virtual std::vector<itk::SmartPointer<BaseData> > Read() = 0;
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override = 0;
- virtual DataStorage::SetOfObjects::Pointer Read(mitk::DataStorage& ds);
+ virtual DataStorage::SetOfObjects::Pointer Read(mitk::DataStorage& ds) override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
- virtual Options GetOptions() const;
- virtual us::Any GetOption(const std::string &name) const;
+ virtual Options GetOptions() const override;
+ virtual us::Any GetOption(const std::string &name) const override;
- virtual void SetOptions(const Options& options);
- virtual void SetOption(const std::string& name, const us::Any& value);
+ virtual void SetOptions(const Options& options) override;
+ virtual void SetOption(const std::string& name, const us::Any& value) override;
- virtual void AddProgressCallback(const ProgressCallback& callback);
+ virtual void AddProgressCallback(const ProgressCallback& callback) override;
- virtual void RemoveProgressCallback(const ProgressCallback& callback);
+ virtual void RemoveProgressCallback(const ProgressCallback& callback) override;
/**
* Associate this reader with the MIME type returned by the current IMimeTypeProvider
* service for the provided extension if the MIME type exists, otherwise registers
* a new MIME type when RegisterService() is called.
*
* If no MIME type for \c extension is already registered, a call to RegisterService()
* will register a new MIME type and associate this reader instance with it. The MIME
* type id can be set via SetMimeType() or it will be auto-generated using \c extension,
* having the form "application/vnd.mitk.<extension>".
*
* @param extension The file extension (without a leading period) for which a registered
* mime-type object is looked up and associated with this reader instance.
* @param description A human readable description of this reader.
*/
us::ServiceRegistration<IFileReader> RegisterService(us::ModuleContext* context = us::GetModuleContext());
void UnregisterService();
protected:
/**
* @brief An input stream wrapper.
*
* If a reader can only work with input streams, use an instance
* of this class to either wrap the specified input stream or
* create a new input stream based on the input location in the
* file system.
*/
class MITKCORE_EXPORT InputStream : public std::istream
{
public:
InputStream(IFileReader* writer, std::ios_base::openmode mode = std::ios_base::in);
~InputStream();
private:
std::istream* m_Stream;
};
AbstractFileReader();
~AbstractFileReader();
AbstractFileReader(const AbstractFileReader& other);
/**
* Associate this reader instance with the given MIME type.
*
* If \c mimeType does not provide an extension list, an already
* registered mime-type object is used. Otherwise, the first entry in
* the extensions list is used to construct a mime-type name and
* register it as a new CustomMimeType service object in the default
* implementation of RegisterMimeType().
*
* @param mimeType The mime type this reader can read.
* @param description A human readable description of this reader.
*
* @throws std::invalid_argument if \c mimeType is empty.
*
* @see RegisterService
*/
explicit AbstractFileReader(const CustomMimeType& mimeType, const std::string& description);
virtual us::ServiceProperties GetServiceProperties() const;
/**
* Registers a new CustomMimeType service object.
*
* This method is called from RegisterService and the default implementation
* registers a new mime-type service object if all of the following conditions
* are true:
*
* - TODO
*
* @param context
* @return
* @throws std::invalid_argument if \c context is NULL.
*/
virtual us::ServiceRegistration<CustomMimeType> RegisterMimeType(us::ModuleContext* context);
void SetMimeType(const CustomMimeType& mimeType);
/**
* @return The mime-type this reader can handle.
*/
const CustomMimeType* GetMimeType() const;
void SetMimeTypePrefix(const std::string& prefix);
std::string GetMimeTypePrefix() const;
void SetDescription(const std::string& description);
std::string GetDescription() const;
void SetDefaultOptions(const Options& defaultOptions);
Options GetDefaultOptions() const;
/**
* \brief Set the service ranking for this file reader.
*
* Default is zero and should only be chosen differently for a reason.
* The ranking is used to determine which reader to use if several
* equivalent readers have been found.
* It may be used to replace a default reader from MITK in your own project.
* E.g. if you want to use your own reader for nrrd files instead of the default,
* implement it and give it a higher ranking than zero.
*/
void SetRanking(int ranking);
int GetRanking() const;
/**
* @brief Get a local file name for reading.
*
* This is a convenience method for readers which cannot work natively
* with input streams. If no input stream has been been set,
* this method just returns the result of GetLocation(). However, if
* SetLocation(std::string, std::istream*) has been called with a non-null
* input stream, this method writes the contents of the stream to a temporary
* file and returns the name of the temporary file.
*
* The temporary file is deleted when either SetLocation(std::string, std::istream*)
* is called again with a different input stream or the destructor of this
* class is called.
*
* This method does not validate file names set via SetInput(std::string).
*
* @return A file path in the local file-system for reading.
*/
std::string GetLocalFileName() const;
virtual void SetDefaultDataNodeProperties(DataNode* node, const std::string& filePath);
private:
AbstractFileReader& operator=(const AbstractFileReader& other);
virtual mitk::IFileReader* Clone() const = 0;
class Impl;
std::auto_ptr<Impl> d;
};
} // namespace mitk
#endif /* AbstractFileReader_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/Core/include/mitkAbstractFileWriter.h b/Modules/Core/include/mitkAbstractFileWriter.h
index 8bdae4ef50..6d65f75f4b 100644
--- a/Modules/Core/include/mitkAbstractFileWriter.h
+++ b/Modules/Core/include/mitkAbstractFileWriter.h
@@ -1,232 +1,232 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef AbstractFileWriter_H_HEADER_INCLUDED_C1E7E521
#define AbstractFileWriter_H_HEADER_INCLUDED_C1E7E521
// Macro
#include <MitkCoreExports.h>
// MITK
#include <mitkIFileWriter.h>
#include <mitkMimeType.h>
// Microservices
#include <usServiceRegistration.h>
#include <usServiceProperties.h>
#include <usGetModuleContext.h>
#include <memory>
namespace us {
struct PrototypeServiceFactory;
}
namespace mitk {
class CustomMimeType;
/**
* @brief Base class for writing mitk::BaseData objects to files or streams.
*
* In general, all file writers should derive from this class, this way it is
* made sure that the new implementation is
* exposed to the Microservice-Framework and that is automatically available troughout MITK.
* The default implementation only requires one Write()
* method and the Clone() method to be implemented.
*
* @ingroup IO
*/
class MITKCORE_EXPORT AbstractFileWriter : public mitk::IFileWriter
{
public:
- virtual void SetInput(const BaseData* data);
- virtual const BaseData* GetInput() const;
+ virtual void SetInput(const BaseData* data) override;
+ virtual const BaseData* GetInput() const override;
- virtual void SetOutputLocation(const std::string& location);
- virtual std::string GetOutputLocation() const;
+ virtual void SetOutputLocation(const std::string& location) override;
+ virtual std::string GetOutputLocation() const override;
- virtual void SetOutputStream(const std::string& location, std::ostream* os);
- virtual std::ostream* GetOutputStream() const;
+ virtual void SetOutputStream(const std::string& location, std::ostream* os) override;
+ virtual std::ostream* GetOutputStream() const override;
/**
* \brief Write the base data to the specified location or output stream.
*
* This method must be implemented for each specific writer. Call
* GetOutputStream() first and check for a non-null stream to write to.
* If the output stream is \c NULL, use GetOutputLocation() to write
* to a local file-system path.
*
* If the reader cannot use streams directly, use GetLocalFile() to retrieve
* a temporary local file name instead.
*
* \throws mitk::Exception
*
* \see GetLocalFile()
* \see IFileWriter::Write()
*/
- virtual void Write() = 0;
+ virtual void Write() override = 0;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
MimeType GetRegisteredMimeType() const;
- virtual Options GetOptions() const;
- virtual us::Any GetOption(const std::string &name) const;
+ virtual Options GetOptions() const override;
+ virtual us::Any GetOption(const std::string &name) const override;
- virtual void SetOptions(const Options& options);
- virtual void SetOption(const std::string& name, const us::Any& value);
+ virtual void SetOptions(const Options& options) override;
+ virtual void SetOption(const std::string& name, const us::Any& value) override;
- virtual void AddProgressCallback(const ProgressCallback& callback);
+ virtual void AddProgressCallback(const ProgressCallback& callback) override;
- virtual void RemoveProgressCallback(const ProgressCallback& callback);
+ virtual void RemoveProgressCallback(const ProgressCallback& callback) override;
us::ServiceRegistration<IFileWriter> RegisterService(us::ModuleContext* context = us::GetModuleContext());
void UnregisterService();
protected:
/**
* @brief A local file representation for streams.
*
* If a writer can only work with local files, use an instance
* of this class to get either a temporary file name for writing
* to the specified output stream or the original output location
* if no output stream was set.
*/
class MITKCORE_EXPORT LocalFile
{
public:
LocalFile(IFileWriter* writer);
// Writes to the ostream and removes the temporary file
~LocalFile();
// Creates a temporary file for output operations.
std::string GetFileName();
private:
// disabled
LocalFile();
LocalFile(const LocalFile&);
LocalFile& operator=(const LocalFile& other);
struct Impl;
std::auto_ptr<Impl> d;
};
/**
* @brief An output stream wrapper.
*
* If a writer can only work with output streams, use an instance
* of this class to either wrap the specified output stream or
* create a new output stream based on the output location in the
* file system.
*/
class MITKCORE_EXPORT OutputStream : public std::ostream
{
public:
OutputStream(IFileWriter* writer, std::ios_base::openmode mode = std::ios_base::trunc | std::ios_base::out);
~OutputStream();
private:
std::ostream* m_Stream;
};
~AbstractFileWriter();
AbstractFileWriter(const AbstractFileWriter& other);
AbstractFileWriter(const std::string& baseDataType);
AbstractFileWriter(const std::string& baseDataType, const CustomMimeType& mimeType, const std::string& description);
virtual us::ServiceProperties GetServiceProperties() const;
/**
* Registers a new CustomMimeType service object.
*
* This method is called from RegisterService and the default implementation
* registers a new mime-type service object if all of the following conditions
* are true:
*
* - TODO
*
* @param context
* @return
* @throws std::invalid_argument if \c context is NULL.
*/
virtual us::ServiceRegistration<CustomMimeType> RegisterMimeType(us::ModuleContext* context);
void SetMimeType(const CustomMimeType& mimeType);
/**
* @return Get the mime-type this writer can handle.
*/
const CustomMimeType* GetMimeType() const;
void SetMimeTypePrefix(const std::string& prefix);
std::string GetMimeTypePrefix() const;
/**
* \brief Sets a human readable description of this writer.
*
* This will be used in file dialogs for example.
*/
void SetDescription(const std::string& description);
std::string GetDescription() const;
void SetDefaultOptions(const Options& defaultOptions);
Options GetDefaultOptions() const;
/**
* \brief Set the service ranking for this file writer.
*
* Default is zero and should only be chosen differently for a reason.
* The ranking is used to determine which writer to use if several
* equivalent writers have been found.
* It may be used to replace a default writer from MITK in your own project.
* E.g. if you want to use your own writer for nrrd files instead of the default,
* implement it and give it a higher ranking than zero.
*/
void SetRanking(int ranking);
int GetRanking() const;
/**
* \brief Sets the name of the mitk::Basedata that this writer is able to handle.
*
* The correct value is the one given as the first parameter in the mitkNewMacro of that BaseData derivate.
* You can also retrieve it by calling <code>GetNameOfClass()</code> on an instance of said data.
*/
void SetBaseDataType(const std::string& baseDataType);
virtual std::string GetBaseDataType() const;
void ValidateOutputLocation() const;
private:
AbstractFileWriter& operator=(const AbstractFileWriter& other);
virtual mitk::IFileWriter* Clone() const = 0;
class Impl;
std::auto_ptr<Impl> d;
};
} // namespace mitk
#endif /* AbstractFileWriter_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/Core/include/mitkAbstractOverlayLayouter.h b/Modules/Core/include/mitkAbstractOverlayLayouter.h
index 5909db169c..b57c675b36 100644
--- a/Modules/Core/include/mitkAbstractOverlayLayouter.h
+++ b/Modules/Core/include/mitkAbstractOverlayLayouter.h
@@ -1,95 +1,95 @@
/*===================================================================
*
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ABSTRACTOVERLAYLAYOUTER_H
#define ABSTRACTOVERLAYLAYOUTER_H
#include <MitkCoreExports.h>
#include <itkObject.h>
#include <mitkCommon.h>
#include "mitkOverlay.h"
namespace mitk {
class BaseRenderer;
/** @brief Baseclass of Overlay layouters */
/**
*A AbstractOverlayLayouter can be implemented to control a set of Overlays by means of position and size.
*AbstractOverlayLayouter::PrepareLayout() should be implemented with a routine to set the position of the internal m_ManagedOverlays List.
*A layouter is always connected to one BaseRenderer, so there is one instance of the layouter for each BaseRenderer.
*One type of layouter should always have a unique identifier.
*@ingroup Overlays
*/
class MITKCORE_EXPORT AbstractOverlayLayouter : public itk::LightObject {
public:
- mitkClassMacro(AbstractOverlayLayouter, itk::LightObject);
+ mitkClassMacroItkParent(AbstractOverlayLayouter, itk::LightObject);
void SetBaseRenderer(BaseRenderer* renderer);
BaseRenderer *GetBaseRenderer();
/** \brief Adds an Overlay to the internal list of managed Overlays.*/
/** By calling this, the previous Layouter of the passed Overlays is called to remove this overlay from its internal list.*/
void AddOverlay(Overlay *Overlay);
/** \brief Removes the passed Overlay from the m_ManagedOverlays List */
void RemoveOverlay(Overlay *Overlay);
/** \brief Returns a unique identifier for one specific kind of layouter.*/
std::string GetIdentifier() const;
/** \brief Sets the positions of each managed overlay according to the layouter role*/
/** This has to be implemented in order to provide a layouting procedure for the list of managed Overlays.
* The method has to provide a layouting for each identifier.*/
virtual void PrepareLayout() = 0;
protected:
/** \brief explicit constructor which disallows implicit conversions */
explicit AbstractOverlayLayouter();
/** \brief virtual destructor in order to derive from this class */
virtual ~AbstractOverlayLayouter();
/** \brief returns a list of the overlays that is managed by this Layouter. */
std::list<mitk::Overlay*> GetManagedOverlays() const;
/** \brief A unique identifier for one specific kind of layouter.*/
/** If the implementation of the layouter can manage the overlay positions in different ways, each instance has to have
its own unique identifier.*/
std::string m_Identifier;
private:
/** \brief The baserenderer on which this layouter is active. */
mitk::BaseRenderer* m_BaseRenderer;
/** \brief List of the overlays managed by this layouter. */
std::list<mitk::Overlay*> m_ManagedOverlays;
/** \brief copy constructor */
AbstractOverlayLayouter( const AbstractOverlayLayouter &);
/** \brief assignment operator */
AbstractOverlayLayouter &operator=(const AbstractOverlayLayouter &);
};
} // namespace mitk
#endif // ABSTRACTOVERLAYLAYOUTER_H
diff --git a/Modules/Core/include/mitkAbstractTransformGeometry.h b/Modules/Core/include/mitkAbstractTransformGeometry.h
index a94d60e844..f4046edfb1 100644
--- a/Modules/Core/include/mitkAbstractTransformGeometry.h
+++ b/Modules/Core/include/mitkAbstractTransformGeometry.h
@@ -1,224 +1,224 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include <MitkCoreExports.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 PlaneGeometry) 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 MITKCORE_EXPORT AbstractTransformGeometry : public PlaneGeometry
{
public:
mitkClassMacro(AbstractTransformGeometry, PlaneGeometry);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//##Documentation
//## @brief Get the vtkAbstractTransform (stored in m_VtkAbstractTransform)
virtual vtkAbstractTransform* GetVtkAbstractTransform() const;
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
//##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);
/**
* \brief projects the given point onto the curved plane
*/
- virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const;
+ virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const override;
/**
* \brief projects a given vector starting from given point onto the curved plane
* \warning no satisfiyng implementation existing yet
*/
- virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const;
+ virtual bool Project(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const override;
/**
* \brief projects a given vector starting from standard point onto the curved plane
* \warning no satisfying implementation existing yet
*/
- virtual bool Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const;
+ virtual bool Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const override;
- virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const;
+ virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const override;
- virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const;
+ virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const override;
- virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const;
+ virtual bool Map(const mitk::Point3D & atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const override;
- virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const;
+ virtual void Map(const mitk::Point2D & atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const override;
- virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const;
+ virtual void IndexToWorld(const mitk::Point2D &pt_units, mitk::Point2D &pt_mm) const override;
- virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const;
+ virtual void WorldToIndex(const mitk::Point2D &pt_mm, mitk::Point2D &pt_units) const override;
//##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;
+ virtual void IndexToWorld(const mitk::Point2D &atPt2d_units, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const override;
//##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;
+ virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const override;
//##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;
+ virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const override;
//##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 WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const override;
- virtual bool IsAbove(const Point3D& pt3d_mm, bool considerBoundingBox = false) const;
+ virtual bool IsAbove(const Point3D& pt3d_mm, bool considerBoundingBox = false) const override;
virtual mitk::ScalarType GetParametricExtentInMM(int direction) const;
virtual const itk::Transform<mitk::ScalarType, 3, 3>* 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(mitk::ScalarType oversampling);
//##Documentation
//## @brief Calculates the standard part of a BaseGeometry
//## (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 BaseGeometry (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::BaseGeometry* frameGeometry);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
//##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;
//##Documentation
//## @brief Get the parametric extent
//##
//## See AbstractTransformGeometry for an example usage of this.
mitk::ScalarType GetParametricExtent(int direction) 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<ScalarType>::Pointer m_ItkVtkAbstractTransform;
mitk::BaseGeometry::Pointer m_FrameGeometry;
//##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);
mutable mitk::BoundingBox::Pointer m_ParametricBoundingBox;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
};
} // namespace mitk
#endif /* MITKVTKABSTRACTTRANSFORMPLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/Core/include/mitkAction.h b/Modules/Core/include/mitkAction.h
index 36e6d7bdab..54d432e890 100644
--- a/Modules/Core/include/mitkAction.h
+++ b/Modules/Core/include/mitkAction.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ACTION_H_HEADER_INCLUDED_C19AE06B
#define ACTION_H_HEADER_INCLUDED_C19AE06B
#include <MitkCoreExports.h>
#include "mitkPropertyList.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk {
//##Documentation
//## @brief represents an action, that is executed after a certain event (in statemachine-mechanism)
//##
//## @ingroup Interaction
class MITKCORE_EXPORT Action : public itk::Object
{
public:
- mitkClassMacro(Action, itk::Object);
+ mitkClassMacroItkParent(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/Modules/Core/include/mitkAffineInteractor.h b/Modules/Core/include/mitkAffineInteractor.h
index e7ec1fb273..e77b0836e2 100755
--- a/Modules/Core/include/mitkAffineInteractor.h
+++ b/Modules/Core/include/mitkAffineInteractor.h
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKAFFINEINTERACTOR_H_HEADER_INCLUDED_C188C29F
#define MITKAFFINEINTERACTOR_H_HEADER_INCLUDED_C188C29F
#include <MitkCoreExports.h>
#include "mitkInteractor.h"
#include "mitkNumericTypes.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
#pragma GCC visibility push(default)
itkEventMacro(AffineInteractionEvent, itk::AnyEvent);
itkEventMacro(ScaleEvent, AffineInteractionEvent);
itkEventMacro(RotateEvent, AffineInteractionEvent);
itkEventMacro(TranslateEvent, AffineInteractionEvent);
#pragma GCC visibility pop
class MITKCORE_EXPORT AffineInteractor : public Interactor
{
public:
mitkClassMacro(AffineInteractor,Interactor);
// itkFactorylessNewMacro(Self)
// itkCloneMacro(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);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
//##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;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
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/Modules/Core/include/mitkAnnotationProperty.h b/Modules/Core/include/mitkAnnotationProperty.h
index 7d7d035742..13ad4fd39f 100644
--- a/Modules/Core/include/mitkAnnotationProperty.h
+++ b/Modules/Core/include/mitkAnnotationProperty.h
@@ -1,92 +1,92 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED
#define MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "mitkNumericTypes.h"
#include <itkConfigure.h>
#include <string>
namespace mitk {
/**
* \brief Property for annotations
* \ingroup DataManagement
*/
class MITKCORE_EXPORT AnnotationProperty : public BaseProperty
{
public:
mitkClassMacro(AnnotationProperty, BaseProperty);
typedef std::string ValueType;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
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 std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
virtual BaseProperty& operator=(const BaseProperty& other) { return Superclass::operator=(other); } \
using BaseProperty::operator =;
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 );
AnnotationProperty(const AnnotationProperty& other);
private:
// purposely not implemented
AnnotationProperty& operator=(const AnnotationProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty & property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty & property) override;
};
} // namespace mitk
#endif /* MITKANNOTATIONPROPERTY_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkBaseData.h b/Modules/Core/include/mitkBaseData.h
index dd9195445d..8d5a6fdff0 100644
--- a/Modules/Core/include/mitkBaseData.h
+++ b/Modules/Core/include/mitkBaseData.h
@@ -1,428 +1,428 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BASEDATA_H_HEADER_INCLUDED_C1EBB6FA
#define BASEDATA_H_HEADER_INCLUDED_C1EBB6FA
#include <itkDataObject.h>
#include "mitkBaseProcess.h"
#include "mitkTimeGeometry.h"
#include <MitkCoreExports.h>
#include "mitkOperationActor.h"
#include "mitkPropertyList.h"
namespace mitk {
//class BaseProcess;
//##Documentation
//## @brief Base of all data objects
//##
//## Base of all data objects, e.g., images, contours, surfaces etc. Inherits
//## from itk::DataObject and thus can be included in a pipeline.
//## Inherits also from OperationActor and can be used as a destination for Undo
//## @ingroup Data
class MITKCORE_EXPORT BaseData : public itk::DataObject, public OperationActor
{
public:
mitkClassMacro(BaseData,itk::DataObject)
/**
* \brief Return the TimeGeometry 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::TimeGeometry* GetTimeGeometry() const
{
return m_TimeGeometry.GetPointer();
}
/**
* \brief Return the TimeGeometry 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.
* \deprecatedSince{2013_09} Please use GetTimeGeometry instead: For additional information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(const mitk::TimeGeometry* GetTimeSlicedGeometry() const)
{
return GetTimeGeometry();
}
/**
* @brief Return the TimeGeometry 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::TimeGeometry* GetTimeGeometry()
{
return m_TimeGeometry.GetPointer();
}
/**
* @brief Return the TimeGeometry of the data.
*
* The method does not simply return the value of the m_TimeGeometry
* member. Before doing this, it makes sure that the TimeGeometry
* is up-to-date (by setting the update extent to largest possible and
* calling UpdateOutputInformation).
*/
const mitk::TimeGeometry* GetUpdatedTimeGeometry();
/**
* @brief Return the TimeGeometry of the data.
*
* The method does not simply return the value of the m_TimeGeometry
* member. Before doing this, it makes sure that the TimeGeometry
* is up-to-date (by setting the update extent to largest possible and
* calling UpdateOutputInformation).
* \deprecatedSince{2013_09} Please use GetUpdatedTimeGeometry instead: For additional information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(const mitk::TimeGeometry* GetUpdatedTimeSliceGeometry())
{
return GetUpdatedTimeGeometry();
}
/**
* \brief Expands the TimeGeometry to a number of TimeSteps.
*
* The method expands the TimeGeometry 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 );
/**
* \brief Return the BaseGeometry of the data at time \a t.
*
* The method does not simply return
* m_TimeGeometry->GetGeometry(t).
* Before doing this, it makes sure that the BaseGeometry is up-to-date
* (by setting the update extent appropriately and calling
* UpdateOutputInformation).
*
* @todo Appropriate setting of the update extent is missing.
*/
const mitk::BaseGeometry* GetUpdatedGeometry(int t=0);
//##Documentation
//## @brief Return the geometry, which is a TimeGeometry, 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::BaseGeometry* GetGeometry(int t=0) const
{
if(m_TimeGeometry.IsNull())
return NULL;
return m_TimeGeometry->GetGeometryForTimeStep(t);
}
//##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
//## GetTimeGeometry()->UpdateInformation()
//## \em after calling its source's BaseProcess::UpdateOutputInformation().
- void UpdateOutputInformation();
+ void UpdateOutputInformation() override;
//##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().
- virtual void SetRequestedRegionToLargestPossibleRegion()=0;
+ virtual void SetRequestedRegionToLargestPossibleRegion() override = 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
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()=0;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override = 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;
+ virtual bool VerifyRequestedRegion() override = 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);
+ void CopyInformation(const itk::DataObject* data) override;
//##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.
- virtual void SetRequestedRegion(const itk::DataObject *data)=0;
+ virtual void SetRequestedRegion(const itk::DataObject *data) override = 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);
+ void ExecuteOperation(Operation* operation) override;
/**
* \brief Set the BaseGeometry of the data, which will be referenced (not copied!).
* Assumes the data object has only 1 time step ( is a 3D object ) and creates a
* new TimeGeometry which saves the given BaseGeometry. If an TimeGeometry has already
* been set for the object, it will be replaced after calling this function.
*
* @warning This method will normally be called internally by the sub-class of BaseData
* during initialization.
* \sa SetClonedGeometry
*/
virtual void SetGeometry(BaseGeometry* aGeometry3D);
/**
* \brief Set the TimeGeometry of the data, which will be referenced (not copied!).
*
* @warning This method will normally be called internally by the sub-class of BaseData
* during initialization.
* \sa SetClonedTimeGeometry
*/
virtual void SetTimeGeometry (TimeGeometry* geometry);
/**
* \brief Set a clone of the provided TimeGeometry as TimeGeometry of the data.
* Assumes the data object has only 1 time step ( is a 3D object ) and
* creates a new TimeGeometry. If an TimeGeometry has already
* been set for the object, it will be replaced after calling this function.
*
* \sa SetGeometry
*/
virtual void SetClonedGeometry(const BaseGeometry* aGeometry3D);
/**
* \brief Set a clone of the provided TimeGeometry as TimeGeometry of the data.
*
* \sa SetGeometry
*/
virtual void SetClonedTimeGeometry (const TimeGeometry* geometry);
//##Documentation
//## @brief Set a clone of the provided geometry as BaseGeometry of a given time step.
//##
//## \sa SetGeometry
virtual void SetClonedGeometry(const BaseGeometry* 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 BaseGeometry instances of all time steps
//##
//## \warning Geometries contained in the BaseGeometry will
//## \em not be changed, e.g. in case the BaseGeometry 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 SmartPointer and not a WeakPointer
* because it is assumed the code calling GetSource() wants to hold a
* long term reference to the source. */
itk::SmartPointer<mitk::BaseDataSource> GetSource() const;
//##Documentation
//## @brief Get the number of time steps from the TimeGeometry
//## 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_TimeGeometry->CountTimeSteps();
}
//##Documentation
//## @brief Get the modified time of the last change of the contents
//## this data object or its geometry.
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
/**
* \sa itk::ProcessObject::Graft
*/
- virtual void Graft(const DataObject*);
+ virtual void Graft(const DataObject*) override;
protected:
BaseData();
BaseData(const BaseData &other);
~BaseData();
//##Documentation
//## \brief Initialize the TimeGeometry for a number of time steps.
//## The TimeGeometry is initialized empty and evenly timed.
//## In many cases it will be necessary to overwrite this in sub-classes.
virtual void InitializeTimeGeometry( unsigned int timeSteps = 1 );
/**
* \brief Initialize the TimeGeometry for a number of time steps.
* The TimeGeometry is initialized empty and evenly timed.
* In many cases it will be necessary to overwrite this in sub-classes.
* \deprecatedSince{2013_09} Please use GetUpdatedTimeGeometry instead: For additional information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(virtual void InitializeTimeSlicedGeometry( unsigned int timeSteps = 1 ))
{
InitializeTimeGeometry(timeSteps);
}
//##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::InitializeTimeGeometry() to ensure an existing valid geometry
virtual void InitializeEmpty(){}
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion;
mutable unsigned int m_SourceOutputIndexDuplicate;
bool m_Initialized;
private:
//##Documentation
//## @brief PropertyList, f.e. to hold pic-tags, tracking-data,..
//##
PropertyList::Pointer m_PropertyList;
TimeGeometry::Pointer m_TimeGeometry;
};
} // namespace mitk
#endif /* BASEDATA_H_HEADER_INCLUDED_C1EBB6FA */
diff --git a/Modules/Core/include/mitkBaseDataSource.h b/Modules/Core/include/mitkBaseDataSource.h
index 9a1c6e4243..844e129def 100644
--- a/Modules/Core/include/mitkBaseDataSource.h
+++ b/Modules/Core/include/mitkBaseDataSource.h
@@ -1,162 +1,162 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_BASE_DATA_SOURCE_H
#define MITK_BASE_DATA_SOURCE_H
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include <itkProcessObject.h>
#define mitkBaseDataSourceGetOutputDeclarations \
OutputType* GetOutput(); \
const OutputType* GetOutput() const; \
OutputType* GetOutput(DataObjectPointerArraySizeType idx); \
const OutputType* GetOutput(DataObjectPointerArraySizeType idx) const;
#define mitkBaseDataSourceGetOutputDefinitions(className) \
className::OutputType* className::GetOutput(void) \
{ \
return itkDynamicCastInDebugMode<OutputType*>( this->GetPrimaryOutput() ); \
} \
const className::OutputType* className::GetOutput(void) const \
{ \
return itkDynamicCastInDebugMode<const OutputType*>( this->GetPrimaryOutput() ); \
} \
className::OutputType* className::GetOutput(DataObjectPointerArraySizeType idx) \
{ \
OutputType* out = dynamic_cast<OutputType*>( this->ProcessObject::GetOutput(idx) ); \
if ( out == NULL && this->ProcessObject::GetOutput(idx) != NULL ) \
{ \
itkWarningMacro (<< "Unable to convert output number " << idx << " to type " << typeid( OutputType ).name () ); \
} \
return out; \
} \
const className::OutputType* className::GetOutput(DataObjectPointerArraySizeType idx) const \
{ \
const OutputType* out = dynamic_cast<const OutputType*>( this->ProcessObject::GetOutput(idx) ); \
if ( out == NULL && this->ProcessObject::GetOutput(idx) != NULL ) \
{ \
itkWarningMacro (<< "Unable to convert output number " << idx << " to type " << typeid( OutputType ).name () ); \
} \
return out; \
}
namespace mitk {
class BaseData;
/**
* @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 MITKCORE_EXPORT BaseDataSource : public itk::ProcessObject
{
public:
- mitkClassMacro(BaseDataSource, itk::ProcessObject)
+ mitkClassMacroItkParent(BaseDataSource, itk::ProcessObject)
typedef BaseData OutputType;
typedef itk::DataObject::DataObjectIdentifierType DataObjectIdentifierType;
mitkBaseDataSourceGetOutputDeclarations
/** @brief Graft the specified BaseData onto this BaseDataSource's output.
*
* 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(0) );
*
* // 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(0) );
* \endcode
*/
virtual void GraftOutput(OutputType* output);
/**
* Graft the specified base data object onto this BaseDataSource's named
* output. This is similar to the GraftOutput method except it
* allows you to specify which output is affected.
* See the GraftOutput for general usage information.
*/
virtual void GraftOutput(const DataObjectIdentifierType & key, OutputType* output);
/** @brief Graft the specified base data object onto this BaseDataSource'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, OutputType* output);
/**
* @sa itk::ProcessObject::MakeOutput(DataObjectPointerArraySizeType)
*/
- virtual DataObjectPointer MakeOutput ( DataObjectPointerArraySizeType idx ) = 0;
+ virtual DataObjectPointer MakeOutput ( DataObjectPointerArraySizeType idx ) override = 0;
/**
* @sa itk::ProcessObject::MakeOutput(const DataObjectIdentifierType&)
*/
- virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType& name) = 0;
+ virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType& name) override = 0;
/**
* @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;
protected:
BaseDataSource();
virtual ~BaseDataSource();
// purposely not implemented
static Pointer New();
};
} // namespace mitk
#endif /* MITK_BASE_DATA_SOURCE_H */
diff --git a/Modules/Core/include/mitkBaseDataTestImplementation.h b/Modules/Core/include/mitkBaseDataTestImplementation.h
index 93340cac93..ace1517878 100644
--- a/Modules/Core/include/mitkBaseDataTestImplementation.h
+++ b/Modules/Core/include/mitkBaseDataTestImplementation.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BASEDATAIMPLEMENTATION_H_HEADER_INCLUDED
#define BASEDATAIMPLEMENTATION_H_HEADER_INCLUDED
#include "mitkBaseData.h"
namespace mitk {
//##Documentation
//## @brief Implementation of BaseData (for testing)
//##
//## As BaseData is an abstract class, we need an implementation for testing its methods
//## @ingroup Data
class BaseDataTestImplementation : public BaseData
{
public:
mitkClassMacro(BaseDataTestImplementation, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void InitializeTimeGeometry( unsigned int timeSteps /* = 1 */ )
+ virtual void InitializeTimeGeometry( unsigned int timeSteps /* = 1 */ ) override
{
Superclass::InitializeTimeGeometry(timeSteps);
}
protected:
mitkCloneMacro(Self);
- virtual bool VerifyRequestedRegion(){return false;};
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(){return false;};
- virtual void SetRequestedRegionToLargestPossibleRegion(){};
- virtual void SetRequestedRegion( const itk::DataObject * /*data*/){};
+ virtual bool VerifyRequestedRegion() override{return false;};
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override{return false;};
+ virtual void SetRequestedRegionToLargestPossibleRegion() override{};
+ virtual void SetRequestedRegion( const itk::DataObject * /*data*/) override{};
BaseDataTestImplementation(){};
virtual ~BaseDataTestImplementation(){};
};
} // namespace
#endif // BASEDATA_H_HEADER_INCLUDED
diff --git a/Modules/Core/include/mitkBaseGeometry.h b/Modules/Core/include/mitkBaseGeometry.h
index e01283af77..41d97bba85 100644
--- a/Modules/Core/include/mitkBaseGeometry.h
+++ b/Modules/Core/include/mitkBaseGeometry.h
@@ -1,741 +1,741 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BaseGeometry_H_HEADER_INCLUDED
#define BaseGeometry_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "mitkOperationActor.h"
#include <itkBoundingBox.h>
#include "mitkNumericTypes.h"
#include <itkAffineGeometryFrame.h>
#include <itkQuaternionRigidTransform.h>
#include "itkScalableAffineTransform.h"
#include <itkIndex.h>
#include <mitkAffineTransform3D.h>
#include <vtkTransform.h>
#include <mitkGeometryTransformHolder.h>
class vtkMatrix4x4;
class vtkMatrixToLinearTransform;
class vtkLinearTransform;
namespace mitk {
//##Documentation
//## @brief Standard 3D-BoundingBox typedef
//##
//## Standard 3D-BoundingBox typedef to get rid of template arguments (3D, type).
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBox;
//##Documentation
//## @brief Standard typedef for time-bounds
typedef itk::FixedArray<ScalarType, 2> TimeBounds;
typedef itk::FixedArray<ScalarType, 3> FixedArrayType;
typedef itk::AffineGeometryFrame<ScalarType, 3> AffineGeometryFrame3D;
//##Documentation
//## @brief BaseGeometry Describes the geometry of a 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 an origin and spacing to define the geometry
//##
//## BaseGeometry 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.
//##
//## BaseGeometry instances referring to an Image need a slightly
//## different definition of corners, see SetImageGeometry. This
//## is usualy automatically called by Image.
//##
//## BaseGeometry 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().
//##
//## At least, it can return the bounding box of the data object.
//##
//## The BaseGeometry class is an abstract class. The most simple implementation
//## is the sublass Geometry3D.
//##
//## Rule: everything is in mm (ms) if not stated otherwise.
//## @ingroup Geometry
class MITKCORE_EXPORT BaseGeometry : public itk::Object, public OperationActor
{
public:
mitkClassMacro(BaseGeometry, itk::Object);
itkCloneMacro(Self)
// ********************************** TypeDef **********************************
typedef GeometryTransformHolder::TransformType TransformType;
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBoxType;
typedef BoundingBoxType::BoundsArrayType BoundsArrayType;
typedef BoundingBoxType::Pointer BoundingBoxPointer;
// ********************************** Origin, Spacing **********************************
//##Documentation
//## @brief Get the origin, e.g. the upper-left corner of the plane
const Point3D GetOrigin() const;
//##Documentation
//## @brief Set the origin, i.e. the upper-left corner of the plane
//##
void SetOrigin(const Point3D& origin);
//##Documentation
//## @brief Get the spacing (size of a pixel).
//##
const mitk::Vector3D GetSpacing() const;
//##Documentation
//## @brief Set the spacing (m_Spacing).
//##
//##The spacing is also changed in the IndexToWorldTransform.
void SetSpacing(const mitk::Vector3D& aSpacing, bool enforceSetSpacing = false);
//##Documentation
//## @brief Get the origin as VnlVector
//##
//## \sa GetOrigin
VnlVector GetOriginVnl() const;
// ********************************** other functions **********************************
//##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);
itkGetConstMacro(IndexToWorldTransformLastModified, unsigned long);
//##Documentation
//## @brief Overload of function Modified() to prohibit several calls of Modified() using the ModifiedLock class.
//##
//## For the use of Modified(), see class ModifiedLock.
- void Modified() const;
+ void Modified() const override;
friend class ModifiedLock;
//##Documentation
//## @brief Is this BaseGeometry in a state that is valid?
//##
//## This function returns always true in the BaseGeometry class. Other implementations are possible in subclasses.
virtual bool IsValid() const;
// ********************************** Initialize **********************************
//##Documentation
//## @brief Initialize the BaseGeometry
void Initialize();
void InitializeGeometry(Self * newGeometry) const;
// ********************************** Transformations Set/Get **********************************
//##Documentation
//## @brief Get the transformation used to convert from index
//## to world coordinates
mitk::AffineTransform3D* GetIndexToWorldTransform();
//##Documentation
//## @brief Get the transformation used to convert from index
//## to world coordinates
const mitk::AffineTransform3D* GetIndexToWorldTransform() const;
//## @brief Set the transformation used to convert from index
//## to world coordinates. The spacing of the new transform is
//## copied to m_spacing.
void SetIndexToWorldTransform(mitk::AffineTransform3D* transform);
//##Documentation
//## @brief Convenience method for setting the ITK transform
//## (m_IndexToWorldTransform) via an vtkMatrix4x4.The spacing of
//## the new transform is copied to m_spacing.
//## \sa SetIndexToWorldTransform
void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4* vtkmatrix);
//## @brief Set the transformation used to convert from index
//## to world coordinates.This function keeps the original spacing.
void SetIndexToWorldTransformWithoutChangingSpacing(mitk::AffineTransform3D* transform);
//##Documentation
//## @brief Convenience method for setting the ITK transform
//## (m_IndexToWorldTransform) via an vtkMatrix4x4. This function keeps the original spacing.
//## \sa SetIndexToWorldTransform
void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing(vtkMatrix4x4* vtkmatrix);
//## Get the Vtk Matrix which describes the transform.
vtkMatrix4x4* GetVtkMatrix();
//##Documentation
//## @brief Get the m_IndexToWorldTransform as a vtkLinearTransform
vtkLinearTransform* GetVtkTransform() const;
//##Documentation
//## @brief Set the transform to identity, the spacing to 1 and origin to 0
//##
void SetIdentity();
// ********************************** Transformations **********************************
//##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.
//## This method also changes m_spacing.
void Compose(const 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.
void Compose(const vtkMatrix4x4 * vtkmatrix, bool pre = 0);
//##Documentation
//## @brief Translate the origin by a vector
//##
void Translate(const Vector3D& vector);
//##Documentation
//##@brief executes affine operations (translate, rotate, scale)
- virtual void ExecuteOperation(Operation* operation);
+ virtual void ExecuteOperation(Operation* operation) override;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates
//## \warning If you need (discrete) integer index coordinates (e.g., for iterating easily over an image),
//## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index).
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Point3D& pt_mm, mitk::Point3D& pt_units) const;
//##Documentation
//## @brief Convert 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 world coordinates (in mm) of a \em point to (discrete!) index coordinates.
//## This method rounds to integer indices!
//## For further information about coordinates types, please see the Geometry documentation
template <unsigned int VIndexDimension>
void WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index) const
{
typedef itk::Index<VIndexDimension> IndexType;
mitk::Point3D pt_units;
this->WorldToIndex(pt_mm, pt_units);
int i, dim = index.GetIndexDimension();
if (dim > 3)
{
index.Fill(0);
dim = 3;
}
for (i = 0; i < dim; ++i){
index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
}
}
//##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 (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 (discrete) index coordinates of a \em point to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
template <unsigned int VIndexDimension>
void IndexToWorld(const itk::Index<VIndexDimension> &index, mitk::Point3D& pt_mm) const
{
mitk::Point3D pt_units;
pt_units.Fill(0);
int i, dim = index.GetIndexDimension();
if (dim > 3)
{
dim = 3;
}
for (i = 0; i < dim; ++i)
{
pt_units[i] = index[i];
}
IndexToWorld(pt_units, pt_mm);
}
//##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 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 Deprecated for use with ITK version 3.10 or newer.
//## Convert ITK physical coordinates of a \em point (in mm,
//## but without a rotation) into MITK world coordinates (in mm)
//##
//## For more information, see WorldToItkPhysicalPoint.
template<class TCoordRep>
void ItkPhysicalPointToWorld(const itk::Point<TCoordRep, 3>& itkPhysicalPoint,
mitk::Point3D& pt_mm) const
{
mitk::vtk2itk(itkPhysicalPoint, pt_mm);
}
//##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 BaseGeometry is
//## simply discarded; in other word: only the origin and spacing is
//## used by ITK, not the complete matrix available in MITK.
//## With WorldToItkPhysicalPoint you can convert an MITK world
//## coordinate (including the rotation) into a coordinate that
//## can be used with the ITK image as a ITK physical coordinate
//## (excluding the rotation).
template<class TCoordRep>
void WorldToItkPhysicalPoint(const mitk::Point3D& pt_mm,
itk::Point<TCoordRep, 3>& itkPhysicalPoint) const
{
mitk::vtk2itk(pt_mm, itkPhysicalPoint);
}
// ********************************** BoundingBox **********************************
/** Get the bounding box */
itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
// a bit of a misuse, but we want only doxygen to see the following:
#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;
#endif
const BoundsArrayType GetBounds() const;
//##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.
void SetBounds(const BoundsArrayType& bounds);
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a float array
void SetFloatBounds(const float bounds[6]);
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a double array
void SetFloatBounds(const double bounds[6]);
//##Documentation
//## @brief Get a VnlVector along bounding-box in the specified
//## @a direction, length is spacing
//##
//## \sa GetAxisVector
VnlVector GetMatrixColumn(unsigned int direction) const;
//##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 Set the time bounds (in ms)
//void SetTimeBounds(const TimeBounds& timebounds);
// ********************************** Geometry **********************************
#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
/** Get the extent of the bounding box */
ScalarType GetExtent(unsigned int direction) const;
//##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;
//##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;
//##Documentation
//## @brief Checks, if the given geometry can be converted to 2D without information loss
//## e.g. when a 2D image is saved, the matrix is usually cropped to 2x2, and when you load it back to MITK
//## it will be filled with standard values. This function checks, if information would be lost during this
//## procedure
virtual bool Is2DConvertable();
//##Documentation
//## @brief Get the center of the bounding-box in mm
//##
Point3D GetCenter() const;
//##Documentation
//## @brief Get the squared length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength2() const;
//##Documentation
//## @brief Get the length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength() const;
//##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 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!
void SetExtentInMM(int direction, ScalarType extentInMM);
//##Documentation
//## @brief Test whether the point \a p (world coordinates in mm) is
//## inside the bounding box
bool IsInside(const mitk::Point3D& p) const;
//##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;
//##Documentation
//## @brief Convenience method for working with ITK indices
template <unsigned int VIndexDimension>
bool IsIndexInside(const itk::Index<VIndexDimension> &index) const
{
int i, dim = index.GetIndexDimension();
Point3D pt_index;
pt_index.Fill(0);
for (i = 0; i < dim; ++i)
{
pt_index[i] = index[i];
}
return IsIndexInside(pt_index);
}
// ********************************* Image Geometry ********************************
//##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 Is this an ImageGeometry?
//##
//## For more information, see SetImageGeometry
itkGetConstMacro(ImageGeometry, bool)
//##Documentation
//## @brief Define that this BaseGeometry 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 BaseGeometry is referring to an Image.
itkSetMacro(ImageGeometry, bool)
itkBooleanMacro(ImageGeometry)
const GeometryTransformHolder* GetGeometryTransformHolder() const;
protected:
// ********************************** Constructor **********************************
BaseGeometry();
BaseGeometry(const BaseGeometry& other);
virtual ~BaseGeometry();
//##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 itk::LightObject::Pointer InternalClone() const = 0;
+ virtual itk::LightObject::Pointer InternalClone() const override = 0;
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
static const std::string GetTransformAsString(TransformType* transformType);
itkGetConstMacro(NDimensions, unsigned int)
bool IsBoundingBoxNull() const;
bool IsIndexToWorldTransformNull() const;
void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
void _SetSpacing(const mitk::Vector3D& aSpacing, bool enforceSetSpacing = false);
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
virtual void PreSetSpacing(const mitk::Vector3D& /*aSpacing*/) {};
//##Documentation
//## @brief CheckBounds
//##
//## This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## If you implement this function in a subclass, make sure, that all classes were your class inherits from
//## have an implementation of CheckBounds
//## (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as well!)
virtual void CheckBounds(const BoundsArrayType& /*bounds*/){};
//##Documentation
//## @brief CheckIndexToWorldTransform
//##
//## This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## In Subclasses of BaseGeometry, implement own conditions or call Superclass::CheckBounds(bounds);.
virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D* /*transform*/){};
private:
GeometryTransformHolder* m_GeometryTransform;
void InitializeGeometryTransformHolder(const BaseGeometry* otherGeometry);
//##Documentation
//## @brief Bounding Box, which is axes-parallel in intrinsic coordinates
//## (often integer indices of pixels)
BoundingBoxPointer m_BoundingBox;
unsigned int m_FrameOfReferenceID;
//mitk::TimeBounds m_TimeBounds;
static const unsigned int m_NDimensions = 3;
mutable TransformType::Pointer m_InvertedTransform;
mutable unsigned long m_IndexToWorldTransformLastModified;
bool m_ImageGeometry;
//##Documentation
//## @brief ModifiedLockFlag is used to prohibit the call of Modified()
//##
//## For the use of this Flag, see class ModifiedLock. This flag should only be set
//## by the ModifiedLock class!
bool m_ModifiedLockFlag;
//##Documentation
//## @brief ModifiedcalledFlag is used to collect calls of Modified().
//##
//## For the use of this Flag, see class ModifiedLock. This flag should only be set
//## by the Modified() function!
mutable bool m_ModifiedCalledFlag;
};
// ********************************** Equal Functions **********************************
//
// Static compare functions mainly for testing
//
/**
* @brief Equal A function comparing two geometries for beeing identical.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::mitk::BaseGeometry& g1, const mitk::BaseGeometry& g2) instead.
*
* @ingroup MITKTestingAPI
*
* The function compares the spacing, origin, axisvectors, extents, the matrix of the
* IndexToWorldTransform (elementwise), the bounding (elementwise) and the ImageGeometry flag.
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* If you want to use different tolarance values for different parts of the geometry, feel free to use
* the other comparison methods and write your own implementation of Equal.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry* leftHandSide, const mitk::BaseGeometry* rightHandSide, ScalarType eps, bool verbose));
/**
* @brief Equal A function comparing two geometries for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the spacing, origin, axisvectors, extents, the matrix of the
* IndexToWorldTransform (elementwise), the bounding (elementwise) and the ImageGeometry flag.
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* If you want to use different tolarance values for different parts of the geometry, feel free to use
* the other comparison methods and write your own implementation of Equal.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry& leftHandSide, const mitk::BaseGeometry& rightHandSide, ScalarType eps, bool verbose);
/**
* @brief Equal A function comparing two transforms (TransformType) for beeing identical.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::mitk::BaseGeometry::TransformType& t1, const mitk::BaseGeometry::TransformType& t2) instead.
*
* @ingroup MITKTestingAPI
*
* The function compares the IndexToWorldTransform (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::TransformType *leftHandSide, const mitk::BaseGeometry::TransformType *rightHandSide, ScalarType eps, bool verbose));
/**
* @brief Equal A function comparing two transforms (TransformType) for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the IndexToWorldTransform (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::TransformType& leftHandSide, const mitk::BaseGeometry::TransformType& rightHandSide, ScalarType eps, bool verbose);
/**
* @brief Equal A function comparing two bounding boxes (BoundingBoxType) for beeing identical.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::mitk::BaseGeometry::BoundingBoxType& b1, const mitk::BaseGeometry::BoundingBoxType& b2) instead.
*
* @ingroup MITKTestingAPI
*
* The function compares the bounds (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::BoundingBoxType *leftHandSide, const mitk::BaseGeometry::BoundingBoxType *rightHandSide, ScalarType eps, bool verbose));
/**
* @brief Equal A function comparing two bounding boxes (BoundingBoxType) for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the bounds (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::BoundingBoxType& leftHandSide, const mitk::BaseGeometry::BoundingBoxType& rightHandSide, ScalarType eps, bool verbose);
} // namespace mitk
#endif /* BaseGeometry_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkBaseProperty.h b/Modules/Core/include/mitkBaseProperty.h
index b022923e97..6e0b5ae688 100644
--- a/Modules/Core/include/mitkBaseProperty.h
+++ b/Modules/Core/include/mitkBaseProperty.h
@@ -1,103 +1,103 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#define BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#include <string>
#include <itkObjectFactory.h>
#include <MitkCoreExports.h>
#include <mitkCommon.h>
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 MITKCORE_EXPORT BaseProperty : public itk::Object
{
public:
- mitkClassMacro(BaseProperty,itk::Object)
+ mitkClassMacroItkParent(BaseProperty,itk::Object)
itkCloneMacro(Self)
/*! @brief Subclasses must implement IsEqual(const BaseProperty&) to support comparison.
operator== which is used by PropertyList to check whether a property has been changed.
*/
bool operator==(const BaseProperty& property) const;
/*! @brief Assigns property to this BaseProperty instance.
Subclasses must implement Assign(const BaseProperty&) and call the superclass
Assign method for proper handling of polymorphic assignments. The assignment
operator of the subclass should be disabled and the baseclass operator should
be made visible using "using" statements.
*/
BaseProperty& operator=(const BaseProperty& property);
/*! @brief Assigns property to this BaseProperty instance.
This method is identical to the assignment operator, except for the return type.
It allows to directly check if the assignemnt was successfull.
*/
bool AssignProperty(const BaseProperty & property);
virtual std::string GetValueAsString() const;
protected:
BaseProperty();
BaseProperty(const BaseProperty& other);
virtual ~BaseProperty();
private:
/*!
Override this method in subclasses to implement a meaningful comparison. The property
argument is guaranteed to be castable to the type of the implementing subclass.
*/
virtual bool IsEqual(const BaseProperty& property) const = 0;
/*!
Override this method in subclasses to implement a meaningful assignment. The property
argument is guaranteed to be castable to the type of the implementing subclass.
@warning This is not yet exception aware/safe and if this method returns false,
this property's state might be undefined.
@return True if the argument could be assigned to this property.
*/
virtual bool Assign(const BaseProperty& ) = 0;
};
} // namespace mitk
#endif /* BASEPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */
diff --git a/Modules/Core/include/mitkBaseRenderer.h b/Modules/Core/include/mitkBaseRenderer.h
index 42f9b17918..4c0a8f52ac 100644
--- a/Modules/Core/include/mitkBaseRenderer.h
+++ b/Modules/Core/include/mitkBaseRenderer.h
@@ -1,676 +1,676 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4
#define BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4
#include "mitkDataStorage.h"
#include "mitkPlaneGeometry.h"
#include "mitkTimeGeometry.h"
#include "mitkDisplayGeometry.h"
#include "mitkPlaneGeometryData.h"
#include "mitkCameraController.h"
#include "mitkDisplayPositionEvent.h"
#include "mitkWheelEvent.h"
//#include "mitkMapper.h"
#include "mitkSliceNavigationController.h"
#include "mitkCameraController.h"
#include "mitkCameraRotationController.h"
#include "mitkBindDispatcherInteractor.h"
#include "mitkDispatcher.h"
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <map>
#include <set>
// DEPRECATED
#include <mitkTimeSlicedGeometry.h>
namespace mitk
{
class NavigationController;
class SliceNavigationController;
class CameraRotationController;
class CameraController;
class DataStorage;
class Mapper;
class BaseLocalStorageHandler;
class OverlayManager;
//##Documentation
//## @brief Organizes the rendering process
//##
//## Organizes the rendering process. A Renderer contains a reference to a
//## DataStorage and asks the mappers of the data objects to render
//## the data into the renderwindow it is associated to.
//##
//## \#Render() checks if rendering is currently allowed by calling
//## RenderWindow::PrepareRendering(). Initialization of a rendering context
//## can also be performed in this method.
//##
//## The actual rendering code has been moved to \#Repaint()
//## Both \#Repaint() and \#Update() are declared protected now.
//##
//## Note: Separation of the Repaint and Update processes (rendering vs
//## creating a vtk prop tree) still needs to be worked on. The whole
//## rendering process also should be reworked to use VTK based classes for
//## both 2D and 3D rendering.
//## @ingroup Renderer
class MITKCORE_EXPORT BaseRenderer: public itk::Object
{
public:
/** \brief This rendering mode enumeration is specified at various constructors
* of the Renderer and RenderWindow classes, which autoconfigures the
* respective VTK objects. This has to be done at construction time because later
* configuring turns out to be not working on most platforms.
*/
struct RenderingMode
{
enum Type {
Standard = 0, // no multi-sampling, no depth-peeling
MultiSampling, // multi-sampling (antialiasing), no depth-peeling
DepthPeeling // no multi-sampling, depth-peeling is on (order-independant transparency)
};
};
typedef std::map<vtkRenderWindow*, BaseRenderer*> BaseRendererMapType;
static BaseRendererMapType baseRendererMap;
static BaseRenderer* GetInstance(vtkRenderWindow * renWin);
static void AddInstance(vtkRenderWindow* renWin, BaseRenderer* baseRenderer);
static void RemoveInstance(vtkRenderWindow* renWin);
static BaseRenderer* GetByName(const std::string& name);
static vtkRenderWindow* GetRenderWindowByName(const std::string& name);
#pragma GCC visibility push(default)
itkEventMacro( RendererResetEvent, itk::AnyEvent );
#pragma GCC visibility pop
/** Standard class typedefs. */
- mitkClassMacro(BaseRenderer, itk::Object);
+ mitkClassMacroItkParent(BaseRenderer, itk::Object);
BaseRenderer(const char* name = NULL, vtkRenderWindow * renWin = NULL, mitk::RenderingManager* rm = NULL,RenderingMode::Type mode = RenderingMode::Standard);
//##Documentation
//## @brief MapperSlotId defines which kind of mapper (e.g., 2D or 3D) shoud be used.
typedef int MapperSlotId;
enum StandardMapperSlot
{
Standard2D = 1, Standard3D = 2
};
virtual void SetDataStorage(DataStorage* storage); ///< set the datastorage that will be used for rendering
//##Documentation
//## return the DataStorage that is used for rendering
virtual DataStorage::Pointer GetDataStorage() const
{
return m_DataStorage.GetPointer();
}
//##Documentation
//## @brief Access the RenderWindow into which this renderer renders.
vtkRenderWindow* GetRenderWindow() const
{
return m_RenderWindow;
}
vtkRenderer* GetVtkRenderer() const
{
return m_VtkRenderer;
}
//##Documentation
//## @brief Returns the Dispatcher which handles Events for this BaseRenderer
Dispatcher::Pointer GetDispatcher() const;
//##Documentation
//## @brief Default mapper id to use.
static const MapperSlotId defaultMapper;
//##Documentation
//## @brief Do the rendering and flush the result.
virtual void Paint();
//##Documentation
//## @brief Initialize the RenderWindow. Should only be called from RenderWindow.
virtual void Initialize();
//##Documentation
//## @brief Called to inform the renderer that the RenderWindow has been resized.
virtual void Resize(int w, int h);
//##Documentation
//## @brief Initialize the renderer with a RenderWindow (@a renderwindow).
virtual void InitRenderer(vtkRenderWindow* renderwindow);
//##Documentation
//## @brief Set the initial size. Called by RenderWindow after it has become
//## visible for the first time.
virtual void InitSize(int w, int h);
//##Documentation
//## @brief Draws a point on the widget.
//## Should be used during conferences to show the position of the remote mouse
virtual void DrawOverlayMouse(Point2D& p2d);
//##Documentation
//## @brief Set/Get the WorldGeometry (m_WorldGeometry) for 3D and 2D rendering, that describing the
//## (maximal) area to be rendered.
//##
//## Depending of the type of the passed BaseGeometry more or less information can be extracted:
//## \li if it is a PlaneGeometry (which is a sub-class of BaseGeometry), m_CurrentWorldPlaneGeometry is
//## also set to point to it. m_WorldTimeGeometry is set to NULL.
//## \li if it is a TimeGeometry, m_WorldTimeGeometry is also set to point to it.
//## If m_WorldTimeGeometry contains instances of SlicedGeometry3D, m_CurrentWorldPlaneGeometry is set to
//## one of geometries stored in the SlicedGeometry3D according to the value of m_Slice; otherwise
//## a PlaneGeometry describing the top of the bounding-box of the BaseGeometry is set as the
//## m_CurrentWorldPlaneGeometry.
//## \li otherwise a PlaneGeometry describing the top of the bounding-box of the BaseGeometry
//## is set as the m_CurrentWorldPlaneGeometry. m_WorldTimeGeometry is set to NULL.
//## @todo add calculation of PlaneGeometry describing the top of the bounding-box of the BaseGeometry
//## when the passed BaseGeometry is not sliced.
//## \sa m_WorldGeometry
//## \sa m_WorldTimeGeometry
//## \sa m_CurrentWorldPlaneGeometry
virtual void SetWorldGeometry3D(BaseGeometry* geometry);
virtual void SetWorldTimeGeometry(mitk::TimeGeometry* geometry);
/**
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(void SetWorldGeometry3D(TimeSlicedGeometry* geometry));
itkGetConstObjectMacro(WorldGeometry, BaseGeometry)
itkGetObjectMacro(WorldGeometry, BaseGeometry)
itkGetConstObjectMacro(WorldTimeGeometry, TimeGeometry)
itkGetObjectMacro(WorldTimeGeometry, TimeGeometry)
//##Documentation
//## @brief Get the current 3D-worldgeometry (m_CurrentWorldGeometry) used for 3D-rendering
itkGetConstObjectMacro(CurrentWorldGeometry, BaseGeometry)
//##Documentation
//## @brief Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering
itkGetConstObjectMacro(CurrentWorldPlaneGeometry, PlaneGeometry)
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometry
*/
DEPRECATED(const PlaneGeometry* GetCurrentWorldGeometry2D()){return GetCurrentWorldPlaneGeometry();};
//##Documentation
//## 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.
//## \warn This is not implemented yet.
virtual bool SetWorldGeometryToDataStorageBounds()
{
return false;
}
//##Documentation
//## @brief Set/Get the DisplayGeometry (for 2D rendering)
//##
//## The DisplayGeometry describes which part of the PlaneGeometry m_CurrentWorldPlaneGeometry
//## is displayed.
virtual void SetDisplayGeometry(DisplayGeometry* geometry2d);
itkGetConstObjectMacro(DisplayGeometry, DisplayGeometry)
itkGetObjectMacro(DisplayGeometry, DisplayGeometry)
//##Documentation
//## @brief Set/Get m_Slice which defines together with m_TimeStep the 2D geometry
//## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry
//##
//## \sa m_Slice
virtual void SetSlice(unsigned int slice);
//##Documentation
//## @brief Sets an OverlayManager which is used to add various Overlays to this
//## renderer. If an OverlayManager was already set it will be overwritten.
void SetOverlayManager(itk::SmartPointer<OverlayManager> overlayManager);
//##Documentation
//## @brief Get the OverlayManager registered with this renderer
//## if none was set, it will be created at this point.
itk::SmartPointer<OverlayManager> GetOverlayManager();
itkGetConstMacro(Slice, unsigned int)
//##Documentation
//## @brief Set/Get m_TimeStep which defines together with m_Slice the 2D geometry
//## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry
//##
//## \sa m_TimeStep
virtual void SetTimeStep(unsigned int timeStep);
itkGetConstMacro(TimeStep, unsigned int)
//##Documentation
//## @brief Get the time-step of a BaseData object which
//## exists at the time of the currently displayed content
//##
//## Returns -1 or mitk::BaseData::m_TimeSteps if there
//## is no data at the current time.
//## \sa GetTimeStep, m_TimeStep
int GetTimeStep(const BaseData* data) const;
//##Documentation
//## @brief Get the time in ms of the currently displayed content
//##
//## \sa GetTimeStep, m_TimeStep
ScalarType GetTime() const;
//##Documentation
//## @brief SetWorldGeometry is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometrySendEvent
virtual void SetGeometry(const itk::EventObject & geometrySliceEvent);
//##Documentation
//## @brief UpdateWorldGeometry is called to re-read the 2D geometry from the
//## slice navigation controller
virtual void UpdateGeometry(const itk::EventObject & geometrySliceEvent);
//##Documentation
//## @brief SetSlice is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometrySliceEvent
virtual void SetGeometrySlice(const itk::EventObject & geometrySliceEvent);
//##Documentation
//## @brief SetTimeStep is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometryTimeEvent
virtual void SetGeometryTime(const itk::EventObject & geometryTimeEvent);
//##Documentation
//## @brief Get a data object containing the DisplayGeometry (for 2D rendering)
itkGetObjectMacro(DisplayGeometryData, PlaneGeometryData)
//##Documentation
//## @brief Get a data object containing the WorldGeometry (for 2D rendering)
itkGetObjectMacro(WorldGeometryData, PlaneGeometryData)
//##Documentation
//## @brief Get a DataNode pointing to a data object containing the WorldGeometry (3D and 2D rendering)
itkGetObjectMacro(WorldGeometryNode, DataNode)
//##Documentation
//## @brief Get a DataNode pointing to a data object containing the DisplayGeometry (for 2D rendering)
itkGetObjectMacro(DisplayGeometryNode, DataNode)
//##Documentation
//## @brief Get a DataNode pointing to a data object containing the current 2D-worldgeometry m_CurrentWorldPlaneGeometry (for 2D rendering)
itkGetObjectMacro(CurrentWorldPlaneGeometryNode, DataNode)
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometryNode
*/
DEPRECATED(DataNode* GetCurrentWorldGeometry2DNode()){return GetCurrentWorldPlaneGeometryNode();};
//##Documentation
//## @brief Sets timestamp of CurrentWorldPlaneGeometry and DisplayGeometry and forces so reslicing in that renderwindow
void SendUpdateSlice();
//##Documentation
//## @brief Get timestamp of last call of SetCurrentWorldPlaneGeometry
unsigned long GetCurrentWorldPlaneGeometryUpdateTime()
{
return m_CurrentWorldPlaneGeometryUpdateTime;
}
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometryUpdateTime
*/
DEPRECATED(unsigned long GetCurrentWorldGeometry2DUpdateTime()){return GetCurrentWorldPlaneGeometryUpdateTime();};
//##Documentation
//## @brief Get timestamp of last call of SetDisplayGeometry
unsigned long GetDisplayGeometryUpdateTime()
{
return m_CurrentWorldPlaneGeometryUpdateTime;
}
//##Documentation
//## @brief Get timestamp of last change of current TimeStep
unsigned long GetTimeStepUpdateTime()
{
return m_TimeStepUpdateTime;
}
//##Documentation
//## @brief Perform a picking: find the x,y,z world coordinate of a
//## display x,y coordinate.
//## @warning Has to be overwritten in subclasses for the 3D-case.
//##
//## Implemented here only for 2D-rendering by using
//## m_DisplayGeometry
virtual void PickWorldPoint(const Point2D& diplayPosition, Point3D& worldPosition) const;
/** \brief Determines the object (mitk::DataNode) closest to the current
* position by means of picking
*
* \warning Implementation currently empty for 2D rendering; intended to be
* implemented for 3D renderers */
virtual DataNode* PickObject(const Point2D& /*displayPosition*/, Point3D& /*worldPosition*/) const
{
return NULL;
}
//##Documentation
//## @brief Get the MapperSlotId to use.
itkGetMacro(MapperID, MapperSlotId)
itkGetConstMacro(MapperID, MapperSlotId)
//##Documentation
//## @brief Set the MapperSlotId to use.
itkSetMacro(MapperID, MapperSlotId)
//##Documentation
//## @brief Has the renderer the focus?
itkGetMacro(Focused, bool)
//##Documentation
//## @brief Tell the renderer that it is focused. The caller is responsible for focus management,
//## not the renderer itself.
itkSetMacro(Focused, bool)
itkGetMacro(Size, int*)
void SetSliceNavigationController(SliceNavigationController* SlicenavigationController);
void SetCameraController(CameraController* cameraController);
itkGetObjectMacro(CameraController, CameraController)
itkGetObjectMacro(SliceNavigationController, SliceNavigationController)
itkGetObjectMacro(CameraRotationController, CameraRotationController)
itkGetMacro(EmptyWorldGeometry, bool)
//##Documentation
//## @brief Tells if the displayed region is shifted and rescaled if the render window is resized.
itkGetMacro(KeepDisplayedRegion, bool)
//##Documentation
//## @brief Tells if the displayed region should be shifted and rescaled if the render window is resized.
itkSetMacro(KeepDisplayedRegion, bool)
//##Documentation
//## @brief Mouse event dispatchers
//## @note for internal use only. preliminary.
virtual void MousePressEvent(MouseEvent*);
//##Documentation
//## @brief Mouse event dispatchers
//## @note for internal use only. preliminary.
virtual void MouseReleaseEvent(MouseEvent*);
//##Documentation
//## @brief Mouse event dispatchers
//## @note for internal use only. preliminary.
virtual void MouseMoveEvent(MouseEvent*);
//##Documentation
//## @brief Wheel event dispatcher
//## @note for internal use only. preliminary.
virtual void WheelEvent(mitk::WheelEvent* we);
//##Documentation
//## @brief Key event dispatcher
//## @note for internal use only. preliminary.
virtual void KeyPressEvent(KeyEvent*);
//##Documentation
//## @brief get the name of the Renderer
//## @note
const char * GetName() const
{
return m_Name.c_str();
}
//##Documentation
//## @brief get the x_size of the RendererWindow
//## @note
int GetSizeX() const
{
return m_Size[0];
}
//##Documentation
//## @brief get the y_size of the RendererWindow
//## @note
int GetSizeY() const
{
return m_Size[1];
}
const double* GetBounds() const;
void RequestUpdate();
void ForceImmediateUpdate();
/** Returns number of mappers which are visible and have level-of-detail
* rendering enabled */
unsigned int GetNumberOfVisibleLODEnabledMappers() const;
///**
//* \brief Setter for the RenderingManager that handles this instance of BaseRenderer
//*/
//void SetRenderingManager( mitk::RenderingManager* );
/**
* \brief Getter for the RenderingManager that handles this instance of BaseRenderer
*/
virtual mitk::RenderingManager* GetRenderingManager() const;
/**
* \brief Provides (1) world coordinates for a given mouse position and (2)
* translates mousePosition to Display coordinates
*/
virtual Point3D Map2DRendererPositionTo3DWorldPosition(const Point2D& mousePosition) const;
/**
* \deprecatedSince{2014_03} Please use Map2DRendererPositionTo3DWorldPosition(const Point2D& mousePosition) const
*/
DEPRECATED(Point3D Map2DRendererPositionTo3DWorldPosition(Point2D* mousePosition) const);
protected:
virtual ~BaseRenderer();
//##Documentation
//## @brief Call update of all mappers. To be implemented in subclasses.
virtual void Update() = 0;
vtkRenderWindow* m_RenderWindow;
vtkRenderer* m_VtkRenderer;
//##Documentation
//## @brief MapperSlotId to use. Defines which kind of mapper (e.g., 2D or 3D) shoud be used.
MapperSlotId m_MapperID;
//##Documentation
//## @brief The DataStorage that is used for rendering.
DataStorage::Pointer m_DataStorage;
//##Documentation
//## @brief The RenderingManager that manages this instance
RenderingManager::Pointer m_RenderingManager;
//##Documentation
//## @brief Timestamp of last call of Update().
unsigned long m_LastUpdateTime;
//##Documentation
//## @brief CameraController for 3D rendering
//## @note preliminary.
CameraController::Pointer m_CameraController;
SliceNavigationController::Pointer m_SliceNavigationController;
CameraRotationController::Pointer m_CameraRotationController;
//##Documentation
//## @brief Size of the RenderWindow.
int m_Size[2];
//##Documentation
//## @brief Contains whether the renderer that it is focused. The caller of
//## SetFocused is responsible for focus management, not the renderer itself.
//## is doubled because of mitk::FocusManager in GlobalInteraction!!! (ingmar)
bool m_Focused;
//##Documentation
//## @brief Sets m_CurrentWorldPlaneGeometry
virtual void SetCurrentWorldPlaneGeometry(PlaneGeometry* geometry2d);
/**
* \deprecatedSince{2014_10} Please use SetCurrentWorldPlaneGeometry
*/
DEPRECATED(void SetCurrentWorldGeometry2D(PlaneGeometry* geometry2d)){SetCurrentWorldPlaneGeometry(geometry2d);};
//##Documentation
//## @brief Sets m_CurrentWorldGeometry
virtual void SetCurrentWorldGeometry(BaseGeometry* geometry);
//##Documentation
//## @brief This method is called during the rendering process to update or render the Overlays
//## which are stored in the OverlayManager
void UpdateOverlays();
private:
//TODO 18735: Why are there three world geometries and a world plane? Why should they be const and are not (see comment below)?
//##Documentation
//## Pointer to the worldgeometry, describing the maximal area to be rendered
//## (3D as well as 2D).
//## It is const, since we are not allowed to change it (it may be taken
//## directly from the geometry of an image-slice and thus it would be
//## very strange when suddenly the image-slice changes its geometry).
//## \sa SetWorldGeometry
//TODO 18735: can be deleted, because it is not used (except QmtikSlicesInterpolator, but this usage is wrong and the code cannot be reached. bug?).
BaseGeometry::Pointer m_WorldGeometry;
itk::SmartPointer<OverlayManager> m_OverlayManager;
//##Documentation
//## m_WorldTimeGeometry is set by SetWorldGeometry if the passed BaseGeometry is a
//## TimeGeometry (or a sub-class of it). If it contains instances of SlicedGeometry3D,
//## m_Slice and m_TimeStep (set via SetSlice and SetTimeStep, respectively) define
//## which 2D geometry stored in m_WorldTimeGeometry (if available)
//## is used as m_CurrentWorldPlaneGeometry.
//## \sa m_CurrentWorldPlaneGeometry
TimeGeometry::Pointer m_WorldTimeGeometry;
//##Documentation
//## Pointer to the current 3D-worldgeometry.
BaseGeometry::Pointer m_CurrentWorldGeometry;
//##Documentation
//## Pointer to the current 2D-worldgeometry. The 2D-worldgeometry
//## describes the maximal area (2D manifold) to be rendered in case we
//## are doing 2D-rendering. More precisely, a subpart of this according
//## to m_DisplayGeometry is displayed.
//## It is const, since we are not allowed to change it (it may be taken
//## directly from the geometry of an image-slice and thus it would be
//## very strange when suddenly the image-slice changes its geometry).
PlaneGeometry::Pointer m_CurrentWorldPlaneGeometry;
//##Documentation
//## Pointer to the displaygeometry. The displaygeometry describes the
//## geometry of the \em visible area in the window controlled by the renderer
//## in case we are doing 2D-rendering.
//## It is const, since we are not allowed to change it.
DisplayGeometry::Pointer m_DisplayGeometry;
//##Documentation
//## Defines together with m_Slice which 2D geometry stored in m_WorldTimeGeometry
//## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep).
//## \sa m_WorldTimeGeometry
unsigned int m_Slice;
//##Documentation
//## Defines together with m_TimeStep which 2D geometry stored in m_WorldTimeGeometry
//## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep).
//## \sa m_WorldTimeGeometry
unsigned int m_TimeStep;
//##Documentation
//## @brief timestamp of last call of SetWorldGeometry
itk::TimeStamp m_CurrentWorldPlaneGeometryUpdateTime;
//##Documentation
//## @brief timestamp of last call of SetDisplayGeometry
itk::TimeStamp m_DisplayGeometryUpdateTime;
//##Documentation
//## @brief timestamp of last change of the current time step
itk::TimeStamp m_TimeStepUpdateTime;
//##Documentation
//## @brief Helper class which establishes connection between Interactors and Dispatcher via a common DataStorage.
BindDispatcherInteractor* m_BindDispatcherInteractor;
//##Documentation
//## @brief Tells if the displayed region should be shifted or rescaled if the render window is resized.
bool m_KeepDisplayedRegion;
protected:
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
//##Documentation
//## Data object containing the m_WorldGeometry defined above.
PlaneGeometryData::Pointer m_WorldGeometryData;
//##Documentation
//## Data object containing the m_DisplayGeometry defined above.
PlaneGeometryData::Pointer m_DisplayGeometryData;
//##Documentation
//## Data object containing the m_CurrentWorldPlaneGeometry defined above.
PlaneGeometryData::Pointer m_CurrentWorldPlaneGeometryData;
//##Documentation
//## DataNode objects containing the m_WorldGeometryData defined above.
DataNode::Pointer m_WorldGeometryNode;
//##Documentation
//## DataNode objects containing the m_DisplayGeometryData defined above.
DataNode::Pointer m_DisplayGeometryNode;
//##Documentation
//## DataNode objects containing the m_CurrentWorldPlaneGeometryData defined above.
DataNode::Pointer m_CurrentWorldPlaneGeometryNode;
//##Documentation
//## @brief test only
unsigned long m_DisplayGeometryTransformTime;
//##Documentation
//## @brief test only
unsigned long m_CurrentWorldPlaneGeometryTransformTime;
std::string m_Name;
double m_Bounds[6];
bool m_EmptyWorldGeometry;
typedef std::set<Mapper *> LODEnabledMappersType;
/** Number of mappers which are visible and have level-of-detail
* rendering enabled */
unsigned int m_NumberOfVisibleLODEnabledMappers;
// Local Storage Handling for mappers
protected:
std::list<mitk::BaseLocalStorageHandler*> m_RegisteredLocalStorageHandlers;
public:
void RemoveAllLocalStorages();
void RegisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh);
void UnregisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh);
};
} // namespace mitk
#endif /* BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4 */
diff --git a/Modules/Core/include/mitkCallbackFromGUIThread.h b/Modules/Core/include/mitkCallbackFromGUIThread.h
index 80f8854495..3f779dae75 100644
--- a/Modules/Core/include/mitkCallbackFromGUIThread.h
+++ b/Modules/Core/include/mitkCallbackFromGUIThread.h
@@ -1,204 +1,204 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ
#define MITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ
#include<itkCommand.h>
#include <itkEventObject.h>
#include <MitkCoreExports.h>
namespace mitk
{
/*!
\brief Used by CallbackFromGUIThread to pass parameters.
*/
template <class T>
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
+ virtual const char * GetEventName() const override
{
return "CallbackEventOneParameter";
}
- virtual bool CheckEvent(const ::itk::EventObject* e) const
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{
return dynamic_cast<const Self*>(e);
}
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{
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 MITKCORE_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.
<b>Usage example</b>
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 <itkCommand.h>
// 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<ThreadedClass>::Pointer command = itk::ReceptorMemberCommand<ThreadedClass>::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<ThreadedClass>::Pointer command = itk::ReceptorMemberCommand<ThreadedClass>::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 MITKCORE_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/Modules/Core/include/mitkCameraRotationController.h b/Modules/Core/include/mitkCameraRotationController.h
index 19ee4399fa..dbc744b174 100644
--- a/Modules/Core/include/mitkCameraRotationController.h
+++ b/Modules/Core/include/mitkCameraRotationController.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef CAMERAROTATIONCONTROLLER_H_HEADER_INCLUDED_NXYCBIU
#define CAMERAROTATIONCONTROLLER_H_HEADER_INCLUDED_NXYCBIU
#include <MitkCoreExports.h>
#include "mitkBaseController.h"
class vtkCamera;
class vtkRenderWindow;
namespace mitk {
class MITKCORE_EXPORT CameraRotationController : public BaseController
{
public:
mitkClassMacro(CameraRotationController,BaseController);
itkFactorylessNewMacro(Self)
itkCloneMacro(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 );
+ virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ) override;
protected:
CameraRotationController(const char * type = NULL);
virtual ~CameraRotationController();
private:
int m_LastStepperValue;
vtkCamera* m_Camera;
vtkRenderWindow* m_RenderWindow;
};
}
#endif
diff --git a/Modules/Core/include/mitkClippingProperty.h b/Modules/Core/include/mitkClippingProperty.h
index c0a36aadd4..155abb3b19 100644
--- a/Modules/Core/include/mitkClippingProperty.h
+++ b/Modules/Core/include/mitkClippingProperty.h
@@ -1,96 +1,96 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED
#define MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "mitkNumericTypes.h"
#include <itkConfigure.h>
#include <string>
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* \brief Property for clipping datasets; currently only
* clipping planes are possible
* \ingroup DataManagement
*/
class MITKCORE_EXPORT ClippingProperty : public BaseProperty
{
public:
mitkClassMacro(ClippingProperty, BaseProperty);
typedef std::string ValueType;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
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 std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator =;
protected:
bool m_ClippingEnabled;
Point3D m_Origin;
Vector3D m_Normal;
ClippingProperty();
ClippingProperty(const ClippingProperty& other);
ClippingProperty( const Point3D &origin, const Vector3D &normal );
private:
// purposely not implemented
ClippingProperty& operator=(const ClippingProperty&);
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKCLIPPINGPROPERTY_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkColorProperty.h b/Modules/Core/include/mitkColorProperty.h
index 0f8b67986f..ac76ee00fa 100644
--- a/Modules/Core/include/mitkColorProperty.h
+++ b/Modules/Core/include/mitkColorProperty.h
@@ -1,105 +1,105 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1
#define MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include <itkRGBPixel.h>
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* @brief Color Standard RGB color typedef (float)
*
* Standard RGB color typedef to get rid of template argument (float).
* Color range is from 0.0f to 1.0f for each component.
*
* @ingroup Property
*/
typedef itk::RGBPixel< float > Color;
/**
* @brief The ColorProperty class RGB color property
* @ingroup DataManagement
*
* @note If you want to apply the mitk::ColorProperty to an mitk::Image
* make sure to set the mitk::RenderingModeProperty to a mode which
* supports color (e.g. LEVELWINDOW_COLOR). For an example how to use
* the mitk::ColorProperty see mitkImageVtkMapper2DColorTest.cpp in
* Core\Code\Rendering.
*/
class MITKCORE_EXPORT ColorProperty : public BaseProperty
{
protected:
mitk::Color m_Color;
ColorProperty();
ColorProperty(const ColorProperty& other);
ColorProperty(const float red, const float green, const float blue);
ColorProperty(const float color[3]);
ColorProperty(const mitk::Color & color);
public:
mitkClassMacro(ColorProperty, BaseProperty)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ColorProperty, const float*);
mitkNewMacro1Param(ColorProperty, const mitk::Color&);
mitkNewMacro3Param(ColorProperty, const float, const float, const float);
typedef mitk::Color ValueType;
const mitk::Color & GetColor() const;
const mitk::Color & GetValue() const;
- std::string GetValueAsString() const;
+ std::string GetValueAsString() const override;
void SetColor(const mitk::Color & color );
void SetValue(const mitk::Color & color );
void SetColor( float red, float green, float blue );
using BaseProperty::operator=;
private:
// purposely not implemented
ColorProperty& operator=(const ColorProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty & property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty & property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 */
diff --git a/Modules/Core/include/mitkCommon.h b/Modules/Core/include/mitkCommon.h
index fbb9963eb1..b2b3846c98 100644
--- a/Modules/Core/include/mitkCommon.h
+++ b/Modules/Core/include/mitkCommon.h
@@ -1,182 +1,191 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef 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"
#include "mitkExceptionMacro.h"
#include "mitkGetClassHierarchy.h"
#ifndef MITK_UNMANGLE_IPPIC
#define mitkIpPicDescriptor mitkIpPicDescriptor
#endif
typedef unsigned int MapperSlotId;
/** From ITK 4.7 version, the TypeMacro overrides (by using the explicit attribute) the GetNameOfClass
* hence the SuperClass must provide one.
*
* If not, use the mitkClassMacroNoParent version
*/
#define mitkClassMacro(className,SuperClassName) \
+ typedef className Self; \
+ typedef SuperClassName Superclass; \
+ typedef itk::SmartPointer<Self> Pointer; \
+ typedef itk::SmartPointer<const Self> ConstPointer; \
+ static const char* GetStaticNameOfClass() { return #className; } \
+ virtual std::vector<std::string> GetClassHierarchy() const override { return mitk::GetClassHierarchy<Self>(); } \
+ itkTypeMacro(className,SuperClassName)
+
+#define mitkClassMacroItkParent(className,SuperClassName) \
typedef className Self; \
typedef SuperClassName Superclass; \
typedef itk::SmartPointer<Self> Pointer; \
typedef itk::SmartPointer<const Self> ConstPointer; \
static const char* GetStaticNameOfClass() { return #className; } \
virtual std::vector<std::string> GetClassHierarchy() const { return mitk::GetClassHierarchy<Self>(); } \
itkTypeMacro(className,SuperClassName)
/** At version 4.7 provides two type macros, the normal one expects the Superclass to provide the
* GetNameOfClass explicitely, the NoParent deos not expect anything.
*/
#define mitkClassMacroNoParent(className) \
typedef className Self; \
typedef itk::SmartPointer<Self> Pointer; \
typedef itk::SmartPointer<const Self> ConstPointer; \
static const char* GetStaticNameOfClass() { return #className; } \
virtual std::vector<std::string> GetClassHierarchy() const { return mitk::GetClassHierarchy<Self>(); } \
itkTypeMacroNoParent(className)
/**
* 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 four 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; \
} \
/**
* Macro for Constructors with five parameters for classes derived from itk::Lightobject
**/
#define mitkNewMacro5Param(classname,typea,typeb,typec,typed,typee) \
static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd, typee _arge) \
{ \
Pointer smartPtr = new classname ( _arga, _argb, _argc, _argd, _arge ); \
smartPtr->UnRegister(); \
return smartPtr; \
} \
/**
* Macro for Constructors with six parameters for classes derived from itk::Lightobject
**/
#define mitkNewMacro6Param(classname,typea,typeb,typec,typed,typee, typef) \
static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd, typee _arge, typef _argf) \
{ \
Pointer smartPtr = new classname ( _arga, _argb, _argc, _argd, _arge, _argf ); \
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 itk::LightObject::Pointer InternalClone() const \
+ virtual itk::LightObject::Pointer InternalClone() const override \
{ \
Pointer smartPtr = new classname(*this); \
smartPtr->UnRegister(); \
return smartPtr.GetPointer(); \
}
/** cross-platform deprecation macro
\todo maybe there is something in external toolkits (ITK, VTK,...) that we could reulse -- would be much preferable
*/
#ifdef MITK_NO_DEPRECATED_WARNINGS
#define DEPRECATED(func) func
#elif defined(__GNUC__)
#define DEPRECATED(...) __VA_ARGS__ __attribute__((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED(...) __declspec(deprecated) ##__VA_ARGS__
#else
#pragma message("WARNING: You need to implement DEPRECATED for your compiler!")
#define DEPRECATED(func) func
#endif
/**
* Mark templates as exported to generate public RTTI symbols which are
* needed for GCC and Clang to support e.g. dynamic_cast between DSOs.
*/
#if defined(__clang__) || defined(__GNUC__)
#define MITK_EXPORT __attribute__ ((visibility ("default")))
#define MITK_IMPORT __attribute__ ((visibility ("default")))
#define MITK_LOCAL __attribute__ ((visibility ("hidden")))
#elif defined(WIN32)
#define MITK_EXPORT __declspec(dllexport)
#define MITK_IMPORT __declspec(dllimport)
#define MITK_LOCAL
#else
#define MITK_EXPORT
#define MITK_IMPORT
#define MITK_LOCAL
#endif
#endif // MITK_COMMON_H_DEFINED
diff --git a/Modules/Core/include/mitkCompareImageDataFilter.h b/Modules/Core/include/mitkCompareImageDataFilter.h
index 9a54817f30..65c10dfc98 100644
--- a/Modules/Core/include/mitkCompareImageDataFilter.h
+++ b/Modules/Core/include/mitkCompareImageDataFilter.h
@@ -1,123 +1,123 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOMPAREIMAGEDATAFILTER_H
#define MITKCOMPAREIMAGEDATAFILTER_H
//MITK
#include "mitkImageToImageFilter.h"
#include "mitkImage.h"
//ITK
#include <itkImage.h>
namespace mitk
{
/**
* @brief A simple struct to hold the result of the comparison filter.
*/
struct CompareFilterResults
{
void PrintSelf()
{
if( !m_FilterCompleted )
{
MITK_INFO << "Comparison filter terminated due to an exception: \n "
<< m_ExceptionMessage;
return;
}
MITK_INFO << "Min. difference: " << m_MinimumDifference <<"\n"
<< "Max. difference: " << m_MaximumDifference <<"\n"
<< "Total difference: " << m_TotalDifference <<"\n"
<< "Mean difference: " << m_MeanDifference <<"\n"
<< "Number of pixels with differences: " << m_PixelsWithDifference;
}
double m_MinimumDifference;
double m_MaximumDifference;
double m_TotalDifference;
double m_MeanDifference;
size_t m_PixelsWithDifference;
bool m_FilterCompleted;
std::string m_ExceptionMessage;
};
/**
* @brief Filter for comparing two mitk::Image objects by pixel values
*
* The comparison is pixel-wise, the filter uses the itk::Testing::ComparisonImageFilter
* to find differences. The filter expects two images as input, provide them by using the SetInput( int, mitk::Image)
* method.
*/
class MITKCORE_EXPORT CompareImageDataFilter
: public ImageToImageFilter
{
public:
mitkClassMacro(CompareImageDataFilter,
ImageToImageFilter)
itkSimpleNewMacro(Self)
/**
* @brief Get the result of the comparison
*
* The method compares only the number of pixels with differences. It returns true if the amount
* is under the specified threshold. To get the complete results, use the GetCompareResults method.
*
* Returns false also if the itk ComparisionImageFilter raises an exception during update.
*
* @param threshold Allowed amount of pixels with differences
*/
bool GetResult(size_t threshold = 0);
/**
* @brief Get the detailed results of the comparision run
*
* @sa CompareFilterResults
*/
CompareFilterResults GetCompareResults()
{
return m_CompareDetails;
}
void SetTolerance(double eps){ m_Tolerance=eps; }
protected:
CompareImageDataFilter();
virtual ~CompareImageDataFilter() {}
- virtual void GenerateData();
+ virtual void GenerateData() override;
/*! \brief Method resets the compare detail memeber struct to its initial state */
void ResetCompareResultsToInitial();
/** ITK-like method which calls the ComparisionFilter on the two inputs of the filter */
template< typename TPixel, unsigned int VImageDimension>
void EstimateValueDifference( const itk::Image< TPixel, VImageDimension>* itkImage1,
const mitk::Image* referenceImage);
bool m_CompareResult;
CompareFilterResults m_CompareDetails;
double m_Tolerance;
};
} // end namespace mitk
#endif // MITKCompareImageDataFilter_H
diff --git a/Modules/Core/include/mitkConvert2Dto3DImageFilter.h b/Modules/Core/include/mitkConvert2Dto3DImageFilter.h
index adb44a2944..e2f1aadb0e 100644
--- a/Modules/Core/include/mitkConvert2Dto3DImageFilter.h
+++ b/Modules/Core/include/mitkConvert2Dto3DImageFilter.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkConvert2Dto3DImageFilter_h
#define __mitkConvert2Dto3DImageFilter_h
//MITK
#include <mitkImage.h>
#include "mitkImageToImageFilter.h"
#include <itkImage.h>
namespace mitk
{
/** \brief Image Filter to convert 2D MITK images to 3D MITK images.
*
* A new 3D MITK image is created and all pixel and geometry information from
* the given 2D input image is copied. The resulting image 3D image has just one slice.
*
* This filter can be used when before saving a 2D image with 3D geometry information.
* By converting it to 3D with just one slice, the common formats (e.g. nrrd) allow
* a 3x3 transformation matrix.
*
* @ingroup Geometry
*/
class MITKCORE_EXPORT Convert2Dto3DImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro( Convert2Dto3DImageFilter , ImageToImageFilter );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
/*!
\brief standard constructor
*/
Convert2Dto3DImageFilter();
/*!
\brief standard destructor
*/
~Convert2Dto3DImageFilter();
/*!
\brief Method generating the output of this filter. Called in the updated process of the pipeline.
This method generates the smoothed output image.
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/*!
\brief Make a 2D image to a 3D image
*/
template<typename TPixel, unsigned int VImageDimension>
void ItkConvert2DTo3D(const itk::Image<TPixel,VImageDimension>* itkImage, mitk::Image::Pointer &mitkImage );
};
} //END mitk namespace
#endif
diff --git a/Modules/Core/include/mitkCoordinateSupplier.h b/Modules/Core/include/mitkCoordinateSupplier.h
index 6156539378..4a1dfe53fa 100755
--- a/Modules/Core/include/mitkCoordinateSupplier.h
+++ b/Modules/Core/include/mitkCoordinateSupplier.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOORDINATESUPPLIER_H
#define MITKCOORDINATESUPPLIER_H
#include <MitkCoreExports.h>
#include "mitkStateMachine.h"
#include "mitkNumericTypes.h"
namespace mitk {
class Operation;
class OperationActor;
//##Documentation
//## @brief Interactor
//##
//## sends a Point, that can be processed in its own OperationActor
//## @ingroup Interaction
class MITKCORE_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);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
private:
OperationActor* m_Destination;
Point3D m_OldPoint;
Point3D m_CurrentPoint;
};
} // namespace mitk
#endif /* MITKCOORDINATESUPPLIER_H */
diff --git a/Modules/Core/include/mitkCoreObjectFactory.h b/Modules/Core/include/mitkCoreObjectFactory.h
index 44b9843bd2..bb897c032c 100644
--- a/Modules/Core/include/mitkCoreObjectFactory.h
+++ b/Modules/Core/include/mitkCoreObjectFactory.h
@@ -1,148 +1,148 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef COREOBJECTFACTORY_H_INCLUDED
#define COREOBJECTFACTORY_H_INCLUDED
#include <set>
#include <MitkCoreExports.h>
#include "mitkCoreObjectFactoryBase.h"
#include "mitkFileWriterWithInformation.h"
namespace mitk {
class Event;
class LegacyFileReaderService;
class LegacyFileWriterService;
class LegacyImageWriterService;
class MITKCORE_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 Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
virtual void MapEvent(const mitk::Event* event, const int eventID);
virtual void RegisterExtraFactory(CoreObjectFactoryBase* factory);
virtual void UnRegisterExtraFactory(CoreObjectFactoryBase* factory);
static Pointer GetInstance();
~CoreObjectFactory();
/**
* @brief This method gets the supported (open) file extensions as string.
*
* This string can then used by the Qt QFileDialog widget.
*
* @return The c-string that contains the file extensions
* @deprecatedSince{2014_10} See mitk::FileReaderRegistry and QmitkIOUtil
*/
- DEPRECATED(virtual const char* GetFileExtensions());
+ DEPRECATED(virtual const char* GetFileExtensions() override);
/**
* @brief get the defined (open) file extension map
*
* @return the defined (open) file extension map
* @deprecatedSince{2014_10} See mitk::FileReaderRegistry and QmitkIOUtil
*/
- DEPRECATED(virtual MultimapType GetFileExtensionsMap());
+ DEPRECATED(virtual MultimapType GetFileExtensionsMap() override);
/**
* @brief This method gets the supported (save) file extensions as string.
*
* This string can then used by the Qt QFileDialog widget.
*
* @return The c-string that contains the (save) file extensions
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry and QmitkIOUtil
*/
- DEPRECATED(virtual const char* GetSaveFileExtensions());
+ DEPRECATED(virtual const char* GetSaveFileExtensions() override);
/**
* @brief get the defined (save) file extension map
*
* @return the defined (save) file extension map
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry and QmitkIOUtil
*/
- virtual MultimapType GetSaveFileExtensionsMap();
+ virtual MultimapType GetSaveFileExtensionsMap() override;
/**
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry
*/
DEPRECATED(virtual FileWriterList GetFileWriters());
/**
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry and QmitkIOUtil
*/
DEPRECATED(std::string GetDescriptionForExtension(const std::string& extension));
protected:
CoreObjectFactory();
/**
* @brief Merge the input map into the fileExtensionsMap. Duplicate entries are removed
*
* @param fileExtensionsMap the existing map, it contains value pairs like
* ("*.dcm", "DICOM files"),("*.dc3", "DICOM files").
* This map is extented/merged with the values from the input map.
* @param inputMap the input map, it contains value pairs like ("*.dcm",
* "DICOM files"),("*.dc3", "DICOM files") returned by the extra factories.
* @deprecatedSince{2014_10}
*/
void MergeFileExtensions(MultimapType& fileExtensionsMap, MultimapType inputMap);
/**
* @brief initialize the file extension entries for open and save
* @deprecatedSince{2014_10}
*/
void CreateFileExtensionsMap();
/**
* @deprecatedSince{2014_10}
*/
DEPRECATED(void CreateSaveFileExtensions());
typedef std::set<mitk::CoreObjectFactoryBase::Pointer> ExtraFactoriesContainer;
ExtraFactoriesContainer m_ExtraFactories;
FileWriterList m_FileWriters;
std::string m_FileExtensions;
MultimapType m_FileExtensionsMap;
std::string m_SaveFileExtensions;
MultimapType m_SaveFileExtensionsMap;
private:
void RegisterLegacyReaders(mitk::CoreObjectFactoryBase* factory);
void RegisterLegacyWriters(mitk::CoreObjectFactoryBase* factory);
void UnRegisterLegacyReaders(mitk::CoreObjectFactoryBase* factory);
void UnRegisterLegacyWriters(mitk::CoreObjectFactoryBase* factory);
std::map<mitk::CoreObjectFactoryBase*, std::list<mitk::LegacyFileReaderService*> > m_LegacyReaders;
std::map<mitk::CoreObjectFactoryBase*, std::list<mitk::LegacyFileWriterService*> > m_LegacyWriters;
};
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkCoreObjectFactoryBase.h b/Modules/Core/include/mitkCoreObjectFactoryBase.h
index c3b201e9f7..e3de44c61f 100644
--- a/Modules/Core/include/mitkCoreObjectFactoryBase.h
+++ b/Modules/Core/include/mitkCoreObjectFactoryBase.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef 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 <MitkCoreExports.h>
#include "mitkMapper.h"
#include <itkObjectFactoryBase.h>
#include <itkVersion.h>
#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 MITKCORE_EXPORT CoreObjectFactoryBase : public itk::Object
{
public:
typedef std::list<mitk::FileWriterWithInformation::Pointer> FileWriterList;
typedef std::multimap<std::string, std::string> MultimapType;
- mitkClassMacro(CoreObjectFactoryBase,itk::Object)
+ mitkClassMacroItkParent(CoreObjectFactoryBase,itk::Object)
virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) = 0;
virtual void SetDefaultProperties(mitk::DataNode* node) = 0;
/**
* @deprecatedSince{2014_10} See mitk::FileReaderRegistry and QmitkIOUtil
*/
virtual const char* GetFileExtensions() = 0;
/**
* @deprecatedSince{2014_10} See mitk::FileReaderRegistry and QmitkIOUtil
*/
virtual MultimapType GetFileExtensionsMap() = 0;
/**
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry and QmitkIOUtil
*/
virtual const char* GetSaveFileExtensions() = 0;
/**
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry and QmitkIOUtil
*/
virtual MultimapType GetSaveFileExtensionsMap() = 0;
virtual const char* GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
virtual const char* GetDescription() const
{
return "Core Object Factory";
}
/**
* @deprecatedSince{2014_10} See mitk::FileWriterRegistry
*/
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)"
*
* @deprecatedSince{2014_10}
*/
static void CreateFileExtensions(MultimapType fileExtensionsMap, std::string& fileExtensions);
FileWriterList m_FileWriters;
friend class CoreObjectFactory;
};
}
#endif
diff --git a/Modules/Core/include/mitkDataInteractor.h b/Modules/Core/include/mitkDataInteractor.h
index 683af76414..7ec51bb02f 100644
--- a/Modules/Core/include/mitkDataInteractor.h
+++ b/Modules/Core/include/mitkDataInteractor.h
@@ -1,125 +1,125 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDATAINTERACTOR_H_
#define MITKDATAINTERACTOR_H_
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include "mitkEventStateMachine.h"
#include <string.h>
namespace mitk
{
/**
* \class DataInteractor
*
* \brief Base class from with interactors that handle DataNodes are to be derived.
*
* Base class from with interactors that handle DataNodes are to be derived.
* Provides an interface that is relevant for the interactor to work together with the dispatcher.
* To implement a new interactor overwrite the ConnectActionsAndFunctions to connect the actions.
*/
// Define events for DataInteractors
itkEventMacro( DataInteractorEvent, itk::AnyEvent )
/** Event is thrown when interation is started */
itkEventMacro( StartInteraction, DataInteractorEvent )
/** Event is thrown when DataInteractor stores a finished result in the DataNode */
itkEventMacro( ResultReady, DataInteractorEvent )
// Public 'cause it's also used by the mitk::Dispatcher
enum ProcessEventMode
{
REGULAR = 0,
GRABINPUT = 1,
PREFERINPUT = 2,
CONNECTEDMOUSEACTION = 3 // only used by mitk::Dispatcher
};
class DataNode;
class MITKCORE_EXPORT DataInteractor: public EventStateMachine
{
public:
typedef itk::SmartPointer<DataNode> NodeType;
mitkClassMacro(DataInteractor, EventStateMachine)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Set/Change the DataNode of the DataInteractor
*/
void SetDataNode(NodeType);
/**
* @brief Returns the mode the DataInteractor currently is in. See in mitkDispatcher the description of m_ProcessingMode for further details.
*/
ProcessEventMode GetMode() const;
NodeType GetDataNode() const;
int GetLayer() const;
// Predefined internal events/signals
static const std::string IntDeactivateMe; // = "DeactivateMe";
static const std::string IntLeaveWidget; // = "LeaveWidget";
static const std::string IntEnterWidget; // = "EnterWidget";
protected:
DataInteractor();
virtual ~DataInteractor();
/**
* @brief Overwrite this function to connect actions from StateMachine description with functions.
*
* Following example shows how to connect the 'addpoint' action from the StateMachine XML description using the CONNECT_FUNCTION macro
* with the AddPoint() function in the TestInteractor.
* @code
* void mitk::TestInteractor::ConnectActionsAndFunctions()
{
CONNECT_FUNCTION("addpoint", AddPoint);
}
* @endcode
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/** \brief Is called when a DataNode is initially set or changed
* To be implemented by sub-classes for initialization code which require a DataNode.
* \note New DataInteractors usually are expected to have the focus, but this only works if they have the highest Layer,
* since empty DataNodes have a layer of -1, the DataNode must be filled here in order to get a layer assigned.
* \note Is also called when the DataNode is set to NULL.
*/
virtual void DataNodeChanged();
/**
* @brief NotifyStart Sends StartInteraction event via the mitk::DataNode
*/
void virtual NotifyStart();
/**
* @brief NotifyResultReady Sends ResultReady event via the mitk::DataNode
*
* This can be used to get notifcation when the mitk::DataNode is in a ready state for further processing.
*/
void virtual NotifyResultReady();
private:
NodeType m_DataNode;
};
} /* namespace mitk */
#endif /* MITKDATAINTERACTOR_H_ */
diff --git a/Modules/Core/include/mitkDataNode.h b/Modules/Core/include/mitkDataNode.h
index 7a729d9155..2472666ecf 100644
--- a/Modules/Core/include/mitkDataNode.h
+++ b/Modules/Core/include/mitkDataNode.h
@@ -1,601 +1,601 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef DATATREENODE_H_HEADER_INCLUDED_C1E14338
#define DATATREENODE_H_HEADER_INCLUDED_C1E14338
#include "mitkBaseData.h"
//#include "mitkMapper.h"
#include "mitkInteractor.h"
#include "mitkDataInteractor.h"
#ifdef MBI_NO_STD_NAMESPACE
#define MBI_STD
#include <iostream.h>
#include <fstream.h>
#else
#define MBI_STD std
#include <iostream>
#include <fstream>
#endif
#include "mitkStringProperty.h"
#include "mitkColorProperty.h"
#include "mitkPropertyList.h"
//#include "mitkMapper.h"
#include <map>
#include <set>
#include "mitkLevelWindow.h"
class vtkLinearTransform;
namespace mitk {
class BaseRenderer;
class Mapper;
/**
* \brief Class for nodes of the DataTree
*
* Contains the data (instance of BaseData), a list of mappers, which can
* draw the data, a transform (vtkTransform) and a list of properties
* (PropertyList).
* \ingroup DataManagement
*
* \todo clean up all the GetProperty methods. There are too many different flavours... Can most probably be reduced to <tt>bool GetProperty<type>(type&)</tt>
*
* \warning Change in semantics of SetProperty() since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*/
class MITKCORE_EXPORT DataNode : public itk::DataObject
{
public:
typedef mitk::Geometry3D::Pointer Geometry3DPointer;
typedef std::vector< itk::SmartPointer< Mapper > > MapperVector;
typedef std::map<std::string, mitk::PropertyList::Pointer> MapOfPropertyLists;
typedef std::set<std::string> GroupTagList;
/**
* \brief Definition of an itk::Event that is invoked when
* a DataInteractor is set on this DataNode.
*/
itkEventMacro(InteractorChangedEvent, itk::AnyEvent);
- mitkClassMacro(DataNode, itk::DataObject);
+ mitkClassMacroItkParent(DataNode, itk::DataObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitk::Mapper* GetMapper(MapperSlotId id) const;
/**
* \brief Get the data object (instance of BaseData, e.g., an Image)
* managed by this DataNode
*/
BaseData* GetData() const;
/**
* \brief Get the transformation applied prior to displaying the data as
* a vtkTransform
* \deprecated use GetData()->GetGeometry()->GetVtkTransform() instead
*/
vtkLinearTransform* GetVtkTransform(int t=0) const;
/**
* \brief Get the Interactor.
* \deprecatedSince{2013_03} Use DataInteractor and GetDataInteractor instead.
*/
Interactor* GetInteractor() const;
/**
* \brief Set the data object (instance of BaseData, e.g., an Image)
* managed by this DataNode
* \warning the actor-mode of the vtkInteractor does not work any more, if the transform of the
* data-tree-node is connected to the transform of the basedata via vtkTransform->SetInput.
*/
virtual void SetData(mitk::BaseData* baseData);
/**
* \brief Set the Interactor.
* \deprecatedSince{2013_03} Use DataInteractor and SetDataInteractor instead.
*/
virtual void SetInteractor(Interactor* interactor);
virtual void SetDataInteractor(const DataInteractor::Pointer& interactor);
virtual DataInteractor::Pointer GetDataInteractor() const;
mitk::DataNode& operator=(const DataNode& right);
mitk::DataNode& operator=(BaseData* right);
virtual void SetMapper(MapperSlotId id, mitk::Mapper* mapper);
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
- virtual void CopyInformation(const itk::DataObject *data);
+ virtual void CopyInformation(const itk::DataObject *data) override;
/**
* \brief Set the property (instance of BaseProperty) with key \a propertyKey in the PropertyList
* of the \a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-value.
*
* \warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void SetProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL);
/**
* \brief Replace the property (instance of BaseProperty) with key \a propertyKey in the PropertyList
* of the \a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-reference.
*
* If \a renderer is \a NULL the property is set in the BaseRenderer-independent
* PropertyList of this DataNode.
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void ReplaceProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL);
/**
* \brief Add the property (instance of BaseProperty) if it does
* not exist (or always if\a overwrite is\a true)
* with key \a propertyKey in the PropertyList
* of the \a renderer (if NULL, use BaseRenderer-independent
* PropertyList). This is set-by-value.
*
* For\a overwrite ==\a false the property is\em not changed
* if it already exists. For\a overwrite ==\a true the method
* is identical to SetProperty.
*
* \sa SetProperty
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void AddProperty(const char *propertyKey, BaseProperty* property, const mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/**
* \brief Get the PropertyList of the \a renderer. If \a renderer is \a
* NULL, the BaseRenderer-independent PropertyList of this DataNode
* is returned.
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
mitk::PropertyList* GetPropertyList(const mitk::BaseRenderer* renderer = NULL) const;
mitk::PropertyList* GetPropertyList(const std::string& rendererName) const;
/**
* \brief Add values from another PropertyList.
*
* Overwrites values in m_PropertyList only when possible (i.e. when types are compatible).
* If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty,
* set the \param replace.
*
* \param replace true: if \param pList contains a property "visible" of type ColorProperty and our m_PropertyList also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects behind the pointer.
*
* \sa SetProperty
* \sa ReplaceProperty
* \sa m_PropertyList
*/
void ConcatenatePropertyList(PropertyList* pList, bool replace = false);
/**
* \brief Get the property (instance of BaseProperty) with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a NULL or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
mitk::BaseProperty* GetProperty(const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const;
/**
* \brief Get the property of type T with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a NULL or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(itk::SmartPointer<T> &property, const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property.IsNotNull();
}
/**
* \brief Get the property of type T with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a NULL or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(T* &property, const char *propertyKey, const mitk::BaseRenderer* renderer = NULL) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property!=NULL;
}
/**
* \brief Convenience access method for GenericProperty<T> properties
* (T being the type of the second parameter)
* \return \a true property was found
*/
template <typename T>
bool GetPropertyValue(const char* propertyKey, T & value, const mitk::BaseRenderer* renderer=NULL) const
{
GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey, renderer));
if ( gp != NULL )
{
value = gp->GetValue();
return true;
}
return false;
}
/// \brief Get a set of all group tags from this node's property list
GroupTagList GetGroupTags() const;
/**
* \brief Convenience access method for bool properties (instances of
* BoolProperty)
* \return \a true property was found
*/
bool GetBoolProperty(const char* propertyKey, bool &boolValue, const mitk::BaseRenderer* renderer = NULL) const;
/**
* \brief Convenience access method for int properties (instances of
* IntProperty)
* \return \a true property was found
*/
bool GetIntProperty(const char* propertyKey, int &intValue, const mitk::BaseRenderer* renderer=NULL) const;
/**
* \brief Convenience access method for float properties (instances of
* FloatProperty)
* \return \a true property was found
*/
bool GetFloatProperty(const char* propertyKey, float &floatValue, const mitk::BaseRenderer* renderer = NULL) const;
/**
* \brief Convenience access method for double properties (instances of
* DoubleProperty)
*
* If there is no DoubleProperty for the given\c propertyKey argument, the method
* looks for a corresponding FloatProperty instance.
*
* \return \a true property was found
*/
bool GetDoubleProperty(const char* propertyKey, double &doubleValue, const mitk::BaseRenderer* renderer = NULL) const;
/**
* \brief Convenience access method for string properties (instances of
* StringProperty)
* \return \a true property was found
*/
bool GetStringProperty(const char* propertyKey, std::string& string, const mitk::BaseRenderer* renderer = NULL) const;
/**
* \brief Convenience access method for color properties (instances of
* ColorProperty)
* \return \a true property was found
*/
bool GetColor(float rgb[3], const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color") const;
/**
* \brief Convenience access method for level-window properties (instances of
* LevelWindowProperty)
* \return \a true property was found
*/
bool GetLevelWindow(mitk::LevelWindow &levelWindow, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "levelwindow") const;
/**
* \brief set the node as selected
*/
void SetSelected(bool selected, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief set the node as selected
* \return \a true node is selected
*/
bool IsSelected(const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name")
* \return \a true property was found
*/
bool GetName(std::string& nodeName, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "name") const
{
return GetStringProperty(propertyKey, nodeName, renderer);
}
/**
* \brief Extra convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name").
*
* This method does not take the renderer specific
* propertylists into account, because the name of an object should never be renderer specific.
* \returns a std::string with the name of the object (content of "name" Property).
* If there is no "name" Property, an empty string will be returned.
*/
virtual std::string GetName() const
{
mitk::StringProperty* sp = dynamic_cast<mitk::StringProperty*>(this->GetProperty("name"));
if (sp == NULL)
return "";
return sp->GetValue();
}
/**
* \brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName( const char* name)
{
if (name == NULL)
return;
this->SetProperty("name", StringProperty::New(name));
}
/**
* \brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName( const std::string name)
{
this->SetName(name.c_str());
}
/**
* \brief Convenience access method for visibility properties (instances
* of BoolProperty with property-key "visible")
* \return \a true property was found
* \sa IsVisible
*/
bool GetVisibility(bool &visible, const mitk::BaseRenderer* renderer, const char* propertyKey = "visible") const
{
return GetBoolProperty(propertyKey, visible, renderer);
}
/**
* \brief Convenience access method for opacity properties (instances of
* FloatProperty)
* \return \a true property was found
*/
bool GetOpacity(float &opacity, const mitk::BaseRenderer* renderer, const char* propertyKey = "opacity") const;
/**
* \brief Convenience access method for boolean properties (instances
* of BoolProperty). Return value is the value of the property. If the property is
* not found, the value of \a defaultIsOn is returned.
*
* Thus, the return value has a different meaning than in the
* GetBoolProperty method!
* \sa GetBoolProperty
*/
bool IsOn(const char* propertyKey, const mitk::BaseRenderer* renderer, bool defaultIsOn = true) const
{
if(propertyKey==NULL)
return defaultIsOn;
GetBoolProperty(propertyKey, defaultIsOn, renderer);
return defaultIsOn;
}
/**
* \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
* \sa IsOn
*/
bool IsVisible(const mitk::BaseRenderer* renderer, const char* propertyKey = "visible", bool defaultIsOn = true) const
{
return IsOn(propertyKey, renderer, defaultIsOn);
}
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const mitk::Color &color, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color");
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(float red, float green, float blue, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color");
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const float rgb[3], const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "color");
/**
* \brief Convenience method for setting visibility properties (instances
* of BoolProperty)
* \param visible If set to true, the data will be rendered. If false, the render will skip this data.
* \param renderer Specify a renderer if the visibility shall be specific to a renderer
* \param propertykey Can be used to specify a user defined name of the visibility propery.
*/
void SetVisibility(bool visible, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "visible");
/**
* \brief Convenience method for setting opacity properties (instances of
* FloatProperty)
*/
void SetOpacity(float opacity, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "opacity");
/**
* \brief Convenience method for setting level-window properties
* (instances of LevelWindowProperty)
*/
void SetLevelWindow(mitk::LevelWindow levelWindow, const mitk::BaseRenderer* renderer = NULL, const char* propertyKey = "levelwindow");
/**
* \brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetIntProperty(const char* propertyKey, int intValue, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Convenience method for setting boolean properties (instances of
* BoolProperty)
*/
void SetBoolProperty(const char* propertyKey, bool boolValue, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Convenience method for setting float properties (instances of
* FloatProperty)
*/
void SetFloatProperty(const char* propertyKey, float floatValue, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Convenience method for setting double properties (instances of
* DoubleProperty)
*/
void SetDoubleProperty(const char* propertyKey, float doubleValue, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Convenience method for setting string properties (instances of
* StringProperty)
*/
void SetStringProperty(const char* propertyKey, const char* string, const mitk::BaseRenderer* renderer=NULL);
/**
* \brief Get the timestamp of the last change of the contents of this node or
* the referenced BaseData.
*/
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
/**
* \brief Get the timestamp of the last change of the reference to the
* BaseData.
*/
unsigned long GetDataReferenceChangedTime() const
{
return m_DataReferenceChangedTime.GetMTime();
}
/**
* \brief Adds or removes the associated interactor to mitk::GLobalInteraction.
*/
virtual void SetInteractorEnabled( const bool& enabled );
/**
* \brief Adds the interactor to mitk::GlobalInteraction
*/
virtual void EnableInteractor();
/**
* \brief Removes the Interactor from mitk::GlobalInteraction
*/
virtual void DisableInteractor();
/**
* \brief Tests, if the interactor is already added to mitk::GlobalInteraction
*/
virtual bool IsInteractorEnabled() const;
protected:
DataNode();
virtual ~DataNode();
/// Invoked when the property list was modified. Calls Modified() of the DataNode
virtual void PropertyListModified(const itk::Object *caller, const itk::EventObject &event);
/// \brief Mapper-slots
mutable MapperVector m_Mappers;
/**
* \brief The data object (instance of BaseData, e.g., an Image) managed
* by this DataNode
*/
BaseData::Pointer m_Data;
/**
* \brief BaseRenderer-independent PropertyList
*
* Properties herein can be overwritten specifically for each BaseRenderer
* by the BaseRenderer-specific properties defined in m_MapOfPropertyLists.
*/
PropertyList::Pointer m_PropertyList;
/// \brief Map associating each BaseRenderer with its own PropertyList
mutable MapOfPropertyLists m_MapOfPropertyLists;
/// \brief Interactor, that handles the Interaction
Interactor::Pointer m_Interactor; // TODO: INTERACTION_LEGACY
DataInteractor::Pointer m_DataInteractor;
/// \brief Timestamp of the last change of m_Data
itk::TimeStamp m_DataReferenceChangedTime;
unsigned long m_PropertyListModifiedObserverTag;
};
#if (_MSC_VER > 1200) || !defined(_MSC_VER)
MITKCORE_EXPORT MBI_STD::istream& operator>>( MBI_STD::istream& i, DataNode::Pointer& dtn );
MITKCORE_EXPORT MBI_STD::ostream& operator<<( MBI_STD::ostream& o, DataNode::Pointer& dtn);
#endif
} // namespace mitk
#if ((defined(_MSC_VER)) && (_MSC_VER <= 1200))
MITKCORE_EXPORT MBI_STD::istream& operator>>( MBI_STD::istream& i, mitk::DataNode::Pointer& dtn );
MITKCORE_EXPORT MBI_STD::ostream& operator<<( MBI_STD::ostream& o, mitk::DataNode::Pointer& dtn);
#endif
#endif /* DATATREENODE_H_HEADER_INCLUDED_C1E14338 */
diff --git a/Modules/Core/include/mitkDataNodeSource.h b/Modules/Core/include/mitkDataNodeSource.h
index 6929b6fde5..d3df3781b1 100644
--- a/Modules/Core/include/mitkDataNodeSource.h
+++ b/Modules/Core/include/mitkDataNodeSource.h
@@ -1,79 +1,79 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DATA_TREE_NODE_SOURCE_H
#define _MITK_DATA_TREE_NODE_SOURCE_H
#include "itkProcessObject.h"
#include "mitkDataNode.h"
namespace mitk
{
/**
* @brief Superclass of all classes generating data tree nodes (instances of class
* mitk::DataNode) 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::DataNodeSource.
* @ingroup Process
*/
class MITKCORE_EXPORT DataNodeSource : public itk::ProcessObject
{
public:
- mitkClassMacro( DataNodeSource, itk::ProcessObject )
+ mitkClassMacroItkParent( DataNodeSource, itk::ProcessObject )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::DataNode OutputType;
typedef OutputType::Pointer OutputTypePointer;
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual DataObjectPointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual DataObjectPointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType &name) override;
OutputType* GetOutput();
const OutputType* GetOutput() const;
OutputType* GetOutput(DataObjectPointerArraySizeType idx);
const OutputType* GetOutput(DataObjectPointerArraySizeType idx) const;
protected:
DataNodeSource();
virtual ~DataNodeSource();
};
}
#endif // #define _MITK_BASE_DATA_SOURCE_H
diff --git a/Modules/Core/include/mitkDataStorage.h b/Modules/Core/include/mitkDataStorage.h
index 4f0a47e80d..d1b56a82ba 100644
--- a/Modules/Core/include/mitkDataStorage.h
+++ b/Modules/Core/include/mitkDataStorage.h
@@ -1,414 +1,414 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDATASTORAGE_H_HEADER_INCLUDED_
#define MITKDATASTORAGE_H_HEADER_INCLUDED_
#include "itkObject.h"
#include <MitkCoreExports.h>
#include "mitkMessage.h"
#include "itkVectorContainer.h"
#include "mitkDataNode.h"
#include "mitkGeometry3D.h"
#include "itkSimpleFastMutexLock.h"
#include <map>
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 MITKCORE_EXPORT DataStorage : public itk::Object
{
public:
- mitkClassMacro(DataStorage, itk::Object);
+ mitkClassMacroItkParent(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<unsigned int, mitk::DataNode::Pointer> 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 <class DataType>
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<DataType*>(n->GetData());
}
//##Documentation
//## @brief Convenience method to get the first data object of a given data type with a given name
//##
template <class DataType>
DataType* GetNamedObject(const std::string name) const
{
return this->GetNamedObject<DataType>(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 <class DataType>
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<DataType*>(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<const mitk::DataNode*> 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;
DataStorageEvent InteractorChangedNodeEvent;
//##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::TimeGeometry::Pointer ComputeBoundingGeometry3D( const SetOfObjects* input, const char* boolPropertyKey = NULL, const mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey2 = NULL) const;
//##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::TimeGeometry::Pointer ComputeBoundingGeometry3D( const char* boolPropertyKey = NULL, const mitk::BaseRenderer* renderer = NULL, const char* boolPropertyKey2 = NULL) const;
//##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::TimeGeometry::Pointer ComputeVisibleBoundingGeometry3D( const 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, const 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( const 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, const 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( const mitk::BaseRenderer* renderer, const char* boolPropertyKey)
{
return ComputeTimeBounds( "visible", renderer, boolPropertyKey);
}
//##Documentation
//## @brief Defines whether or not NodeChangedEvent is invoked .
//##
//## This method can be used to set m_BlockNodeModifiedEvents.
//##
//## If this flag is true, NodeChangedEvent is not invoked when a
//## DataNode is modified. This might be undesired when setting
//## many properties on a datanode and you do not want anyone to
//## react.
void BlockNodeModifiedEvents( bool block );
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);
void OnNodeInteractorChanged( itk::Object *caller, const itk::EventObject &event );
//##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<const mitk::DataNode*, unsigned long> m_NodeModifiedObserverTags;
std::map<const mitk::DataNode*, unsigned long> m_NodeInteractorChangedObserverTags;
//##Documentation
//## @brief Saves Delete-Observer Tags for each node in order to remove the event listeners again.
std::map<const mitk::DataNode*, unsigned long> 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;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
};
} // namespace mitk
#endif /* MITKDATASTORAGE_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkDicomSeriesReader.h b/Modules/Core/include/mitkDicomSeriesReader.h
index 86354ddda1..fa68b20192 100644
--- a/Modules/Core/include/mitkDicomSeriesReader.h
+++ b/Modules/Core/include/mitkDicomSeriesReader.h
@@ -1,970 +1,970 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDicomSeriesReader_h
#define mitkDicomSeriesReader_h
#include "mitkDataNode.h"
#include "mitkConfig.h"
#include <itkGDCMImageIO.h>
#include <itkImageSeriesReader.h>
#include <itkCommand.h>
#ifdef NOMINMAX
# define DEF_NOMINMAX
# undef NOMINMAX
#endif
#include <gdcmConfigure.h>
#ifdef DEF_NOMINMAX
# ifndef NOMINMAX
# define NOMINMAX
# endif
# undef DEF_NOMINMAX
#endif
#include <gdcmDataSet.h>
#include <gdcmScanner.h>
namespace mitk
{
/**
\brief Loading DICOM images as MITK images.
- \ref DicomSeriesReader_purpose
- \ref DicomSeriesReader_limitations
- \ref DicomSeriesReader_usage
- \ref DicomSeriesReader_sorting
- \ref DicomSeriesReader_sorting1
- \ref DicomSeriesReader_sorting2
- \ref DicomSeriesReader_sorting3
- \ref DicomSeriesReader_sorting4
- \ref DicomSeriesReader_gantrytilt
- \ref DicomSeriesReader_pixelspacing
- \ref DicomSeriesReader_nextworkitems
- \ref DicomSeriesReader_whynotinitk
- \ref DicomSeriesReader_tests
\section DicomSeriesReader_purpose Purpose
DicomSeriesReader serves as a central class for loading DICOM images as mitk::Image.
As the term "DICOM image" covers a huge variety of possible modalities and
implementations, and since MITK assumes that 3D images are made up of continuous blocks
of slices without any gaps or changes in orientation, the loading mechanism must
implement a number of decisions and compromises.
<b>The main intention of this implementation is not efficiency but correctness of generated slice positions and pixel spacings!</b>
\section DicomSeriesReader_limitations Assumptions and limitations
The class is working only with GDCM 2.0.14 (or possibly newer). This version is the
default of an MITK super-build. Support for other versions or ITK's DicomIO was dropped
because of the associated complexity of DicomSeriesReader.
\b Assumptions
- expected to work with certain SOP Classes (mostly CT Image Storage and MR Image Storage)
- see ImageBlockDescriptor.GetReaderImplementationLevel() method for the details
- special treatment for a certain type of Philips 3D ultrasound (recogized by tag 3001,0010 set to "Philips3D")
- loader will always attempt to read multiple single slices as a single 3D image volume (i.e. mitk::Image)
- slices will be grouped by basic properties such as orientation, rows, columns, spacing and grouped into as large blocks as possible
- images which do NOT report a position or orientation in space (Image Position Patient, Image Orientation) will be assigned defaults
- image position (0,0,0)
- image orientation (1,0,0), (0,1,0)
- such images will always be grouped separately since spatial grouping / sorting makes no sense for them
\b Options
- images that cover the same piece of space (i.e. position, orientation, and dimensions are equal)
can be interpreted as time-steps of the same image, i.e. a series will be loaded as 3D+t
\b Limitations
- the 3D+t assumption only works if all time-steps have an equal number of slices and if all
have the Acquisition Time attribute set to meaningful values
\section DicomSeriesReader_usage Usage
The starting point for an application is a set of DICOM files that should be loaded.
For convenience, DicomSeriesReader can also parse a whole directory for DICOM files,
but an application should better know exactly what to load.
Loading is then done in two steps:
1. <b>Group the files into spatial blocks</b> by calling GetSeries().
This method will sort all passed files into meaningful blocks that
could fit into an mitk::Image. Sorting for 3D+t loading is optional but default.
The \b return value of this function is a list of descriptors, which
describe a grouped list of files with its most basic properties:
- SOP Class (CT Image Storage, Secondary Capture Image Storage, etc.)
- Modality
- What type of pixel spacing can be read from the provided DICOM tags
- How well DicomSeriesReader is prepared to load this type of data
2. <b>Load a sorted set of files</b> by calling LoadDicomSeries().
This method expects go receive the sorting output of GetSeries().
The method will then invoke ITK methods configured with GDCM-IO
classes to actually load the files into memory and put them into
mitk::Images. Again, loading as 3D+t is optional.
Example:
\code
// only a directory is known at this point: /home/who/dicom
DicomSeriesReader::FileNamesGrouping allImageBlocks = DicomSeriesReader::GetSeries("/home/who/dicom/");
// file now divided into groups of identical image size, orientation, spacing, etc.
// each of these lists should be loadable as an mitk::Image.
DicomSeriesReader::StringContainer seriesToLoad = allImageBlocks[...]; // decide what to load
// final step: load into DataNode (can result in 3D+t image)
DataNode::Pointer node = DicomSeriesReader::LoadDicomSeries( oneBlockSorted );
itk::SmartPointer<Image> image = dynamic_cast<mitk::Image*>( node->GetData() );
\endcode
\section DicomSeriesReader_sorting Logic for sorting 2D slices from DICOM images into 3D+t blocks for mitk::Image
The general sorting mechanism (implemented in GetSeries) groups and sorts a set of DICOM files, each assumed to contain a single CT/MR slice.
In the following we refer to those file groups as "blocks", since this is what they are meant to become when loaded into an mitk::Image.
\subsection DicomSeriesReader_sorting1 Step 1: Avoiding pure non-sense
A first pass separates slices that cannot possibly be loaded together because of restrictions of mitk::Image.
After this steps, each block contains only slices that match in all of the following DICOM tags:
- (0020,000e) Series Instance UID
- (0020,0037) Image Orientation
- (0028,0030) Pixel Spacing
- (0018,1164) Imager Pixel Spacing
- (0018,0050) Slice Thickness
- (0028,0010) Number Of Rows
- (0028,0011) Number Of Columns
- (0028,0008) Number Of Frames
\subsection DicomSeriesReader_sorting2 Step 2: Sort slices spatially
Before slices are further analyzed, they are sorted spatially. As implemented by GdcmSortFunction(),
slices are sorted by
1. distance from origin (calculated using (0020,0032) Image Position Patient and (0020,0037) Image Orientation)
2. when distance is equal, (0020,0012) Aquisition Number, (0008,0032) Acquisition Time and (0018,1060) Trigger Time are
used as a backup criterions (necessary for meaningful 3D+t sorting)
\subsection DicomSeriesReader_sorting3 Step 3: Ensure equal z spacing
Since inter-slice distance is not recorded in DICOM tags, we must ensure that blocks are made up of
slices that have equal distances between neighboring slices. This is especially necessary because itk::ImageSeriesReader
is later used for the actual loading, and this class expects (and does nocht verify) equal inter-slice distance (see \ref DicomSeriesReader_whatweknowaboutitk).
To achieve such grouping, the inter-slice distance is calculated from the first two different slice positions of a block.
Following slices are added to a block as long as they can be added by adding the calculated inter-slice distance to the
last slice of the block. Slices that do not fit into the expected distance pattern, are set aside for further analysis.
This grouping is done until each file has been assigned to a group.
Slices that share a position in space are also sorted into separate blocks during this step.
So the result of this step is a set of blocks that contain only slices with equal z spacing
and uniqe slices at each position.
\subsection DicomSeriesReader_sorting4 Step 4 (optional): group 3D blocks as 3D+t when possible
This last step depends on an option of GetSeries(). When requested, image blocks from the previous step are merged again
whenever two blocks occupy the same portion of space (i.e. same origin, number of slices and z-spacing).
\section DicomSeriesReader_gantrytilt Handling of gantry tilt
When CT gantry tilt is used, the gantry plane (= X-Ray source and detector ring) and the vertical plane do not align
anymore. This scanner feature is used for example to reduce metal artifacs (e.g. <i>Lee C , Evaluation of Using CT
Gantry Tilt Scan on Head and Neck Cancer Patients with Dental Structure: Scans Show Less Metal Artifacts. Presented
at: Radiological Society of North America 2011 Scientific Assembly and Annual Meeting; November 27- December 2,
2011 Chicago IL.</i>).
The acquired planes of such CT series do not match the expectations of a orthogonal geometry in mitk::Image: if you
stack the slices, they show a small shift along the Y axis:
\verbatim
without tilt with tilt
|||||| //////
|||||| //////
-- |||||| --------- ////// -------- table orientation
|||||| //////
|||||| //////
Stacked slices:
without tilt with tilt
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
\endverbatim
As such gemetries do not in conjunction with mitk::Image, DicomSeriesReader performs a correction for such series
if the groupImagesWithGantryTilt or correctGantryTilt flag in GetSeries and LoadDicomSeries is set (default = on).
The correction algorithms undoes two errors introduced by ITK's ImageSeriesReader:
- the plane shift that is ignored by ITK's reader is recreated by applying a shearing transformation using itk::ResampleFilter.
- the spacing is corrected (it is calculated by ITK's reader from the distance between two origins, which is NOT the slice distance in this special case)
Both errors are introduced in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
For the correction, we examine two consecutive slices of a series, both described as a pair (origin/orientation):
- we calculate if the first origin is on a line along the normal of the second slice
- if this is not the case, the geometry will not fit a normal mitk::Image/mitk::Geometry3D
- we then project the second origin into the first slice's coordinate system to quantify the shift
- both is done in class GantryTiltInformation with quite some comments.
The geometry of image stacks with tilted geometries is illustrated below:
- green: the DICOM images as described by their tags: origin as a point with the line indicating the orientation
- red: the output of ITK ImageSeriesReader: wrong, larger spacing, no tilt
- blue: how much a shear must correct
\image tilt-correction.jpg
\section DicomSeriesReader_whatweknowaboutitk The actual image loading process
When calling LoadDicomSeries(), this method "mainly" uses an instance of itk::ImageSeriesReader,
configured with an itk::GDCMImageIO object. Because DicomSeriesReader works around some of the
behaviors of these classes, the following is a list of features that we find in the code and need to work with:
- itk::ImageSeriesReader::GenerateOutputInformation() does the z-spacing handling
+ spacing is directly determined by comparing (euclidean distance) the origins of the first two slices of a series
* this is GOOD because there is no reliable z-spacing information in DICOM images
* this is bad because it does not work with gantry tilt, in which case the slice distance is SMALLER than the distance between two origins (see section on tilt)
- origin and spacing are calculated by GDCMImageIO and re-used in itk::ImageSeriesReader
+ the origins are read from appropriate tags, nothing special about that
+ the spacing is read by gdcm::ImageReader, gdcm::ImageHelper::GetSpacingValue() from a tag determined by gdcm::ImageHelper::GetSpacingTagFromMediaStorage(), which basically determines ONE appropriate pixel spacing tag for each media storage type (ct image, mr image, secondary capture image, etc.)
* this is fine for modalities such as CT/MR where the "Pixel Spacing" tag is mandatory, but for other modalities such as CR or Secondary Capture, the tag "Imager Pixel Spacing" is taken, which is no only optional but also has a more complicated relation with the "Pixel Spacing" tag. For this reason we check/modify the pixel spacing reported by itk::ImageSeriesReader after loading the image (see \ref DicomSeriesReader_pixelspacing)
AFTER loading, DicomSeriesReader marks some of its findings as mitk::Properties to the loaded Image and DataNode:
- <b>dicomseriesreader.SOPClass</b> : DICOM SOP Class as readable string (instead of a UID)
- <b>dicomseriesreader.ReaderImplementationLevelString</b> : Confidence /Support level of the reader for this image as readable string
- <b>dicomseriesreader.ReaderImplementationLevel</b> : Confidence /Support level of the reader for this image as enum value of type ReaderImplementationLevel
- <b>dicomseriesreader.PixelSpacingInterpretationString</b> : Appropriate interpreteation of pixel spacing for this Image as readable string
- <b>dicomseriesreader.PixelSpacingInterpretation</b> : Appropriate interpreteation of pixel spacing for this Image as enum value of type PixelSpacingInterpretation
- <b>dicomseriesreader.MultiFrameImage</b> : bool flag to mark multi-frame images
- <b>dicomseriesreader.GantyTiltCorrected</b> : bool flag to mark images where a gantry tilt was corrected to fit slices into an mitk::Image
- <b>dicomseriesreader.3D+t</b> : bool flag to mark images with a time dimension (multiple 3D blocks of the same size at the same position in space)
\section DicomSeriesReader_pixelspacing Handling of pixel spacing
The reader implementes what is described in DICOM Part 3, chapter 10.7 (Basic Pixel Spacing Calibration Macro): Both tags
- (0028,0030) Pixel Spacing and
- (0018,1164) Imager Pixel Spacing
are evaluated and the pixel spacing is set to the spacing within the patient when tags allow that.
The result of pixel spacing interpretation can be read from a property "dicomseriesreader.PixelSpacingInterpretation",
which refers to one of the enumerated values of type PixelSpacingInterpretation;
\section DicomSeriesReader_supportedmodalities Limitations for specific modalities
- <b>Enhanced Computed Tomography / Magnetic Resonance Images</b> are currently NOT supported at all, because we lack general support for multi-frame images.
- <b>Nuclear Medicine Images</b> are not supported fully supported, only the single-frame variants are loaded properly.
\section DicomSeriesReader_nextworkitems Possible enhancements
This is a short list of ideas for enhancement:
- Class has historically grown and should be reviewed again. There is probably too many duplicated scanning code
- Multi-frame images don't mix well with the curent assumption of "one file - one slice", which is assumed by our code
- It should be checked how well GDCM and ITK support these files (some load, some don't)
- Specializations such as the Philips 3D code should be handled in a more generic way. The current handling of Philips 3D images is not nice at all
\section DicomSeriesReader_whynotinitk Why is this not in ITK?
Some of this code would probably be better located in ITK. It is just a matter of resources that this is not the
case yet. Any attempts into this direction are welcome and can be supported. At least the gantry tilt correction
should be a simple addition to itk::ImageSeriesReader.
\section DicomSeriesReader_tests Tests regarding DICOM loading
A number of tests have been implemented to check our assumptions regarding DICOM loading. Please see \ref DICOMTesting
\todo refactor all the protected helper objects/methods into a separate header so we compile faster
*/
class Image;
class MITKCORE_EXPORT DicomSeriesReader
{
public:
/**
\brief Lists of filenames.
*/
typedef std::vector<std::string> StringContainer;
/**
\brief Interface for the progress callback.
*/
typedef void (*UpdateCallBackMethod)(float);
/**
\brief Describes how well the reader is tested for a certain file type.
Applications should not rely on the outcome for images which are reported
ReaderImplementationLevel_Implemented or ReaderImplementationLevel_Unsupported.
Errors to load images which are reported as ReaderImplementationLevel_Supported
are considered bugs. For ReaderImplementationLevel_PartlySupported please check the appropriate paragraph in \ref DicomSeriesReader_supportedmodalities
*/
typedef enum
{
ReaderImplementationLevel_Supported, /// loader code and tests are established
ReaderImplementationLevel_PartlySupported, /// loader code and tests are establised for specific parts of a SOP Class
ReaderImplementationLevel_Implemented, /// loader code is implemented but not accompanied by tests
ReaderImplementationLevel_Unsupported, /// loader code is not working with this SOP Class
} ReaderImplementationLevel;
/**
\brief How the mitk::Image spacing should be interpreted.
Compare DICOM PS 3.3 10.7 (Basic Pixel Spacing Calibration Macro).
*/
typedef enum
{
PixelSpacingInterpretation_SpacingInPatient, /// distances are mm within a patient
PixelSpacingInterpretation_SpacingAtDetector, /// distances are mm at detector surface
PixelSpacingInterpretation_SpacingUnknown /// NO spacing information is present, we use (1,1) as default
} PixelSpacingInterpretation;
/**
\brief Return type of GetSeries, describes a logical group of files.
Files grouped into a single 3D or 3D+t block are described by an instance
of this class. Relevant descriptive properties can be used to provide
the application user with meaningful choices.
*/
class MITKCORE_EXPORT ImageBlockDescriptor
{
public:
/// List of files in this group
StringContainer GetFilenames() const;
/// A unique ID describing this bloc (enhanced Series Instance UID).
std::string GetImageBlockUID() const;
/// The Series Instance UID.
std::string GetSeriesInstanceUID() const;
/// Series Modality (CT, MR, etc.)
std::string GetModality() const;
/// SOP Class UID as readable string (Computed Tomography Image Storage, Secondary Capture Image Storage, etc.)
std::string GetSOPClassUIDAsString() const;
/// SOP Class UID as DICOM UID
std::string GetSOPClassUID() const;
/// Confidence of the reader that this block can be read successfully.
ReaderImplementationLevel GetReaderImplementationLevel() const;
/// Whether or not the block contains a gantry tilt which will be "corrected" during loading
bool HasGantryTiltCorrected() const;
/// Whether or not mitk::Image spacing relates to the patient
bool PixelSpacingRelatesToPatient() const;
/// Whether or not mitk::Image spacing relates to the detector surface
bool PixelSpacingRelatesToDetector() const;
/// Whether or not mitk::Image spacing is of unknown origin
bool PixelSpacingIsUnknown() const;
/// How the mitk::Image spacing can meaningfully be interpreted.
PixelSpacingInterpretation GetPixelSpacingType() const;
/// 3D+t or not
bool HasMultipleTimePoints() const;
/// Multi-frame image(s) or not
bool IsMultiFrameImage() const;
ImageBlockDescriptor();
~ImageBlockDescriptor();
private:
friend class DicomSeriesReader;
ImageBlockDescriptor(const StringContainer& files);
void AddFile(const std::string& file);
void AddFiles(const StringContainer& files);
void SetImageBlockUID(const std::string& uid);
void SetSeriesInstanceUID(const std::string& uid);
void SetModality(const std::string& modality);
void SetNumberOfFrames(const std::string& );
void SetSOPClassUID(const std::string& mediaStorageSOPClassUID);
void SetHasGantryTiltCorrected(bool);
void SetPixelSpacingInformation(const std::string& pixelSpacing, const std::string& imagerPixelSpacing);
void SetHasMultipleTimePoints(bool);
void GetDesiredMITKImagePixelSpacing(ScalarType& spacingX, ScalarType& spacingY) const;
StringContainer m_Filenames;
std::string m_ImageBlockUID;
std::string m_SeriesInstanceUID;
std::string m_Modality;
std::string m_SOPClassUID;
bool m_HasGantryTiltCorrected;
std::string m_PixelSpacing;
std::string m_ImagerPixelSpacing;
bool m_HasMultipleTimePoints;
bool m_IsMultiFrameImage;
};
typedef std::map<std::string, ImageBlockDescriptor> FileNamesGrouping;
/**
\brief Provide combination of preprocessor defines that was active during compilation.
Since this class is a combination of several possible implementations, separated only
by ifdef's, calling instances might want to know which flags were active at compile time.
*/
static std::string GetConfigurationString();
/**
\brief Checks if a specific file contains DICOM data.
*/
static
bool
IsDicom(const std::string &filename);
/**
\brief see other GetSeries().
Find all series (and sub-series -- see details) in a particular directory.
*/
static FileNamesGrouping GetSeries(const std::string &dir,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief see other GetSeries().
\warning Untested, could or could not work.
This differs only by having an additional restriction to a single known DICOM series.
Internally, it uses the other GetSeries() method.
*/
static StringContainer GetSeries(const std::string &dir,
const std::string &series_uid,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief PREFERRED version of this method - scan and sort DICOM files.
Parse a list of files for images of DICOM series.
For each series, an enumeration of the files contained in it is created.
\return The resulting maps UID-like keys (based on Series Instance UID and slice properties) to sorted lists of file names.
SeriesInstanceUID will be enhanced to be unique for each set of file names
that is later loadable as a single mitk::Image. This implies that
Image orientation, slice thickness, pixel spacing, rows, and columns
must be the same for each file (i.e. the image slice contained in the file).
If this separation logic requires that a SeriesInstanceUID must be made more specialized,
it will follow the same logic as itk::GDCMSeriesFileNames to enhance the UID with
more digits and dots.
Optionally, more tags can be used to separate files into different logical series by setting
the restrictions parameter.
\warning Adding restrictions is not yet implemented!
*/
static
FileNamesGrouping
GetSeries(const StringContainer& files,
bool sortTo3DPlust,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief See other GetSeries().
Use GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer &restrictions) instead.
*/
static
FileNamesGrouping
GetSeries(const StringContainer& files,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
Loads a DICOM series composed by the file names enumerated in the file names container.
If a callback method is supplied, it will be called after every progress update with a progress value in [0,1].
\param filenames The filenames to load.
\param sort Whether files should be sorted spatially (true) or not (false - maybe useful if presorted)
\param load4D Whether to load the files as 3D+t (if possible)
*/
static DataNode::Pointer LoadDicomSeries(const StringContainer &filenames,
bool sort = true,
bool load4D = true,
bool correctGantryTilt = true,
UpdateCallBackMethod callback = 0,
itk::SmartPointer<Image> preLoadedImageBlock = 0);
/**
\brief See LoadDicomSeries! Just a slightly different interface.
If \p preLoadedImageBlock is provided, the reader will only "fake" loading and create appropriate
mitk::Properties.
*/
static bool LoadDicomSeries(const StringContainer &filenames,
DataNode &node,
bool sort = true,
bool load4D = true,
bool correctGantryTilt = true,
UpdateCallBackMethod callback = 0,
itk::SmartPointer<Image> preLoadedImageBlock = 0);
protected:
/**
\brief Return type of DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
Class contains the grouping result of method DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption,
which takes as input a number of images, which are all equally oriented and spatially sorted along their normal direction.
The result contains of two blocks: a first one is the grouping result, all of those images can be loaded
into one image block because they have an equal origin-to-origin distance without any gaps in-between.
*/
class SliceGroupingAnalysisResult
{
public:
SliceGroupingAnalysisResult();
/**
\brief Grouping result, all same origin-to-origin distance w/o gaps.
*/
StringContainer GetBlockFilenames();
/**
\brief Remaining files, which could not be grouped.
*/
StringContainer GetUnsortedFilenames();
/**
\brief Wheter or not the grouped result contain a gantry tilt.
*/
bool ContainsGantryTilt();
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToSortedBlock(const std::string& filename);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToUnsortedBlock(const std::string& filename);
void AddFilesToUnsortedBlock(const StringContainer& filenames);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
\todo Could make sense to enhance this with an instance of GantryTiltInformation to store the whole result!
*/
void FlagGantryTilt();
/**
\brief Only meaningful for use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
*/
void UndoPrematureGrouping();
protected:
StringContainer m_GroupedFiles;
StringContainer m_UnsortedFiles;
bool m_GantryTilt;
};
/**
\brief Gantry tilt analysis result.
Takes geometry information for two slices of a DICOM series and
calculates whether these fit into an orthogonal block or not.
If NOT, they can either be the result of an acquisition with
gantry tilt OR completly broken by some shearing transformation.
Most calculations are done in the constructor, results can then
be read via the remaining methods.
*/
class GantryTiltInformation
{
public:
// two types to avoid any rounding errors
typedef itk::Point<double,3> Point3Dd;
typedef itk::Vector<double,3> Vector3Dd;
/**
\brief Just so we can create empty instances for assigning results later.
*/
GantryTiltInformation();
/**
\brief THE constructor, which does all the calculations.
Determining the amount of tilt is done by checking the distances
of origin1 from planes through origin2. Two planes are considered:
- normal vector along normal of slices (right x up): gives the slice distance
- normal vector along orientation vector "up": gives the shift parallel to the plane orientation
The tilt angle can then be calculated from these distances
\param origin1 origin of the first slice
\param origin2 origin of the second slice
\param right right/up describe the orientatation of borth slices
\param up right/up describe the orientatation of borth slices
\param numberOfSlicesApart how many slices are the given origins apart (1 for neighboring slices)
*/
GantryTiltInformation( const Point3D& origin1,
const Point3D& origin2,
const Vector3D& right,
const Vector3D& up,
unsigned int numberOfSlicesApart);
/**
\brief Whether the slices were sheared.
True if any of the shifts along right or up vector are non-zero.
*/
bool IsSheared() const;
/**
\brief Whether the shearing is a gantry tilt or more complicated.
Gantry tilt will only produce shifts in ONE orientation, not in both.
Since the correction code currently only coveres one tilt direction
AND we don't know of medical images with two tilt directions, the
loading code wants to check if our assumptions are true.
*/
bool IsRegularGantryTilt() const;
/**
\brief The offset distance in Y direction for each slice in mm (describes the tilt result).
*/
double GetMatrixCoefficientForCorrectionInWorldCoordinates() const;
/**
\brief The z / inter-slice spacing. Needed to correct ImageSeriesReader's result.
*/
double GetRealZSpacing() const;
/**
\brief The shift between first and last slice in mm.
Needed to resize an orthogonal image volume.
*/
double GetTiltCorrectedAdditionalSize() const;
/**
\brief Calculated tilt angle in degrees.
*/
double GetTiltAngleInDegrees() const;
protected:
/**
\brief Projection of point p onto line through lineOrigin in direction of lineDirection.
*/
Point3D projectPointOnLine( Point3Dd p, Point3Dd lineOrigin, Vector3Dd lineDirection );
double m_ShiftUp;
double m_ShiftRight;
double m_ShiftNormal;
double m_ITKAssumedSliceSpacing;
unsigned int m_NumberOfSlicesApart;
};
/**
\brief for internal sorting.
*/
typedef std::pair<StringContainer, StringContainer> TwoStringContainers;
/**
\brief Maps DICOM tags to MITK properties.
*/
typedef std::map<std::string, std::string> TagToPropertyMapType;
/**
\brief Ensure an equal z-spacing for a group of files.
Takes as input a number of images, which are all equally oriented and spatially sorted along their normal direction.
Internally used by GetSeries. Returns two lists: the first one contins slices of equal inter-slice spacing.
The second list contains remaining files, which need to be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
*/
static
SliceGroupingAnalysisResult
AnalyzeFileForITKImageSeriesReaderSpacingAssumption(const StringContainer& files, bool groupsOfSimilarImages, const gdcm::Scanner::MappingType& tagValueMappings_);
/**
\brief Safely convert const char* to std::string.
*/
static
std::string
ConstCharStarToString(const char* s);
/**
\brief Safely convert a string into pixel spacing x and y.
*/
static
bool
DICOMStringToSpacing(const std::string& s, ScalarType& spacingX, ScalarType& spacingY);
/**
\brief Convert DICOM string describing a point to Point3D.
DICOM tags like ImagePositionPatient contain a position as float numbers separated by backslashes:
\verbatim
42.7131\13.77\0.7
\endverbatim
*/
static
Point3D
DICOMStringToPoint3D(const std::string& s, bool& successful);
/**
\brief Convert DICOM string describing a point two Vector3D.
DICOM tags like ImageOrientationPatient contain two vectors as float numbers separated by backslashes:
\verbatim
42.7131\13.77\0.7\137.76\0.3
\endverbatim
*/
static
void
DICOMStringToOrientationVectors(const std::string& s, Vector3D& right, Vector3D& up, bool& successful);
template <typename ImageType>
static
typename ImageType::Pointer
// TODO this is NOT inplace!
InPlaceFixUpTiltedGeometry( ImageType* input, const GantryTiltInformation& tiltInfo );
/**
\brief Sort a set of file names in an order that is meaningful for loading them into an mitk::Image.
\warning This method assumes that input files are similar in basic properties such as
slice thicknes, image orientation, pixel spacing, rows, columns.
It should always be ok to put the result of a call to GetSeries(..) into this method.
Sorting order is determined by
1. image position along its normal (distance from world origin)
2. acquisition time
If P<n> denotes a position and T<n> denotes a time step, this method will order slices from three timesteps like this:
\verbatim
P1T1 P1T2 P1T3 P2T1 P2T2 P2T3 P3T1 P3T2 P3T3
\endverbatim
*/
static StringContainer SortSeriesSlices(const StringContainer &unsortedFilenames);
public:
/**
\brief Checks if a specific file is a Philips3D ultrasound DICOM file.
*/
static bool IsPhilips3DDicom(const std::string &filename);
static std::string ReaderImplementationLevelToString( const ReaderImplementationLevel& enumValue );
static std::string PixelSpacingInterpretationToString( const PixelSpacingInterpretation& enumValue );
protected:
/**
\brief Read a Philips3D ultrasound DICOM file and put into an mitk::Image.
*/
static bool ReadPhilips3DDicom(const std::string &filename, itk::SmartPointer<Image> output_image);
/**
\brief Construct a UID that takes into account sorting criteria from GetSeries().
*/
static std::string CreateMoreUniqueSeriesIdentifier( gdcm::Scanner::TagToValue& tagValueMap );
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string CreateSeriesIdentifierPart( gdcm::Scanner::TagToValue& tagValueMap, const gdcm::Tag& tag );
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string IDifyTagValue(const std::string& value);
typedef itk::GDCMImageIO DcmIoType;
/**
\brief Progress callback for DicomSeriesReader.
*/
class CallbackCommand : public itk::Command
{
public:
CallbackCommand(UpdateCallBackMethod callback)
: m_Callback(callback)
{
}
- void Execute(const itk::Object *caller, const itk::EventObject&)
+ void Execute(const itk::Object *caller, const itk::EventObject&) override
{
(*this->m_Callback)(static_cast<const itk::ProcessObject*>(caller)->GetProgress());
}
- void Execute(itk::Object *caller, const itk::EventObject&)
+ void Execute(itk::Object *caller, const itk::EventObject&) override
{
(*this->m_Callback)(static_cast<itk::ProcessObject*>(caller)->GetProgress());
}
protected:
UpdateCallBackMethod m_Callback;
};
static void FixSpacingInformation( Image* image, const ImageBlockDescriptor& imageBlockDescriptor );
/**
\brief Scan for slice image information
*/
static void ScanForSliceInformation( const StringContainer &filenames, gdcm::Scanner& scanner );
/**
\brief Performs actual loading of a series and creates an image having the specified pixel type.
*/
static
void
LoadDicom(const StringContainer &filenames, DataNode &node, bool sort, bool check_4d, bool correctTilt, UpdateCallBackMethod callback, itk::SmartPointer<Image> preLoadedImageBlock);
/**
\brief Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image.
\param command can be used for progress reporting
*/
template <typename PixelType>
static
itk::SmartPointer<Image>
LoadDICOMByITK( const StringContainer&, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image> MultiplexLoadDICOMByITK(const StringContainer&, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image> MultiplexLoadDICOMByITKScalar(const StringContainer&, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image> MultiplexLoadDICOMByITKRGBPixel(const StringContainer&, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
template <typename PixelType>
static
itk::SmartPointer<Image>
LoadDICOMByITK4D( std::list<StringContainer>& imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image>
MultiplexLoadDICOMByITK4D( std::list<StringContainer>& imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image>
MultiplexLoadDICOMByITK4DScalar( std::list<StringContainer>& imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
static
itk::SmartPointer<Image>
MultiplexLoadDICOMByITK4DRGBPixel( std::list<StringContainer>& imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation& tiltInfo, DcmIoType::Pointer& io, CallbackCommand* command, itk::SmartPointer<Image> preLoadedImageBlock);
/**
\brief Sort files into time step blocks of a 3D+t image.
Called by LoadDicom. Expects to be fed a single list of filenames that have been sorted by
GetSeries previously (one map entry). This method will check how many timestep can be filled
with given files.
Assumption is that the number of time steps is determined by how often the first position in
space repeats. I.e. if the first three files in the input parameter all describe the same
location in space, we'll construct three lists of files. and sort the remaining files into them.
\todo We can probably remove this method if we somehow transfer 3D+t information from GetSeries to LoadDicomSeries.
*/
static
std::list<StringContainer>
SortIntoBlocksFor3DplusT( const StringContainer& presortedFilenames, const gdcm::Scanner::MappingType& tagValueMappings_, bool sort, bool& canLoadAs4D);
/**
\brief Defines spatial sorting for sorting by GDCM 2.
Sorts by image position along image normal (distance from world origin).
In cases of conflict, acquisition time is used as a secondary sort criterium.
*/
static
bool
GdcmSortFunction(const gdcm::DataSet &ds1, const gdcm::DataSet &ds2);
/**
\brief Copy information about files and DICOM tags from ITK's MetaDataDictionary
and from the list of input files to the PropertyList of mitk::Image.
\todo Tag copy must follow; image level will cause some additional files parsing, probably.
*/
static void CopyMetaDataToImageProperties( StringContainer filenames, const gdcm::Scanner::MappingType& tagValueMappings_, DcmIoType* io, const ImageBlockDescriptor& blockInfo, Image* image);
static void CopyMetaDataToImageProperties( std::list<StringContainer> imageBlock, const gdcm::Scanner::MappingType& tagValueMappings_, DcmIoType* io, const ImageBlockDescriptor& blockInfo, Image* image);
/**
\brief Map between DICOM tags and MITK properties.
Uses as a positive list for copying specified DICOM tags (from ITK's ImageIO)
to MITK properties. ITK provides MetaDataDictionary entries of form
"gggg|eeee" (g = group, e = element), e.g. "0028,0109" (Largest Pixel in Series),
which we want to sort as dicom.series.largest_pixel_in_series".
*/
static const TagToPropertyMapType& GetDICOMTagsToMITKPropertyMap();
};
}
#endif /* mitkDicomSeriesReader_h */
diff --git a/Modules/Core/include/mitkDispatcher.h b/Modules/Core/include/mitkDispatcher.h
index f8a2c27e00..6fd3d48455 100644
--- a/Modules/Core/include/mitkDispatcher.h
+++ b/Modules/Core/include/mitkDispatcher.h
@@ -1,131 +1,131 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDispatcher_h
#define mitkDispatcher_h
#include "itkLightObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkDataNode.h"
#include "mitkDataInteractor.h"
#include <MitkCoreExports.h>
#include <list>
#include "usServiceTracker.h"
namespace mitk
{
class InternalEvent;
class InteractionEvent;
struct InteractionEventObserver;
/**
* \class Dispatcher
* \brief Manages event distribution
*
* Receives Events (Mouse-,Key-, ... Events) and dispatches them to the registered DataInteractor Objects.
* The order in which DataInteractors are offered to handle an event is determined by layer of their associated DataNode.
* Higher layers are preferred.
*
* \ingroup Interaction
*/
class MITKCORE_EXPORT Dispatcher: public itk::LightObject
{
public:
- mitkClassMacro(Dispatcher, itk::LightObject);
+ mitkClassMacroItkParent(Dispatcher, itk::LightObject);
mitkNewMacro1Param(Self, const std::string&);
typedef std::list<DataInteractor::Pointer> ListInteractorType;
typedef std::list<itk::SmartPointer<InteractionEvent> > ListEventsType;
/**
* To post new Events which are to be handled by the Dispatcher.
*
* @return Returns true if the event has been handled by an DataInteractor, and false else.
*/
bool ProcessEvent(InteractionEvent* event);
/**
* Adds an Event to the Dispatchers EventQueue, these events will be processed after a a regular posted event has been fully handled.
* This allows DataInteractors to post their own events without interrupting regular Dispatching workflow.
* It is important to note that the queued events will be processed AFTER the state change of a current transition (which queued the events)
* is performed.
*
* \note 1) If an event is added from an other source than an DataInteractor / Observer its execution will be delayed until the next regular event
* comes in.
* \note 2) Make sure you're not causing infinite loops!
*/
void QueueEvent(InteractionEvent* event);
/**
* Adds the DataInteractor that is associated with the DataNode to the Dispatcher Queue.
* If there already exists an DataInteractor that has a reference to the same DataNode, it is removed.
* Note that within this method also all other DataInteractors are checked and removed if they are no longer active,
* and were not removed properly.
*/
void AddDataInteractor(const DataNode* dataNode);
/**
* Remove all DataInteractors related to this Node, to prevent double entries and dead references.
*/
void RemoveDataInteractor(const DataNode* dataNode);
size_t GetNumberOfInteractors(); // DEBUG TESTING
protected:
Dispatcher(const std::string& rendererName);
virtual ~Dispatcher();
private:
struct cmp{
bool operator()(DataInteractor::Pointer d1, DataInteractor::Pointer d2){
return (d1->GetLayer() > d2->GetLayer());
}
};
std::list<DataInteractor::Pointer> m_Interactors;
ListEventsType m_QueuedEvents;
/**
* Removes all Interactors without a DataNode pointing to them, this is necessary especially when a DataNode is assigned to a new Interactor
*/
void RemoveOrphanedInteractors();
/**
* See \ref DataInteractionTechnicalPage_DispatcherEventDistSection for a description of ProcessEventModes
*/
ProcessEventMode m_ProcessingMode;
DataInteractor::Pointer m_SelectedInteractor;
void SetEventProcessingMode(DataInteractor::Pointer);
/**
* Function to handle special internal events,
* such as events that are directed at a specific DataInteractor,
* or the request to delete an Interactor and its DataNode.
*/
bool HandleInternalEvent(InternalEvent* internalEvent);
/**
* Hold microservice reference to object that takes care of informing the InteractionEventObservers about InteractionEvents
*/
us::ServiceTracker<InteractionEventObserver>* m_EventObserverTracker;
};
} /* namespace mitk */
#endif /* mitkDispatcher_h */
diff --git a/Modules/Core/include/mitkDisplayGeometry.h b/Modules/Core/include/mitkDisplayGeometry.h
index cf1735c841..6d17decdb0 100644
--- a/Modules/Core/include/mitkDisplayGeometry.h
+++ b/Modules/Core/include/mitkDisplayGeometry.h
@@ -1,238 +1,238 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDisplayGeometry_h
#define mitkDisplayGeometry_h
#include "mitkPlaneGeometry.h"
namespace mitk
{
/**
\brief Describes the geometry on the display/screen for 2D display.
The main purpose of this class is to convert between display coordinates
(in display-units) and world coordinates (in mm).
DisplayGeometry depends on the size of the display area (widget width and
height, m_SizeInDisplayUnits) and on a PlaneGeometry (m_WoldGeometry). It
represents a recangular view on this world-geometry. E.g., you can tell
the DisplayGeometry to fit the world-geometry in the display area by
calling Fit(). Provides methods for zooming and panning.
Zooming and panning can be restricted within reasonable bounds by setting
the ConstrainZoomingAndPanning flag. In these cases you can re-define what
bounds you accept as "reasonable" by calling
\warning \em Units refers to the units of the underlying world-geometry.
Take care, whether these are really the units you want to convert to.
E.g., when you want to convert a point \a pt_display (which is 2D) given
in display coordinates into a point in units of a BaseData-object @a datum
(the requested point is 3D!), use
\code
displaygeometry->DisplayToWorld(pt_display, pt2d_mm);
displaygeometry->Map(pt2d_mm, pt3d_mm);
datum->GetGeometry()->WorldToIndex(pt3d_mm, pt3d_datum_units);
\endcode
Even, if you want to convert the 2D point \a pt_display into a 2D point in
units on a certain 2D geometry \a certaingeometry, it is safer to use
\code
displaygeometry->DisplayToWorld(pt_display, pt_mm);
certaingeometry->WorldToIndex(pt_mm, pt_certain_geometry_units);
\endcode
unless you can be sure that the underlying geometry of \a displaygeometry
is really the \a certaingeometry.
\ingroup Geometry
*/
class MITKCORE_EXPORT DisplayGeometry : public PlaneGeometry
{
public:
mitkClassMacro(DisplayGeometry, PlaneGeometry);
/// Method for creation through the object factory.
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/// \brief duplicates the geometry, NOT useful for this sub-class
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
/// \return this objects modified time.
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
//virtual const TimeBounds& GetTimeBounds() const;
// size definition methods
virtual void SetWorldGeometry(const PlaneGeometry* aWorldGeometry);
itkGetConstObjectMacro(WorldGeometry, PlaneGeometry);
/// \return if new origin was within accepted limits
virtual bool SetOriginInMM(const Vector2D& origin_mm);
virtual Vector2D GetOriginInMM() const;
virtual Vector2D GetOriginInDisplayUnits() const;
/**
\brief Set the size of the display in display units.
This method must be called every time the display is resized (normally, the GUI-toolkit
informs about resizing).
\param keepDisplayedRegion: if \a true (the default), the displayed contents is zoomed/shrinked
so that the displayed region is (approximately) the same as before: The point at the center will
be kept at the center and the length of the diagonal of the displayed region \em in \em units
will also be kept.
When the aspect ration changes, the displayed region includes the old displayed region, but
cannot be exaclty the same.
*/
virtual void SetSizeInDisplayUnits(unsigned int width, unsigned int height, bool keepDisplayedRegion = true);
virtual Vector2D GetSizeInDisplayUnits() const;
virtual Vector2D GetSizeInMM() const;
unsigned int GetDisplayWidth() const;
unsigned int GetDisplayHeight() const;
// zooming, panning, restriction of both
virtual void SetConstrainZoomingAndPanning(bool constrain);
virtual bool GetConstrainZommingAndPanning() const;
/// what percentage of the world should be visible at maximum zoom out (default 1.0, i.e. 100% of width or height)
itkGetMacro(MaxWorldViewPercentage, float);
itkSetMacro(MaxWorldViewPercentage, float);
/// what percentage of the world should be visible at maximum zoom in (default 0.1, i.e. 10% of width or height)
itkGetMacro(MinWorldViewPercentage, float);
itkSetMacro(MinWorldViewPercentage, float);
virtual bool SetScaleFactor(ScalarType mmPerDisplayUnit);
ScalarType GetScaleFactorMMPerDisplayUnit() const;
/**
* \brief Zooms with a factor (1.0=identity) to/from the specified center in display units
* \return true if zoom request was within accepted limits
*/
virtual bool Zoom(ScalarType factor, const Point2D& centerInDisplayUnits);
/**
* \brief Zooms with a factor (1.0=identity) to/from the specified center, trying to preserve the center of zoom in world coordiantes
*
* Same zoom as mentioned above but tries (if it's within view contraints) to match the center in display units with the center in world coordinates.
*
* \return true if zoom request was within accepted limits
*/
virtual bool ZoomWithFixedWorldCoordinates(ScalarType factor, const Point2D& focusDisplayUnits, const Point2D& focusUnitsInMM);
// \return true if move request was within accepted limits
virtual bool MoveBy(const Vector2D& shiftInDisplayUnits);
// \brief align display with world, make world completely visible
virtual void Fit();
// conversion methods
virtual void DisplayToWorld(const Point2D &pt_display, Point2D &pt_mm) const;
virtual void WorldToDisplay(const Point2D &pt_mm, Point2D &pt_display) const;
virtual void DisplayToWorld(const Vector2D &vec_display, Vector2D &vec_mm) const;
virtual void WorldToDisplay(const Vector2D &vec_mm, Vector2D &vec_display) const;
virtual void ULDisplayToMM(const Point2D &pt_ULdisplay, Point2D &pt_mm) const;
virtual void MMToULDisplay(const Point2D &pt_mm, Point2D &pt_ULdisplay) const;
virtual void ULDisplayToMM(const Vector2D &vec_ULdisplay, Vector2D &vec_mm) const;
virtual void MMToULDisplay(const Vector2D &vec_mm, Vector2D &vec_ULdisplay) const;
virtual void ULDisplayToDisplay(const Point2D &pt_ULdisplay, Point2D &pt_display) const;
virtual void DisplayToULDisplay(const Point2D &pt_display, Point2D &pt_ULdisplay) const;
virtual void ULDisplayToDisplay(const Vector2D &vec_ULdisplay, Vector2D &vec_display) const;
virtual void DisplayToULDisplay(const Vector2D &vec_display, Vector2D &vec_ULdisplay) const;
/**
* \brief projects the given point onto current 2D world geometry plane
*/
- virtual bool Project(const Point3D &pt3d_mm, Point3D &projectedPt3d_mm) const;
+ virtual bool Project(const Point3D &pt3d_mm, Point3D &projectedPt3d_mm) const override;
/**
* \brief projects the given vector onto current 2D world geometry plane.
* \warning DEPRECATED, please use Project(const Vector3D &vec3d_mm, Vector3D &projectedVec3d_mm) instead
*/
- virtual bool Project(const Point3D & atPt3d_mm, const Vector3D &vec3d_mm, Vector3D &projectedVec3d_mm) const;
+ virtual bool Project(const Point3D & atPt3d_mm, const Vector3D &vec3d_mm, Vector3D &projectedVec3d_mm) const override;
/**
* \brief projects the given vector onto current 2D world geometry plane
*/
- virtual bool Project(const Vector3D &vec3d_mm, Vector3D &projectedVec3d_mm) const;
+ virtual bool Project(const Vector3D &vec3d_mm, Vector3D &projectedVec3d_mm) const override;
- virtual bool Map(const Point3D &pt3d_mm, Point2D &pt2d_mm) const;
- virtual void Map(const Point2D &pt2d_mm, Point3D &pt3d_mm) const;
- virtual bool Map(const Point3D & atPt3d_mm, const Vector3D &vec3d_mm, Vector2D &vec2d_mm) const;
- virtual void Map(const Point2D & atPt2d_mm, const Vector2D &vec2d_mm, Vector3D &vec3d_mm) const;
+ virtual bool Map(const Point3D &pt3d_mm, Point2D &pt2d_mm) const override;
+ virtual void Map(const Point2D &pt2d_mm, Point3D &pt3d_mm) const override;
+ virtual bool Map(const Point3D & atPt3d_mm, const Vector3D &vec3d_mm, Vector2D &vec2d_mm) const override;
+ virtual void Map(const Point2D & atPt2d_mm, const Vector2D &vec2d_mm, Vector3D &vec3d_mm) const override;
- virtual bool IsValid() const;
+ virtual bool IsValid() const override;
- virtual bool IsAbove(const Point3D &pt3d_mm, bool /*considerBoundingBox=false*/) const { return Superclass::IsAbove(pt3d_mm, true); };
+ virtual bool IsAbove(const Point3D &pt3d_mm, bool /*considerBoundingBox=false*/) const override { return Superclass::IsAbove(pt3d_mm, true); };
protected:
DisplayGeometry();
virtual ~DisplayGeometry();
/**
\brief Called after zooming/panning to restrict these operations to sensible measures.
\return true if a correction in either zooming or panning was made
Enforces a couple of constraints on the relation of the current viewport and the current world geometry.
The basic logic in this lengthy method is:
<ol>
<li> Make display region big enough (in case of too large zoom factors)
<li> Make display region small enough (so that the image cannot be scaled into a single screen pixel
<li> Correct panning for each border (left, right, bottom, top)
</ol>
The little more complicated implementation is illustrated in the code itself.
*/
virtual bool RefitVisibleRect();
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
Vector2D m_OriginInMM;
Vector2D m_OriginInDisplayUnits;
ScalarType m_ScaleFactorMMPerDisplayUnit;
Vector2D m_SizeInMM;
Vector2D m_SizeInDisplayUnits;
PlaneGeometry::ConstPointer m_WorldGeometry;
bool m_ConstrainZoomingAndPanning;
float m_MaxWorldViewPercentage;
float m_MinWorldViewPercentage;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
};
} // namespace
#endif // include guard
diff --git a/Modules/Core/include/mitkDisplayInteractor.h b/Modules/Core/include/mitkDisplayInteractor.h
index 8c7c439ef3..ae7870eb36 100644
--- a/Modules/Core/include/mitkDisplayInteractor.h
+++ b/Modules/Core/include/mitkDisplayInteractor.h
@@ -1,203 +1,203 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDisplayInteractor_h
#define mitkDisplayInteractor_h
#include <MitkCoreExports.h>
#include "mitkInteractionEventObserver.h"
namespace mitk
{
/**
*\class DisplayInteractor
*@brief Observer that manages the interaction with the display.
*
* This includes the interaction of Zooming, Panning, Scrolling and adjusting the LevelWindow.
*
* @ingroup Interaction
**/
/**
* Inherits from mitk::InteractionEventObserver since it doesn't alter any data (only their representation),
* and its actions cannot be associated with a DataNode. Also inherits from EventStateMachine
*/
class MITKCORE_EXPORT DisplayInteractor: public EventStateMachine, public InteractionEventObserver
{
public:
mitkClassMacro(DisplayInteractor, EventStateMachine)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* By this function the Observer gets notified about new events.
* Here it is adapted to pass the events to the state machine in order to use
* its infrastructure.
* It also checks if event is to be accepted when it already has been processed by a DataInteractor.
*/
- virtual void Notify(InteractionEvent* interactionEvent, bool isHandled);
+ virtual void Notify(InteractionEvent* interactionEvent, bool isHandled) override;
protected:
DisplayInteractor();
virtual ~DisplayInteractor();
/**
* Derived function.
* Connects the action names used in the state machine pattern with functions implemented within
* this InteractionEventObserver. This is only necessary here because the events are processed by the state machine.
*/
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
/**
* Derived function.
* Is executed when config object is set / changed.
* Here it is used to read out the parameters set in the configuration file,
* and set the member variables accordingly.
*/
- virtual void ConfigurationChanged();
+ virtual void ConfigurationChanged() override;
/**
* Derived function.
* Is executed when config object is set / changed.
* Here it is used to read out the parameters set in the configuration file,
* and set the member variables accordingly.
*/
- virtual bool FilterEvents(InteractionEvent* interactionEvent, DataNode* dataNode);
+ virtual bool FilterEvents(InteractionEvent* interactionEvent, DataNode* dataNode) override;
virtual bool CheckPositionEvent( const InteractionEvent* interactionEvent );
/**
* \brief Initializes an interaction, saves the pointers start position for further reference.
*/
virtual bool Init(StateMachineAction*, InteractionEvent*);
/**
* \brief Performs panning of the data set in the render window.
*/
virtual bool Move(StateMachineAction*, InteractionEvent*);
/**
* \brief Performs zooming relative to mouse/pointer movement.
*
* Behavior is determined by \see m_ZoomDirection and \see m_ZoomFactor.
*
*/
virtual bool Zoom(StateMachineAction*, InteractionEvent*);
/**
* \brief Performs scrolling relative to mouse/pointer movement.
*
* Behavior is determined by \see m_ScrollDirection and \see m_AutoRepeat.
*
*/
virtual bool Scroll(StateMachineAction*, InteractionEvent*);
/**
* \brief Scrolls one layer up
*/
virtual bool ScrollOneDown(StateMachineAction*, InteractionEvent*);
/**
* \brief Scrolls one layer down
*/
virtual bool ScrollOneUp(StateMachineAction*, InteractionEvent*);
/**
* \brief Adjusts the level windows relative to mouse/pointer movement.
*/
virtual bool AdjustLevelWindow(StateMachineAction*, InteractionEvent*);
/**
* \brief Method to retrieve bool-value for given property from string-property
* in given propertylist.
*/
bool GetBoolProperty( mitk::PropertyList::Pointer propertyList, const char* propertyName, bool defaultValue );
private:
/**
* \brief Coordinate of the pointer at begin of an interaction
*/
mitk::Point2D m_StartDisplayCoordinate;
/**
* \brief Coordinate of the pointer at begin of an interaction translated to mm unit
*/
mitk::Point2D m_StartCoordinateInMM;
/**
* \brief Coordinate of the pointer in the last step within an interaction.
*/
mitk::Point2D m_LastDisplayCoordinate;
/**
* \brief Current coordinates of the pointer.
*/
mitk::Point2D m_CurrentDisplayCoordinate;
/**
* \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;
/** Defines behavior at end of data set.
* If set to true it will restart at end of data set from the beginning.
*/
bool m_AutoRepeat;
/**
* Defines scroll behavior.
* Default is up/down movement of pointer performs scrolling
*/
std::string m_ScrollDirection;
/**
* Defines how the axis of interaction influences scroll behavior.
*/
bool m_InvertScrollDirection;
/**
* Defines scroll behavior.
* Default is up/down movement of pointer performs zooming
*/
std::string m_ZoomDirection;
/**
* Defines how the axis of interaction influences zoom behavior.
*/
bool m_InvertZoomDirection;
/**
* Defines how the axis of interaction influences move behavior.
*/
bool m_InvertMoveDirection;
/**
* Defines level/window behavior.
* Default is left/right movement of pointer modifies the level.
*/
std::string m_LevelDirection;
/**
* Defines how the axis of interaction influences level/window behavior.
*/
bool m_InvertLevelWindowDirection;
/**
* Determines if the Observer reacts to events that already have been processed by a DataInteractor.
* The default value is false.
*/
bool m_AlwaysReact;
/**
* Factor to adjust zooming speed.
*/
float m_ZoomFactor;
};
}
#endif
diff --git a/Modules/Core/include/mitkEnumerationProperty.h b/Modules/Core/include/mitkEnumerationProperty.h
index 81de1363de..949ec91e33 100644
--- a/Modules/Core/include/mitkEnumerationProperty.h
+++ b/Modules/Core/include/mitkEnumerationProperty.h
@@ -1,227 +1,227 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ENUMERATION_PROPERTY__H_
#define _MITK_ENUMERATION_PROPERTY__H_
#include "mitkBaseProperty.h"
#include <map>
#include <string>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* This class may be used to store properties similar to enumeration values.
* Each enumeration value is identified via a string representation and a
* id. Note, that both string representation and id MUST be unique. This is checked
* when inserting a new enumeration value. Please note that you have to add valid
* enumeration values before you may use the Get/SetValue methods.
*
* To use the class enumeration property you have 2 choices:
*
* 1. Directly use the class and add your possible enumeration values via
* AddEnum(name, id). NOte that the ids do not have to be in any order, they
* just have to be unique. The current value is set via SetValue(...) and
* retrieved via GetValueAsId() or GetValueAsString().
* 2. Create a subclass, which adds the possible enumeration values in its
* constructor and maybe adds some additional convenience functions to
* set/get the value. NOte that you should override AddEnum(...) as protected
* so that the user may not add additional invalid enumeration values.
* As example see mitk::VtkRepresentationProperty or mitk::VtkInterpolationProperty
*
* @ingroup DataManagement
*/
class MITKCORE_EXPORT EnumerationProperty : public BaseProperty
{
public:
mitkClassMacro( EnumerationProperty, BaseProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Represents the unique id which is asigned to each enumeration value
*/
typedef unsigned int IdType;
/**
* Type used to store a mapping from enumeration id to enumeration string/
* description
*/
typedef std::map<IdType, std::string> EnumIdsContainerType;
/**
* Type used to store a mapping from enumeration string/description to
* enumeration id
*/
typedef std::map<std::string, IdType> EnumStringsContainerType;
/**
* Type used for iterators over all defined enumeration values.
*/
typedef EnumIdsContainerType::const_iterator EnumConstIterator;
/**
* Adds an enumeration value into the enumeration. The name and id provided
* must be unique. This is checked while adding the new enumeration value.
* If it is not unique, false is returned. If addition was successful, true
* is returned.
* @param name the unique string representation of the enumeration value
* @param id the unique integer representation of the enumeration value
* @returns true, if the name/id combination was successfully added to the
* enumeration values or true otherwise
*/
virtual bool AddEnum( const std::string& name, const IdType& id );
/**
* Sets the current value of the enumeration
* @param name the string representation of the enumeration value to set
* @returns true if the value was successfully set (i.e. it was valid), or
* false, if the name provided is incalid.
*/
virtual bool SetValue( const std::string& name );
/**
* Sets the current value of the enumeration
* @param id the integer representation of the enumeration value to set
* @returns true if the value was successfully set (i.e. it was valid), or
* false, if the id provided is invalid.
*/
virtual bool SetValue( const IdType& id );
/**
* Returns the id of the current enumeration value. If it was not yet set,
* the return value is unspecified
*/
virtual IdType GetValueAsId() const;
/**
* Returns the string representation of the current enumeration value. If it
* was not yet set, the return value is unspecified
*/
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
/**
* Clears all possible enumeration values and the current enumeration value.
*/
virtual void Clear();
/**
* Determines the number of enumeration values which have been added via
* AddEnum(...).
* @returns the number of enumeration values associated with this Enumeration
* Property
*/
virtual EnumIdsContainerType::size_type Size() const;
/**
* Provides access to the set of known enumeration values. The string representation
* may be accessed via iterator->second, the id may be access via iterator->first
* @returns an iterator over all enumeration values.
*/
virtual EnumConstIterator Begin() const;
/**
* Specifies the end of the range of the known enumeration values.
* @returns an iterator pointing past the last known element of the possible
* enumeration values.
*/
virtual EnumConstIterator End() const;
/**
* Returns the string representation for the given id.
* @param id the id for which the string representation should be determined
* if id is invalid, the return value is unspecified.
* @returns the string representation of the given enumeration value
*/
virtual std::string GetEnumString( const IdType& id ) const;
/**
* Returns the integer representation for the given string.
* @param name the enumeration name for which the integer representation should be determined
* if the name is invalid, the return value is unspecified.
* @returns the integer representation of the given enumeration value
*/
virtual IdType GetEnumId( const std::string& name ) const;
/**
* Determines if a given integer representation of an enumeration value
* is valid or not
* @param val the integer value to check
* @returns true if the given value is valid or false otherwise
*/
virtual bool IsValidEnumerationValue( const IdType& val ) const;
/**
* Determines if a given string representation of an enumeration value
* is valid or not
* @param val the string to check
* @returns true if the given value is valid or false otherwise
*/
virtual bool IsValidEnumerationValue( const std::string& val ) const;
const EnumIdsContainerType& GetEnumIds() const;
const EnumStringsContainerType& GetEnumStrings() const;
EnumIdsContainerType& GetEnumIds();
EnumStringsContainerType& GetEnumStrings();
using BaseProperty::operator=;
protected:
/**
* Default constructor. The current value of the enumeration is undefined.
*/
EnumerationProperty();
EnumerationProperty(const EnumerationProperty&);
- virtual bool IsEqual( const BaseProperty& property ) const;
- virtual bool Assign( const BaseProperty& property );
+ virtual bool IsEqual( const BaseProperty& property ) const override;
+ virtual bool Assign( const BaseProperty& property ) override;
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
private:
// purposely not implemented
EnumerationProperty& operator=(const EnumerationProperty&);
IdType m_CurrentValue;
typedef std::map<std::string, EnumIdsContainerType> IdMapForClassNameContainerType;
typedef std::map<std::string, EnumStringsContainerType> StringMapForClassNameContainerType;
static IdMapForClassNameContainerType s_IdMapForClassName;
static StringMapForClassNameContainerType s_StringMapForClassName;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace
#endif
diff --git a/Modules/Core/include/mitkEventMapper.h b/Modules/Core/include/mitkEventMapper.h
index 414f398b8e..0b02eea1d4 100644
--- a/Modules/Core/include/mitkEventMapper.h
+++ b/Modules/Core/include/mitkEventMapper.h
@@ -1,208 +1,208 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef EVENTMAPPER_H_HEADER_INCLUDED
#define EVENTMAPPER_H_HEADER_INCLUDED
#include <mitkEvent.h>
#include <MitkCoreExports.h>
#include <mitkEventDescription.h>
#include <vtkXMLParser.h>
#include <itkSmartPointer.h>
#include <vector>
#include <map>
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
/**
* \deprecatedSince{2013_03} EventMapper is deprecated. It will become obsolete.
* Mapping from Qt to MITK events is performed now by mitk::QmitkRenderWindow .
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_EXPORT EventMapper : public vtkXMLParser
{
public:
static EventMapper *New();
vtkTypeMacro(EventMapper,vtkXMLParser);
typedef std::vector<mitk::EventDescription> EventDescriptionVec;
typedef std::vector<mitk::EventDescription>::iterator EventDescriptionVecIter;
typedef std::map<const char*, int, ltstr> ConstMap;
typedef std::map<const char*, int, ltstr>::iterator ConstMapIter;
typedef std::vector< itk::SmartPointer<mitk::EventMapperAddOn> > 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);
+ void StartElement (const char *elementName, const char **atts) override;
//##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/Modules/Core/include/mitkEventRecorder.h b/Modules/Core/include/mitkEventRecorder.h
index 5ce326cee2..3cc9185b6e 100644
--- a/Modules/Core/include/mitkEventRecorder.h
+++ b/Modules/Core/include/mitkEventRecorder.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkEventRecorder_h
#define mitkEventRecorder_h
#include <MitkCoreExports.h>
#include "mitkInteractionEventObserver.h"
#include "iostream"
namespace mitk
{
/**
*\class EventRecorder
*@brief Observer that enables recoding of all user interaction with the render windows and storing it in an XML file.
*
* @ingroup Interaction
*
* XML file will look like
*
* <?xml version="1.0"?>
* <interactions>
* <config>
* <renderer RendererName="stdmulti.widget1" ViewDirection="0"/>
* <renderer RendererName="stdmulti.widget2" ViewDirection="1"/>
* <renderer RendererName="stdmulti.widget3" ViewDirection="2"/>
* </config>
* <events>
* <event_variant class="MOUSEMOVEEVENT" >
* <attribute name="PositionOnScreen" value="491,388"/>
* <attribute name="PositionInWorld" value="128,235.771,124.816"/>
* <attribute name="RendererName" value="stdmulti.widget2"/>
* </event_variant>
* </events>
* </interactions>
**/
class MITKCORE_EXPORT EventRecorder: public InteractionEventObserver
{
public:
EventRecorder();
~EventRecorder();
/**
* By this function the Observer gets notified about new events.
*/
- virtual void Notify(InteractionEvent* interactionEvent, bool);
+ virtual void Notify(InteractionEvent* interactionEvent, bool) override;
/**
* @brief SetEventIgnoreList Optional. Provide a list of strings that describe which events are to be ignored
*/
void SetEventIgnoreList(std::vector<std::string> list);
void StartRecording();
void StopRecording();
bool IsActive(){ return m_Active; }
void SetOutputFile(std::string filename)
{
m_FileName = filename;
}
private:
/**
* @brief m_IgnoreList lists the names of events that are dropped
*/
std::vector<std::string> m_IgnoreList;
/**
* @brief m_Active determindes if events are caught and written to file
*/
bool m_Active;
std::string m_FileName;
std::ofstream m_FileStream;
};
}
#endif
diff --git a/Modules/Core/include/mitkEventStateMachine.h b/Modules/Core/include/mitkEventStateMachine.h
index 12078a3096..ef7c4a0948 100644
--- a/Modules/Core/include/mitkEventStateMachine.h
+++ b/Modules/Core/include/mitkEventStateMachine.h
@@ -1,253 +1,253 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKEVENTSTATEMACHINE_H_
#define MITKEVENTSTATEMACHINE_H_
#include "itkObject.h"
#include "mitkCommon.h"
#include "mitkMessage.h"
#include "mitkInteractionEventHandler.h"
#include <MitkCoreExports.h>
#include <string>
/**
* Macro that can be used to connect a StateMachineAction with a function.
* It assumes that there is a typedef Classname Self in classes that use
* this macro, as is provided by e.g. mitkClassMacro
*/
#define CONNECT_FUNCTION(a, f) \
::mitk::EventStateMachine::AddActionFunction(a, ::mitk::MessageDelegate2<Self, ::mitk::StateMachineAction*, ::mitk::InteractionEvent*, bool>(this, &Self::f));
#define CONNECT_CONDITION(a, f) \
::mitk::EventStateMachine::AddConditionFunction(a, ::mitk::MessageDelegate1<Self,const ::mitk::InteractionEvent*, bool>(this, &Self::f));
namespace us {
class Module;
}
namespace mitk
{
class StateMachineTransition;
class StateMachineContainer;
class StateMachineAction;
class StateMachineCondition;
class InteractionEvent;
class StateMachineState;
class DataNode;
class UndoController;
/**
* \class TActionFunctor
* \brief Base class of ActionFunctors, to provide an easy to connect actions with functions.
*
* \deprecatedSince{2013_03} Use mitk::Message classes instead.
*/
class TActionFunctor
{
public:
virtual bool DoAction(StateMachineAction*, InteractionEvent*)=0;
virtual ~TActionFunctor()
{
}
};
/**
* \class TSpecificActionFunctor
* Specific implementation of ActionFunctor class, implements a reference to the function which is to be executed. It takes two arguments:
* StateMachineAction - the action by which the function call is invoked, InteractionEvent - the event that caused the transition.
*/
template<class T>
class DEPRECATED() TSpecificActionFunctor : public TActionFunctor
{
public:
TSpecificActionFunctor(T* object, bool (T::*memberFunctionPointer)(StateMachineAction*, InteractionEvent*)) :
m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
virtual ~TSpecificActionFunctor()
{
}
- virtual bool DoAction(StateMachineAction* action, InteractionEvent* event)
+ virtual bool DoAction(StateMachineAction* action, InteractionEvent* event) override
{
return (*m_Object.*m_MemberFunctionPointer)(action, event);// executes member function
}
private:
T* m_Object;
bool (T::*m_MemberFunctionPointer)(StateMachineAction*, InteractionEvent*);
};
/**
* \class EventStateMachine
*
* \brief Super-class that provides the functionality of a StateMachine to DataInteractors.
*
* A state machine is created by loading a state machine pattern. It consists of states, transitions and action.
* The state represent the current status of the interaction, transitions are means to switch between states. Each transition
* is triggered by an event and it is associated with actions that are to be executed when the state change is performed.
*
*/
class MITKCORE_EXPORT EventStateMachine : public mitk::InteractionEventHandler
{
public:
mitkClassMacro(EventStateMachine, InteractionEventHandler)
typedef std::map<std::string, TActionFunctor*> DEPRECATED(ActionFunctionsMapType);
typedef itk::SmartPointer<StateMachineState> StateMachineStateType;
/**
* @brief Loads XML resource
*
* Loads a XML resource file from the given module.
* Default is the Mitk module (core).
* The files have to be placed in the Resources/Interaction folder of their respective module.
**/
bool LoadStateMachine(const std::string& filename, const us::Module* module = NULL);
/**
* Receives Event from Dispatcher.
* Event is mapped using the EventConfig Object to a variant, then it is checked if the StateMachine is listening for
* such an Event. If this is the case, the transition to the next state it performed and all actions associated with the transition executed,
* and true is returned to the caller.
* If the StateMachine can't handle this event false is returned.
* Attention:
* If a transition is associated with multiple actions - "true" is returned if one action returns true,
* and the event is treated as HANDLED even though some actions might not have been executed! So be sure that all actions that occur within
* one transitions have the same conditions.
*/
bool HandleEvent(InteractionEvent* event, DataNode* dataNode);
/**
* @brief Enables or disabled Undo.
**/
void EnableUndo(bool enable)
{
m_UndoEnabled = enable;
}
/**
* @brief Enables/disables the state machine. In un-enabled state it won't react to any events.
**/
void EnableInteraction(bool enable)
{
m_IsActive = enable;
}
protected:
EventStateMachine();
virtual ~EventStateMachine();
typedef MessageAbstractDelegate2<StateMachineAction*, InteractionEvent*, bool> ActionFunctionDelegate;
typedef MessageAbstractDelegate1<const InteractionEvent*, bool> ConditionFunctionDelegate;
/**
* Connects action from StateMachine (String in XML file) with a function that is called when this action is to be executed.
*/
DEPRECATED(void AddActionFunction(const std::string& action, TActionFunctor* functor));
void AddActionFunction(const std::string& action, const ActionFunctionDelegate& delegate);
void AddConditionFunction(const std::string& condition, const ConditionFunctionDelegate& delegate);
StateMachineState* GetCurrentState() const;
/**
* @brief ResetToStartState Reset state machine to it initial starting state.
*/
void ResetToStartState();
/**
* Is called after loading a statemachine.
* Overwrite this function in specific interactor implementations.
* Connect actions and functions using the CONNECT_FUNCTION macro within this function.
*/
virtual void ConnectActionsAndFunctions();
virtual bool CheckCondition( const StateMachineCondition& condition, const InteractionEvent* interactionEvent );
/**
* Looks up function that is associated with action and executes it.
* To implement your own execution scheme overwrite this in your DataInteractor.
*/
virtual bool ExecuteAction(StateMachineAction* action, InteractionEvent* interactionEvent);
/**
* Implements filter scheme for events.
* Standard implementation accepts events from 2d and 3d windows,
* and rejects events if DataNode is not visible.
* \return true if event is accepted, else false
*
* Overwrite this function to adapt for your own needs, for example to filter out events from
* 3d windows like this:
\code
bool mitk::EventStateMachine::FilterEvents(InteractionEvent* interactionEvent, DataNode*dataNode)
{
return interactionEvent->GetSender()->GetMapperID() == BaseRenderer::Standard2D; // only 2D mappers
}
\endcode
* or to enforce that the interactor only reacts when the corresponding DataNode is selected in the DataManager view..
*/
virtual bool FilterEvents(InteractionEvent* interactionEvent, DataNode* dataNode);
/**
* \brief Returns the executable transition for the given event.
*
* This method takes a list of transitions that correspond to the given
* event from the current state.
*
* This method iterates through all transitions and checks all
* corresponding conditions. The results of each condition in stored in
* map, as other transitions may need the same condition again.
*
* As soon as a transition is found for which all conditions are
* fulfilled, this instance is returned.
*
* If a transition has no condition, it is automatically returned.
* If no executable transition is found, NULL is returned.
*/
StateMachineTransition* GetExecutableTransition( InteractionEvent* event );
// Determines if state machine reacts to events
bool m_IsActive;
// Undo/Redo
UndoController* m_UndoController;
bool m_UndoEnabled;
private:
typedef std::map<std::string, ActionFunctionDelegate*> ActionDelegatesMapType;
typedef std::map<std::string, ConditionFunctionDelegate*> ConditionDelegatesMapType;
StateMachineContainer* m_StateMachineContainer; // storage of all states, action, transitions on which the statemachine operates.
std::map<std::string, TActionFunctor*> m_ActionFunctionsMap; // stores association between action string
ActionDelegatesMapType m_ActionDelegatesMap;
ConditionDelegatesMapType m_ConditionDelegatesMap;
StateMachineStateType m_CurrentState;
};
} /* namespace mitk */
#endif /* MITKEVENTSTATEMACHINE_H_ */
diff --git a/Modules/Core/include/mitkExtractSliceFilter.h b/Modules/Core/include/mitkExtractSliceFilter.h
index a425f62d5a..4ba9dcecbc 100644
--- a/Modules/Core/include/mitkExtractSliceFilter.h
+++ b/Modules/Core/include/mitkExtractSliceFilter.h
@@ -1,179 +1,179 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkExtractSliceFilter_h_Included
#define mitkExtractSliceFilter_h_Included
#include "MitkCoreExports.h"
#include "mitkImageToImageFilter.h"
#include <vtkSmartPointer.h>
#include <vtkImageReslice.h>
#include <vtkMatrix4x4.h>
#include <vtkImageData.h>
#include <vtkPoints.h>
#include <vtkTransform.h>
#include <vtkAbstractTransform.h>
namespace mitk
{
/**
\brief ExtractSliceFilter extracts a 2D abitrary oriented slice from a 3D volume.
The filter can reslice in all orthogonal planes such as sagittal, coronal and axial,
and is also able to reslice a abitrary oriented oblique plane.
Curved planes are specified via an AbstractTransformGeometry as the input worldgeometry.
The convinient workflow is:
1. Set an image as input.
2. Set the worldPlaneGeometry. This defines a grid where the slice is being extracted
3. And then start the pipeline.
There are a few more properties that can be set to modify the behavior of the slicing.
The properties are:
- interpolation mode either Nearestneighbor, Linear or Cubic.
- a transform this is a convinient way to adapt the reslice axis for the case
that the image is transformed e.g. rotated.
- time step the time step in a times volume.
- resample by geometry wether the resampling grid corresponds to the specs of the
worldgeometry or is directly derived from the input image
By default the properties are set to:
- interpolation mode Nearestneighbor.
- a transform NULL (No transform is set).
- time step 0.
- resample by geometry false (Corresponds to input image).
*/
class MITKCORE_EXPORT ExtractSliceFilter : public ImageToImageFilter
{
public:
mitkClassMacro(ExtractSliceFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(Self, vtkImageReslice*);
/** \brief Set the axis where to reslice at.*/
void SetWorldGeometry(const PlaneGeometry* geometry ){
this->m_WorldGeometry = geometry;
this->Modified(); }
/** \brief Set the time step in the 4D volume */
void SetTimeStep( unsigned int timestep){ this->m_TimeStep = timestep; }
unsigned int GetTimeStep(){ return this->m_TimeStep; }
/** \brief Set a transform for the reslice axes.
* This transform is needed if the image volume itself is transformed. (Effects the reslice axis)
*/
void SetResliceTransformByGeometry(const BaseGeometry* transform){ this->m_ResliceTransform = transform; }
/** \brief Resampling grid corresponds to: false->image true->worldgeometry*/
void SetInPlaneResampleExtentByGeometry(bool inPlaneResampleExtentByGeometry){ this->m_InPlaneResampleExtentByGeometry = inPlaneResampleExtentByGeometry; }
/** \brief Sets the output dimension of the slice*/
void SetOutputDimensionality(unsigned int dimension){ this->m_OutputDimension = dimension; }
/** \brief Set the spacing in z direction manually.
* Required if the outputDimension is > 2.
*/
void SetOutputSpacingZDirection(double zSpacing){ this->m_ZSpacing = zSpacing; }
/** \brief Set the extent in pixel for direction z manualy.
Required if the output dimension is > 2.
*/
void SetOutputExtentZDirection(int zMin, int zMax) { this->m_ZMin = zMin; this->m_ZMax = zMax; }
/** \brief Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax]
* The method uses the input of the filter to calculate the bounds.
* It is recommended to use
* GetClippedPlaneBounds(const BaseGeometry*, const PlaneGeometry*, double*)
* if you are not sure about the input.
*/
bool GetClippedPlaneBounds(double bounds[6]);
/** \brief Get the bounding box of the slice [xMin, xMax, yMin, yMax, zMin, zMax]*/
bool GetClippedPlaneBounds( const BaseGeometry *boundingGeometry,
const PlaneGeometry *planeGeometry, double *bounds );
/** \brief Get the spacing of the slice. returns mitk::ScalarType[2] */
mitk::ScalarType* GetOutputSpacing();
/** \brief Get Output as vtkImageData.
* Note:
* SetVtkOutputRequest(true) has to be called at least once before
* GetVtkOutput(). Otherwise the output is empty for the first update step.
*/
vtkImageData* GetVtkOutput(){ m_VtkOutputRequested = true; return m_Reslicer->GetOutput(); }
/** Set VtkOutPutRequest to suppress the convertion of the image.
* It is suggested to use this with GetVtkOutput().
* Note:
* SetVtkOutputRequest(true) has to be called at least once before
* GetVtkOutput(). Otherwise the output is empty for the first update step.
*/
void SetVtkOutputRequest(bool isRequested){ m_VtkOutputRequested = isRequested; }
/** \brief Get the reslices axis matrix.
* Note: the axis are recalculated when calling SetResliceTransformByGeometry.
*/
vtkMatrix4x4* GetResliceAxes(){
return this->m_Reslicer->GetResliceAxes();
}
void SetBackgroundLevel(double backgroundLevel) { m_BackgroundLevel = backgroundLevel; }
enum ResliceInterpolation { RESLICE_NEAREST=0, RESLICE_LINEAR=1, RESLICE_CUBIC=3 };
void SetInterpolationMode( ExtractSliceFilter::ResliceInterpolation interpolation){ this->m_InterpolationMode = interpolation; }
protected:
ExtractSliceFilter(vtkImageReslice* reslicer = NULL);
virtual ~ExtractSliceFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
+ virtual void GenerateInputRequestedRegion() override;
const PlaneGeometry* m_WorldGeometry;
vtkSmartPointer<vtkImageReslice> m_Reslicer;
unsigned int m_TimeStep;
unsigned int m_OutputDimension;
double m_ZSpacing;
int m_ZMin;
int m_ZMax;
ResliceInterpolation m_InterpolationMode;
BaseGeometry::ConstPointer m_ResliceTransform;
bool m_InPlaneResampleExtentByGeometry;//Resampling grid corresponds to: false->image true->worldgeometry
mitk::ScalarType* m_OutPutSpacing;
bool m_VtkOutputRequested;
double m_BackgroundLevel;
};
}
#endif // mitkExtractSliceFilter_h_Included
diff --git a/Modules/Core/include/mitkFileReader.h b/Modules/Core/include/mitkFileReader.h
index 807e349415..f497025791 100644
--- a/Modules/Core/include/mitkFileReader.h
+++ b/Modules/Core/include/mitkFileReader.h
@@ -1,110 +1,110 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef FILEREADER_H_HEADER_INCLUDED_C1E7E521
#define FILEREADER_H_HEADER_INCLUDED_C1E7E521
#include <MitkCoreExports.h>
-#include <itkMacro.h>
+#include <mitkCommon.h>
namespace mitk {
//##Documentation
//## @brief Interface class of readers that read from files
//## @ingroup DeprecatedIO
//## @deprecatedSince{2014_10} Use mitk::IFileReader instead.
class MITKCORE_EXPORT FileReader
{
public:
- itkTypeMacroNoParent(FileReader)
+ mitkClassMacroNoParent(FileReader)
//##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/Modules/Core/include/mitkFileWriter.h b/Modules/Core/include/mitkFileWriter.h
index ba1cf6f38e..aaff637200 100644
--- a/Modules/Core/include/mitkFileWriter.h
+++ b/Modules/Core/include/mitkFileWriter.h
@@ -1,166 +1,166 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef FILEWRITER_H_HEADER_INCLUDED
#define FILEWRITER_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include <itkProcessObject.h>
#include <mitkDataNode.h>
namespace mitk {
//##Documentation
//## @brief Interface class of writers that write data to files
//## @ingroup DeprecatedIO
//## @deprecatedSince{2014_10} Use mitk::IFileWriter instead.
class MITKCORE_EXPORT FileWriter : public itk::ProcessObject
{
public:
- mitkClassMacro(FileWriter,itk::ProcessObject);
+ mitkClassMacroItkParent(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<std::string> 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();
virtual std::string GetSupportedBaseData() const = 0;
using ProcessObject::SetInput;
void SetInput( BaseData* data );
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/Modules/Core/include/mitkFocusManager.h b/Modules/Core/include/mitkFocusManager.h
index 7173fd3639..f157ce4b8e 100755
--- a/Modules/Core/include/mitkFocusManager.h
+++ b/Modules/Core/include/mitkFocusManager.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197
#define MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197
#include <MitkCoreExports.h>
#include "mitkBaseRenderer.h"
#include <vector>
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
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 MITKCORE_EXPORT FocusManager : public itk::Object
{
public:
- mitkClassMacro(FocusManager, itk::Object);
+ mitkClassMacroItkParent(FocusManager, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//##Documentation
//##@brief Element, that can be focused and held here.
//##
//## has to be an itk-Object in order to use itk-Smartpointer!
typedef mitk::BaseRenderer FocusElement;
typedef itk::WeakPointer<FocusElement> FocusElementWeakPointer;
typedef std::vector<FocusElementWeakPointer> FocusElementList;
typedef std::vector<FocusElementWeakPointer>::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
//## If the focus was on the removed widget then the next widget
//## will get the focus, as described in GoToNext().
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<FocusElement> m_FocElement;
//##Documentation
//## switch which sets the LoopMode.
//## if true, then the next after the last one is the first
bool m_Loop;
};
#pragma GCC visibility push(default)
//##Documentation
//## @brief connect to this Event to get noticed when the focus changes
itkEventMacro( FocusEvent , itk::AnyEvent );
#pragma GCC visibility pop
} // namespace mitk
#endif /* MITKFOCUSMANAGER_H_HEADER_INCLUDED_C135A197 */
diff --git a/Modules/Core/include/mitkGenericProperty.h b/Modules/Core/include/mitkGenericProperty.h
index 2567a6f4b2..bb77da6280 100644
--- a/Modules/Core/include/mitkGenericProperty.h
+++ b/Modules/Core/include/mitkGenericProperty.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE
#define MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE
#include <string>
#include <sstream>
#include <stdlib.h>
#include "mitkNumericTypes.h"
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/*!
@ brief Template class for generating properties for int, float, bool, etc.
This class template can be instantiated for all classes/internal types that fulfills
these requirements:
- an operator<< so that the properties value can be put into a std::stringstream
- an operator== so that two properties can be checked for equality
Note: you must use the macro mitkSpecializeGenericProperty to provide specializations
for concrete types (e.g. BoolProperty). Please see mitkProperties.h for examples. If you
don't use the mitkSpecializeGenericProperty Macro, GetNameOfClass() returns a wrong name.
*/
template <typename T>
class MITK_EXPORT GenericProperty : public BaseProperty
{
public:
mitkClassMacro(GenericProperty, BaseProperty);
mitkNewMacro1Param(GenericProperty<T>, T);
itkCloneMacro(Self)
typedef T ValueType;
itkSetMacro(Value,T);
itkGetConstMacro(Value,T);
- virtual std::string GetValueAsString() const
+ virtual std::string GetValueAsString() const override
{
std::stringstream myStr;
myStr << GetValue() ;
return myStr.str();
}
using BaseProperty::operator=;
protected:
GenericProperty() {}
GenericProperty(T x)
: m_Value(x) {}
GenericProperty(const GenericProperty& other)
: BaseProperty(other)
, m_Value(other.m_Value)
{}
T m_Value;
private:
// purposely not implemented
GenericProperty& operator=(const GenericProperty&);
- virtual itk::LightObject::Pointer InternalClone() const
+ virtual itk::LightObject::Pointer InternalClone() const override
{
itk::LightObject::Pointer result(new Self(*this));
result->UnRegister();
return result;
}
- virtual bool IsEqual(const BaseProperty& other) const
+ virtual bool IsEqual(const BaseProperty& other) const override
{
return (this->m_Value == static_cast<const Self&>(other).m_Value);
}
- virtual bool Assign(const BaseProperty& other)
+ virtual bool Assign(const BaseProperty& other) override
{
this->m_Value = static_cast<const Self&>(other).m_Value;
return true;
}
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // 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 subclass of GenericProperty
* @param Type the value type of the GenericProperty
* @param Export the export macro for DLL usage
*/
#define mitkDeclareGenericProperty(PropertyName,Type,Export) \
class Export PropertyName: public GenericProperty< Type > \
{ \
public: \
mitkClassMacro(PropertyName, GenericProperty< Type >) \
itkFactorylessNewMacro(Self) \
itkCloneMacro(Self) \
mitkNewMacro1Param(PropertyName, Type) \
using BaseProperty::operator=; \
protected: \
PropertyName(); \
PropertyName(const PropertyName&); \
PropertyName(Type x); \
private: \
- itk::LightObject::Pointer InternalClone() const; \
+ itk::LightObject::Pointer InternalClone() const override; \
};
#define mitkDefineGenericProperty(PropertyName,Type,DefaultValue) \
mitk::PropertyName::PropertyName() : Superclass(DefaultValue) { } \
mitk::PropertyName::PropertyName(const PropertyName& other) : GenericProperty< Type >(other) {} \
mitk::PropertyName::PropertyName(Type x) : Superclass(x) {} \
- itk::LightObject::Pointer mitk::PropertyName::InternalClone() const { \
+ itk::LightObject::Pointer mitk::PropertyName::InternalClone() const { \
itk::LightObject::Pointer result(new Self(*this)); \
result->UnRegister(); \
return result; \
} \
#endif /* MITKGENERICPROPERTY_H_HEADER_INCLUDED_C1061CEE */
diff --git a/Modules/Core/include/mitkGeometry3D.h b/Modules/Core/include/mitkGeometry3D.h
index 25959e6c76..2bb325f1a1 100644
--- a/Modules/Core/include/mitkGeometry3D.h
+++ b/Modules/Core/include/mitkGeometry3D.h
@@ -1,81 +1,81 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "mitkNumericTypes.h"
#include "itkScalableAffineTransform.h"
#include <itkIndex.h>
#include "mitkBaseGeometry.h"
class vtkLinearTransform;
namespace mitk {
//##Documentation
//## @brief Standard implementation of BaseGeometry.
//##
//## @ingroup Geometry
class MITKCORE_EXPORT Geometry3D : public BaseGeometry
{
public:
mitkClassMacro(Geometry3D, mitk::BaseGeometry)
typedef itk::QuaternionRigidTransform< ScalarType > QuaternionTransformType;
typedef QuaternionTransformType::VnlQuaternionType VnlQuaternionType;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
mitkNewMacro1Param(Self, const Self&)
itkCloneMacro(Self)
//itkGetConstReferenceMacro(TimeBounds, TimeBounds);
//virtual void SetTimeBounds(const TimeBounds& timebounds);
protected:
Geometry3D();
Geometry3D(const Geometry3D&);
//##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 itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
virtual ~Geometry3D();
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
};
} // namespace mitk
#endif /* GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Modules/Core/include/mitkGeometryData.h b/Modules/Core/include/mitkGeometryData.h
index c63e272c71..72022a8a42 100644
--- a/Modules/Core/include/mitkGeometryData.h
+++ b/Modules/Core/include/mitkGeometryData.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRYDATA_H_HEADER_INCLUDED_C19C01E2
#define MITKGEOMETRYDATA_H_HEADER_INCLUDED_C19C01E2
#include "mitkBaseData.h"
namespace mitk {
//##Documentation
//## @brief Data class only having a BaseGeometry but not containing
//## any specific data.
//##
//## Only implements pipeline methods which are abstract in BaseData.
//## @ingroup Geometry
class MITKCORE_EXPORT GeometryData : public BaseData
{
public:
mitkClassMacro(GeometryData, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
- virtual void CopyInformation(const itk::DataObject *data);
+ virtual void CopyInformation(const itk::DataObject *data) override;
protected:
GeometryData();
virtual ~GeometryData();
};
} // namespace mitk
#endif /* MITKGEOMETRYDATA_H_HEADER_INCLUDED_C19C01E2 */
diff --git a/Modules/Core/include/mitkGlobalInteraction.h b/Modules/Core/include/mitkGlobalInteraction.h
index 18dd4e9fb4..108049422c 100755
--- a/Modules/Core/include/mitkGlobalInteraction.h
+++ b/Modules/Core/include/mitkGlobalInteraction.h
@@ -1,324 +1,324 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A
#define GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A
#include "mitkFocusManager.h"
#include <MitkCoreExports.h>
#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 <strong>must</strong> 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.
//## Additional to that a EVENT_NOTIFICATION_POLICY can be set. This can be either INFORM_MULTIPLE (the event is passed
//## to all listeners) or INFORM_ONE (event is passed to the listener which can handle the event best and only to this one).
//##
//## To divide these two types of statemachine this class holds three lists and two maps:
//## m_ListenerList, m_InteractorList, m_SelectedList and m_InteractorRelevanceMap and m_ListenerRelevanceMap
//## 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_InteractorRelevanceMap and m_ListenerRelevanceMap map values returned from CanHandleEvent to the asked Interactors and Listeners.
//## Through m_InteractorRelevanceMap stepping through interactors, that were not selected and could handle that event, can be done.
//## Through m_ListenerRelevanceMap the listener which can handle the event best can be determined. In case of the INFORM_ONE notification policy
//## the event is passed to just this listener
//##
//## 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 Relevance.
//## 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
/**
* \deprecatedSince{2013_03} GlobalInteraction is deprecated. It is replaced by mitk::Dispatcher.
* Please use the new implementation described in \see DataInteractionPage .
*/
class MITKCORE_EXPORT GlobalInteraction : public StateMachine
{
public:
mitkClassMacro(GlobalInteraction, StateMachine);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef std::vector<StateMachine::Pointer> StateMachineList;
typedef std::vector<StateMachine*> StateMachineCPointerList;
typedef StateMachineList::iterator StateMachineListIter;
typedef StateMachineCPointerList::iterator StateMachineCPointerListIter;
typedef std::vector<Interactor::Pointer> InteractorList;
typedef InteractorList::iterator InteractorListIter;
typedef std::multimap<float, Interactor::Pointer, std::greater<double> > InteractorMap;
typedef std::multimap<float, StateMachine::Pointer, std::greater<double> > StateMachineMap;
typedef InteractorMap::iterator InteractorMapIter;
typedef StateMachineMap::iterator StateMachineMapIter;
/**
* Enum for setting the event notification policy of the GlobalInteraction.
*/
enum EVENT_NOTIFICATION_POLICY
{
INFORM_MULTIPLE, /** For setting that all registered listeners are informed */
INFORM_ONE /** For setting that just the listener that can handle the event best is informed */
};
//##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;}
/**
* @brief Set the policy of how the global interaction informs listeners and interactors
*
* INFORM_MULTIPLE broadcasts the event to all listeners and interactors that can handle the event
* INFORM_ONE only informs the listener or interactor which can handle the event best
**/
void SetEventNotificationPolicy(EVENT_NOTIFICATION_POLICY);
/**
* Return the current set eventspreading policy
* @returns the current event spreading policy
**/
EVENT_NOTIFICATION_POLICY GetEventNotificationPolicy() const;
//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);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
/*
*@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_RelevanceMap
bool AskCurrentInteractor(mitk::StateEvent const* stateEvent);
//##Documentation
//##@brief filling m_InteractorRelevanceMap
//##
//## @ params threshold: if the calculated Relevance value is above threshold, then add it to the map
void FillInteractorRelevanceMap(mitk::StateEvent const* stateEvent, float threshold);
//##Documentation
//##@brief filling m_ListenerRelevanceMap
//##
//## @ params threshold: if the calculated Relevance value is above threshold, then add it to the map
void FillListenerRelevanceMap(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_InteractorRelevanceMap;
//##Documentation
//## @brief map for sorting all listeners by the value returned from CanHandleEvent(..).
//##
//## With that list certain listeners can be looped through like diving through layers
StateMachineMap m_ListenerRelevanceMap;
//##Documentation
//## @brief iterator on an entry in m_RelevanceMap 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;
EVENT_NOTIFICATION_POLICY m_EventNotificationPolicy;
};
} // namespace mitk
#endif /* GLOBALINTERACTION_H_HEADER_INCLUDED_C152938A */
diff --git a/Modules/Core/include/mitkGradientBackground.h b/Modules/Core/include/mitkGradientBackground.h
index 2739cd6c39..3fe5f5756d 100644
--- a/Modules/Core/include/mitkGradientBackground.h
+++ b/Modules/Core/include/mitkGradientBackground.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkGradientBackground_h
#define mitkGradientBackground_h
#include <itkObject.h>
#include <mitkCommon.h>
#include <mitkColorProperty.h>
#include <vtkSmartPointer.h>
class vtkRenderer;
class vtkRenderWindow;
namespace mitk {
class RenderWindow;
/**
* Displays a color gradient in the background
* of a vtkRenderWindow.
* The gradient ist faked by displaying a non-interactable
* smoothly shaded plane in a separate layer behind the
* scene. After setting the renderwindow, the gradient may be
* activated by calling Enable()
*/
class MITKCORE_EXPORT GradientBackground : public itk::Object
{
public:
- mitkClassMacro( GradientBackground, itk::Object );
+ mitkClassMacroItkParent( GradientBackground, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Sets the renderwindow, in which the gradient background
* will be shown. Make sure, you have called this function
* before calling Enable()
*/
virtual void SetRenderWindow( vtkSmartPointer<vtkRenderWindow> renderWindow );
/**
* Returns the vtkRenderWindow, which is used
* for displaying the gradient background
*/
virtual vtkSmartPointer<vtkRenderWindow> GetRenderWindow();
/**
* Returns the renderer responsible for
* rendering the color gradient into the
* vtkRenderWindow
*/
virtual vtkSmartPointer<vtkRenderer> GetVtkRenderer();
/**
* Sets the gradient colors. The gradient
* will smoothly fade from color1 to color2
*/
virtual void SetGradientColors(double r1, double g1, double b1, double r2, double g2, double b2);
virtual void SetGradientColors(Color upper, Color lower);
virtual void SetUpperColor(double r, double g, double b );
virtual void SetLowerColor(double r, double g, double b );
virtual void SetUpperColor(Color upper);
virtual void SetLowerColor(Color lower);
/**
* Enables drawing of the color gradient background.
* If you want to disable it, call the Disable() function.
*/
virtual void Enable();
/**
* Disables drawing of the color gradient background.
* If you want to enable it, call the Enable() function.
*/
virtual void Disable();
/**
* Checks, if the gradient background is currently
* enabled (visible)
*/
virtual bool IsEnabled();
protected:
GradientBackground();
~GradientBackground();
vtkSmartPointer<vtkRenderWindow> m_RenderWindow;
vtkSmartPointer<vtkRenderer> m_Renderer;
};
} //end of namespace mitk
#endif //mitkGradientBackground_h
diff --git a/Modules/Core/include/mitkGroupTagProperty.h b/Modules/Core/include/mitkGroupTagProperty.h
index bcb5dd187f..397ebf09bc 100644
--- a/Modules/Core/include/mitkGroupTagProperty.h
+++ b/Modules/Core/include/mitkGroupTagProperty.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#define GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54
#include <mitkBaseProperty.h>
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/*! @brief Property class that has no value.
@ingroup DataManagement
The GroupTag property is used to tag a datatree node to show, that it is member of a
group of datatree nodes. This can be used to build groups of datatreenodes without the
need to contain them in a specific hiearchic order in the datatree
*/
class MITKCORE_EXPORT GroupTagProperty : public BaseProperty
{
public:
mitkClassMacro(GroupTagProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
using BaseProperty::operator=;
protected:
GroupTagProperty();
GroupTagProperty(const GroupTagProperty&);
private:
// purposely not implemented
GroupTagProperty& operator=(const GroupTagProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* GROUPTAGPROPERTY_H_HEADER_INCLUDED_C1F4DF54 */
diff --git a/Modules/Core/include/mitkHistogramGenerator.h b/Modules/Core/include/mitkHistogramGenerator.h
index ace643b30c..4fdd2b9230 100644
--- a/Modules/Core/include/mitkHistogramGenerator.h
+++ b/Modules/Core/include/mitkHistogramGenerator.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef HISTOGRAM_GENERATOR_H_HEADER_INCLUDED
#define HISTOGRAM_GENERATOR_H_HEADER_INCLUDED
#include <itkObject.h>
#include <itkHistogram.h>
#include <itkImage.h>
#include "mitkImage.h"
namespace mitk {
//##Documentation
//## @brief Provides an easy way to calculate an itk::Histogram for a mitk::Image
//##
class MITKCORE_EXPORT HistogramGenerator : public itk::Object
{
public:
- mitkClassMacro(HistogramGenerator,itk::Object);
+ mitkClassMacroItkParent(HistogramGenerator,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef itk::Statistics::Histogram<double> HistogramType;
itkSetMacro(Image,mitk::Image::ConstPointer);
itkSetMacro(Size,int);
itkGetConstMacro(Size,int);
itkGetConstObjectMacro(Histogram,HistogramType);
// TODO: calculate if needed in GetHistogram()
void ComputeHistogram();
float GetMaximumFrequency() const;
static float CalculateMaximumFrequency(const HistogramType* histogram);
protected:
HistogramGenerator();
virtual ~HistogramGenerator();
mitk::Image::ConstPointer m_Image;
int m_Size;
HistogramType::ConstPointer m_Histogram;
};
} // namespace mitk
#endif /* HISTOGRAM_GENERATOR_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkIOAdapter.h b/Modules/Core/include/mitkIOAdapter.h
index e8632e4db1..d968151f22 100644
--- a/Modules/Core/include/mitkIOAdapter.h
+++ b/Modules/Core/include/mitkIOAdapter.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkIOAdapter_h
#define __mitkIOAdapter_h
#include "mitkBaseProcess.h"
#include "itkObject.h"
namespace mitk
{
/**
* @brief IOAdapterBase class is an abstract adapter class for IO process objects.
*
* @ingroup DeprecatedIO
* @deprecatedSince{2014_10} Use mitk::IFileReader instead
*/
class IOAdapterBase: public itk::Object
{
public:
/** Standard typedefs. */
typedef IOAdapterBase Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self>Pointer;
typedef itk::SmartPointer<const Self>ConstPointer;
/// Create an object and return a pointer to it as a mitk::BaseProcess.
virtual itk::SmartPointer<BaseDataSource> CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern) = 0;
virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern) = 0;
protected:
IOAdapterBase() {}
~IOAdapterBase() {}
private:
IOAdapterBase(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
/**
* @brief IOAdapter class is an adapter class for instantiation of IO process objects.
* Additional this interface defines the function CanReadFile().
* This interface allows the target (object) the access to the adaptee (IO process object).
*
* @ingroup IO
* @deprecatedSince{2014_10} Use mitk::IFileReader instead
*/
template <class T>
class IOAdapter : public IOAdapterBase
{
public:
/** Standard class typedefs. */
typedef IOAdapter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from mitk::BaseProcess. */
itkFactorylessNewMacro(Self);
- mitk::BaseDataSource::Pointer CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern)
+ mitk::BaseDataSource::Pointer CreateIOProcessObject(const std::string filename, const std::string filePrefix, const std::string filePattern) override
{
typename T::Pointer ioProcessObject = T::New();
ioProcessObject->SetFileName(filename.c_str());
ioProcessObject->SetFilePrefix(filePrefix.c_str());
ioProcessObject->SetFilePattern(filePattern.c_str());
return ioProcessObject.GetPointer();
}
virtual bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern)
{
return T::CanReadFile(filename, filePrefix, filePattern);
}
protected:
IOAdapter() {}
~IOAdapter() {}
private:
IOAdapter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/Core/include/mitkIOMimeTypes.h b/Modules/Core/include/mitkIOMimeTypes.h
index 27cf5a8ac4..63f82e17df 100644
--- a/Modules/Core/include/mitkIOMimeTypes.h
+++ b/Modules/Core/include/mitkIOMimeTypes.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIOMIMETYPES_H
#define MITKIOMIMETYPES_H
#include "mitkCustomMimeType.h"
#include <string>
namespace mitk {
/**
* @ingroup IO
* @brief The IOMimeTypes class
*/
class MITKCORE_EXPORT IOMimeTypes
{
public:
class MITKCORE_EXPORT DicomMimeType : public CustomMimeType
{
public:
DicomMimeType();
- virtual bool AppliesTo(const std::string &path) const;
- virtual DicomMimeType* Clone() const;
+ virtual bool AppliesTo(const std::string &path) const override;
+ virtual DicomMimeType* Clone() const override;
};
static std::vector<CustomMimeType*> Get();
static std::string DEFAULT_BASE_NAME(); // application/vnd.mitk
static std::string CATEGORY_IMAGES(); // Images
static std::string CATEGORY_SURFACES(); // Surfaces
// ------------------------------ VTK formats ----------------------------------
static CustomMimeType VTK_IMAGE_MIMETYPE(); // (mitk::Image) vti
static CustomMimeType VTK_IMAGE_LEGACY_MIMETYPE(); // (mitk::Image) vtk
static CustomMimeType VTK_PARALLEL_IMAGE_MIMETYPE(); // (mitk::Image) pvti
static CustomMimeType VTK_POLYDATA_MIMETYPE(); // (mitk::Surface) vtp, vtk
static CustomMimeType VTK_POLYDATA_LEGACY_MIMETYPE(); // (mitk::Surface) vtk
static CustomMimeType VTK_PARALLEL_POLYDATA_MIMETYPE(); // (mitk::Surface) pvtp
static CustomMimeType STEREOLITHOGRAPHY_MIMETYPE(); // (mitk::Surface) stl
static CustomMimeType WAVEFRONT_OBJ_MIMETYPE(); // (mitk::Surface) obj
static CustomMimeType STANFORD_PLY_MIMETYPE(); // (mitk::Surface) ply
static std::string STEREOLITHOGRAPHY_NAME(); // DEFAULT_BASE_NAME.stl
static std::string VTK_IMAGE_NAME(); // DEFAULT_BASE_NAME.vtk.image
static std::string VTK_IMAGE_LEGACY_NAME(); // DEFAULT_BASE_NAME.vtk.image.legacy
static std::string VTK_PARALLEL_IMAGE_NAME(); // DEFAULT_BASE_NAME.vtk.parallel.image
static std::string VTK_POLYDATA_NAME(); // DEFAULT_BASE_NAME.vtk.polydata
static std::string VTK_POLYDATA_LEGACY_NAME(); // DEFAULT_BASE_NAME.vtk.polydata.legacy
static std::string VTK_PARALLEL_POLYDATA_NAME(); // DEFAULT_BASE_NAME.vtk.parallel.polydata
static std::string WAVEFRONT_OBJ_NAME(); // DEFAULT_BASE_NAME.obj
static std::string STANFORD_PLY_NAME(); // DEFAULT_BASE_NAME.ply
// ------------------------- Image formats (ITK based) --------------------------
static CustomMimeType NRRD_MIMETYPE(); // nrrd, nhdr
static CustomMimeType NIFTI_MIMETYPE();
static CustomMimeType RAW_MIMETYPE(); // raw
static DicomMimeType DICOM_MIMETYPE();
static std::string NRRD_MIMETYPE_NAME(); // DEFAULT_BASE_NAME.nrrd
static std::string NIFTI_MIMETYPE_NAME();
static std::string RAW_MIMETYPE_NAME(); // DEFAULT_BASE_NAME.raw
static std::string DICOM_MIMETYPE_NAME();
// ------------------------------ MITK formats ----------------------------------
static CustomMimeType POINTSET_MIMETYPE(); // mps
static std::string POINTSET_MIMETYPE_NAME(); // DEFAULT_BASE_NAME.pointset
private:
// purposely not implemented
IOMimeTypes();
IOMimeTypes(const IOMimeTypes&);
};
}
#endif // MITKIOMIMETYPES_H
diff --git a/Modules/Core/include/mitkIShaderRepository.h b/Modules/Core/include/mitkIShaderRepository.h
index 4041e00acd..740893b972 100644
--- a/Modules/Core/include/mitkIShaderRepository.h
+++ b/Modules/Core/include/mitkIShaderRepository.h
@@ -1,145 +1,145 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKISHADERREPOSITORY_H
#define MITKISHADERREPOSITORY_H
#include <itkLightObject.h>
#include "mitkCommon.h"
#include "mitkServiceInterface.h"
#include <list>
class vtkActor;
class vtkShaderProgram2;
namespace mitk {
class DataNode;
class BaseRenderer;
/**
* \ingroup MicroServices_Interfaces
* \brief Management class for vtkShader XML descriptions.
*
* Loads XML shader files from std::istream objects 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.
*/
struct MITKCORE_EXPORT IShaderRepository
{
struct ShaderPrivate;
class MITKCORE_EXPORT Shader : public itk::LightObject
{
public:
- mitkClassMacro( Shader, itk::LightObject )
+ mitkClassMacroItkParent( Shader, itk::LightObject )
itkFactorylessNewMacro( Self )
~Shader();
int GetId() const;
std::string GetName() const;
std::string GetMaterialXml() const;
protected:
Shader();
void SetId(int id);
void SetName(const std::string& name);
void SetMaterialXml(const std::string& xml);
private:
// not implemented
Shader(const Shader&);
Shader& operator=(const Shader&);
ShaderPrivate* d;
};
class MITKCORE_EXPORT ShaderProgram : public itk::LightObject
{
public:
virtual void Activate() = 0;
virtual void Deactivate() = 0;
- mitkClassMacro( ShaderProgram, itk::LightObject )
+ mitkClassMacroItkParent( ShaderProgram, itk::LightObject )
};
virtual ~IShaderRepository();
virtual std::list<Shader::Pointer> GetShaders() const = 0;
/**
* \brief Return the named shader.
*
* \param name The shader name.
* \return A Shader object.
*
* Names might not be unique. Use the shader id to uniquely identify a shader.
*/
virtual Shader::Pointer GetShader(const std::string& name) const = 0;
virtual ShaderProgram::Pointer CreateShaderProgram() = 0;
/**
* \brief Return the shader identified by the given id.
* @param id The shader id.
* @return The shader object or null if the id is unknown.
*/
virtual Shader::Pointer GetShader(int id) const = 0;
/** \brief Adds all parsed shader uniforms to property list of the given DataNode;
* used by mappers.
*/
virtual void AddDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer,
bool overwrite) const = 0;
/** \brief Applies shader and shader specific variables of the specified DataNode
* to the VTK object by updating the shader variables of its vtkProperty.
*/
virtual void UpdateShaderProgram(mitk::IShaderRepository::ShaderProgram* shaderProgram, mitk::DataNode* node,
mitk::BaseRenderer* renderer) const = 0;
/** \brief Loads a shader from a given file. Make sure that this stream is in the XML shader format.
*
* \return A unique id for the loaded shader which can be used to unload it.
*/
virtual int LoadShader(std::istream& stream, const std::string& name) = 0;
/**
* \brief Unload a previously loaded shader.
* \param id The unique shader id returned by LoadShader.
* \return \c true if the shader id was found and the shader was successfully unloaded,
* \c false otherwise.
*/
virtual bool UnloadShader(int id) = 0;
};
}
MITK_DECLARE_SERVICE_INTERFACE(mitk::IShaderRepository, "org.mitk.services.IShaderRepository/1.0")
#endif // MITKISHADERREPOSITORY_H
diff --git a/Modules/Core/include/mitkITKImageImport.h b/Modules/Core/include/mitkITKImageImport.h
index f9b3d7f9a5..6c1046adbe 100644
--- a/Modules/Core/include/mitkITKImageImport.h
+++ b/Modules/Core/include/mitkITKImageImport.h
@@ -1,195 +1,195 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
#define MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
#include <MitkCoreExports.h>
#include "mitkImageSource.h"
#include "itkImageToImageFilterDetail.h"
namespace mitk {
/**
* @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 TInputImage>
class MITK_EXPORT ITKImageImport : public ImageSource
{
public:
mitkClassMacro(ITKImageImport,ImageSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/// \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);
/** \brief Set the input itk::Image of this image importer. */
InputImageType * GetInput(void);
/** \brief Set the input itk::Image of this image importer. */
void SetInput(const InputImageType*);
using itk::ProcessObject::SetInput;
/**
* \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 BaseGeometry* geometry);
protected:
ITKImageImport();
virtual ~ITKImageImport();
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
- virtual void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output);
+ virtual void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
/** Typedef for the region copier function object that converts an
* output region to an input region. */
typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
itkGetStaticConstMacro(RegionDimension)> OutputToInputRegionCopierType;
BaseGeometry::Pointer m_Geometry;
};
/**
* @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 <typename ItkOutputImageType>
Image::Pointer ImportItkImage(const itk::SmartPointer<ItkOutputImageType>& itkimage, const BaseGeometry* geometry = NULL, bool update = true);
/**
* @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.
*
*
* \note If the source (itk image) and the target (mitk image) do not share the same scope, the mitk::GrabItkImageMemory function
* has to be used instead. Otherwise the image memory managed by the itk image is lost at a scope level change. This affects especially the
* usage in combination with AccessByItk macros as in following example code
*
* \snippet Testing/mitkGrabItkImageMemoryTest.cpp OutOfScopeCall
*
* which calls an ITK-like filter
*
* \snippet Testing/mitkGrabItkImageMemoryTest.cpp ItkThresholdFilter
*
*
* \sa itk::Image::CastToMitkImage
* \sa GrabItkImageMemory
*/
template <typename ItkOutputImageType>
Image::Pointer ImportItkImage(const ItkOutputImageType* itkimage, const BaseGeometry* geometry = NULL, bool update = true);
/**
* @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 <typename ItkOutputImageType>
Image::Pointer GrabItkImageMemory(itk::SmartPointer<ItkOutputImageType>& itkimage, mitk::Image* mitkImage = NULL, const BaseGeometry* geometry = NULL, bool update = true);
/**
* @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 <typename ItkOutputImageType>
Image::Pointer GrabItkImageMemory(ItkOutputImageType* itkimage, mitk::Image* mitkImage = NULL, const BaseGeometry* geometry = NULL, bool update = true);
} // namespace mitk
#ifndef MITK_MANUAL_INSTANTIATION
#include "mitkITKImageImport.txx"
#endif
#endif /* MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D */
diff --git a/Modules/Core/include/mitkImage.h b/Modules/Core/include/mitkImage.h
index d531adaeda..0ed68d072f 100644
--- a/Modules/Core/include/mitkImage.h
+++ b/Modules/Core/include/mitkImage.h
@@ -1,718 +1,718 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#define MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#include <MitkCoreExports.h>
#include "mitkSlicedData.h"
#include "mitkBaseData.h"
#include "mitkLevelWindow.h"
#include "mitkPlaneGeometry.h"
#include <mitkProportionalTimeGeometry.h>
#include "mitkImageDataItem.h"
#include "mitkImageDescriptor.h"
#include "mitkImageAccessorBase.h"
#include "mitkImageVtkAccessor.h"
//DEPRECATED
#include <mitkTimeSlicedGeometry.h>
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
class vtkImageData;
namespace itk {
template<class T> class MutexLockHolder;
}
namespace mitk {
class SubImageSelector;
class ImageTimeSelector;
class ImageStatisticsHolder;
//##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 BaseGeometry of the Image, see
//## BaseGeometry::WorldToItkPhysicalPoint.
//##
//## For more information, see \ref MitkImagePage .
//## @ingroup Data
class MITKCORE_EXPORT Image : public SlicedData
{
friend class SubImageSelector;
friend class ImageAccessorBase;
friend class ImageVtkAccessor;
friend class ImageVtkReadAccessor;
friend class ImageVtkWriteAccessor;
friend class ImageReadAccessor;
friend class ImageWriteAccessor;
public:
mitkClassMacro(Image, SlicedData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Smart Pointer type to a ImageDataItem. */
typedef itk::SmartPointer<ImageDataItem> ImageDataItemPointer;
typedef itk::Statistics::Histogram<double> HistogramType;
typedef mitk::ImageStatisticsHolder* StatisticsHolderPointer;
//## @param ImportMemoryManagementType This parameter is evaluated when setting new data to an image.
//## The different options are:
//## CopyMemory: Data to be set is copied and assigned to a new memory block. Data memory block will be freed on deletion of mitk::Image.
//## MamageMemory: Data to be set will be referenced, and Data memory block will be freed on deletion of mitk::Image.
//## Reference Memory: Data to be set will be referenced, but Data memory block will not be freed on deletion of mitk::Image.
//## DontManageMemory = ReferenceMemory.
enum ImportMemoryManagementType { CopyMemory, ManageMemory, ReferenceMemory, DontManageMemory = ReferenceMemory };
//##Documentation
//## @brief Vector container of SmartPointers to ImageDataItems;
//## Class is only for internal usage to allow convenient access to all slices over iterators;
//## See documentation of ImageDataItem for details.
typedef std::vector<ImageDataItemPointer> ImageDataItemPointerArray;
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.
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method can be replaced by ImageWriteAccessor::GetData() or ImageReadAccessor::GetData() */
DEPRECATED(virtual void* GetData());
public:
/** @brief Get the pixel value at one specific index position.
The pixel type is always being converted to double.
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method can be replaced by a method from ImagePixelWriteAccessor or ImagePixelReadAccessor */
DEPRECATED(double GetPixelValueByIndex(const itk::Index<3>& position, unsigned int timestep = 0, unsigned int component=0));
/** @brief Get the pixel value at one specific world position.
The pixel type is always being converted to double.
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method can be replaced by a method from ImagePixelWriteAccessor or ImagePixelReadAccessor */
DEPRECATED(double GetPixelValueByWorldCoordinate(const mitk::Point3D& position, unsigned int timestep = 0, unsigned int component=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);
virtual const vtkImageData* GetVtkImageData(int t = 0, int n = 0) const;
//##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;
+ virtual bool IsSliceSet(int s = 0, int t = 0, int n = 0) const override;
//##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;
+ virtual bool IsVolumeSet(int t = 0, int n = 0) const override;
//##Documentation
//## @brief Check whether the channel @a n is set
- virtual bool IsChannelSet(int n = 0) const;
+ virtual bool IsChannelSet(int n = 0) const override;
//##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
//## 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, const unsigned int *dimensions, unsigned int channels = 1);
//##Documentation
//## initialize new (or re-initialize) image information by a BaseGeometry
//##
//## @param tDim defines the number of time steps for which the Image should be initialized
virtual void Initialize(const mitk::PixelType& type, const mitk::BaseGeometry& geometry, unsigned int channels = 1, int tDim=1);
/**
* initialize new (or re-initialize) image information by a TimeGeometry
*
* @param tDim defines the number of time steps for which the Image should be initialized
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(virtual void Initialize(const mitk::PixelType& /*type*/, const mitk::TimeSlicedGeometry* /*geometry*/, unsigned int /*channels = 1*/, int /*tDim=1*/)){}
/**
* \brief Initialize new (or re-initialize) image information by a TimeGeometry
*
* \param tDim override time dimension if the value is bigger than 0 (Default -1)
*/
virtual void Initialize(const mitk::PixelType& type, const mitk::TimeGeometry& geometry, unsigned int channels = 1, int tDim=-1 );
//##Documentation
//## initialize new (or re-initialize) image information by a PlaneGeometry and number of slices
//##
//## Initializes the bounding box according to the width/height of the
//## PlaneGeometry and @a sDim via SlicedGeometry3D::InitializeEvenlySpaced.
//## The spacing is calculated from the PlaneGeometry.
//## \sa SlicedGeometry3D::InitializeEvenlySpaced
virtual void Initialize(const mitk::PixelType& type, int sDim, const mitk::PlaneGeometry& 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);
virtual void Initialize(const mitk::ImageDescriptor::Pointer inDesc);
//##Documentation
//## initialize new (or re-initialize) image information by @a pic.
//## Dimensions and @a Geometry3D /@a PlaneGeometry 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 <)
//## @param pDim override y-space dimension in @a vtkimagedata (if >0 and <)
virtual void Initialize(vtkImageData* vtkimagedata, int channels = 1, int tDim = -1, int sDim = -1, int pDim = -1);
//##Documentation
//## initialize new (or re-initialize) image information by @a itkimage,
//## a templated itk-image.
//## Only the header is used, not the data vector! Use
//## SetVolume(itkimage->GetBufferPointer()) to set the data vector.
//##
//## @param tDim override time dimension in @a itkimage (if >0 and <)
//## @param sDim override z-space dimension in @a itkimage (if >0 and <)
template <typename itkImageType> void InitializeByItk(const itkImageType* itkimage, int channels = 1, int tDim = -1, int sDim=-1)
{
if(itkimage==NULL) return;
MITK_DEBUG << "Initializing MITK image from ITK image.";
// build array with dimensions in each direction with at least 4 entries
m_Dimension=itkimage->GetImageDimension();
unsigned int i, *tmpDimensions=new unsigned int[m_Dimension>4?m_Dimension:4];
for(i=0;i<m_Dimension;++i)
tmpDimensions[i]=itkimage->GetLargestPossibleRegion().GetSize().GetSize()[i];
if(m_Dimension<4)
{
unsigned int *p;
for(i=0,p=tmpDimensions+m_Dimension;i<4-m_Dimension;++i, ++p)
*p=1;
}
// overwrite number of slices if sDim is set
if((m_Dimension>2) && (sDim>=0))
tmpDimensions[2]=sDim;
// overwrite number of time points if tDim is set
if((m_Dimension>3) && (tDim>=0))
tmpDimensions[3]=tDim;
// rough initialization of Image
// mitk::PixelType importType = ImportItkPixelType( itkimage::PixelType );
Initialize(MakePixelType<itkImageType>(itkimage->GetNumberOfComponentsPerPixel()),
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::Imagm_PixelType = new mitk::PixelType(type);e and include spacing
const typename itkImageType::DirectionType & itkdirection = itkimage->GetDirection();
MITK_DEBUG << "ITK direction " << itkdirection;
mitk::Matrix3D matrix;
matrix.SetIdentity();
unsigned int j, itkDimMax3 = (m_Dimension >= 3? 3 : m_Dimension);
// check if spacing has no zero entry and itkdirection has no zero columns
bool itkdirectionOk = true;
mitk::ScalarType columnSum;
for( j=0; j < itkDimMax3; ++j )
{
columnSum = 0.0;
for ( i=0; i < itkDimMax3; ++i)
{
columnSum += fabs(itkdirection[i][j]);
}
if(columnSum < mitk::eps)
{
itkdirectionOk = false;
}
if ( (spacing[j] < - mitk::eps) // (normally sized) negative value
&& (j==2) && (m_Dimensions[2] == 1) )
{
// Negative spacings can occur when reading single DICOM slices with ITK via GDCMIO
// In these cases spacing is not determind by ITK correctly (because it distinguishes correctly
// between slice thickness and inter slice distance -- slice distance is meaningless for
// single slices).
// I experienced that ITK produced something meaningful nonetheless because is is
// evaluating the tag "(0018,0088) Spacing between slices" as a fallback. This tag is not
// reliable (http://www.itk.org/pipermail/insight-users/2005-September/014711.html)
// but gives at least a hint.
// In real world cases I experienced that this tag contained the correct inter slice distance
// with a negative sign, so we just invert such negative spacings.
MITK_WARN << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using inverted value " << -spacing[j];
spacing[j] = -spacing[j];
}
else if (spacing[j] < mitk::eps) // value near zero
{
MITK_ERROR << "Illegal value of itk::Image::GetSpacing()[" << j <<"]=" << spacing[j] << ". Using 1.0 instead.";
spacing[j] = 1.0;
}
}
if(itkdirectionOk == false)
{
MITK_ERROR << "Illegal matrix returned by itk::Image::GetDirection():" << itkdirection << " Using identity instead.";
for ( i=0; i < itkDimMax3; ++i)
for( j=0; j < itkDimMax3; ++j )
if ( i == j )
matrix[i][j] = spacing[j];
else
matrix[i][j] = 0.0;
}
else
{
for ( i=0; i < itkDimMax3; ++i)
for( j=0; j < itkDimMax3; ++j )
matrix[i][j] = itkdirection[i][j]*spacing[j];
}
// re-initialize PlaneGeometry with origin and direction
PlaneGeometry* planeGeometry = static_cast<PlaneGeometry*>(GetSlicedGeometry(0)->GetPlaneGeometry(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 TimeGeometry
ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
timeGeometry->Initialize(slicedGeometry, m_Dimensions[3]);
SetTimeGeometry(timeGeometry);
// 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;
ImageDescriptor::Pointer GetImageDescriptor() const
{ return m_ImageDescriptor; }
ChannelDescriptor GetChannelDescriptor( int id = 0 ) const
{ return m_ImageDescriptor->GetChannelDescriptor(id); }
/** \brief Sets a geometry to an image.
*/
- virtual void SetGeometry(BaseGeometry* aGeometry3D);
+ virtual void SetGeometry(BaseGeometry* aGeometry3D) override;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
\brief (DEPRECATED) Get the minimum for scalar images
*/
DEPRECATED (ScalarType GetScalarValueMin(int t=0) const);
/**
\brief (DEPRECATED) Get the maximum for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValueMax(int t=0) const);
/**
\brief (DEPRECATED) Get the second smallest value for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValue2ndMin(int t=0) const);
/**
\brief (DEPRECATED) Get the smallest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValueMinNoRecompute( unsigned int t = 0 ) const);
/**
\brief (DEPRECATED) Get the second smallest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValue2ndMinNoRecompute( unsigned int t = 0 ) const);
/**
\brief (DEPRECATED) Get the second largest value for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValue2ndMax(int t=0) const);
/**
\brief (DEPRECATED) Get the largest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValueMaxNoRecompute( unsigned int t = 0 ) const );
/**
\brief (DEPRECATED) Get the second largest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetScalarValue2ndMaxNoRecompute( unsigned int t = 0 ) const);
/**
\brief (DEPRECATED) Get the count of voxels with the smallest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetCountOfMinValuedVoxels(int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the largest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (ScalarType GetCountOfMaxValuedVoxels(int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the largest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (unsigned int GetCountOfMaxValuedVoxelsNoRecompute( unsigned int t = 0 ) const);
/**
\brief (DEPRECATED) Get the count of voxels with the smallest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED (unsigned int GetCountOfMinValuedVoxelsNoRecompute( unsigned int t = 0 ) const);
/**
\brief Returns a pointer to the ImageStatisticsHolder object that holds all statistics information for the image.
All Get-methods for statistics properties formerly accessible directly from an Image object are now moved to the
new \a ImageStatisticsHolder object.
*/
StatisticsHolderPointer GetStatistics() const
{
return m_ImageStatistics;
}
protected:
mitkCloneMacro(Self);
typedef itk::MutexLockHolder<itk::SimpleFastMutexLock> MutexHolder;
int GetSliceIndex(int s = 0, int t = 0, int n = 0) const;
int GetVolumeIndex(int t = 0, int n = 0) const;
void ComputeOffsetTable();
virtual bool IsValidTimeStep(int t) const;
- virtual void Expand( unsigned int timeSteps );
+ virtual void Expand( unsigned int timeSteps ) override;
virtual ImageDataItemPointer AllocateSliceData(int s = 0, int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
virtual ImageDataItemPointer AllocateVolumeData(int t = 0, int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
virtual ImageDataItemPointer AllocateChannelData(int n = 0, void *data = NULL, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
Image();
Image(const Image &other);
virtual ~Image();
- virtual void Clear();
+ virtual void Clear() override;
//## @warning Has to be called by every Initialize method!
- virtual void Initialize();
+ virtual void Initialize() override;
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
mutable ImageDataItemPointerArray m_Channels;
mutable ImageDataItemPointerArray m_Volumes;
mutable ImageDataItemPointerArray m_Slices;
mutable itk::SimpleFastMutexLock m_ImageDataArraysLock;
unsigned int m_Dimension;
unsigned int* m_Dimensions;
ImageDescriptor::Pointer m_ImageDescriptor;
size_t *m_OffsetTable;
ImageDataItemPointer m_CompleteData;
// Image statistics Holder replaces the former implementation directly inside this class
friend class ImageStatisticsHolder;
StatisticsHolderPointer m_ImageStatistics;
private:
ImageDataItemPointer GetSliceData_unlocked(int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer GetVolumeData_unlocked(int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer GetChannelData_unlocked(int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateSliceData_unlocked(int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateVolumeData_unlocked(int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateChannelData_unlocked(int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
bool IsSliceSet_unlocked(int s, int t, int n) const;
bool IsVolumeSet_unlocked(int t, int n) const;
bool IsChannelSet_unlocked(int n) const;
/** Stores all existing ImageReadAccessors */
mutable std::vector<ImageAccessorBase*> m_Readers;
/** Stores all existing ImageWriteAccessors */
mutable std::vector<ImageAccessorBase*> m_Writers;
/** Stores all existing ImageVtkAccessors */
mutable std::vector<ImageAccessorBase*> m_VtkReaders;
/** A mutex, which needs to be locked to manage m_Readers and m_Writers */
itk::SimpleFastMutexLock m_ReadWriteLock;
/** A mutex, which needs to be locked to manage m_VtkReaders */
itk::SimpleFastMutexLock m_VtkReadersLock;
};
/**
* @brief Equal A function comparing two images for beeing equal in meta- and imagedata
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::Image& i1, const mitk::Image& i2) instead.
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - dimension of the images
* - size of the images
* - pixel type
* - pixel values : pixel values are expected to be identical at each position ( for other options see mitk::CompareImageFilter )
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
DEPRECATED (MITKCORE_EXPORT bool Equal( const mitk::Image* leftHandSide, const mitk::Image* rightHandSide, ScalarType eps, bool verbose ));
/**
* @brief Equal A function comparing two images for beeing equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - dimension of the images
* - size of the images
* - pixel type
* - pixel values : pixel values are expected to be identical at each position ( for other options see mitk::CompareImageFilter )
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKCORE_EXPORT bool Equal( const mitk::Image& leftHandSide, const mitk::Image& rightHandSide, ScalarType eps, bool verbose );
} // namespace mitk
#endif /* MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 */
diff --git a/Modules/Core/include/mitkImageChannelSelector.h b/Modules/Core/include/mitkImageChannelSelector.h
index 385cdae6ce..218413fa65 100644
--- a/Modules/Core/include/mitkImageChannelSelector.h
+++ b/Modules/Core/include/mitkImageChannelSelector.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7
#define IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT ImageChannelSelector : public SubImageSelector
{
public:
mitkClassMacro(ImageChannelSelector,SubImageSelector);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetConstMacro(ChannelNr,int);
itkSetMacro(ChannelNr,int);
protected:
ImageChannelSelector();
virtual ~ImageChannelSelector();
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
int m_ChannelNr;
};
} // namespace mitk
#endif /* IMAGECHANNELSELECTOR_H_HEADER_INCLUDED_C1E4F4E7 */
diff --git a/Modules/Core/include/mitkImageDataItem.h b/Modules/Core/include/mitkImageDataItem.h
index 1bbcfcc405..c7c1aa0f1d 100644
--- a/Modules/Core/include/mitkImageDataItem.h
+++ b/Modules/Core/include/mitkImageDataItem.h
@@ -1,190 +1,190 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGEDATAITEM_H
#define IMAGEDATAITEM_H
#include "mitkCommon.h"
#include <MitkCoreExports.h>
//#include <mitkIpPic.h>
//#include "mitkPixelType.h"
#include "mitkImageDescriptor.h"
//#include "mitkImageVtkAccessor.h"
class vtkImageData;
namespace mitk {
class PixelType;
class ImageVtkReadAccessor;
class ImageVtkWriteAccessor;
class Image;
//##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 MITKCORE_EXPORT ImageDataItem : public itk::LightObject
{
friend class ImageAccessorBase;
friend class ImageWriteAccessor;
friend class ImageReadAccessor;
template <class TPixel, unsigned int VDimension>
friend class ImagePixelAccessor;
friend class Image;
// template<class TOutputImage>
// friend class ImageToItk;
public:
typedef itk::SmartPointer<mitk::Image> ImagePointer;
typedef itk::SmartPointer<const mitk::Image> ImageConstPointer;
- mitkClassMacro(ImageDataItem, itk::LightObject);
+ mitkClassMacroItkParent(ImageDataItem, itk::LightObject);
ImageDataItem(const ImageDataItem& aParent, const mitk::ImageDescriptor::Pointer desc,
int timestep, unsigned int dimension, void *data = NULL,
bool manageMemory = false, size_t offset = 0);
~ImageDataItem();
ImageDataItem(const mitk::ImageDescriptor::Pointer desc, int timestep,
void *data, bool manageMemory);
ImageDataItem(const mitk::PixelType& type, int timestep, unsigned int dimension, unsigned int* dimensions, void* data, bool manageMemory);
ImageDataItem(const ImageDataItem &other);
/**
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method can be replaced by ImageWriteAccessor::GetData() or ImageReadAccessor::GetData() */
DEPRECATED(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;
}
int GetDimension() const
{
return m_Dimension;
}
int GetDimension(int i) const
{
int returnValue = 0;
// return the true size if dimension available
if (i< (int) m_Dimension)
returnValue = m_Dimensions[i];
return returnValue;
}
ImageDataItem::ConstPointer GetParent() const
{
return m_Parent;
}
//## Returns a vtkImageData; if non is present, a new one is constructed.
ImageVtkReadAccessor* GetVtkImageAccessor(ImageConstPointer) const;
ImageVtkWriteAccessor* GetVtkImageAccessor(ImagePointer);
/*{
if(m_VtkImageData==NULL)
ConstructVtkImageData(iP);
return m_VtkImageData;
}*/
// Returns if image data should be deleted on destruction of ImageDataItem.
bool GetManageMemory() const
{
return m_ManageMemory;
}
virtual void ConstructVtkImageData(ImageConstPointer) const;
unsigned long GetSize() const
{
return m_Size;
}
virtual void Modified() const;
protected:
unsigned char* m_Data;
PixelType *m_PixelType;
bool m_ManageMemory;
mutable vtkImageData* m_VtkImageData;
mutable ImageVtkReadAccessor* m_VtkImageReadAccessor;
ImageVtkWriteAccessor* m_VtkImageWriteAccessor;
int m_Offset;
bool m_IsComplete;
unsigned long m_Size;
private:
void ComputeItemSize( const unsigned int* dimensions, unsigned int dimension);
ImageDataItem::ConstPointer m_Parent;
unsigned int m_Dimension;
unsigned int m_Dimensions[MAX_IMAGE_DIMENSIONS];
int m_Timestep;
};
} // namespace mitk
#endif /* IMAGEDATAITEM_H */
diff --git a/Modules/Core/include/mitkImageDescriptor.h b/Modules/Core/include/mitkImageDescriptor.h
index e6abec2cfb..1d650eb07f 100644
--- a/Modules/Core/include/mitkImageDescriptor.h
+++ b/Modules/Core/include/mitkImageDescriptor.h
@@ -1,134 +1,134 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEDESCRIPTOR_H
#define MITKIMAGEDESCRIPTOR_H
#include <itkObjectFactory.h>
#include <vector>
#include <string>
#include "mitkChannelDescriptor.h"
#include "mitkCommon.h"
/// Defines the maximum of 8 dimensions per image channel taken from ipPicDescriptor
#define MAX_IMAGE_DIMENSIONS 8
namespace mitk
{
/** \brief An object to hold all essential information about an Image object
The ImageDescriptor holds an std::vector of pointers to ChannelDescriptor together with the
information about the image's dimensions. The general assumption ist, that each channel of an image
has to have the same geometry.
\sa Image, ChannelDescriptor
*/
class MITKCORE_EXPORT ImageDescriptor : public itk::Object
{
public:
- mitkClassMacro(ImageDescriptor, itk::Object);
+ mitkClassMacroItkParent(ImageDescriptor, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Insert new channel
@param ptype Pixel Type
@param name channel's name
*/
void AddNewChannel( mitk::PixelType ptype, const char* name = 0);
/** \brief Initialize the image descriptor by the dimensions */
void Initialize( const unsigned int* dims, const unsigned int dim);
/** \brief Initialize the descriptor by an referenced Descriptor */
void Initialize( const ImageDescriptor::Pointer refDescriptor, unsigned int channel = 0);
/** \brief Get the C-array of unsigned int holding the size for each dimension of the image
The C-array has allways lenght of MAX_IMAGE_DIMENSIONS
*/
const unsigned int* GetDimensions() const
{ return m_Dimensions; }
/** \brief Get the number dimensions used (e.g. non-zero size)
The return value does not exceed MAX_IMAGE_DIMENSIONS
*/
unsigned int GetNumberOfDimensions() const
{ return m_NumberOfDimensions; }
/** \brief Get the name of selected channel
If the name of the channel wasn't initialized, the string returned is set to "Unnamed [ <PixelTypeName> ]"
\sa PixelType, ChannelDescriptor
*/
const std::string GetChannelName( unsigned int id ) const;
/** \brief Get the pixel type of a channel specified by its name
Returns an uninitialized PixelType object if no channel with given name was found
*/
PixelType GetChannelTypeByName( const char* name) const;
/** \brief Get the pixel type of a channel specified by its id
Returns an uninitialized PixelType object if no channel with given id was found
*/
PixelType GetChannelTypeById( unsigned int id) const;
/** \brief Get the ChannelDescriptor for a channel specified by its id */
ChannelDescriptor GetChannelDescriptor( unsigned int id = 0) const;
/** \brief Get the count of channels used */
unsigned int GetNumberOfChannels() const
{ return m_NumberOfChannels; }
protected:
/** Protected constructor */
ImageDescriptor();
/** Protected desctructor */
~ImageDescriptor(){};
private:
/** A std::vector holding a pointer to a ChannelDescriptor for each active channel of the image */
std::vector<ChannelDescriptor> m_ChannelDesc;
/** A vector holding the names of corresponding channels */
std::vector<std::string> m_ChannelNames;
/** Constant iterator for traversing the vector of channel's names */
typedef std::vector<std::string>::const_iterator ConstChannelNamesIter;
/** Constant iterator for traversing the vector of ChannelDescriptors */
typedef std::vector<ChannelDescriptor>::const_iterator ConstChannelsIter;
unsigned int m_NumberOfChannels;
unsigned int m_NumberOfDimensions;
unsigned int m_Dimensions[MAX_IMAGE_DIMENSIONS];
};
} // end namespace
#endif // MITKIMAGEDESCRIPTOR_H
diff --git a/Modules/Core/include/mitkImageReadAccessor.h b/Modules/Core/include/mitkImageReadAccessor.h
index 58c04220ce..7875b0f917 100644
--- a/Modules/Core/include/mitkImageReadAccessor.h
+++ b/Modules/Core/include/mitkImageReadAccessor.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEREADACCESSOR_H
#define MITKIMAGEREADACCESSOR_H
#include "mitkImageAccessorBase.h"
namespace mitk {
class Image;
class ImageDataItem;
/**
* @brief ImageReadAccessor class to get locked read access for a particular image part
* @ingroup Data
*/
class MITKCORE_EXPORT ImageReadAccessor : public ImageAccessorBase
{
friend class Image;
template <class TPixel, unsigned int VDimension>
friend class ImagePixelReadAccessor;
public:
typedef itk::SmartPointer<Image> ImagePointer;
/** \brief Orders read access for a slice, volume or 4D-Image
* \param Image::Pointer specifies the associated Image
* \param ImageDataItem* specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*/
ImageReadAccessor(
ImageConstPointer image,
const ImageDataItem* iDI = NULL,
int OptionFlags = ImageAccessorBase::DefaultBehavior
);
ImageReadAccessor(
ImagePointer image,
const ImageDataItem* iDI = NULL,
int OptionFlags = ImageAccessorBase::DefaultBehavior
);
ImageReadAccessor(const Image* image, const ImageDataItem* iDI = NULL);
/** Destructor informs Image to unlock memory. */
virtual ~ImageReadAccessor();
protected:
- virtual const Image* GetImage() const;
+ virtual const Image* GetImage() const override;
private:
/** \brief manages a consistent read access and locks the ordered image part */
void OrganizeReadAccess();
ImageReadAccessor& operator=(const ImageReadAccessor&); // Not implemented on purpose.
ImageReadAccessor(const ImageReadAccessor&);
ImageConstPointer m_Image;
};
}
#endif // MITKIMAGEACCESSOR_H
diff --git a/Modules/Core/include/mitkImageSliceSelector.h b/Modules/Core/include/mitkImageSliceSelector.h
index c9cbde4d3a..f76d39e542 100644
--- a/Modules/Core/include/mitkImageSliceSelector.h
+++ b/Modules/Core/include/mitkImageSliceSelector.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B
#define IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT ImageSliceSelector : public SubImageSelector
{
public:
mitkClassMacro(ImageSliceSelector,SubImageSelector);
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateOutputInformation() override;
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
ImageSliceSelector();
virtual ~ImageSliceSelector();
int m_SliceNr;
int m_TimeNr;
int m_ChannelNr;
};
} // namespace mitk
#endif /* IMAGESLICESELECTOR_H_HEADER_INCLUDED_C1E4BE7B */
diff --git a/Modules/Core/include/mitkImageSource.h b/Modules/Core/include/mitkImageSource.h
index 2375135a87..69e4d73ba7 100644
--- a/Modules/Core/include/mitkImageSource.h
+++ b/Modules/Core/include/mitkImageSource.h
@@ -1,263 +1,263 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC
#define IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC
#include <MitkCoreExports.h>
#include "mitkBaseDataSource.h"
#include "mitkImage.h"
namespace mitk {
/**
* @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 MITKCORE_EXPORT ImageSource : public BaseDataSource
{
public:
mitkClassMacro(ImageSource,BaseDataSource)
/** @brief Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Some convenient typedefs. */
typedef mitk::Image OutputImageType;
typedef OutputImageType OutputType;
typedef OutputImageType::Pointer OutputImagePointer;
typedef SlicedData::RegionType OutputImageRegionType;
/**
* @brief Get the output data of this image source object.
*
* The output of this
* function is not valid until an appropriate Update() method has
* been called, either explicitly or implicitly. Both the filter
* itself and the data object have Update() methods, and both
* methods update the data. Here are three ways to use
* GetOutput() and make sure the data is valid. In these
* examples, \a image is a pointer to some Image object, and the
* particular ProcessObjects involved are filters. The same
* examples apply to non-image (e.g. Mesh) data as well.
*
* \code
* anotherFilter->SetInput( someFilter->GetOutput() );
* anotherFilter->Update();
* \endcode
*
* In this situation, \a someFilter and \a anotherFilter are said
* to constitute a \b pipeline.
*
* \code
* image = someFilter->GetOutput();
* image->Update();
* \endcode
*
* \code
* someFilter->Update();
* image = someFilter->GetOutput();
* \endcode
* (In the above example, the two lines of code can be in
* either order.)
*
* Note that Update() is not called automatically except within a
* pipeline as in the first example. When \b streaming (using a
* StreamingImageFilter) is activated, it may be more efficient to
* use a pipeline than to call Update() once for each filter in
* turn.
*
* For an image, the data generated is for the requested
* Region, which can be set using ImageBase::SetRequestedRegion().
* By default, the largest possible region is requested.
*
* For Filters which have multiple outputs of different types, the
* GetOutput() method assumes the output is of OutputImageType. For
* the GetOutput(DataObjectPointerArraySizeType) method, a dynamic_cast is performed
* incase the filter has outputs of different types or image
* types. Derived classes should have named get methods for these
* outputs.
*/
mitkBaseDataSourceGetOutputDeclarations
/** @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 itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
virtual vtkImageData* GetVtkImageData();
virtual const vtkImageData* GetVtkImageData() const;
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();
+ virtual void GenerateData() override;
/** @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,
itk::ThreadIdType 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();
+ virtual void PrepareOutputs() override;
/** @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
unsigned int SplitRequestedRegion(unsigned int i, unsigned 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:
ImageSource(const Self &); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // namespace mitk
#endif /* IMAGESOURCE_H_HEADER_INCLUDED_C1E7D6EC */
diff --git a/Modules/Core/include/mitkImageTimeSelector.h b/Modules/Core/include/mitkImageTimeSelector.h
index b3ec73d8cf..0c0ade4b55 100644
--- a/Modules/Core/include/mitkImageTimeSelector.h
+++ b/Modules/Core/include/mitkImageTimeSelector.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D
#define IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT ImageTimeSelector : public SubImageSelector
{
public:
mitkClassMacro(ImageTimeSelector,SubImageSelector);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetConstMacro(TimeNr,int);
itkSetMacro(TimeNr,int);
itkGetConstMacro(ChannelNr,int);
itkSetMacro(ChannelNr,int);
protected:
ImageTimeSelector();
virtual ~ImageTimeSelector();
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
int m_TimeNr;
int m_ChannelNr;
};
} // namespace mitk
#endif /* IMAGETIMESELECTOR_H_HEADER_INCLUDED_C1E4861D */
diff --git a/Modules/Core/include/mitkImageToImageFilter.h b/Modules/Core/include/mitkImageToImageFilter.h
index 0cbc6e5484..e990725887 100644
--- a/Modules/Core/include/mitkImageToImageFilter.h
+++ b/Modules/Core/include/mitkImageToImageFilter.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869
#define IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT ImageToImageFilter : public ImageSource
{
public:
mitkClassMacro(ImageToImageFilter,ImageSource);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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;
using itk::ProcessObject::SetInput;
/** Set/Get the image input of this process object. */
virtual void SetInput( const InputImageType *image);
virtual void SetInput( unsigned int, const InputImageType * image);
InputImageType * GetInput(void);
InputImageType * GetInput(unsigned int idx);
const InputImageType * GetInput(void) const;
const InputImageType * GetInput(unsigned int idx) const;
protected:
ImageToImageFilter();
virtual ~ImageToImageFilter();
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
/** 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();
+ virtual void GenerateInputRequestedRegion() override;
private:
void operator=(const Self&); //purposely not implemented
};
} // namespace mitk
#endif /* IMAGETOIMAGEFILTER_H_HEADER_INCLUDED_C1E5E869 */
diff --git a/Modules/Core/include/mitkImageToItk.h b/Modules/Core/include/mitkImageToItk.h
index 076140b821..acfd826697 100644
--- a/Modules/Core/include/mitkImageToItk.h
+++ b/Modules/Core/include/mitkImageToItk.h
@@ -1,203 +1,203 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
#define IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
#include "mitkImage.h"
#include "mitkImageDataItem.h"
#include "mitkImageWriteAccessor.h"
#include <itkImage.h>
#include <itkImageSource.h>
namespace mitk
{
/**
* Create itk::ImageSource for mitk::Image
* \ingroup Adaptor
*
* \warning 2D MITK images will get a 2D identity matrix in ITK
* \todo Get clear about how to handle directed ITK 2D images in ITK
*/
template <class TOutputImage>
class ImageToItk : public itk::ImageSource<TOutputImage>
{
protected:
mitk::Image::Pointer m_MitkImage;
mitk::ImageDataItem::Pointer m_ImageDataItem;
public:
typedef ImageToItk Self;
typedef itk::ImageSource<TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Superclass typedefs. */
typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
/** Some convenient typedefs. */
typedef mitk::Image InputImageType;
typedef InputImageType::Pointer InputImagePointer;
typedef InputImageType::ConstPointer InputImageConstPointer;
typedef SlicedData::RegionType InputImageRegionType;
typedef typename TOutputImage::SizeType SizeType;
typedef typename TOutputImage::IndexType IndexType;
typedef typename TOutputImage::RegionType RegionType;
typedef typename TOutputImage::PixelType PixelType;
typedef typename TOutputImage::InternalPixelType InternalPixelType;
typedef typename TOutputImage::PixelContainer PixelContainer;
virtual void SetInput(mitk::Image *input);
virtual void SetInput(const mitk::Image* input);
//virtual void SetInput(unsigned int index, mitk::Image * image);
//virtual void SetInput(unsigned int index, const mitk::Image * image);
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
itkGetMacro( Channel, int );
itkSetMacro( Channel, int );
itkSetMacro( CopyMemFlag, bool );
itkGetMacro( CopyMemFlag, bool );
itkBooleanMacro( CopyMemFlag );
itkSetMacro( Options, int );
itkGetMacro( Options, int );
protected:
using itk::ProcessObject::SetInput;
mitk::Image * GetInput(void);
const mitk::Image* GetInput() const;
ImageToItk()
: m_CopyMemFlag(false)
, m_Channel(0)
, m_Options(mitk::ImageAccessorBase::DefaultBehavior)
{
}
virtual ~ImageToItk()
{
}
- void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ void PrintSelf(std::ostream& os, itk::Indent indent) const override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
private:
bool m_CopyMemFlag;
int m_Channel;
int m_Options;
bool m_ConstInput;
//ImageToItk(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
void CheckInput(const mitk::Image* image) const;
};
/**
* @brief Convert a MITK image to an ITK image.
*
* This method creates a itk::Image representation for the given MITK
* image, referencing the MITK image memory. If the provided template
* arguments do not match the type of the MITK image, an exception is thrown.
*
* The MITK image is locked for read/write access as long as the returned
* itk::Image object exists. See ImageToItkImage(const mitk::Image*) for
* read-only access.
*
* @tparam TPixel The pixel type of the ITK image
* @tparam VDimension The image dimension of the ITK image
* @param mitkImage The MITK image which is to be converted to an ITK image
* @return An ITK image representation for the given MITK image
* @throws mitk::Exception if the pixel type or dimension does not match
* the MITK image type or if the MITK image is already locked for
* read or write access.
*
* @sa ImageToItkImage(const mitk::Image*)
* @sa CastToItkImage
*
* @ingroup Adaptor
*/
template<typename TPixel, unsigned int VDimension>
typename ImageTypeTrait<TPixel, VDimension>::ImageType::Pointer ImageToItkImage(mitk::Image* mitkImage)
{
typedef typename ImageTypeTrait<TPixel, VDimension>::ImageType ImageType;
typedef mitk::ImageToItk<ImageType> ImageToItkType;
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New();
imagetoitk->SetInput(mitkImage);
imagetoitk->Update();
return imagetoitk->GetOutput();
}
/**
* @brief Convert a MITK image to an ITK image.
*
* This method creates a itk::Image representation for the given MITK
* image, referencing the MITK image memory. If the provided template
* arguments do not match the type of the MITK image, an exception is thrown.
*
* The MITK image is locked for read access as long as the returned
* itk::Image object exists. See ImageToItkImage(mitk::Image*) for
* read and write access.
*
* @tparam TPixel The pixel type of the ITK image
* @tparam VDimension The image dimension of the ITK image
* @param mitkImage The MITK image which is to be converted to an ITK image
* @return An ITK image representation for the given MITK image
* @throws mitk::Exception if the pixel type or dimension does not match
* the MITK image type or if the MITK image is already locked for
* write access.
*
* @sa ImageToItkImage(mitk::Image*)
* @sa CastToItkImage
*
* @ingroup Adaptor
*/
template<typename TPixel, unsigned int VDimension>
typename ImageTypeTrait<TPixel, VDimension>::ImageType::ConstPointer ImageToItkImage(const mitk::Image* mitkImage)
{
typedef typename ImageTypeTrait<TPixel, VDimension>::ImageType ImageType;
typedef mitk::ImageToItk<ImageType> ImageToItkType;
itk::SmartPointer<ImageToItkType> imagetoitk = ImageToItkType::New();
imagetoitk->SetInput(mitkImage);
imagetoitk->Update();
return imagetoitk->GetOutput();
}
} // end namespace mitk
#ifndef ITK_MANUAL_INSTANTIATION
#include "mitkImageToItk.txx"
#endif
#endif // IMAGETOITK_H_HEADER_INCLUDED_C1C2FCD2
diff --git a/Modules/Core/include/mitkImageToSurfaceFilter.h b/Modules/Core/include/mitkImageToSurfaceFilter.h
index 5918af4301..cb2b9475f1 100644
--- a/Modules/Core/include/mitkImageToSurfaceFilter.h
+++ b/Modules/Core/include/mitkImageToSurfaceFilter.h
@@ -1,243 +1,243 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKIMAGETOSURFACEFILTER_h__
#define _MITKIMAGETOSURFACEFILTER_h__
#include <vtkPolyData.h>
#include "MitkCoreExports.h"
#include <mitkCommon.h>
#include <mitkSurfaceSource.h>
#include <mitkSurface.h>
#include <mitkImage.h>
#include <vtkImageData.h>
#include <vtkSmoothPolyDataFilter.h>
#include <vtkMarchingCubes.h>
namespace mitk {
/**
* @brief Converts pixel data to surface data by using a threshold
* The mitkImageToSurfaceFilter is used to create a new surface out of an mitk image. The filter
* uses a threshold to define the surface. It is based on the vtkMarchingCube algorithm. By default
* a vtkPolyData surface based on an input threshold for the input image will be created. Optional
* it is possible to reduce the number of triangles/polygones [SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro) and SetTargetReduction (float _arg)]
* or smooth the surface-data [SetSmooth(true), SetSmoothIteration(int smoothIteration) and SetSmoothRelaxation(float smoothRelaxation)].
*
* The resulting vtk-surface has the same size as the input image. The surface
* can be generally smoothed by vtkDecimatePro reduce complexity of triangles
* and vtkSmoothPolyDataFilter to relax the mesh. Both are enabled by default
* and connected in the common way of pipelining in ITK. It's also possible
* to create time sliced surfaces.
*
* @ingroup ImageFilters
* @ingroup Process
*/
class MITKCORE_EXPORT ImageToSurfaceFilter : public SurfaceSource
{
public:
/*
* To decide whether a reduction of polygons in the created surface shall be
* done or not by using the vtkDecimatePro Filter. Till vtk 4.x an vtkDecimateFilter existed,
* but was patented. So since vtk 5.x it was replaced by the (worser?) vtkDecimateProFilter
* Maybe another Filter will come soon.
*/
enum DecimationType {NoDecimation,DecimatePro,QuadricDecimation};
mitkClassMacro(ImageToSurfaceFilter, SurfaceSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* For each image time slice a surface will be created. This method is
* called by Update().
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/**
* Initializes the output information ( i.e. the geometry information ) of
* the output of the filter
*/
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/**
* Returns a const reference to the input image (e.g. the original input image that ist used to create the surface)
*/
const mitk::Image *GetInput(void);
/**
* Set the source image to create a surface for this filter class. As input every mitk
* 3D or 3D+t image can be used.
*/
using itk::ProcessObject::SetInput;
virtual void SetInput(const mitk::Image *image);
/**
* Set the number of iterations that is used to smooth the surface. Used is the vtkSmoothPolydataFilter that uses the laplacian filter. The higher the number of iterations that stronger the smooth-result
*
* @param smoothIteration As smoothIteration default in that case 50 was choosen. The VTK documentation recommends small relaxation factors and large numbers of iterations.
*/
void SetSmoothIteration(int smoothIteration);
/**
* Set number of relaxation. Specify the relaxation factor for Laplacian
* smoothing. The VTK documentation recommends small relaxation factors
* and large numbers of iterations.
*
* @param smoothRelaxation As smoothRelaxation default in that case 0.1 was choosen. The VTK documentation recommends small relaxation factors and large numbers of iterations.
*/
void SetSmoothRelaxation(float smoothRelaxation);
/**
* Threshold that is used to create the surface. All pixel in the input image that are higher than that
* value will be considered in the surface. The threshold referees to
* vtkMarchingCube. Default value is 1. See also SetThreshold (ScalarType _arg)
*/
itkSetMacro(Threshold, ScalarType);
/**
* Get Threshold from vtkMarchingCube. Threshold can be manipulated by
* inherited classes.
*/
itkGetConstMacro(Threshold, ScalarType);
/**
* Enables vtkSmoothPolyDataFilter. With Laplacian smoothing this filter
* will relax the surface. You can control the Filter by manipulating the
* number of iterations and the relaxing factor.
* */
itkSetMacro(Smooth,bool);
/*
* Enable/Disable surface smoothing.
*/
itkBooleanMacro(Smooth);
/*
* Returns if surface smoothing is enabled
*/
itkGetConstMacro(Smooth,bool);
/**
* Get the state of decimation mode to reduce triangle in the
* surface represantation. Modes can only be NoDecimation or DecimatePro
* (till vtk 4.x also Decimate)
* */
itkGetConstMacro(Decimate,DecimationType);
/**
* Enable the decimation filter to reduce the number of triangles in the
* mesh and produce a good approximation to the original image. The filter
* has support for vtk-5 and earlier versions. More detailed information
* check the vtkDecimatePro and vtkDecimate.
* */
itkSetMacro(Decimate,DecimationType);
/**
* Set desired TargetReduction of triangles in the range from 0.0 to 1.0.
* The destroyed triangles are in relation with the size of data. For example 0.9
* will reduce the data set to 10%.
*
* @param Set a TargetReduction float-value from 0.0 to 1.0
* */
itkSetMacro(TargetReduction, float);
/**
* Returns the reduction factor for the VtkDecimatePro Decimation Filter as a float value
*/
itkGetConstMacro(TargetReduction, float);
/**
* Transforms a point by a 4x4 matrix
*/
template <class T1, class T2, class T3>
inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
{
T3 x = matrix[0][0]*in[0]+matrix[0][1]*in[1]+matrix[0][2]*in[2]+matrix[0][3];
T3 y = matrix[1][0]*in[0]+matrix[1][1]*in[1]+matrix[1][2]*in[2]+matrix[1][3];
T3 z = matrix[2][0]*in[0]+matrix[2][1]*in[1]+matrix[2][2]*in[2]+matrix[2][3];
out[0] = x;
out[1] = y;
out[2] = z;
}
protected:
ImageToSurfaceFilter();
/**
* Destructor
* */
virtual ~ImageToSurfaceFilter();
/**
* With the given threshold vtkMarchingCube creates the surface. By default nothing a
* vtkPolyData surface based on a threshold of the input image will be created. Optional
* it is possible to reduce the number of triangles/polygones [SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro) and SetTargetReduction (float _arg)]
* or smooth the data [SetSmooth(true), SetSmoothIteration(int smoothIteration) and SetSmoothRelaxation(float smoothRelaxation)].
*
* @param time selected slice or "0" for single
* @param *vtkimage input image
* @param *surface output
* @param threshold can be different from SetThreshold()
*/
void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface * surface, const ScalarType threshold);
/**
* Flag whether the created surface shall be smoothed or not (default is "false"). SetSmooth (bool _arg)
* */
bool m_Smooth;
/**
* Decimation mode, default mode is "NoDecimation". See also SetDecimate (DecimationType _arg)
* */
DecimationType m_Decimate;
/**
* Threshold that is used to create the surface. All pixel in the input image that are higher than that
* value will be considered in the surface. Default value is 1. See also SetThreshold (ScalarType _arg)
* */
ScalarType m_Threshold;
/**
* The Reduction factor of the Decimation Filter for the created surface. See also SetTargetReduction (float _arg)
* */
float m_TargetReduction;
/**
* The Iteration value for the Smooth Filter of the created surface. See also SetSmoothIteration (int smoothIteration)
* */
int m_SmoothIteration;
/**
* The Relaxation value for the Smooth Filter of the created surface. See also SetSmoothRelaxation (float smoothRelaxation)
* */
float m_SmoothRelaxation;
};
} // namespace mitk
#endif //_MITKIMAGETOSURFACEFILTER_h__
diff --git a/Modules/Core/include/mitkImageVtkMapper2D.h b/Modules/Core/include/mitkImageVtkMapper2D.h
index a1b7ba1a27..ec2ce4f69e 100644
--- a/Modules/Core/include/mitkImageVtkMapper2D.h
+++ b/Modules/Core/include/mitkImageVtkMapper2D.h
@@ -1,307 +1,307 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E
#define MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E
//MITK
#include <mitkCommon.h>
//MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkExtractSliceFilter.h"
//VTK
#include <vtkSmartPointer.h>
#include <vtkPropAssembly.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageExtractComponents;
class vtkImageReslice;
class vtkImageChangeInformation;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkApplyLevelWindowToRGBFilter;
class vtkMitkLevelWindowFilter;
namespace mitk {
/** \brief Mapper to resample and display 2D slices of a 3D image.
*
* The following image gives a brief overview of the mapping and the involved parts.
*
* \image html imageVtkMapper2Darchitecture.png
*
* First, the image is resliced by means of vtkImageReslice. The volume image
* serves as input to the mapper in addition to spatial placement of the slice and a few other
* properties such as thick slices. This code was already present in the old version
* (mitkImageMapperGL2D).
*
* Next, the obtained slice (m_ReslicedImage) is put into a vtkMitkLevelWindowFilter
* and the scalar levelwindow, opacity levelwindow and optional clipping to
* local image bounds are applied
*
* Next, the output of the vtkMitkLevelWindowFilter is used to create a texture
* (m_Texture) and a plane onto which the texture is rendered (m_Plane). For
* mapping purposes, a vtkPolyDataMapper (m_Mapper) is utilized. Orthographic
* projection is applied to create the effect of a 2D image. The mapper and the
* texture are assigned to the actor (m_Actor) which is passed to the VTK rendering
* pipeline via the method GetVtkProp().
*
* In order to transform the textured plane to the correct position in space, the
* same transformation as used for reslicing is applied to both the camera and the
* vtkActor. All important steps are explained in more detail below. 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 by another
* rendering entity, e.g. in texture mapping in a 3D view.
*
* Properties that can be set for images and influence the imageMapper2D are:
*
* - \b "opacity": (FloatProperty) Opacity of the image
* - \b "color": (ColorProperty) Color of the image
* - \b "LookupTable": (mitkLookupTableProperty) If this property is set,
* the default lookuptable will be ignored and the "LookupTable" value
* will be used instead.
* - \b "Image Rendering.Mode": This property decides which mode is used to render images. (E.g. if a lookup table or a transferfunction is applied). Detailed documentation about the modes can be found here: \link mitk::RenderingerModeProperty \endlink
* - \b "Image Rendering.Transfer Function": (mitkTransferFunctionProperty) If this
* property is set, a color transferfunction will be used to color the image.
* - \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, TODO has to be reimplemented
* - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!)
unit is ml or cm3, TODO has to be reimplemented
* 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 "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)
* - \b "Image Rendering.Transfer Function": Default color transfer function for CTs
* - \b "LookupTable": Rainbow color.
* 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 MITKCORE_EXPORT ImageVtkMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( ImageVtkMapper2D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Get the Image to map */
const mitk::Image *GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
//### methods of MITK-VTK rendering pipeline
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transveral, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKCORE_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_Actor;
vtkSmartPointer<vtkPropAssembly> m_Actors;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
vtkSmartPointer<vtkImageExtractComponents> m_VectorComponentExtractor;
/** \brief Current slice of a 2D render window.*/
vtkSmartPointer<vtkImageData> m_ReslicedImage;
/** \brief Empty vtkPolyData that is set when rendering geometry does not
* intersect the image geometry.
* \warning This member variable is set to NULL,
* if no image geometry is inside the plane geometry
* of the respective render window. Any user of this
* slice has to check whether it is set to NULL!
*/
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
/** \brief Plane on which the slice is rendered as texture. */
vtkSmartPointer<vtkPlaneSource> m_Plane;
/** \brief The texture which is used to render the current slice. */
vtkSmartPointer<vtkTexture> m_Texture;
/** \brief The lookuptables for colors and level window */
vtkSmartPointer<vtkLookupTable> m_DefaultLookupTable;
vtkSmartPointer<vtkLookupTable> m_BinaryLookupTable;
vtkSmartPointer<vtkLookupTable> m_ColorLookupTable;
/** \brief The actual reslicer (one per renderer) */
mitk::ExtractSliceFilter::Pointer m_Reslicer;
/** \brief Filter for thick slices */
vtkSmartPointer<vtkMitkThickSlicesFilter> m_TSFilter;
/** \brief PolyData object containg all lines/points needed for outlining the contour.
This container is used to save a computed contour for the next rendering execution.
For instance, if you zoom or pann, there is no need to recompute the contour. */
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType* m_mmPerPixel;
/** \brief This filter is used to apply the level window to Grayvalue and RBG(A) images. */
vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief This method switches between different rendering modes (e.g. use a lookup table or a transfer function).
* Detailed documentation about the modes can be found here: \link mitk::RenderingerModeProperty \endlink
*/
void ApplyRenderingMode(mitk::BaseRenderer *renderer);
protected:
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer* renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
*
* \image html texturedPlane.png
*
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer* renderer, double planeBounds[6]);
/** \brief Generates a vtkPolyData object containing the outline of a given binary slice.
\param renderer: Pointer to the renderer containing the needed information
\note This code is based on code from the iil library.
*/
vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer* renderer);
/** Default constructor */
ImageVtkMapper2D();
/** Default deconstructor */
virtual ~ImageVtkMapper2D();
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
- virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer* renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer* renderer);
/** \brief This method applies a color transfer function.
* Internally, a vtkColorTransferFunction is used. This is usefull for coloring continous
* images (e.g. float)
* \warning To use the color transfer function, the property 'Image Rendering.Transfer Function' must be set and a 'Image Rendering.Mode' which uses the color transfer function must be set.
*/
void ApplyColorTransferFunction(mitk::BaseRenderer* renderer);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses the level window must be set.
* @param renderer Level window for which renderer?
*/
void ApplyLevelWindow(mitk::BaseRenderer* renderer);
/** \brief Set the color of the image/polydata */
void ApplyColor( mitk::BaseRenderer* renderer );
/** \brief Set the opacity of the actor. */
void ApplyOpacity( mitk::BaseRenderer* renderer );
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given PlaneGeometry intersects the given
* SlicedGeometry3D. It calculates the distance of the PlaneGeometry to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
**/
bool RenderingGeometryIntersectsImage( const PlaneGeometry* renderingGeometry, SlicedGeometry3D* imageGeometry );
};
} // namespace mitk
#endif /* MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E */
diff --git a/Modules/Core/include/mitkImageVtkReadAccessor.h b/Modules/Core/include/mitkImageVtkReadAccessor.h
index f12d99d932..664fc7db76 100644
--- a/Modules/Core/include/mitkImageVtkReadAccessor.h
+++ b/Modules/Core/include/mitkImageVtkReadAccessor.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEVTKREADACCESSOR_H
#define MITKIMAGEVTKREADACCESSOR_H
#include "mitkImageAccessorBase.h"
class vtkImageData;
namespace mitk {
class Image;
class ImageDataItem;
/**
* @brief ImageVtkReadAccessor class provides any image read access which is required by Vtk methods
* @ingroup Data
*/
class MITKCORE_EXPORT ImageVtkReadAccessor : public ImageAccessorBase
{
public:
/** \brief Creates an ImageVtkWriteAccessor for a whole Image
* \param Image::Pointer specifies the associated Image
*/
ImageVtkReadAccessor(
ImageConstPointer iP,
const ImageDataItem* iDI,
const vtkImageData* imageDataVtk
);
~ImageVtkReadAccessor();
const vtkImageData* GetVtkImageData() const;
//vtkTypeMacro(ImageVtkWriteAccessor,vtkDataSet)
protected:
- virtual const Image* GetImage() const;
+ virtual const Image* GetImage() const override;
private:
// due to smart pointer issues, the image is only kept as a weak pointer.
const Image* m_Image;
const vtkImageData* m_ImageDataVtk;
};
}
#endif // MITKIMAGEVTKREADACCESSOR_H
diff --git a/Modules/Core/include/mitkImageVtkWriteAccessor.h b/Modules/Core/include/mitkImageVtkWriteAccessor.h
index 58e3b35e80..06d790a033 100644
--- a/Modules/Core/include/mitkImageVtkWriteAccessor.h
+++ b/Modules/Core/include/mitkImageVtkWriteAccessor.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEVTKWRITEACCESSOR_H
#define MITKIMAGEVTKWRITEACCESSOR_H
#include "mitkImageAccessorBase.h"
class vtkImageData;
namespace mitk {
class Image;
class ImageDataItem;
/**
* @brief ImageVtkWriteAccessor class provides any image write access which is required by Vtk methods
* @ingroup Data
*/
class MITKCORE_EXPORT ImageVtkWriteAccessor : public ImageAccessorBase
{
public:
typedef itk::SmartPointer<Image> ImagePointer;
/** \brief Creates an ImageVtkWriteAccessor for a whole Image
* \param Image::Pointer specifies the associated Image
*/
ImageVtkWriteAccessor(
ImagePointer iP,
const ImageDataItem* iDI,
vtkImageData* imageDataVtk
);
~ImageVtkWriteAccessor();
vtkImageData* GetVtkImageData() const;
protected:
- virtual const Image* GetImage() const;
+ virtual const Image* GetImage() const override;
private:
// due to smart pointer issues, the image is only kept as a weak pointer.
Image* m_Image;
vtkImageData* m_ImageDataVtk;
};
}
#endif // MITKIMAGEVTKWRITEACCESSOR_H
diff --git a/Modules/Core/include/mitkImageWriteAccessor.h b/Modules/Core/include/mitkImageWriteAccessor.h
index c40e2d80b2..d2727e8ddc 100644
--- a/Modules/Core/include/mitkImageWriteAccessor.h
+++ b/Modules/Core/include/mitkImageWriteAccessor.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEWRITEACCESSOR_H
#define MITKIMAGEWRITEACCESSOR_H
#include "mitkImageAccessorBase.h"
#include "mitkImage.h"
namespace mitk {
/**
* @brief ImageWriteAccessor class to get locked write-access for a particular image part.
* @ingroup Data
*/
class MITKCORE_EXPORT ImageWriteAccessor : public ImageAccessorBase
{
template <class TPixel, unsigned int VDimension>
friend class ImagePixelReadAccessor;
public:
typedef Image::Pointer ImagePointer;
/** \brief Orders write access for a slice, volume or 4D-Image
* \param Image::Pointer specifies the associated Image
* \param ImageDataItem* specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*/
ImageWriteAccessor(
ImagePointer image,
const ImageDataItem* iDI = NULL,
int OptionFlags = ImageAccessorBase::DefaultBehavior
);
/** \brief Gives full data access. */
inline void * GetData()
{
return m_AddressBegin;
}
/** \brief informs Image to unlock the represented image part */
virtual ~ImageWriteAccessor();
protected:
- virtual const Image* GetImage() const;
+ virtual const Image* GetImage() const override;
private:
/** \brief manages a consistent write access and locks the ordered image part */
void OrganizeWriteAccess();
ImageWriteAccessor& operator=(const ImageWriteAccessor&); // Not implemented on purpose.
ImageWriteAccessor(const ImageWriteAccessor&);
ImagePointer m_Image;
};
}
#endif // MITKIMAGEWRITEACCESSOR_H
diff --git a/Modules/Core/include/mitkInteractionEvent.h b/Modules/Core/include/mitkInteractionEvent.h
index 5e1d8a26e3..bcfd9e3364 100644
--- a/Modules/Core/include/mitkInteractionEvent.h
+++ b/Modules/Core/include/mitkInteractionEvent.h
@@ -1,150 +1,150 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKINTERACTIONEVENT_H_
#define MITKINTERACTIONEVENT_H_
#include "itkLightObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkBaseRenderer.h"
#include <MitkCoreExports.h>
#include <string>
namespace mitk
{
class MITKCORE_EXPORT InteractionEvent: public itk::LightObject
{
public:
- mitkClassMacro(InteractionEvent,itk::LightObject)
+ mitkClassMacroItkParent(InteractionEvent,itk::LightObject)
mitkNewMacro1Param(Self,BaseRenderer*)
void SetSender(BaseRenderer* sender);
BaseRenderer* GetSender() const;
/**
* This class implements an up cast to check if the provided baseClass object is derived from this class.
* This function is used to support polymorphism on state machine pattern (XML) level.
*/
virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
/**
* Mouse/keyboard state values
*/
enum MouseButtons
{
NoButton = 0x0000,
LeftMouseButton = 0x0001,
RightMouseButton = 0x0002,
MiddleMouseButton = 0x0004
};
enum ModifierKeys
{
NoKey = 0x0000,
ShiftKey = 0x0100,
ControlKey = 0x0200,
AltKey = 0x0400
};
/**
* KeyConstants Constants for special keys
*/
// Special Keys
static const std::string KeyEsc; // = "Escape";
static const std::string KeyEnter; // = "Enter";
static const std::string KeyReturn; // = "Return";
static const std::string KeyDelete; // = "Delete";
static const std::string KeyArrowUp; // = "ArrowUp";
static const std::string KeyArrowDown; // = "ArrowDown";
static const std::string KeyArrowLeft; // = "ArrowLeft";
static const std::string KeyArrowRight; // = "ArrowRight";
static const std::string KeyF1; // = "F1";
static const std::string KeyF2; // = "F2";
static const std::string KeyF3; // = "F3";
static const std::string KeyF4; // = "F4";
static const std::string KeyF5; // = "F5";
static const std::string KeyF6; // = "F6";
static const std::string KeyF7; // = "F7";
static const std::string KeyF8; // = "F8";
static const std::string KeyF9; // = "F9";
static const std::string KeyF10; // = "F10";
static const std::string KeyF11; // = "F11";
static const std::string KeyF12; // = "F12";
static const std::string KeyPos1; // = "Pos1";
static const std::string KeyEnd; // = "End";
static const std::string KeyInsert; // = "Insert";
static const std::string KeyPageUp; // = "PageUp";
static const std::string KeyPageDown; // = "PageDown";
static const std::string KeySpace; // = "Space";
// End special keys
protected:
InteractionEvent(BaseRenderer*);
virtual ~InteractionEvent();
friend MITKCORE_EXPORT bool operator==(const InteractionEvent&, const InteractionEvent&);
virtual bool IsEqual(const InteractionEvent& other) const;
private:
BaseRenderer* m_Sender;
};
/**
* Implementation of equality for event classes.
* Equality does \b not mean an exact copy or pointer equality.
*
* A match is determined by agreement in all attributes that are necessary to describe
* the event for a state machine transition.
* E.g. for a mouse event press event, it is important which modifiers are used,
* which mouse button was used to triggered the event, but the mouse position is irrelevant.
*/
MITKCORE_EXPORT bool operator==(const InteractionEvent& a, const InteractionEvent& b);
MITKCORE_EXPORT bool operator!=(const InteractionEvent& a, const InteractionEvent& b);
/*
* Allow bitwise OR operation on enums.
*/
inline InteractionEvent::MouseButtons operator|(InteractionEvent::MouseButtons a, InteractionEvent::MouseButtons b)
{
return static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
}
inline InteractionEvent::MouseButtons& operator|=(InteractionEvent::MouseButtons& a, InteractionEvent::MouseButtons& b)
{
a = static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
return a;
}
inline InteractionEvent::ModifierKeys operator|(InteractionEvent::ModifierKeys a, InteractionEvent::ModifierKeys b)
{
return static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
}
inline InteractionEvent::ModifierKeys& operator|=(InteractionEvent::ModifierKeys& a, InteractionEvent::ModifierKeys& b)
{
a = static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
return a;
}
} /* namespace mitk */
#endif /* MITKINTERACTIONEVENT_H_ */
diff --git a/Modules/Core/include/mitkInteractionEventHandler.h b/Modules/Core/include/mitkInteractionEventHandler.h
index a9203e6560..3d0519c539 100644
--- a/Modules/Core/include/mitkInteractionEventHandler.h
+++ b/Modules/Core/include/mitkInteractionEventHandler.h
@@ -1,135 +1,135 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKEVENTHANDLER_H_
#define MITKEVENTHANDLER_H_
#include "itkLightObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include "mitkEventConfig.h"
#include "mitkPropertyList.h"
#include <string>
namespace us {
class Module;
}
namespace mitk
{
/**
* \class EventHandler
* Serves as a base class for all objects and classes that handle mitk::InteractionEvents.
*
* It provides an interface to load configuration objects map of events to variant names.
*/
class InteractionEvent;
class MITKCORE_EXPORT InteractionEventHandler : public itk::LightObject
{
public:
- mitkClassMacro(InteractionEventHandler, itk::LightObject)
+ mitkClassMacroItkParent(InteractionEventHandler, itk::LightObject)
/**
* @brief Loads a configuration from an XML resource.
*
* Loads an event configuration from an XML resource file contained in the given module.
* Default is the Mitk module (core).
* The files have to be placed in the Resources/Interactions folder of their respective module.
* This method will remove all existing configuration and replaces it with the new one.
*
* @see SetEventConfig(const EventConfig&)
*
* @param filename The resource name relative to the Interactions resource folder.
* @param module The module containing the resource. Defaults to the Mitk module.
* @return \c true if the resource was successfully loaded, \c false otherwise.
*/
bool SetEventConfig(const std::string& filename, const us::Module* module = NULL);
/**
* @brief Loads a configuration from an EventConfig object.
*
* Loads an event configuration from the given EventConfig object. This method will remove
* all existing configuration and replaces it with the new one.
*
* @see SetEventConfig(const std::string&, const Module*)
*
* @param config The EventConfig object containing the new configuration.
* @return \c true if the configuration was successfully loaded, \c false otherwise.
*/
bool SetEventConfig(const EventConfig& config);
/**
* @brief Returns the current configuration.
* @return A EventConfig object representing the current event configuration.
*/
EventConfig GetEventConfig() const;
/**
* @brief This method \e extends the configuration.
*
* The configuration from the resource provided is loaded and only the ones conflicting are replaced by the new one.
* This way several configuration files can be combined.
*
* @see AddEventConfig(const EventConfig&)
*
* @param filename The resource name relative to the Interactions resource folder.
* @param module The module containing the resource. Defaults to the Mitk module.
* @return \c true if the configuration was successfully added, \c false otherwise.
*/
bool AddEventConfig(const std::string& filename, const us::Module* module = NULL);
/**
* @brief This method \e extends the configuration.
* The configuration from the EventConfig object is loaded and only the ones conflicting are replaced by the new one.
* This way several configurations can be combined.
*
* @see AddEventConfig(const std::string&, const Module*)
*
* @param config The EventConfig object whose configuration should be added.
* @return \c true if the configuration was successfully added, \c false otherwise.
*/
bool AddEventConfig(const EventConfig& config);
protected:
InteractionEventHandler();
virtual ~InteractionEventHandler();
/**
* Returns a PropertyList in which the parameters defined in the config file are listed.
*/
PropertyList::Pointer GetAttributes() const;
std::string MapToEventVariant(InteractionEvent* interactionEvent);
/**
* Is called whenever a new config object ist set.
* Overwrite this method e.g. to initialize EventHandler with parameters in configuration file.
*/
virtual void ConfigurationChanged();
private:
EventConfig m_EventConfig;
};
} /* namespace mitk */
#endif /* MITKEVENTHANDLER_H_ */
diff --git a/Modules/Core/include/mitkInteractionKeyEvent.h b/Modules/Core/include/mitkInteractionKeyEvent.h
index 7db14db03d..8886be9e2f 100644
--- a/Modules/Core/include/mitkInteractionKeyEvent.h
+++ b/Modules/Core/include/mitkInteractionKeyEvent.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKINTERACTIONKEYEVENT_H_
#define MITKINTERACTIONKEYEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <string.h>
#include <MitkCoreExports.h>
/*
* Note: A Click with the MiddleButton is to be handled with MousePressEvents
*/
namespace mitk
{
/**
* \class InteractionKeyEvent
* \brief Handles key events.
* Takes a std::string for pressed key or special key description, mitk::ModifierKeys for modifiers
* \ingroup Interaction.
*/
class MITKCORE_EXPORT InteractionKeyEvent : public InteractionEvent {
public:
mitkClassMacro(InteractionKeyEvent,InteractionEvent)
mitkNewMacro3Param(Self, BaseRenderer*, const std::string& , ModifierKeys)
- bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
ModifierKeys GetModifiers() const;
std::string GetKey() const;
protected:
InteractionKeyEvent(BaseRenderer*, const std::string& key, ModifierKeys modifiers);
virtual ~InteractionKeyEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
std::string m_Key;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKINTERACTIONKEYEVENT_H_ */
diff --git a/Modules/Core/include/mitkInteractionPositionEvent.h b/Modules/Core/include/mitkInteractionPositionEvent.h
index 1574be3b50..41e0eb1ed8 100644
--- a/Modules/Core/include/mitkInteractionPositionEvent.h
+++ b/Modules/Core/include/mitkInteractionPositionEvent.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKINTERACTIONPOSITIONEVENT_H_
#define MITKINTERACTIONPOSITIONEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEvent.h"
#include "mitkInteractionEventConst.h"
#include <MitkCoreExports.h>
#include <string>
namespace mitk
{
/**
* \class InteractionPositionEvent
*
* \brief Super class for all position events.
*
* This class is instantiated with a BaseRenderer and the 2D pointer position relative to the renderer,
* the object then queries the Renderer for 3D world coordinates and supplies them to deriving classes.
*
*/
class MITKCORE_EXPORT InteractionPositionEvent : public InteractionEvent
{
public:
mitkClassMacro(InteractionPositionEvent,InteractionEvent);
mitkNewMacro3Param(Self, BaseRenderer*, const Point2D&, const Point3D&);
Point2D GetPointerPositionOnScreen() const;
Point3D GetPositionInWorld() const;
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
InteractionPositionEvent(BaseRenderer* baseRenderer, const Point2D& mousePosition, const Point3D &worldPosition);
virtual ~InteractionPositionEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
const Point2D m_PointerPosition;
const Point3D m_WorldPosition;
};
} /* namespace mitk */
#endif /* MITKINTERACTIONPOSITIONEVENT_H_ */
diff --git a/Modules/Core/include/mitkInteractor.h b/Modules/Core/include/mitkInteractor.h
index 3ba6dc02e0..9a87fb4c1d 100755
--- a/Modules/Core/include/mitkInteractor.h
+++ b/Modules/Core/include/mitkInteractor.h
@@ -1,174 +1,174 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef INTERACTOR_H_HEADER_INCLUDED
#define INTERACTOR_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkStateMachine.h"
#include "mitkGeometry3D.h"
#include <string>
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
/**
* \deprecatedSince{2013_03} mitk::Interactor is deprecated. Use mitk::DataInteractor instead.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_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;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
/**
* @brief Updates the current TimeStep according to the associated data and calls Superclass::HandleEvent()
**/
- bool HandleEvent(StateEvent const* stateEvent);
+ bool HandleEvent(StateEvent const* stateEvent) override;
/**
* @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);
+ virtual void ExecuteOperation(Operation* operation) override;
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);
+ virtual void UpdateTimeStep(unsigned int timeStep) override;
//##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/Modules/Core/include/mitkInternalEvent.h b/Modules/Core/include/mitkInternalEvent.h
index a8c67ff435..3839e7c35f 100644
--- a/Modules/Core/include/mitkInternalEvent.h
+++ b/Modules/Core/include/mitkInternalEvent.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkInternalEvent_h
#define mitkInternalEvent_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionEvent.h"
#include "mitkBaseRenderer.h"
#include <string>
#include <MitkCoreExports.h>
namespace mitk
{
/**
*\brief Class to create events from within the application to signal about internal events.
*
* These events can target a specific DataInteractor, if this DataInteractor is specified in the constructor;
* else this parameter is set to NULL and the event is treated as a regular event.
*/
class MITKCORE_EXPORT InternalEvent: public InteractionEvent
{
public:
mitkClassMacro(InternalEvent,InteractionEvent);
mitkNewMacro3Param(Self, BaseRenderer*, DataInteractor*, const std::string&);
std::string GetSignalName() const;
DataInteractor* GetTargetInteractor() const;
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
InternalEvent(BaseRenderer*, DataInteractor* destInteractor, const std::string& signalName);
virtual ~InternalEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
DataInteractor::Pointer m_DataInteractor;
std::string m_SignalName;
};
}
#endif /* mitkInternalEvent_h */
diff --git a/Modules/Core/include/mitkItkImageIO.h b/Modules/Core/include/mitkItkImageIO.h
index 1fa0fe293f..3159e696ed 100644
--- a/Modules/Core/include/mitkItkImageIO.h
+++ b/Modules/Core/include/mitkItkImageIO.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKITKFILEIO_H
#define MITKITKFILEIO_H
#include "mitkAbstractFileIO.h"
#include <itkImageIOBase.h>
namespace mitk {
/**
* This class wraps ITK image IO objects as mitk::IFileReader and
* mitk::IFileWriter objects.
*
* Instantiating this class with a given itk::ImageIOBase instance
* will register corresponding MITK reader/writer services for that
* ITK ImageIO object.
*/
class MITKCORE_EXPORT ItkImageIO : public AbstractFileIO
{
public:
ItkImageIO(itk::ImageIOBase::Pointer imageIO);
ItkImageIO(const CustomMimeType& mimeType, itk::ImageIOBase::Pointer imageIO, int rank);
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual void Write() override;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
protected:
virtual std::vector<std::string> FixUpImageIOExtensions(const std::string& imageIOName);
private:
ItkImageIO(const ItkImageIO& other);
- ItkImageIO* IOClone() const;
+ ItkImageIO* IOClone() const override;
itk::ImageIOBase::Pointer m_ImageIO;
};
} // namespace mitk
#endif /* MITKITKFILEIO_H */
diff --git a/Modules/Core/include/mitkItkLoggingAdapter.h b/Modules/Core/include/mitkItkLoggingAdapter.h
index 44651eb370..cd617e3334 100644
--- a/Modules/Core/include/mitkItkLoggingAdapter.h
+++ b/Modules/Core/include/mitkItkLoggingAdapter.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ItkLoggingAdapter_H_HEADER_INCLUDED
#define ItkLoggingAdapter_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include <itkOutputWindow.h>
#include <itkObjectFactory.h>
namespace mitk {
//##Documentation
//## @brief Adapter that overwrites the standard itk logging output window and sends the logging messages to the MITK logging instead.
//## @ingroup IO
// this class is used to send output to stdout and not the itk window
class MITKCORE_EXPORT ItkLoggingAdapter : public itk::OutputWindow
{
public:
typedef ItkLoggingAdapter Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Run-time type information (and related methods). */
itkTypeMacro( ItkLoggingAdapter, itk::OutputWindow );
/** New macro for creation of through a Smart Pointer */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Initializes the logging adapter. Itk logging
* messages are redirected to MITK logging afterwards.
*/
static void Initialize();
- virtual void DisplayText(const char* s);
+ virtual void DisplayText(const char* s) override;
protected:
ItkLoggingAdapter();
virtual ~ItkLoggingAdapter();
private:
ItkLoggingAdapter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
}
#endif /* mitkItkLoggingAdapter_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkLandmarkProjector.h b/Modules/Core/include/mitkLandmarkProjector.h
index 0d607d7ecf..f61619362d 100644
--- a/Modules/Core/include/mitkLandmarkProjector.h
+++ b/Modules/Core/include/mitkLandmarkProjector.h
@@ -1,117 +1,117 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C
#define MITKLANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT LandmarkProjector : public itk::Object
{
public:
- mitkClassMacro(LandmarkProjector, itk::Object);
+ mitkClassMacroItkParent(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::BaseGeometry);
//##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::BaseGeometry);
//##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::BaseGeometry::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/Modules/Core/include/mitkLandmarkProjectorBasedCurvedGeometry.h b/Modules/Core/include/mitkLandmarkProjectorBasedCurvedGeometry.h
index 886e3f5fb0..672c6e50b9 100644
--- a/Modules/Core/include/mitkLandmarkProjectorBasedCurvedGeometry.h
+++ b/Modules/Core/include/mitkLandmarkProjectorBasedCurvedGeometry.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkLandmarkProjector.h"
#include "mitkAbstractTransformGeometry.h"
#include "mitkPointSet.h"
namespace mitk {
//##Documentation
//## @brief Superclass of AbstractTransformGeometry sub-classes defined
//## by a set of landmarks.
//##
//## @ingroup Geometry
class MITKCORE_EXPORT LandmarkProjectorBasedCurvedGeometry : public AbstractTransformGeometry
{
public:
mitkClassMacro(LandmarkProjectorBasedCurvedGeometry, AbstractTransformGeometry);
void SetLandmarkProjector(mitk::LandmarkProjector* aLandmarkProjector);
itkGetConstObjectMacro(LandmarkProjector, mitk::LandmarkProjector);
- virtual void SetFrameGeometry(const mitk::BaseGeometry* frameGeometry);
+ virtual void SetFrameGeometry(const mitk::BaseGeometry* frameGeometry) override;
virtual void ComputeGeometry();
itkGetConstMacro(InterpolatingAbstractTransform, vtkAbstractTransform*);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
//##Documentation
//## @brief Set the landmarks through which the geometry shall pass
itkSetConstObjectMacro(TargetLandmarks, mitk::PointSet::DataType::PointsContainer);
//##Documentation
//## @brief Get the landmarks through which the geometry shall pass
itkGetConstObjectMacro(TargetLandmarks, mitk::PointSet::DataType::PointsContainer);
protected:
LandmarkProjectorBasedCurvedGeometry();
LandmarkProjectorBasedCurvedGeometry(const LandmarkProjectorBasedCurvedGeometry& other);
virtual ~LandmarkProjectorBasedCurvedGeometry();
mitk::LandmarkProjector::Pointer m_LandmarkProjector;
vtkAbstractTransform* m_InterpolatingAbstractTransform;
mitk::PointSet::DataType::PointsContainer::ConstPointer m_TargetLandmarks;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
};
} // namespace mitk
#endif /* MITKLANDMARKPROJECTORBASEDCURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/Core/include/mitkLevelWindowManager.h b/Modules/Core/include/mitkLevelWindowManager.h
index d46059fdda..e96b50a7ad 100644
--- a/Modules/Core/include/mitkLevelWindowManager.h
+++ b/Modules/Core/include/mitkLevelWindowManager.h
@@ -1,144 +1,144 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkLevelWindowManager_h
#define mitkLevelWindowManager_h
#include "mitkDataStorage.h"
#include "mitkLevelWindowProperty.h"
#include "mitkBaseProperty.h"
#include <map>
#include <utility>
namespace mitk
{
/**
\brief Provides access to the LevelWindowProperty object and LevelWindow of the "current" image.
- provides a LevelWindowProperty for purposes like GUI editors
- this property comes from one of two possible sources
- either something (e.g. the application) sets the property because of some user selection
- OR the "Auto top-most" logic is used to search a DataStorage for the image with the highest "layer" property value
Changes on Level/Window can be set with SetLevelWindow() and will affect either the topmost layer image,
if isAutoTopMost() returns true, or an image which is set by SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty).
Changes to Level/Window, when another image gets active or by SetLevelWindow(const LevelWindow& levelWindow),
will be sent to all listeners by Modified().
DataStorageChanged() listens to the DataStorage for new or removed images. Depending on how m_AutoTopMost is set,
the new image becomes active or not. If an image is removed from the DataStorage and m_AutoTopMost is false,
there is a check to proof, if the active image is still available. If not, then m_AutoTopMost becomes true.
Note that this class is not thread safe at the moment!
*/
class MITKCORE_EXPORT LevelWindowManager : public itk::Object
{
public:
- mitkClassMacro(LevelWindowManager, itk::Object)
+ mitkClassMacroItkParent(LevelWindowManager, itk::Object)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetDataStorage(DataStorage* ds);
DataStorage* GetDataStorage(); ///< returns the datastorage
/** @brief (Re-)Initializes the LevelWindowManager by setting the topmost image.
* Use the removedNode parameter if a node was removed...
* @param autoTopMost true: sets the topmost layer image to be affected by changes
* @param removedNode != NULL a node was removed from DataStorage */
void SetAutoTopMostImage(bool autoTopMost, const DataNode* removedNode = NULL);
void Update(const itk::EventObject& e); ///< gets called if a visible property changes
/** @brief Sets an specific LevelWindowProperty, all changes will affect the image belonging to this property.
* @throw mitk::Exception Throws an exception if the there is no image in the data storage which belongs to this property.*/
void SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty);
/** @brief Sets new Level/Window values and informs all listeners about changes. */
void SetLevelWindow(const LevelWindow& levelWindow);
/** @return Returns Level/Window values for the current image.*/
const LevelWindow& GetLevelWindow();
/** @return Returns the current mitkLevelWindowProperty object from the image that is affected by changes.*/
LevelWindowProperty::Pointer GetLevelWindowProperty();
/** @return true if changes on slider or line-edits will affect always the topmost layer image. */
bool isAutoTopMost();
/** @brief This method is called when a node is added to the data storage.
* A listener on the data storage is used to call this method automatically after a node was added.
* @throw mitk::Exception Throws an exception if something is wrong, e.g. if the number of observers differs from the number of nodes.
*/
void DataStorageAddedNode(const DataNode* n = NULL);
/** @brief This method is called when a node is removed to the data storage.
* A listener on the data storage is used to call this method automatically directly before a node will be removed.
* @throw mitk::Exception Throws an exception if something is wrong, e.g. if the number of observers differs from the number of nodes.
*/
void DataStorageRemovedNode(const DataNode* removedNode = NULL);
/** @brief change notifications from mitkLevelWindowProperty */
void OnPropertyModified(const itk::EventObject& e);
Image* GetCurrentImage(); ///< return the currently active image
/**
* @return Returns the current number of observers which are registered in this object.
* @throw mitk::Exception Throws an exception if the number of observers differs from
* the number of relevant objects
* which means that something is wrong.
*
*/
int GetNumberOfObservers();
/**
* returns all nodes in the DataStorage that have the following properties:
* "visible" == true, "binary" == false, "levelwindow", and DataType == Image
*/
DataStorage::SetOfObjects::ConstPointer GetRelevantNodes();
protected:
LevelWindowManager();
~LevelWindowManager();
DataStorage::Pointer m_DataStorage;
LevelWindowProperty::Pointer m_LevelWindowProperty; ///< pointer to the LevelWindowProperty of the current image
typedef std::pair<unsigned long, DataNode::Pointer> PropDataPair;
typedef std::map<PropDataPair, BaseProperty::Pointer> ObserverToPropertyMap;
ObserverToPropertyMap m_PropObserverToNode; ///< map to hold observer IDs to every visible property of DataNode�s BaseProperty
ObserverToPropertyMap m_PropObserverToNode2; ///< map to hold observer IDs to every layer property of DataNode�s BaseProperty
ObserverToPropertyMap m_PropObserverToNode3; ///< map to hold observer IDs to every Image Rendering.Mode property of DataNode�s BaseProperty
void UpdateObservers(); ///< updates the internal observer list. Ignores nodes which are marked to be deleted in the variable m_NodeMarkedToDelete
void ClearPropObserverLists(); ///< internal help method to clear both lists/maps.
void CreatePropObserverLists(); ///< internal help method to create both lists/maps.
const mitk::DataNode* m_NodeMarkedToDelete; ///< this variable holds a data node which will be deleted from the datastorage immedeately (if there is one, NULL otherways)
bool m_AutoTopMost;
unsigned long m_ObserverTag;
bool m_IsObserverTagSet;
unsigned long m_PropertyModifiedTag;
Image* m_CurrentImage;
bool m_IsPropertyModifiedTagSet;
};
}
#endif
diff --git a/Modules/Core/include/mitkLevelWindowPreset.h b/Modules/Core/include/mitkLevelWindowPreset.h
index f6c12ce4a0..5f0d9943ea 100644
--- a/Modules/Core/include/mitkLevelWindowPreset.h
+++ b/Modules/Core/include/mitkLevelWindowPreset.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LEVELWINDOWPRESET_H_HEADER
#define LEVELWINDOWPRESET_H_HEADER
#include <vtkXMLParser.h>
#include <MitkCoreExports.h>
#include <map>
#include <string>
namespace mitk {
class MITKCORE_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<std::string, double>& getLevelPresets();
std::map<std::string, double>& getWindowPresets();
void newPresets(std::map<std::string, double> newLevel, std::map<std::string, double> 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 StartElement (const char *elementName, const char **atts) override;
//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<std::string, double> m_Level;
std::map<std::string, double> m_Window;
std::string m_XmlFileName;
};
}
#endif
diff --git a/Modules/Core/include/mitkLevelWindowProperty.h b/Modules/Core/include/mitkLevelWindowProperty.h
index 8ef5b7ac7c..c41af2cc03 100755
--- a/Modules/Core/include/mitkLevelWindowProperty.h
+++ b/Modules/Core/include/mitkLevelWindowProperty.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include "mitkBaseProperty.h"
#include "mitkLevelWindow.h"
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* @brief The LevelWindowProperty class Property for the mitk::LevelWindow
*
* @ingroup DataManagement
*
* @note If you want to apply the mitk::LevelWindowProperty to an mitk::Image,
* make sure to set the mitk::RenderingModeProperty to a mode which supports
* level window (e.g. LEVELWINDOW_COLOR). Make sure to check the documentation
* of the mitk::RenderingModeProperty. For a code example how to use the
* mitk::LevelWindowProperty check the mitkImageVtkMapper2DLevelWindowTest.cpp
* in Core\Code\Testing.
*/
class MITKCORE_EXPORT LevelWindowProperty : public BaseProperty
{
protected:
LevelWindow m_LevWin;
LevelWindowProperty();
LevelWindowProperty(const LevelWindowProperty& other);
LevelWindowProperty(const mitk::LevelWindow &levWin);
public:
mitkClassMacro(LevelWindowProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(LevelWindowProperty, const mitk::LevelWindow&);
typedef LevelWindow ValueType;
virtual ~LevelWindowProperty();
const mitk::LevelWindow & GetLevelWindow() const;
const mitk::LevelWindow & GetValue() const;
void SetLevelWindow(const LevelWindow &levWin);
void SetValue(const ValueType& levWin);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
LevelWindowProperty& operator=(const LevelWindowProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Modules/Core/include/mitkLimitedLinearUndo.h b/Modules/Core/include/mitkLimitedLinearUndo.h
index 4b91b9e751..9646e76e34 100644
--- a/Modules/Core/include/mitkLimitedLinearUndo.h
+++ b/Modules/Core/include/mitkLimitedLinearUndo.h
@@ -1,145 +1,145 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96
#define LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96
// MITK header
#include <MitkCoreExports.h>
#include "mitkOperationEvent.h"
#include "mitkUndoModel.h"
// STL header
#include <vector>
// ITK header
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
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 MITKCORE_EXPORT LimitedLinearUndo : public UndoModel
{
public:
typedef std::vector<UndoStackItem*> UndoContainer;
typedef std::vector<UndoStackItem*>::reverse_iterator UndoContainerRevIter;
mitkClassMacro(LimitedLinearUndo, UndoModel);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual bool SetOperationEvent(UndoStackItem* stackItem);
+ virtual bool SetOperationEvent(UndoStackItem* stackItem) override;
//##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);
+ virtual bool Undo() override;
+ virtual bool Undo(bool) override;
//##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);
+ virtual bool Redo() override;
+ virtual bool Redo(bool) override;
//##Documentation
//## @brief Redoes all changes until ObjectEventID oeid
virtual bool Redo(int oeid);
//##Documentation
//## @brief Clears UndoList and RedoList
- virtual void Clear();
+ virtual void Clear() override;
//##Documentation
//## @brief Clears the RedoList
- virtual void ClearRedoList();
+ virtual void ClearRedoList() override;
//##Documentation
//## @brief True, if RedoList is empty
- virtual bool RedoListEmpty();
+ virtual bool RedoListEmpty() override;
//##Documentation
//## @brief Returns the ObjectEventId of the
//## top element in the OperationHistory
- virtual int GetLastObjectEventIdInList();
+ virtual int GetLastObjectEventIdInList() override;
//##Documentation
//## @brief Returns the GroupEventId of the
//## top element in the OperationHistory
- virtual int GetLastGroupEventIdInList();
+ virtual int GetLastGroupEventIdInList() override;
//##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);
+ virtual OperationEvent* GetLastOfType(OperationActor* destination, OperationType opType) override;
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);
};
#pragma GCC visibility push(default)
/// 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 );
#pragma GCC visibility pop
} //namespace mitk
#endif /* LIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E9C96 */
diff --git a/Modules/Core/include/mitkLocalStorageHandler.h b/Modules/Core/include/mitkLocalStorageHandler.h
index 73089ac65b..6dd4591007 100644
--- a/Modules/Core/include/mitkLocalStorageHandler.h
+++ b/Modules/Core/include/mitkLocalStorageHandler.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LOCALSTORAGEHANDLER_H_HEADER_INCLUDED_C1E6EA08
#define LOCALSTORAGEHANDLER_H_HEADER_INCLUDED_C1E6EA08
#include <MitkCoreExports.h>
#include "mitkBaseRenderer.h"
#include "mitkVtkPropRenderer.h"
#include "mitkLevelWindow.h"
#include "mitkCommon.h"
#include <itkObject.h>
#include <itkWeakPointer.h>
//Just included to get VTK version
#include <vtkConfigure.h>
class vtkWindow;
class vtkProp;
namespace mitk {
/** \brief Interface for accessing (templated) LocalStorageHandler instances.
*/
class BaseLocalStorageHandler
{
public:
virtual ~BaseLocalStorageHandler() {}
virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true )=0;
};
/** \brief Templated class for management of LocalStorage implementations in Mappers.
*
* The LocalStorageHandler is responsible for providing a LocalStorage to a
* concrete mitk::Mapper subclass. Each RenderWindow / mitk::BaseRenderer is
* assigned its own LocalStorage instance so that all contained ressources
* (actors, shaders, textures, ...) are provided individually per window.
*
*/
template<class L> class LocalStorageHandler : public mitk::BaseLocalStorageHandler
{
protected:
std::map<mitk::BaseRenderer *,L*> m_BaseRenderer2LS;
public:
/** \brief deallocates a local storage for a specifc BaseRenderer (if the
* BaseRenderer is itself deallocating it in its destructor, it has to set
* unregisterFromBaseRenderer=false)
*/
- virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true )
+ virtual void ClearLocalStorage(mitk::BaseRenderer *renderer,bool unregisterFromBaseRenderer=true ) override
{
//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 GenerateDataForRenderer()
*/
L *GetLocalStorage(mitk::BaseRenderer *forRenderer)
{
L *l = m_BaseRenderer2LS[ forRenderer ];
if(!l)
{
//MITK_INFO << "creating new localstorage";
l = new L;
m_BaseRenderer2LS[ forRenderer ] = l;
forRenderer->RegisterLocalStorageHandler( this );
}
return l;
}
~LocalStorageHandler()
{
typename std::map<mitk::BaseRenderer *,L*>::iterator it;
for ( it=m_BaseRenderer2LS.begin() ; it != m_BaseRenderer2LS.end(); it++ )
{
(*it).first->UnregisterLocalStorageHandler(this);
delete (*it).second;
}
m_BaseRenderer2LS.clear();
}
};
} // namespace mitk
#endif /* LOCALSTORAGEHANDLER_H_HEADER_INCLUDED_C1E6EA08 */
diff --git a/Modules/Core/include/mitkLog.h b/Modules/Core/include/mitkLog.h
index 0bc6367fe5..f0c4fa56f8 100644
--- a/Modules/Core/include/mitkLog.h
+++ b/Modules/Core/include/mitkLog.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_LOG_H
#define _MITK_LOG_H
#include <MitkCoreExports.h>
#include <mbilog.h>
namespace mitk
{
/*!
\brief mbilog backend implementation for mitk
*/
class MITKCORE_EXPORT LoggingBackend : public mbilog::TextBackendBase
{
public:
/** \brief overloaded method for receiving log message from mbilog
*/
- void ProcessMessage(const mbilog::LogMessage& );
+ void ProcessMessage(const mbilog::LogMessage& ) override;
/** \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 Activates and handles a rolling log file with the given prefix and path.
* This method handles 10 log files with a given prefix, e.g. "myLogFile".
* The 10 log files will then look like this:
* myLogFile-0.log (current file)
* myLogFile-1.log (last file)
* myLogFile-2.log
* [...]
* myLogFile-9.log
*
* Everytime this method this called, normally when MITK is started, then
* all log files are copied one file below (0 to 1, 1 to 2, and so on).
* The oldes logfile (number 9) is always deleted. So users have access to
* the log files of the last 10 runs.
* @throws mitk::Exception Throws an exception if there is a problem with renaming the logfiles, e.g., because of file access problems.
* @param prefixPath Should hold the prefix of the logfile together with its path. E.g., "C:/programs/mitk/myLogFile".
*/
static void RotateLogFiles(const std::string& prefixPath);
/** @brief Increments the names of logfiles with the given prefixPath.
* This means, if the prefixPath is "myLogFile" myLogFile-0.log
* is renamed to myLogFile-1.log, myLogFile-1.log to myLogFile-2.log,
* and so on. The oldest logfile is deleted. The number of log files is
* defined by the parameter "numLogFiles". The first logfile name is
* "free" (e.g., [prefix]-0.log) again. This name is retured.
* @param prefixPath Should hold the prefix of the logfile together with its path. E.g., "C:/programs/mitk/myLogFile".
* @param numLogFiles Sets the number of logfiles. Default value is 10. This means logfiles from [prefix]-0.log
* to [prefix]-1.log are stored.
* @return Returns a new logfile name which is free again because the old first log file was renamed.
* @throws mitk::Exception Throws an exception if there is a problem with renaming the logfiles, e.g., because of file access problems.
*/
static std::string IncrementLogFileNames(const std::string& prefixPath, int numLogFiles = 10);
/** @return Returns the log file if there is one. Returns an empty string
* if no log file is active.
*/
static std::string GetLogFile();
/** \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 <file>" parameters from the standard C main(argc,argv) parameter list and calls SetLogFile if needed
*/
static void CatchLogFileCommandLineParameter(int &argc,char **argv);
- virtual mbilog::OutputType GetOutputType() const;
+ virtual mbilog::OutputType GetOutputType() const override;
protected:
/** Checks if a file exists.
* @return Returns true if the file exists, false if not.
*/
static bool CheckIfFileExists(const std::string& filename);
};
}
#endif
diff --git a/Modules/Core/include/mitkLookupTable.h b/Modules/Core/include/mitkLookupTable.h
index 682fbcd3b4..50cc7d311c 100644
--- a/Modules/Core/include/mitkLookupTable.h
+++ b/Modules/Core/include/mitkLookupTable.h
@@ -1,269 +1,269 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkLookupTable_h
#define mitkLookupTable_h
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include <itkDataObject.h>
#include <itkObjectFactory.h>
#include <vtkLookupTable.h>
#include <vtkSmartPointer.h>
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
namespace mitk
{
/**
* @brief The LookupTable class mitk wrapper for a vtkLookupTable
* @ingroup DataManagement
*
* This class can be used to color images with a LookupTable, such as the
* vtkLookupTable.
* @note If you want to use this as a property for an mitk::Image, make sure
* to use the mitk::LookupTableProperty and set the mitk::RenderingModeProperty
* to a mode which supports lookup tables (e.g. LOOKUPTABLE_COLOR). Make
* sure to check the documentation of the mitk::RenderingModeProperty. For a
* code example how to use the mitk::LookupTable check the
* mitkImageVtkMapper2DLookupTableTest.cpp in Core\Code\Testing.
*/
class MITKCORE_EXPORT LookupTable : public itk::DataObject
{
public:
/**
* @brief RawLookupTableType raw lookuptable typedef for convenience.
*/
typedef unsigned char RawLookupTableType;
- mitkClassMacro( LookupTable, itk::DataObject );
+ mitkClassMacroItkParent( LookupTable, itk::DataObject );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief GetVtkLookupTable Getter for the internally wrapped vtkLookupTable.
*/
virtual vtkSmartPointer<vtkLookupTable> GetVtkLookupTable() const;
/**
* @brief GetRawLookupTable Getter for the raw lookuptable array.
*/
virtual RawLookupTableType* GetRawLookupTable() const;
/**
* @brief SetVtkLookupTable Setter for the internal lookuptable.
* @param lut The lookuptable.
*/
virtual void SetVtkLookupTable( vtkSmartPointer<vtkLookupTable> lut );
/**
* @brief ChangeOpacityForAll Set the opacity for all table values.
* @param opacity Opacity between 0.0 and 1.0.
*/
virtual void ChangeOpacityForAll( float opacity );
/**
* @brief ChangeOpacity Set the opacity for a specific table index.
* @param index The lookuptable index.
* @param opacity Opacity between 0.0 and 1.0.
*/
virtual void ChangeOpacity(int index, float opacity );
/**
* @brief GetColor convenience method wrapping the vtkLookupTable::GetColor() method.
*
* Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.
* @param value The value you want to map.
* @param rgb RGB values between 0 and 1.
*/
virtual void GetColor(double value, double rgb[3]);
/**
* @brief GetTableValue convenience method wrapping the vtkLookupTable::GetTableValue() method.
* @param index The index you want to get.
* @param rgba RGB values between 0 and 1.
*/
virtual void GetTableValue(int index, double rgba[4]);
/**
* @brief SetTableValue convenience method wrapping the vtkLookupTable::SetTableValue() method.
* @param index The index you want to set.
* @param rgba RGB values between 0 and 1.
*/
virtual void SetTableValue(int index, double rgba[4]);
itkSetMacro(Window, float);
itkSetMacro(Level, float);
itkSetMacro(Opacity, float);
/*!
* \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( );
+ virtual void UpdateOutputInformation( ) override;
/**
* 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( );
+ virtual void SetRequestedRegionToLargestPossibleRegion( ) override;
/**
* Checks, if the requested region lies outside of the buffered region by
* calling verifyRequestedRegion().
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( );
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion( ) override;
/**
* 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( );
+ virtual bool VerifyRequestedRegion( ) override;
/**
* This method has no effect for lookup tables, since we do
* not support the region-mechanism
*/
- virtual void SetRequestedRegion(const itk::DataObject *data );
+ virtual void SetRequestedRegion(const itk::DataObject *data ) override;
LookupTable();
virtual ~LookupTable();
/**
* \deprecatedSince{2014_03} Please use CreateColorTransferFunction() instead
*/
DEPRECATED(void CreateColorTransferFunction(vtkColorTransferFunction*& colorFunction));
/**
* \deprecatedSince{2014_03} Please use CreateOpacityTransferFunction() instead
*/
DEPRECATED(void CreateOpacityTransferFunction(vtkPiecewiseFunction*& opacityFunction));
/**
* \deprecatedSince{2014_03} Please use CreateGradientTransferFunction() instead
*/
DEPRECATED(void CreateGradientTransferFunction(vtkPiecewiseFunction*& gradientFunction));
vtkSmartPointer<vtkColorTransferFunction> CreateColorTransferFunction();
vtkSmartPointer<vtkPiecewiseFunction> CreateOpacityTransferFunction();
vtkSmartPointer<vtkPiecewiseFunction> CreateGradientTransferFunction();
/**
* @brief The LookupTableType enum for different predefined lookup tables.
*
* \li GRAYSCALE Our default level-window (sometimes referred to as window-level by other sources) setup for a test image looks like this:
* \image html ExampleLevelWindowColor.png
* \li INVERSE_GRAYSCALE Inverse LookupTable of GRAYSCALE.
* \li HOT_IRON A LookupTable for red colors.
* \li JET A LookupTable for JET color rendering.
* \li LEGACY_BINARY A LookupTable for binary images.
* \li LEGACY_RAINBOW_COLOR A rainbow-like LookupTable.
* \li MULTILABEL A LookupTable for multilabel images.
* \li PET_COLOR A LookupTable for PET color rendering.
* \li PET_20 A LookupTable for PET_20 color rendering.
*
* The different LookupTableTypes can be applied in the MitkWorkbench via right-clicking
* on an image and choosing a color map.
*/
enum LookupTableType
{
GRAYSCALE,
INVERSE_GRAYSCALE,
HOT_IRON,
JET,
LEGACY_BINARY,
LEGACY_RAINBOW_COLOR,
MULTILABEL,
PET_COLOR,
PET_20
};
static const char* const typenameList[];
/*!
* \brief Set the look-up table type by enum (or integer).
* \details Returns if the given type doesn't exist. Only changes the type if it is different
* from the current one.
*/
virtual void SetType(const LookupTableType type);
/*!
* \brief Set the look-up table type by string.
* \details Returns if the given type doesn't exist. Only changes the type if it is different
* from the current one.
*/
virtual void SetType(const std::string& typeName);
/*!
* \brief Return the current look-up table type as a string.
*/
virtual const std::string GetActiveTypeAsString();
protected:
- void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ void PrintSelf(std::ostream &os, itk::Indent indent) const override;
LookupTable(const LookupTable& other);
virtual void BuildGrayScaleLookupTable();
virtual void BuildLegacyBinaryLookupTable();
virtual void BuildLegacyRainbowColorLookupTable();
virtual void BuildInverseGrayScaleLookupTable();
virtual void BuildHotIronLookupTable();
virtual void BuildJetLookupTable();
virtual void BuildPETColorLookupTable();
virtual void BuildPET20LookupTable();
virtual void BuildMultiLabelLookupTable();
vtkSmartPointer<vtkLookupTable> m_LookupTable;
float m_Window;
float m_Level;
float m_Opacity;
LookupTableType m_type;
private:
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
} // namespace mitk
#endif /* mitkLookupTable_h */
diff --git a/Modules/Core/include/mitkLookupTableProperty.h b/Modules/Core/include/mitkLookupTableProperty.h
index 732d2a8226..b6e9060217 100644
--- a/Modules/Core/include/mitkLookupTableProperty.h
+++ b/Modules/Core/include/mitkLookupTableProperty.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "mitkLookupTable.h"
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* @brief The LookupTableProperty class Property to associate mitk::LookupTable
* to an mitk::DataNode.
* @ingroup DataManagement
*
* @note If you want to use this property to colorize an mitk::Image, make sure
* to set the mitk::RenderingModeProperty to a mode which supports lookup tables
* (e.g. LOOKUPTABLE_COLOR). Make sure to check the documentation of the
* mitk::RenderingModeProperty. For a code example how to use the mitk::LookupTable
* and this property check the mitkImageVtkMapper2DLookupTableTest.cpp in
* Core\Code\Testing.
*/
class MITKCORE_EXPORT LookupTableProperty : public BaseProperty
{
protected:
LookupTable::Pointer m_LookupTable;
LookupTableProperty();
LookupTableProperty(const LookupTableProperty&);
LookupTableProperty(const mitk::LookupTable::Pointer lut);
public:
typedef LookupTable::Pointer ValueType;
mitkClassMacro(LookupTableProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(LookupTableProperty, const mitk::LookupTable::Pointer);
itkGetObjectMacro(LookupTable, LookupTable );
ValueType GetValue() const;
void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable);
void SetValue(const ValueType&);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
LookupTableProperty& operator=(const LookupTableProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Modules/Core/include/mitkManufacturerLogo.h b/Modules/Core/include/mitkManufacturerLogo.h
index 90de1168ef..2ec7e9bf78 100644
--- a/Modules/Core/include/mitkManufacturerLogo.h
+++ b/Modules/Core/include/mitkManufacturerLogo.h
@@ -1,183 +1,183 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _vtk_Logo_Rendering_h_
#define _vtk_Logo_Rendering_h_
#include <mitkBaseData.h>
class vtkRenderer;
class vtkRenderWindow;
class vtkMapper;
class vtkCamera;
class vtkImageActor;
class vtkImageMapper;
class vtkLookupTable;
class vtkPolyData;
class vtkPNGReader;
class vtkImageImport;
namespace mitk {
class RenderWindow;
/**
* Renders a company logo in the foreground
* of a vtkRenderWindow.
* @deprecatedSince{next_release} Use mitk::LogoOverlay instead
*/
class MITKCORE_EXPORT ManufacturerLogo : public BaseData
{
public:
mitkClassMacro( ManufacturerLogo, BaseData );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
enum LogoPosition{ UpperLeft, UpperRight, LowerLeft, LowerRight, Middle };
/**
* Sets the renderwindow, in which the logo
* will be shown. Make sure, you have called this function
* before calling Enable()
*/
virtual void SetRenderWindow( vtkRenderWindow* renderWindow );
/**
* Sets the source file for the logo.
*/
virtual void SetLogoSource(const char* filename);
/**
* Sets the opacity level of the logo.
*/
virtual void SetOpacity(double opacity);
/**
* Specifies the logo size, values from 0...10,
* where 1 is a nice little logo
*/
virtual void SetZoomFactor( double factor );
/**
* Enables drawing of the logo.
* If you want to disable it, call the Disable() function.
*/
virtual void Enable();
/**
* Disables drawing of the logo.
* If you want to enable it, call the Enable() function.
*/
virtual void Disable();
/**
* Checks, if the logo is currently
* enabled (visible)
*/
virtual bool IsEnabled();
/**
* Empty implementation, since the ManufacturerLogo doesn't
* support the requested region concept
*/
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
/**
* Empty implementation, since the ManufacturerLogo doesn't
* support the requested region concept
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
* Empty implementation, since the ManufacturerLogo doesn't
* support the requested region concept
*/
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
/**
* Empty implementation, since the ManufacturerLogo doesn't
* support the requested region concept
*/
- virtual void SetRequestedRegion( const itk::DataObject*);
+ virtual void SetRequestedRegion( const itk::DataObject*) override;
/**
* Returns the vtkRenderWindow, which is used
* for displaying the logo
*/
virtual vtkRenderWindow* GetRenderWindow();
/**
* Returns the renderer responsible for
* rendering the logo into the
* vtkRenderWindow
*/
virtual vtkRenderer* GetVtkRenderer();
/**
* Returns the actor associated with the logo
*/
virtual vtkImageActor* GetActor();
/**
* Returns the mapper associated with the logo
*/
virtual vtkImageMapper* GetMapper();
/**
* If set true, this method forces the logo rendering mechanism that it always
* renders the MBI department logo, independent from mainapp option settings.
*/
virtual void ForceMBILogoVisible(bool visible);
protected:
void SetupCamera();
void SetupPosition();
/**
* Constructor
*/
ManufacturerLogo();
/**
* Destructor
*/
~ManufacturerLogo();
vtkRenderWindow* m_RenderWindow;
vtkRenderer* m_Renderer;
vtkImageActor* m_Actor;
vtkImageMapper* m_Mapper;
vtkPNGReader* m_PngReader;
vtkCamera* m_Camera;
vtkImageImport* m_VtkImageImport;
std::string m_FileName;
bool m_IsEnabled;
bool m_ForceShowMBIDepartmentLogo;
LogoPosition m_LogoPosition;
double m_ZoomFactor;
double m_Opacity;
char * m_ImageData;
};
} //end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkMapper.h b/Modules/Core/include/mitkMapper.h
index 02a64bb6fe..e5b1ffbcc4 100644
--- a/Modules/Core/include/mitkMapper.h
+++ b/Modules/Core/include/mitkMapper.h
@@ -1,239 +1,239 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MAPPER_H_HEADER_INCLUDED_C1E6EA08
#define MAPPER_H_HEADER_INCLUDED_C1E6EA08
#include <MitkCoreExports.h>
#include "mitkBaseRenderer.h"
#include "mitkVtkPropRenderer.h"
#include "mitkLevelWindow.h"
#include "mitkCommon.h"
#include "mitkLocalStorageHandler.h"
#include <itkObject.h>
#include <itkWeakPointer.h>
//Just included to get VTK version
#include <vtkConfigure.h>
class vtkWindow;
class vtkProp;
namespace mitk {
class BaseRenderer;
class BaseData;
class DataNode;
class OverlayManager;
/** \brief Base class of all mappers, Vtk as well as OpenGL mappers
*
* By the help of mappers, the input data is transformed to tangible primitives,
* such as surfaces, points, lines, etc.
* This is the base class of all mappers, Vtk as well as OpenGL mappers.
* 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 MITKCORE_EXPORT Mapper : public itk::Object
{
public:
- mitkClassMacro(Mapper, itk::Object);
+ mitkClassMacroItkParent(Mapper, itk::Object);
/** \brief Set the DataNode containing the data to map */
itkSetObjectMacro(DataNode, DataNode);
/** \brief Get the DataNode containing the data to map.
* Method only returns valid DataNode Pointer if the mapper belongs to a data node.
* Otherwise, the returned DataNode Pointer might be invalid. */
virtual DataNode* GetDataNode() const;
/**\brief Get the data to map
*
* Returns the mitk::BaseData object associated with this mapper.
* \return the mitk::BaseData associated with this mapper.
* \deprecatedSince{2013_03} Use GetDataNode()->GetData() instead to access the data
*/
DEPRECATED(BaseData* GetData() const);
/** \brief Convenience access method for color properties (instances of
* ColorProperty)
* \return \a true property was found
* \deprecatedSince{2013_03} Use GetDataNode()->GetColor(...) instead to get the color
*/
DEPRECATED(virtual bool GetColor(float rgb[3], BaseRenderer* renderer, const char* name = "color") const);
/** \brief Convenience access method for visibility properties (instances
* of BoolProperty)
* \return \a true property was found
* \sa IsVisible
* \deprecatedSince{2013_03} Use GetDataNode()->GetVisibility(...) instead to get the visibility
*/
DEPRECATED(virtual bool GetVisibility(bool &visible, BaseRenderer* renderer, const char* name = "visible") const);
/** \brief Convenience access method for opacity properties (instances of
* FloatProperty)
* \return \a true property was found
* \deprecatedSince{2013_03} Use GetDataNode()->GetOpacity(...) instead to get the opacity
*/
DEPRECATED(virtual bool GetOpacity(float &opacity, BaseRenderer* renderer, const char* name = "opacity") const);
/** \brief Convenience access method for color properties (instances of
* LevelWindoProperty)
* \return \a true property was found
* \deprecatedSince{2013_03} Use GetDataNode->GetLevelWindow(...) instead to get the levelwindow
*/
DEPRECATED(virtual bool GetLevelWindow(LevelWindow &levelWindow, BaseRenderer* renderer, const char* name = "levelwindow") const);
/** \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
* \deprecatedSince{2013_03} Use GetDataNode()->GetVisibility(...) instead
*/
DEPRECATED(virtual bool IsVisible(BaseRenderer* renderer, const char* name = "visible") const);
/** \brief Returns whether this is an vtk-based mapper
* \deprecatedSince{2013_03} All mappers of superclass VTKMapper are vtk based, use a dynamic_cast instead
*/
virtual bool IsVtkBased() const = 0;
/** \brief Calls the time step of the input data for the specified renderer and checks
* whether the time step is valid and calls method GenerateDataForRenderer()
*/
virtual void Update(BaseRenderer* renderer);
/** \brief Responsible for calling the appropriate render functions.
* To be implemented in sub-classes.
*/
virtual void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) = 0;
/**
* \brief Apply specific color and opacity properties read from the PropertyList.
* Reimplemented in GLmapper (does not use the actor) and the VtkMapper class.
* The function is called by the individual mapper (mostly in the ApplyProperties() or ApplyAllProperties()
* method).
*/
virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor = NULL) = 0;
/** \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:
/** \brief explicit constructor which disallows implicit conversions */
explicit Mapper();
/** \brief virtual destructor in order to derive from this class */
virtual ~Mapper();
/** \brief Generate the data needed for rendering (independent of a specific renderer)
* \deprecatedSince{2013_03} Use GenerateDataForRenderer(BaseRenderer* renderer) instead.
*/
DEPRECATED( virtual void GenerateData() ) { }
/** \brief Generate the data needed for rendering into \a renderer */
virtual void GenerateDataForRenderer(BaseRenderer* /* renderer */) { }
/** \brief Updates the time step, which is sometimes needed in subclasses */
virtual void CalculateTimeStep( BaseRenderer* renderer );
/** \brief Reset the mapper (i.e., make sure that nothing is displayed) if no
* valid data is present. In most cases the reimplemented function
* disables the according actors (toggling visibility off)
*
* To be implemented in sub-classes.
*/
virtual void ResetMapper( BaseRenderer* /*renderer*/ ) { }
virtual OverlayManager* GetOverlayManager() const;
mitk::DataNode * m_DataNode;
private:
/** \brief The current time step of the dataset to be rendered,
* for use in subclasses.
* The current timestep can be accessed via the GetTimestep() method.
*/
int m_TimeStep;
/** \brief copy constructor */
Mapper( const Mapper &);
/** \brief assignment operator */
Mapper &operator=(const Mapper &);
public:
/** \brief Base class for mapper specific rendering ressources.
*/
class MITKCORE_EXPORT BaseLocalStorage
{
public:
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer,mitk::Mapper *mapper,mitk::DataNode *dataNode) const;
inline void UpdateGenerateDataTime()
{
m_LastGenerateDataTime.Modified();
}
inline itk::TimeStamp & GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
protected:
/** \brief timestamp of last update of stored data */
itk::TimeStamp m_LastGenerateDataTime;
};
};
} // namespace mitk
#endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */
diff --git a/Modules/Core/include/mitkMaterial.h b/Modules/Core/include/mitkMaterial.h
index e4aa202f14..cb59c39ccd 100644
--- a/Modules/Core/include/mitkMaterial.h
+++ b/Modules/Core/include/mitkMaterial.h
@@ -1,475 +1,475 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_MATERIAL_H_
#define _MITK_MATERIAL_H_
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include <itkRGBPixel.h>
#include <itkObject.h>
#include <itkVectorContainer.h>
#include <vtkSystemIncludes.h>
#include <string>
namespace mitk
{
/**
* Encapsulates 3D visualization properties which are forwarded to vtk for
* color mapping. This includes color, specular coefficient and power, opacity
* interpolation type (flat, gouraud, phong) and representation (points,
* wireframe or surface).
*
* @see vtkProperty
*/
class MITKCORE_EXPORT Material : public itk::Object
{
public:
- mitkClassMacro( Material, itk::Object );
+ mitkClassMacroItkParent( Material, itk::Object );
typedef itk::RGBPixel<double> 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, double 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( double red, double green, double blue, double 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( double red, double green, double blue, double colorCoefficient,
double specularCoefficient, double specularPower, double 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, double colorCoefficient, double specularCoefficient, double specularPower, double 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, double red, double green, double blue, double 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( double red, double green, double 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( double 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( double red, double green, double 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( double 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( double 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( double 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 double 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 double GetSpecularCoefficient() const;
/**
* @returns the specular power. Ranges from 0 to infinity
*/
virtual double GetSpecularPower() const;
/**
* @returns the opacity of the material. Ranges from 0 to 1
*/
virtual double 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
*/
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;
+ void PrintSelf ( std::ostream &os, itk::Indent ) const override;
/**
* 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, double 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( double red, double green, double blue, double 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( double red, double green, double blue, double colorCoefficient,
double specularCoefficient, double specularPower, double 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, double colorCoefficient, double specularCoefficient, double specularPower, double 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, double red, double green, double blue, double opacity = 1.0, std::string name = "");
virtual void InitializeStandardValues();
virtual void Update();
std::string m_Name;
Color m_Color;
Color m_SpecularColor;
double m_ColorCoefficient;
double m_SpecularCoefficient;
double m_SpecularPower;
double m_Opacity;
float m_LineWidth;
InterpolationType m_Interpolation;
RepresentationType m_Representation;
};
typedef itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer;
}
#endif
diff --git a/Modules/Core/include/mitkModalityProperty.h b/Modules/Core/include/mitkModalityProperty.h
index b608887aa7..6a75aad059 100644
--- a/Modules/Core/include/mitkModalityProperty.h
+++ b/Modules/Core/include/mitkModalityProperty.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkModalityProperty_h_Included
#define mitkModalityProperty_h_Included
#include <MitkCoreExports.h>
#include "mitkEnumerationProperty.h"
#include <itkObjectFactory.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
\brief Enumerates all known modalities
\ingroup DataManagement
*/
class MITKCORE_EXPORT ModalityProperty : public EnumerationProperty
{
public:
mitkClassMacro(ModalityProperty, EnumerationProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ModalityProperty, const IdType&);
mitkNewMacro1Param(ModalityProperty, const std::string&);
using BaseProperty::operator=;
protected:
ModalityProperty();
ModalityProperty( const IdType& value );
ModalityProperty( const std::string& value );
virtual ~ModalityProperty();
virtual void AddEnumerationTypes();
private:
// purposely not implemented
const ModalityProperty& operator=(const ModalityProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace
#endif
diff --git a/Modules/Core/include/mitkMouseDoubleClickEvent.h b/Modules/Core/include/mitkMouseDoubleClickEvent.h
index c27db23d72..f544452c45 100644
--- a/Modules/Core/include/mitkMouseDoubleClickEvent.h
+++ b/Modules/Core/include/mitkMouseDoubleClickEvent.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMouseDoubleClickEvent_H_
#define MITKMouseDoubleClickEvent_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <MitkCoreExports.h>
namespace mitk
{
class MITKCORE_EXPORT MouseDoubleClickEvent: public InteractionPositionEvent
{
public:
mitkClassMacro(MouseDoubleClickEvent,InteractionPositionEvent)
mitkNewMacro6Param(Self, BaseRenderer*, const Point2D& ,const Point3D& , MouseButtons , ModifierKeys, MouseButtons)
ModifierKeys GetModifiers() const;
MouseButtons GetButtonStates() const;
void SetModifiers(ModifierKeys modifiers);
void SetButtonStates(MouseButtons buttons);
MouseButtons GetEventButton() const;
void SetEventButton(MouseButtons buttons);
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
MouseDoubleClickEvent(BaseRenderer*, const Point2D& = Point2D(),const Point3D& = Point3D(), MouseButtons buttonStates = NoButton,
ModifierKeys modifiers = NoKey, MouseButtons eventButton = NoButton);
virtual ~MouseDoubleClickEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
MouseButtons m_EventButton;
MouseButtons m_ButtonStates;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKMouseDoubleClickEvent_H_ */
diff --git a/Modules/Core/include/mitkMouseModeSwitcher.h b/Modules/Core/include/mitkMouseModeSwitcher.h
index 6b3d2490b7..2ce8fbbc2d 100644
--- a/Modules/Core/include/mitkMouseModeSwitcher.h
+++ b/Modules/Core/include/mitkMouseModeSwitcher.h
@@ -1,132 +1,132 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB
#define MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB
#include "MitkCoreExports.h"
#include <itkObject.h>
#include "mitkDisplayInteractor.h"
namespace mitk {
/***********************************************************************
*
* \brief Class that offers a convenient way to switch between different
* interaction schemes
*
* This class offers the possibility to switch between the two different
* interaction schemes that are available:
* - MITK : The original interaction scheme
* - left mouse button : setting the cross position in the MPR view
* - middle mouse button : panning
* - right mouse button : zooming
*
*
* - PACS : an alternative interaction scheme that behaves more like a
* PACS workstation
* - left mouse button : behavior depends on current MouseMode
* - middle mouse button : fast scrolling
* - right mouse button : level-window
* - ctrl + right button : zooming
* - shift+ right button : panning
*
* There are 5 different MouseModes that are available in the PACS scheme.
* Each MouseMode defines the interaction that is performed on a left
* mouse button click:
* - Pointer : sets the cross position for the MPR
* - Scroll
* - Level-Window
* - Zoom
* - Pan
*
* When the interaction scheme or the MouseMode is changed, this class
* manages the adding and removing of the relevant listeners offering
* a convenient way to modify the interaction behavior.
*
***********************************************************************/
class MITKCORE_EXPORT MouseModeSwitcher : public itk::Object
{
public:
#pragma GCC visibility push(default)
/**
\brief Can be observed by GUI class to update button states when mode is changed programatically.
*/
itkEventMacro( MouseModeChangedEvent, itk::AnyEvent );
#pragma GCC visibility pop
- mitkClassMacro( MouseModeSwitcher, itk::Object );
+ mitkClassMacroItkParent( MouseModeSwitcher, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// enum of the different interaction schemes that are available
enum InteractionScheme
{
PACS = 0,
MITK = 1
};
// enum of available mouse modes for PACS interaction scheme
enum MouseMode
{
MousePointer = 0,
Scroll,
LevelWindow,
Zoom,
Pan
};
/**
* \brief Setter for interaction scheme
*/
void SetInteractionScheme( InteractionScheme );
/**
* \brief Setter for mouse mode
*/
void SelectMouseMode( MouseMode mode );
/**
* \brief Returns the current mouse mode
*/
MouseMode GetCurrentMouseMode() const;
protected:
MouseModeSwitcher();
virtual ~MouseModeSwitcher();
private:
/**
* \brief Initializes the listener with the MITK default behavior.
*/
void InitializeListeners();
InteractionScheme m_ActiveInteractionScheme;
MouseMode m_ActiveMouseMode;
DisplayInteractor::Pointer m_CurrentObserver;
/**
* Reference to the service registration of the observer,
* it is needed to unregister the observer on unload.
*/
us::ServiceRegistration<InteractionEventObserver> m_ServiceRegistration;
};
} // namespace mitk
#endif /* MITKMouseModeSwitcher_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/Core/include/mitkMouseMoveEvent.h b/Modules/Core/include/mitkMouseMoveEvent.h
index 5dff3a4cf3..16154b5e61 100644
--- a/Modules/Core/include/mitkMouseMoveEvent.h
+++ b/Modules/Core/include/mitkMouseMoveEvent.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMOUSEMOVEEVENT_H_
#define MITKMOUSEMOVEEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <MitkCoreExports.h>
namespace mitk
{
class MITKCORE_EXPORT MouseMoveEvent : public InteractionPositionEvent {
public:
mitkClassMacro(MouseMoveEvent,InteractionPositionEvent);
mitkNewMacro5Param(Self, BaseRenderer*, const Point2D& ,const Point3D& , MouseButtons , ModifierKeys);
ModifierKeys GetModifiers() const;
MouseButtons GetButtonStates() const;
void SetModifiers(ModifierKeys modifiers);
void SetButtonStates(MouseButtons buttons);
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
MouseMoveEvent(BaseRenderer*, const Point2D& = Point2D(), const Point3D& = Point3D(), MouseButtons buttonStates = NoButton,
ModifierKeys modifiers = NoKey);
virtual ~MouseMoveEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
MouseButtons m_ButtonStates;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKMOUSEMOVEEVENT_H_ */
diff --git a/Modules/Core/include/mitkMouseMovePointSetInteractor.h b/Modules/Core/include/mitkMouseMovePointSetInteractor.h
index 02886f9f09..fa9b19532b 100644
--- a/Modules/Core/include/mitkMouseMovePointSetInteractor.h
+++ b/Modules/Core/include/mitkMouseMovePointSetInteractor.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMOUSEMOVEPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#define MITKMOUSEMOVEPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#include <MitkCoreExports.h>
#include "mitkNumericTypes.h"
#include <mitkPointSetInteractor.h>
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
*/
/**
* \deprecatedSince{2014_03} mitk::MouseMovePointSetInteractor is deprecated. Needs to be updated to the new interaction-framework.
* Refer to \ref DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_EXPORT MouseMovePointSetInteractor : public PointSetInteractor
{
public:
mitkClassMacro(MouseMovePointSetInteractor, Interactor);
DEPRECATED() mitkNewMacro3Param(Self, const char*, DataNode*, int);
DEPRECATED() 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;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
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/Modules/Core/include/mitkMousePressEvent.h b/Modules/Core/include/mitkMousePressEvent.h
index 21a48939db..20bb45d4e0 100644
--- a/Modules/Core/include/mitkMousePressEvent.h
+++ b/Modules/Core/include/mitkMousePressEvent.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMOUSEPRESSEVENT_H_
#define MITKMOUSEPRESSEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <MitkCoreExports.h>
namespace mitk
{
class MITKCORE_EXPORT MousePressEvent: public InteractionPositionEvent
{
public:
mitkClassMacro(MousePressEvent,InteractionPositionEvent)
mitkNewMacro6Param(Self, BaseRenderer*, const Point2D& , const Point3D& , MouseButtons , ModifierKeys, MouseButtons)
ModifierKeys GetModifiers() const;
MouseButtons GetButtonStates() const;
void SetModifiers(ModifierKeys modifiers);
void SetButtonStates(MouseButtons buttons);
MouseButtons GetEventButton() const;
void SetEventButton(MouseButtons buttons);
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
MousePressEvent(BaseRenderer*, const Point2D& = Point2D(), const Point3D& = Point3D(), MouseButtons buttonStates = NoButton,
ModifierKeys modifiers = NoKey, MouseButtons eventButton = NoButton);
virtual ~MousePressEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
MouseButtons m_EventButton;
MouseButtons m_ButtonStates;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKMOUSEPRESSEVENT_H_ */
diff --git a/Modules/Core/include/mitkMouseReleaseEvent.h b/Modules/Core/include/mitkMouseReleaseEvent.h
index 08b2dddf09..e4dccb84a5 100644
--- a/Modules/Core/include/mitkMouseReleaseEvent.h
+++ b/Modules/Core/include/mitkMouseReleaseEvent.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMOUSERELEASEEVENT_H_
#define MITKMOUSERELEASEEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkInteractionEventConst.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <MitkCoreExports.h>
namespace mitk
{
class MITKCORE_EXPORT MouseReleaseEvent: public InteractionPositionEvent
{
public:
mitkClassMacro(MouseReleaseEvent,InteractionPositionEvent)
mitkNewMacro6Param(Self, BaseRenderer*, const Point2D& ,const Point3D& , MouseButtons , ModifierKeys, MouseButtons)
ModifierKeys GetModifiers() const;
MouseButtons GetButtonStates() const;
void SetModifiers(ModifierKeys modifiers);
void SetButtonStates(MouseButtons buttons);
MouseButtons GetEventButton() const;
void SetEventButton(MouseButtons buttons);
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
MouseReleaseEvent(BaseRenderer*,
const mitk::Point2D& mousePosition = Point2D(),
const mitk::Point3D& worldPosition = Point3D(),
MouseButtons buttonStates = NoButton,
ModifierKeys modifiers = NoKey,
MouseButtons eventButton = NoButton);
virtual ~MouseReleaseEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
MouseButtons m_EventButton;
MouseButtons m_ButtonStates;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKMOUSERELEASEEVENT_H_ */
diff --git a/Modules/Core/include/mitkMouseWheelEvent.h b/Modules/Core/include/mitkMouseWheelEvent.h
index 77661b3349..1c3befd178 100644
--- a/Modules/Core/include/mitkMouseWheelEvent.h
+++ b/Modules/Core/include/mitkMouseWheelEvent.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMOUSEWHEELEVENT_H_
#define MITKMOUSEWHEELEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkBaseRenderer.h"
#include "mitkInteractionEvent.h"
#include <MitkCoreExports.h>
/**
* Note: A Click with the MiddleButton is to be handled with MousePressEvents
*/
namespace mitk
{
class MITKCORE_EXPORT MouseWheelEvent: public InteractionPositionEvent
{
public:
mitkClassMacro(MouseWheelEvent,InteractionPositionEvent)
mitkNewMacro6Param(Self, BaseRenderer*, const Point2D&,const Point3D&, MouseButtons , ModifierKeys, int)
ModifierKeys GetModifiers() const;
MouseButtons GetButtonStates() const;
void SetModifiers(ModifierKeys modifiers);
void SetButtonStates(MouseButtons buttons);
int GetWheelDelta() const;
void SetWheelDelta(int delta);
- virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const;
+ virtual bool IsSuperClassOf(const InteractionEvent::Pointer& baseClass) const override;
protected:
MouseWheelEvent(BaseRenderer* = NULL,
const Point2D& mousePosition = Point2D(),
const Point3D& worldPosition = Point3D(),
MouseButtons buttonStates = NoButton,
ModifierKeys modifiers = NoKey,
int wheelDelta = 0);
virtual ~MouseWheelEvent();
- virtual bool IsEqual(const InteractionEvent&) const;
+ virtual bool IsEqual(const InteractionEvent&) const override;
private:
int m_WheelDelta;
MouseButtons m_ButtonStates;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKMOUSEPRESSEVENT_H_ */
diff --git a/Modules/Core/include/mitkMoveBaseDataInteractor.h b/Modules/Core/include/mitkMoveBaseDataInteractor.h
index bb51fb2d75..92da0d4574 100644
--- a/Modules/Core/include/mitkMoveBaseDataInteractor.h
+++ b/Modules/Core/include/mitkMoveBaseDataInteractor.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMoveBaseDataInteractor_H_HEADER_INCLUDED
#define MITKMoveBaseDataInteractor_H_HEADER_INCLUDED
#include <mitkInteractor.h>
namespace mitk
{
class DataNode;
/**
* \brief Interaction to move an object by the arrow keys. See tutorial step 10 for explanation.
*
* Left- and right-arrows move the x-direction.
* Shift + up-and down-arrows move the y-direction.
* Up- and down-arrows move the z-direction.
* Every move is one unit in world coordinates (usually 1mm).
* This class offers three properties:
* - \b "MovingInteractor.SelectedColor": This color is used to mark that
* the object is selected and the interactor can be used.
* - \b "MovingInteractor.DeselectedColor": Marks that the interactor is
* is added to the data node, but the node is not selected.
* - \b "MovingInteractor.PriorColor": Temporary property used to
* save the old color of the data node in order to restore it
* uppon removal of the interactor.
*
* All properties are deleted when the interactor is destroyed.
*
* \warning After moving an object, the user has to perform a reinit manually, in order to change the geoemtrie.
*
* \warning The picking seems not to work on a single point. If you want to move pointsets,
* they should atleast have 2 or more points.
*
* \ingroup Interaction
*/
class MITKCORE_EXPORT MoveBaseDataInteractor : public Interactor
{
public:
mitkClassMacro(MoveBaseDataInteractor, Interactor);
mitkNewMacro2Param(Self, const char*, DataNode*);
protected:
/**
* \brief Constructor
*/
MoveBaseDataInteractor(const char * type, DataNode* dataNode);
/**
* \brief Default Destructor
**/
virtual ~MoveBaseDataInteractor();
/**
* @brief Convert the given Actions to Operations and send to data and UndoController
**/
- virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent );
+ virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ) override;
};
}
/**
\example mitkMoveBaseDataInteractor.h
* This is an example of how to implement a new Interactor.
* See more details about this example in tutorial Step10.
*/
#endif /* MITKMoveBaseDataInteractor_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkMultiComponentImageDataComparisonFilter.h b/Modules/Core/include/mitkMultiComponentImageDataComparisonFilter.h
index 9d45de0d4d..8ac9aa8c6b 100644
--- a/Modules/Core/include/mitkMultiComponentImageDataComparisonFilter.h
+++ b/Modules/Core/include/mitkMultiComponentImageDataComparisonFilter.h
@@ -1,92 +1,92 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMULTICOMPONENTIMAGEDATACOMPARISONFILTER_H
#define MITKMULTICOMPONENTIMAGEDATACOMPARISONFILTER_H
// mitk includes
#include "mitkImageToImageFilter.h"
#include "mitkCompareImageDataFilter.h"
//struct CompareFilterResults;
namespace mitk
{
/*! Documentation:
* \brief Filter for comparing two multi channel mitk::Image objects by channel wise by pixel values
*
* The comparison is channel- / pixel-wise.
*/
class MITKCORE_EXPORT MultiComponentImageDataComparisonFilter : public ImageToImageFilter
{
public:
mitkClassMacro(MultiComponentImageDataComparisonFilter, ImageToImageFilter);
itkSimpleNewMacro(Self);
/*! /brief
*/
void SetTestImage( const Image *_arg);
const Image* GetTestImage();
/*! /brief
*/
void SetValidImage( const Image *_arg);
const Image* GetValidImage();
/*! /brief Specify the tolerance of the image data comparison
/param Tolerance Default is 0.0f. */
itkSetMacro(Tolerance, double);
itkGetMacro(Tolerance, double);
/*! /brief
*/
void SetCompareFilterResult( CompareFilterResults* results);
/*! /brief Get the detailed results of the comparison run
* /sa CompareFilterResults */
CompareFilterResults* GetCompareFilterResult();
/*! /brief Get the result of the comparison
* The method compares only the number of pixels with differences. It returns true if the amount
* is under the specified threshold. To get the complete results, use the GetCompareResults method.
* Returns false also if the itk ComparisionImageFilter raises an exception during update.
* /param threshold Allowed percentage of pixels with differences (between 0.0...1.0) */
bool GetResult( double threshold = 0.0f);
protected:
MultiComponentImageDataComparisonFilter();
~MultiComponentImageDataComparisonFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
template < typename TPixel >
void CompareMultiComponentImage( const Image* testImage, const Image* validImage);
double m_Tolerance;
bool m_CompareResult;
CompareFilterResults* m_CompareDetails;
};
} // end namespace mitk
#endif // MITKMULTICOMPONENTIMAGEDATACOMPARISONFILTER_H
diff --git a/Modules/Core/include/mitkNodeDepententPointSetInteractor.h b/Modules/Core/include/mitkNodeDepententPointSetInteractor.h
index ec89fcae93..dd06dc7ca0 100644
--- a/Modules/Core/include/mitkNodeDepententPointSetInteractor.h
+++ b/Modules/Core/include/mitkNodeDepententPointSetInteractor.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNodeDepententPointSetInteractor_H_HEADER_INCLUDED
#define MITKNodeDepententPointSetInteractor_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkNumericTypes.h"
#include <mitkInteractor.h>
#include <mitkDataNode.h>
#include <mitkPointSetInteractor.h>
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
*/
/**
* \deprecatedSince{2014_03} mitk::ConnectPointsInteractor is deprecated. Needs to be updated to the new interaction-framework.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_EXPORT NodeDepententPointSetInteractor : public PointSetInteractor
{
public:
mitkClassMacro(NodeDepententPointSetInteractor, PointSetInteractor);
DEPRECATED() mitkNewMacro4Param(Self, const char*, DataNode*, DataNode*, int);
DEPRECATED() 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;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
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/Modules/Core/include/mitkNodePredicateAnd.h b/Modules/Core/include/mitkNodePredicateAnd.h
index 26b2e6866e..a3ec05cae8 100644
--- a/Modules/Core/include/mitkNodePredicateAnd.h
+++ b/Modules/Core/include/mitkNodePredicateAnd.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEAND_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEAND_H_HEADER_INCLUDED_
#include "mitkNodePredicateCompositeBase.h"
namespace mitk {
//##Documentation
//## @brief Composite predicate that forms a logical AND relation from its child predicates
//##
//##
//##
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateAnd : public NodePredicateCompositeBase
{
public:
mitkClassMacro(NodePredicateAnd, NodePredicateCompositeBase);
itkFactorylessNewMacro(NodePredicateAnd);
mitkNewMacro2Param(NodePredicateAnd, const NodePredicateBase*, const NodePredicateBase*);
mitkNewMacro3Param(NodePredicateAnd, const NodePredicateBase*, const NodePredicateBase*, const NodePredicateBase*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateAnd();
//##Documentation
//## @brief Checks, if the node fulfills all of the subpredicates conditions
- virtual bool CheckNode(const DataNode* node) const;
+ virtual bool CheckNode(const DataNode* node) const override;
protected:
//##Documentation
//## @brief Protected constructor, use static instantiation functions instead
NodePredicateAnd();
//##Documentation
//## @brief Convenience constructor that adds p1 and p2 to list of child predicates
//## Protected constructor, use static instantiation functions instead
NodePredicateAnd(const NodePredicateBase* p1, const NodePredicateBase* p2);
//##Documentation
//## @brief Convenience constructor that adds p1, p2 and p3 to list of child predicates
//## Protected constructor, use static instantiation functions instead
NodePredicateAnd(const NodePredicateBase* p1, const NodePredicateBase* p2, const NodePredicateBase* p3);
};
} // namespace mitk
#endif /* MITKNODEPREDICATEAND_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateBase.h b/Modules/Core/include/mitkNodePredicateBase.h
index 181274763c..4cfcdfd5a6 100644
--- a/Modules/Core/include/mitkNodePredicateBase.h
+++ b/Modules/Core/include/mitkNodePredicateBase.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEBASE_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEBASE_H_HEADER_INCLUDED_
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#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 MITKCORE_EXPORT NodePredicateBase: public itk::Object
{
public:
- mitkClassMacro(NodePredicateBase,itk::Object);
+ mitkClassMacroItkParent(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/Modules/Core/include/mitkNodePredicateData.h b/Modules/Core/include/mitkNodePredicateData.h
index 105dae4717..7d590ffd23 100644
--- a/Modules/Core/include/mitkNodePredicateData.h
+++ b/Modules/Core/include/mitkNodePredicateData.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEDATA_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEDATA_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
namespace mitk {
class BaseData;
//##Documentation
//## @brief Predicate that evaluates if the given DataNodes data object pointer equals a given pointer
//##
//## NodePredicateData(NULL) returns true if a DataNode does not have a data object (e.g. ->GetData() returns NULL).
//## This could return an unexpected number of nodes (e.g. the root node of the tree)
//## @warning NodePredicateData holds a weak pointer to a BaseData! NodePredicateData p(mitk::BaseData::New()); will not work.
//## Intended use is: NodePredicateData p(myDataObject); result = myDataStorage->GetSubset(p); Then work with result, do not reuse p later.
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateData : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateData, NodePredicateBase);
mitkNewMacro1Param(NodePredicateData, mitk::BaseData*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateData();
//##Documentation
//## @brief Checks, if the nodes data object is of a specific data type
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Protected constructor, use static instantiation functions instead
NodePredicateData(mitk::BaseData* d);
mitk::BaseData* m_DataObject;
};
} // namespace mitk
#endif /* MITKNODEPREDICATEDATA_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateDataType.h b/Modules/Core/include/mitkNodePredicateDataType.h
index e19370a234..767158cb87 100644
--- a/Modules/Core/include/mitkNodePredicateDataType.h
+++ b/Modules/Core/include/mitkNodePredicateDataType.h
@@ -1,92 +1,92 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEDATATYPE_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEDATATYPE_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
#include "mitkDataNode.h"
#include <string>
namespace mitk {
//##Documentation
//## @brief Predicate that evaluates if the given DataNodes data object is of a specific data type
//##
//## The data type must be specified in the constructor as a string. The string must equal the result
//## value of the requested data types GetNameOfClass() method.
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateDataType : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateDataType, NodePredicateBase);
mitkNewMacro1Param(NodePredicateDataType, const char*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateDataType();
//##Documentation
//## @brief Checks, if the nodes data object is of a specific data type
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Protected constructor, use static instantiation functions instead
NodePredicateDataType(const char* datatype);
std::string m_ValidDataType;
};
/**
* \brief Tests for type compatibility (dynamic_cast).
*
* In contrast to NodePredicateDataType this class also accepts derived types.
* E.g. if you query for type BaseData, you will also get Image and Surface objects.
*
* The desired type is given as a template parameter, the constructor takes no other parameters.
*/
template <class T>
class TNodePredicateDataType : public NodePredicateBase
{
public:
mitkClassMacro(TNodePredicateDataType, NodePredicateBase);
itkFactorylessNewMacro(TNodePredicateDataType);
virtual ~TNodePredicateDataType()
{
}
//##Documentation
//## @brief Checks, if the nodes data object is of a specific data type (casts)
- virtual bool CheckNode(const mitk::DataNode* node) const
+ virtual bool CheckNode(const mitk::DataNode* node) const override
{
return node && node->GetData() && dynamic_cast<T*>(node->GetData());
}
protected:
//##Documentation
//## @brief Protected constructor, use static instantiation functions instead
TNodePredicateDataType()
{
}
};
} // namespace mitk
#endif /* MITKNODEPREDICATEDATATYPE_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateDimension.h b/Modules/Core/include/mitkNodePredicateDimension.h
index a5db491a03..b92fe5711a 100644
--- a/Modules/Core/include/mitkNodePredicateDimension.h
+++ b/Modules/Core/include/mitkNodePredicateDimension.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEDIMENSION_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEDIMENSION_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
namespace mitk {
class BaseData;
//##Documentation
//## @brief Predicate that evaluates if the given DataNodes data object
//## has the specified dimension, for datasets where dimension is
//## applicable.
//##
//## Evaluates to "false" for unsupported datasets.
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateDimension : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateDimension, NodePredicateBase);
mitkNewMacro1Param(NodePredicateDimension, unsigned int);
mitkNewMacro2Param(NodePredicateDimension, unsigned int, int);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateDimension();
//##Documentation
//## @brief Checks if the nodes data object is of the specified dimension
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Standard Constructor
NodePredicateDimension(unsigned int dimension);
//##Documentation
//## @brief Standard Constructor
NodePredicateDimension(unsigned int dimension, int pixelComponents);
unsigned int m_Dimension;
std::size_t m_PixelComponents;
};
} // namespace mitk
#endif /* MITKNodePredicateDimension_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateFirstLevel.h b/Modules/Core/include/mitkNodePredicateFirstLevel.h
index 6af1905a15..74b50fe546 100644
--- a/Modules/Core/include/mitkNodePredicateFirstLevel.h
+++ b/Modules/Core/include/mitkNodePredicateFirstLevel.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEFIRSTLEVEL_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEFIRSTLEVEL_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
#include "mitkDataStorage.h"
#include "mitkDataNode.h"
#include "mitkWeakPointer.h"
namespace mitk {
//##Documentation
//## @brief Predicate that evaluates if the given node is a direct or indirect source node of a specific node
//##
//## @warning This class seems to be obsolete since mitk::DataStorage::GetDerivations().
//## Since there is no real use case up until now, NodePredicateSource is NOT WORKING YET.
//## If you need it working, inform us.
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateFirstLevel : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateFirstLevel, NodePredicateBase);
mitkNewMacro1Param(NodePredicateFirstLevel, mitk::DataStorage*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateFirstLevel();
//##Documentation
//## @brief Checks, if the node is a source node of m_BaseNode (e.g. if m_BaseNode "was created from" node)
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Constructor - This class can either search only for direct source objects or for all source objects
NodePredicateFirstLevel(mitk::DataStorage* ds);
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
};
} // namespace mitk
#endif /* MITKNODEPREDICATEFIRSTLEVEL_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateNot.h b/Modules/Core/include/mitkNodePredicateNot.h
index 404297d47c..9cb72aeceb 100644
--- a/Modules/Core/include/mitkNodePredicateNot.h
+++ b/Modules/Core/include/mitkNodePredicateNot.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATENOT_H_HEADER_INCLUDED_
#define MITKNODEPREDICATENOT_H_HEADER_INCLUDED_
#include "mitkNodePredicateCompositeBase.h"
namespace mitk {
//##Documentation
//## @brief Composite predicate that negates its child predicate
//## Changed: NodePredicateNot now derives from NodePredicateCompositeBase though it really holds
//## only one subpredicate at any time. But logically any Predicate that has one or more subpredicate
//## is a CompositePredicate.
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateNot : public mitk::NodePredicateCompositeBase
{
public:
mitkClassMacro(NodePredicateNot, NodePredicateCompositeBase);
mitkNewMacro1Param(NodePredicateNot, const mitk::NodePredicateBase*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateNot();
//##Documentation
//## @brief Reimplemented, only one child predicate is allowed for the NOT predicate.
- virtual void AddPredicate(const mitk::NodePredicateBase* p);
+ virtual void AddPredicate(const mitk::NodePredicateBase* p) override;
//##Documentation
//## @brief Checks, if the node does not fulfill the child predicate condition
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Constructor
NodePredicateNot(const mitk::NodePredicateBase* p);
};
} // namespace mitk
#endif /* MITKNODEPREDICATENOT_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateOr.h b/Modules/Core/include/mitkNodePredicateOr.h
index 51e2620407..27cc1604a0 100644
--- a/Modules/Core/include/mitkNodePredicateOr.h
+++ b/Modules/Core/include/mitkNodePredicateOr.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEOR_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEOR_H_HEADER_INCLUDED_
#include "mitkNodePredicateCompositeBase.h"
namespace mitk {
//##Documentation
//## @brief Composite predicate that forms a logical OR relation from its child predicates
//##
//##
//##
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateOr : public NodePredicateCompositeBase
{
public:
mitkClassMacro(NodePredicateOr, NodePredicateCompositeBase);
itkFactorylessNewMacro(NodePredicateOr);
mitkNewMacro2Param(NodePredicateOr, const NodePredicateBase*, const NodePredicateBase*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateOr();
//##Documentation
//## @brief Checks, if the node fulfills any of the subpredicates conditions
- virtual bool CheckNode(const DataNode* node) const;
+ virtual bool CheckNode(const DataNode* node) const override;
protected:
//##Documentation
//## @brief Constructor
NodePredicateOr();
//##Documentation
//## @brief Convenience constructor that adds p1 and p2 to list of child predicates
NodePredicateOr(const NodePredicateBase* p1, const NodePredicateBase* p2);
};
} // namespace mitk
#endif /* MITKNODEPREDICATEOR_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateProperty.h b/Modules/Core/include/mitkNodePredicateProperty.h
index 560f08f557..1b9ba6cb08 100644
--- a/Modules/Core/include/mitkNodePredicateProperty.h
+++ b/Modules/Core/include/mitkNodePredicateProperty.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
#include "mitkBaseProperty.h"
#include "mitkWeakPointer.h"
#include "mitkBaseRenderer.h"
namespace mitk {
//##Documentation
//## @brief Predicate that evaluates if the given DataNode has a specific property.
//## If the second parameter is NULL, it will only be checked whether there is a property with the specified name.
//## If a renderer is specified in the third parameter the renderer-specific property will be checked. If this
//## parameter is NULL or not specified, then the non-renderer-specific property will be checked.
//##
//##
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateProperty : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateProperty, NodePredicateBase);
mitkNewMacro1Param(NodePredicateProperty, const char*);
mitkNewMacro2Param(NodePredicateProperty, const char*, mitk::BaseProperty*);
mitkNewMacro3Param(NodePredicateProperty, const char*, mitk::BaseProperty*, const mitk::BaseRenderer*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateProperty();
//##Documentation
//## @brief Checks, if the nodes contains a property that is equal to m_ValidProperty
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Constructor to check for a named property
NodePredicateProperty(const char* propertyName, mitk::BaseProperty* p=0, const mitk::BaseRenderer *renderer=0);
//mitk::WeakPointer<mitk::BaseProperty> m_ValidProperty;
mitk::BaseProperty::Pointer m_ValidProperty;
//mitk::BaseProperty* m_ValidProperty;
std::string m_ValidPropertyName;
const mitk::BaseRenderer *m_Renderer;
};
} // namespace mitk
#endif /* MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkNodePredicateSource.h b/Modules/Core/include/mitkNodePredicateSource.h
index 036a257b9f..693a061765 100644
--- a/Modules/Core/include/mitkNodePredicateSource.h
+++ b/Modules/Core/include/mitkNodePredicateSource.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATESOURCE_H_HEADER_INCLUDED_
#define MITKNODEPREDICATESOURCE_H_HEADER_INCLUDED_
#include "mitkNodePredicateBase.h"
#include "mitkDataStorage.h"
#include "mitkDataNode.h"
#include "mitkWeakPointer.h"
namespace mitk {
//##Documentation
//## @brief Predicate that evaluates if the given node is a direct or indirect source node of a specific node
//##
//## @warning Calling CheckNode() can be computationally quite expensive for a large DataStorage.
//## Alternatively mitk::StandaloneDataStorage::GetSources() can be used
//##
//## @ingroup DataStorage
class MITKCORE_EXPORT NodePredicateSource : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateSource, NodePredicateBase);
mitkNewMacro3Param(NodePredicateSource, mitk::DataNode*, bool, mitk::DataStorage*);
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateSource();
//##Documentation
//## @brief Checks, if m_BaseNode is a source node of childNode (e.g. if childNode "was created from" m_BaseNode)
- virtual bool CheckNode(const mitk::DataNode* childNode) const;
+ virtual bool CheckNode(const mitk::DataNode* childNode) const override;
protected:
//##Documentation
//## @brief Constructor - This class can either search only for direct source objects or for all source objects
NodePredicateSource(mitk::DataNode* n, bool allsources, mitk::DataStorage* ds);
mitk::WeakPointer<mitk::DataNode> m_BaseNode;
bool m_SearchAllSources;
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
};
} // namespace mitk
#endif /* MITKNODEPREDICATESOURCE_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkOperation.h b/Modules/Core/include/mitkOperation.h
index 3af339efa6..b61846f610 100644
--- a/Modules/Core/include/mitkOperation.h
+++ b/Modules/Core/include/mitkOperation.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef OPERATION_H_HEADER_INCLUDED_C16E7D9E
#define OPERATION_H_HEADER_INCLUDED_C16E7D9E
#include <MitkCoreExports.h>
#include <itkEventObject.h>
-#include <itkMacro.h>
+#include <mitkCommon.h>
namespace mitk {
typedef int OperationType ;
//##Documentation
//## @brief Base class of all Operation-classes
//##
//## @ingroup Undo
class MITKCORE_EXPORT Operation
{
public:
- itkTypeMacroNoParent(Operation)
+ mitkClassMacroNoParent(Operation)
//##Documentation
//## Constructor
Operation(OperationType operationType);
virtual ~Operation();
OperationType GetOperationType();
protected:
OperationType m_OperationType;
};
class MITKCORE_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
+ virtual const char * GetEventName() const override { return "OperationEndEvent"; }
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{ return dynamic_cast<const Self*>(e); }
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{ 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/Modules/Core/include/mitkOperationActor.h b/Modules/Core/include/mitkOperationActor.h
index 6cc47f9b21..e5c33d8486 100644
--- a/Modules/Core/include/mitkOperationActor.h
+++ b/Modules/Core/include/mitkOperationActor.h
@@ -1,55 +1,55 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD
#define OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD
#include <MitkCoreExports.h>
-#include <itkMacro.h>
+#include <mitkCommon.h>
/** Macro for checking the type of an operation */
#define mitkCheckOperationTypeMacro(OperationType, operation, newOperationName) \
OperationType *newOperationName = dynamic_cast<OperationType *>(operation); \
if (newOperationName == NULL) \
{ \
itkWarningMacro("Recieved wrong type of operation!"); \
return; \
}
namespace mitk
{
class Operation;
class OperationEvent;
/**
* \brief abstract class, that can be used by Undo to undo an operation.
*
* \ingroup Undo
*/
class MITKCORE_EXPORT OperationActor
{
public:
- itkTypeMacroNoParent(OperationActor)
+ mitkClassMacroNoParent(OperationActor)
virtual ~OperationActor() {}
virtual void ExecuteOperation(Operation* operation) = 0;
};
}
#endif /* OPERATIONACTOR_H_HEADER_INCLUDED_C16E28BD */
diff --git a/Modules/Core/include/mitkOperationEvent.h b/Modules/Core/include/mitkOperationEvent.h
index dd40e41887..948d744d4b 100644
--- a/Modules/Core/include/mitkOperationEvent.h
+++ b/Modules/Core/include/mitkOperationEvent.h
@@ -1,210 +1,210 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC
#define OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC
#include <MitkCoreExports.h>
#include "mitkOperation.h"
#include "mitkOperationActor.h"
#include "mitkUndoModel.h"
#include <string>
#include <list>
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 PointSetDataInteractor. How this is done and when to use
//## GroupEventIDs is still undocumented.
//## @ingroup Undo
class MITKCORE_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 MITKCORE_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();
+ virtual void ReverseOperations() override;
//##reverses and executes both operations (used, when moved from undo to redo stack)
- virtual void ReverseAndExecute();
+ virtual void ReverseAndExecute() override;
//## @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/Modules/Core/include/mitkOverlay.h b/Modules/Core/include/mitkOverlay.h
index 6b5035fe9a..acfc31142c 100644
--- a/Modules/Core/include/mitkOverlay.h
+++ b/Modules/Core/include/mitkOverlay.h
@@ -1,442 +1,442 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef OVERLAY_H
#define OVERLAY_H
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include <mitkBaseRenderer.h>
namespace mitk {
class AbstractOverlayLayouter;
/** \brief Base class for all overlays */
/** This class is to be implemented in order to create overlays which are managed by the OverlayManager and can be placed by a AbstractOverlayLayouter.
This class contains an internal Propertylist, and another PropertyList for each BaseRenderer.
A property that is specified for a specific renderer always overrides the general internal property of the same name.
AddOverlay, RemoveOverlay and UpdateOverlay methods have to be implemented.*/
class MITKCORE_EXPORT Overlay : public itk::Object {
friend class AbstractOverlayLayouter;
public:
/** \brief Container for position and size on the display.*/
struct Bounds
{
itk::Point<double,2> Position;
itk::Point<double,2> Size;
};
typedef std::map<const BaseRenderer*,PropertyList::Pointer> MapOfPropertyLists;
/** \brief Base class for mapper specific rendering ressources.
*/
class MITKCORE_EXPORT BaseLocalStorage
{
public:
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer,mitk::Overlay *overlay);
inline void UpdateGenerateDataTime()
{
m_LastGenerateDataTime.Modified();
}
inline itk::TimeStamp & GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
protected:
/** \brief timestamp of last update of stored data */
itk::TimeStamp m_LastGenerateDataTime;
};
/**
* @brief Set the property (instance of BaseProperty) with key @a propertyKey in the PropertyList
* of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-value.
*
* @warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void SetProperty(const std::string& propertyKey, const BaseProperty::Pointer& property, const mitk::BaseRenderer* renderer = NULL);
/**
* @brief Replace the property (instance of BaseProperty) with key @a propertyKey in the PropertyList
* of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-reference.
*
* If @a renderer is @a NULL the property is set in the BaseRenderer-independent
* PropertyList of this Overlay.
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void ReplaceProperty(const std::string& propertyKey, const BaseProperty::Pointer& property, const mitk::BaseRenderer* renderer = NULL);
/**
* @brief Add the property (instance of BaseProperty) if it does
* not exist (or always if \a overwrite is \a true)
* with key @a propertyKey in the PropertyList
* of the @a renderer (if NULL, use BaseRenderer-independent
* PropertyList). This is set-by-value.
*
* For \a overwrite == \a false the property is \em not changed
* if it already exists. For \a overwrite == \a true the method
* is identical to SetProperty.
*
* @sa SetProperty
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void AddProperty(const std::string& propertyKey, const BaseProperty::Pointer& property, const mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/**
* @brief Get the PropertyList of the @a renderer. If @a renderer is @a
* NULL, the BaseRenderer-independent PropertyList of this Overlay
* is returned.
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
mitk::PropertyList* GetPropertyList(const mitk::BaseRenderer* renderer = NULL) const;
/**
* @brief Add values from another PropertyList.
*
* Overwrites values in m_PropertyList only when possible (i.e. when types are compatible).
* If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty,
* set the @param replace.
*
* @param replace true: if @param pList contains a property "visible" of type ColorProperty and our m_PropertyList also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects behind the pointer.
*
* @sa SetProperty
* @sa ReplaceProperty
* @sa m_PropertyList
*/
void ConcatenatePropertyList(PropertyList* pList, bool replace = false);
/**
* @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a NULL or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Overlay is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
mitk::BaseProperty* GetProperty(const std::string& propertyKey, const mitk::BaseRenderer* renderer = NULL) const;
/**
* @brief Get the property of type T with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a NULL or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Overlay is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(itk::SmartPointer<T> &property, const std::string& propertyKey, const mitk::BaseRenderer* renderer = NULL) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property.IsNotNull();
}
/**
* @brief Get the property of type T with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a NULL or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Overlay is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(T* &property, const std::string& propertyKey, const mitk::BaseRenderer* renderer = NULL) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property!=NULL;
}
/**
* @brief Convenience access method for GenericProperty<T> properties
* (T being the type of the second parameter)
* @return @a true property was found
*/
template <typename T>
bool GetPropertyValue(const std::string& propertyKey, T & value, mitk::BaseRenderer* renderer=NULL) const
{
GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey, renderer));
if ( gp != NULL )
{
value = gp->GetValue();
return true;
}
return false;
}
/**
* @brief Convenience access method for bool properties (instances of
* BoolProperty)
* @return @a true property was found
*/
bool GetBoolProperty(const std::string& propertyKey, bool &boolValue, mitk::BaseRenderer* renderer = NULL) const;
/**
* @brief Convenience access method for int properties (instances of
* IntProperty)
* @return @a true property was found
*/
bool GetIntProperty(const std::string& propertyKey, int &intValue, mitk::BaseRenderer* renderer=NULL) const;
/**
* @brief Convenience access method for float properties (instances of
* FloatProperty)
* @return @a true property was found
*/
bool GetFloatProperty(const std::string& propertyKey, float &floatValue, mitk::BaseRenderer* renderer = NULL) const;
/**
* @brief Convenience access method for string properties (instances of
* StringProperty)
* @return @a true property was found
*/
bool GetStringProperty(const std::string& propertyKey, std::string& string, mitk::BaseRenderer* renderer = NULL) const;
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetIntProperty(const std::string& propertyKey, int intValue, mitk::BaseRenderer* renderer=NULL);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetBoolProperty(const std::string& propertyKey, bool boolValue, mitk::BaseRenderer* renderer=NULL);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetFloatProperty(const std::string& propertyKey, float floatValue, mitk::BaseRenderer* renderer=NULL);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetStringProperty(const std::string& propertyKey, const std::string& string, mitk::BaseRenderer* renderer=NULL);
/**
* @brief Convenience access method for boolean properties (instances
* of BoolProperty). Return value is the value of the property. If the property is
* not found, the value of @a defaultIsOn is returned.
*
* Thus, the return value has a different meaning than in the
* GetBoolProperty method!
* @sa GetBoolProperty
*/
bool IsOn(const std::string& propertyKey, mitk::BaseRenderer* renderer, bool defaultIsOn = true) const
{
GetBoolProperty(propertyKey, defaultIsOn, renderer);
return defaultIsOn;
}
/**
* @brief Convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name")
* @return @a true property was found
*/
bool GetName(std::string& nodeName, mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "name") const;
/**
* @brief Extra convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name").
*
* This method does not take the renderer specific
* propertylists into account, because the name of an object should never be renderer specific.
* @returns a std::string with the name of the object (content of "name" Property).
* If there is no "name" Property, an empty string will be returned.
*/
virtual std::string GetName() const;
/**
* @brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName( const std::string& name);
/**
* @brief Convenience access method for color properties (instances of
* ColorProperty)
* @return @a true property was found
*/
bool GetColor(float rgb[], mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "color") const;
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const mitk::Color &color, mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "color");
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(float red, float green, float blue, mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "color");
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const float rgb[], mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "color");
/**
* @brief Convenience access method for opacity properties (instances of
* FloatProperty)
* @return @a true property was found
*/
bool GetOpacity(float &opacity, mitk::BaseRenderer* renderer, const std::string& propertyKey = "opacity") const;
/**
* @brief Convenience method for setting opacity properties (instances of
* FloatProperty)
*/
void SetOpacity(float opacity, mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "opacity");
void SetText(std::string text);
std::string GetText() const;
void SetFontSize(int fontSize);
int GetFontSize() const;
/**
* @brief Convenience access method for visibility properties (instances
* of BoolProperty with property-key "visible")
* @return @a true property was found
* @sa IsVisible
*/
bool GetVisibility(bool &visible, mitk::BaseRenderer* renderer, const std::string& propertyKey = "visible") const;
/**
* @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
* @sa IsOn
*/
bool IsVisible(mitk::BaseRenderer* renderer, const std::string& propertyKey = "visible", bool defaultIsOn = true) const;
/**
* @brief Convenience method for setting visibility properties (instances
* of BoolProperty)
* @param visible If set to true, the data will be rendered. If false, the render will skip this data.
* @param renderer Specify a renderer if the visibility shall be specific to a renderer
* @param propertykey Can be used to specify a user defined name of the visibility propery.
*/
void SetVisibility(bool visible, mitk::BaseRenderer* renderer = NULL, const std::string& propertyKey = "visible");
/** \brief Adds the overlay to the specified renderer. Update Overlay should be called soon in order to apply all properties*/
virtual void AddToBaseRenderer(BaseRenderer *renderer) = 0;
/** \brief Adds the overlay to the specified renderer. Update Overlay should be called soon in order to apply all properties*/
virtual void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0;
/** \brief Removes the overlay from the specified renderer. It is not visible anymore then.*/
virtual void RemoveFromBaseRenderer(BaseRenderer *renderer) = 0;
/** \brief Removes the overlay from the specified renderer. It is not visible anymore then.*/
virtual void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0;
/** \brief Applies all properties and should be called before the rendering procedure.*/
virtual void Update(BaseRenderer *renderer) = 0;
/** \brief Returns position and size of the overlay on the display.*/
virtual Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const;
/** \brief Sets position and size of the overlay on the display.*/
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds&);
void SetForceInForeground(bool forceForeground);
bool IsForceInForeground() const;
- mitkClassMacro(Overlay, itk::Object);
+ mitkClassMacroItkParent(Overlay, itk::Object);
static mitk::Point2D TransformDisplayPointToViewport(mitk::Point2D point, mitk::BaseRenderer *renderer);
protected:
/** \brief explicit constructor which disallows implicit conversions */
explicit Overlay();
/** \brief virtual destructor in order to derive from this class */
virtual ~Overlay();
/**
* @brief BaseRenderer-independent PropertyList
*
* Properties herein can be overwritten specifically for each BaseRenderer
* by the BaseRenderer-specific properties defined in m_MapOfPropertyLists.
*/
PropertyList::Pointer m_PropertyList;
/**
* @brief Map associating each BaseRenderer with its own PropertyList
*/
mutable MapOfPropertyLists m_MapOfPropertyLists;
/**
* @brief Timestamp of the last change of m_Data
*/
itk::TimeStamp m_DataReferenceChangedTime;
private:
/** \brief render this overlay on a foreground renderer */
bool m_ForceInForeground;
/** \brief copy constructor */
Overlay( const Overlay &);
/** \brief assignment operator */
Overlay &operator=(const Overlay &);
/** \brief Reference to the layouter in which this overlay is managed. */
AbstractOverlayLayouter* m_LayoutedBy;
};
} // namespace mitk
#endif // OVERLAY_H
diff --git a/Modules/Core/include/mitkOverlayManager.h b/Modules/Core/include/mitkOverlayManager.h
index 31dd5a5253..ea3739fb3a 100644
--- a/Modules/Core/include/mitkOverlayManager.h
+++ b/Modules/Core/include/mitkOverlayManager.h
@@ -1,105 +1,105 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef OVERLAYMANAGER_H
#define OVERLAYMANAGER_H
#include "MitkCoreExports.h"
#include <itkLightObject.h>
#include <vtkSmartPointer.h>
#include "mitkOverlay.h"
#include "mitkAbstractOverlayLayouter.h"
#include "mitkLocalStorageHandler.h"
namespace mitk {
class BaseRenderer;
/** \brief The OverlayManager updates and manages Overlays and the respective Layouters. */
/** An Instance of the OverlayManager can be registered to several BaseRenderer instances in order to
* call the update method of each Overlay during the rendering phase of the renderer.
* See \ref OverlaysPage for more info.
*/
class MITKCORE_EXPORT OverlayManager : public itk::LightObject {
public:
typedef std::set<BaseRenderer*> BaseRendererSet;
typedef std::set<Overlay::Pointer> OverlaySet;
typedef std::map<const std::string,AbstractOverlayLayouter::Pointer > LayouterMap;
typedef std::map<const BaseRenderer*,LayouterMap > LayouterRendererMap;
typedef std::map<const BaseRenderer*,vtkSmartPointer<vtkRenderer> > ForegroundRendererMap;
- mitkClassMacro(OverlayManager, itk::LightObject);
+ mitkClassMacroItkParent(OverlayManager, itk::LightObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void AddOverlay(const Overlay::Pointer& overlay, bool ForceInForeground = true);
void AddOverlay(const Overlay::Pointer& overlay, BaseRenderer* renderer, bool ForceInForeground = true);
void RemoveOverlay(const Overlay::Pointer& overlay);
/** \brief Clears the manager of all Overlays.*/
void RemoveAllOverlays();
/** \brief Adds the overlay to the layouter specified by identifier and renderer*/
void SetLayouter(Overlay* overlay, const std::string& identifier, BaseRenderer* renderer);
/** \brief Calls all layouters to update the position and size of the registered Overlays*/
void UpdateLayouts(BaseRenderer* renderer);
/** \brief Returns the Layouter specified by renderer and the identifier*/
AbstractOverlayLayouter::Pointer GetLayouter(BaseRenderer* renderer, const std::string& identifier);
/** \brief Add a layouter to provide it with the use of the SetLayouter method*/
void AddLayouter(const AbstractOverlayLayouter::Pointer& layouter);
void AddBaseRenderer(BaseRenderer* renderer);
/** \brief The layout of each Overlay will be prepared and the properties of each Overlay is updated.*/
void UpdateOverlays(BaseRenderer *baseRenderer);
void RemoveBaseRenderer(mitk::BaseRenderer *renderer);
void RemoveAllBaseRenderers();
protected:
/** \brief explicit constructor which disallows implicit conversions */
explicit OverlayManager();
~OverlayManager();
private:
OverlaySet m_OverlaySet;
BaseRendererSet m_BaseRendererSet;
LayouterRendererMap m_LayouterMap;
ForegroundRendererMap m_ForegroundRenderer;
/** \brief copy constructor */
OverlayManager( const OverlayManager &);
/** \brief assignment operator */
OverlayManager &operator=(const OverlayManager &);
};
} // namespace mitk
#endif // OVERLAYMANAGER_H
diff --git a/Modules/Core/include/mitkPlaneGeometry.h b/Modules/Core/include/mitkPlaneGeometry.h
index 2dce78dc7a..e5edc00937 100644
--- a/Modules/Core/include/mitkPlaneGeometry.h
+++ b/Modules/Core/include/mitkPlaneGeometry.h
@@ -1,571 +1,571 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/**
* \brief Describes the geometry of a plane object
*
* Describes a two-dimensional manifold, i.e., to put it simply,
* an object that can be described using a 2D coordinate-system.
*
* PlaneGeometry 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 PlaneGeometry describes the 2D representation within a 3D object (derived from BaseGeometry). 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.
*
*
* Optionally, a reference BaseGeometry 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 PlaneGeometry) with the bounding box of the associated
* BaseGeometry.
*
* \warning The PlaneGeometry 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::GetPlaneGeometry() makes sure, that the PlaneGeometry 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
*/
#ifndef PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include <MitkCoreExports.h>
#include "mitkBaseGeometry.h"
#include "mitkRestorePlanePositionOperation.h"
#include <vnl/vnl_cross.h>
namespace mitk {
template < class TCoordRep, unsigned int NPointDimension > class Line;
typedef Line<ScalarType, 3> Line3D;
class PlaneGeometry;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometry instead. */
DEPRECATED(typedef PlaneGeometry Geometry2D);
/**
* \brief Describes a two-dimensional, rectangular plane
*
* \ingroup Geometry
*/
class MITKCORE_EXPORT PlaneGeometry : public BaseGeometry
{
public:
mitkClassMacro(PlaneGeometry, BaseGeometry);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
enum PlaneOrientation
{
Axial,
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;
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) with respect to \a BaseGeometry (default: identity).
* Spacing also taken from \a BaseGeometry.
*
* \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 BaseGeometry* geometry3D,
PlaneOrientation planeorientation = Axial, ScalarType zPosition = 0,
bool frontside = true, bool rotated = false);
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) with respect to \a BaseGeometry (default: identity).
* Spacing also taken from \a BaseGeometry.
*
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Axial, for other plane locations respectively)
*/
virtual void InitializeStandardPlane(const BaseGeometry* geometry3D, bool top,
PlaneOrientation planeorientation = Axial,
bool frontside = true, bool rotated = false);
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) 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 = Axial,
ScalarType zPosition = 0, bool frontside = true, bool rotated = false);
/**
* \brief Initialize plane with orientation \a planeorientation
* (default: axial) given width, height and spacing.
*
*/
virtual void InitializeStandardPlane(ScalarType width, ScalarType height,
const Vector3D & spacing, PlaneOrientation planeorientation = Axial,
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;
/**
* \brief Calculates, whether a point is below or above the plane. There are two different
*calculation methods, with or without consideration of the bounding box.
*/
virtual bool IsAbove(const Point3D& pt3d_mm, bool considerBoundingBox = false) 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 itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
/** Implements operation to re-orient the plane */
- virtual void ExecuteOperation(Operation *operation);
+ virtual void ExecuteOperation(Operation *operation) override;
/**
* \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 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).
*
* DEPRECATED. Use Project(vector,vector) instead
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Point3D & atPt3d_mm,
const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_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::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 Set the geometrical frame of reference in which this PlaneGeometry
* is placed.
*
* This would usually be the BaseGeometry of the underlying dataset, but
* setting it is optional.
*/
void SetReferenceGeometry(mitk::BaseGeometry *geometry);
/**
* \brief Get the geometrical frame of reference for this PlaneGeometry.
*/
BaseGeometry *GetReferenceGeometry() const;
bool HasReferenceGeometry() const;
protected:
PlaneGeometry();
PlaneGeometry(const PlaneGeometry& other);
virtual ~PlaneGeometry();
- virtual void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream &os, itk::Indent indent) const override;
mitk::BaseGeometry *m_ReferenceGeometry;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
//##Documentation
//## @brief CheckBounds
//##
//## This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## If you implement this function in a subclass, make sure, that all classes were your class inherits from
//## have an implementation of CheckBounds
//## (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as well!)
- virtual void CheckBounds(const BoundsArrayType& bounds);
+ virtual void CheckBounds(const BoundsArrayType& bounds) override;
//##Documentation
//## @brief CheckIndexToWorldTransform
//##
//## This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## In Subclasses of BaseGeometry, implement own conditions or call Superclass::CheckBounds(bounds);.
- virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D* transform);
+ virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D* transform) override;
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/Modules/Core/include/mitkPlaneGeometryData.h b/Modules/Core/include/mitkPlaneGeometryData.h
index fb4095ac13..ae1581e464 100644
--- a/Modules/Core/include/mitkPlaneGeometryData.h
+++ b/Modules/Core/include/mitkPlaneGeometryData.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2
#define MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2
#include <MitkCoreExports.h>
#include "mitkBaseData.h"
#include "mitkGeometryData.h"
#include "mitkPlaneGeometry.h"
namespace mitk {
class PlaneGeometryData;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometryData instead. */
DEPRECATED( typedef PlaneGeometryData Geometry2DData);
//##Documentation
//## @brief Data class containing PlaneGeometry objects
//## @ingroup Geometry
//##
class MITKCORE_EXPORT PlaneGeometryData : public GeometryData
{
public:
mitkClassMacro(PlaneGeometryData, GeometryData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//##Documentation
//## @brief Set the reference to a PlaneGeometry that is stored
//## by the object
//##
//## @warning Accepts only instances of PlaneGeometry or sub-classes.
- virtual void SetGeometry(mitk::BaseGeometry *geometry);
+ virtual void SetGeometry(mitk::BaseGeometry *geometry) override;
//##Documentation
//## @brief Set the reference to the PlaneGeometry that is stored
//## by the object
virtual void SetPlaneGeometry(mitk::PlaneGeometry* geometry2d);
/**
* \deprecatedSince{2014_10} Please use SetPlaneGeometry
*/
DEPRECATED(void SetGeometry2D(PlaneGeometry* geo)){SetPlaneGeometry(geo);};
//##Documentation
//## @brief Get the reference to the PlaneGeometry that is stored
//## by the object
virtual mitk::PlaneGeometry * GetPlaneGeometry() const
{
return static_cast<mitk::PlaneGeometry *>(GetGeometry());
};
/**
* \deprecatedSince{2014_10} Please use GetPlaneGeometry
*/
DEPRECATED(const PlaneGeometry* GetGeometry2D()){return GetPlaneGeometry();};
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
- virtual void CopyInformation(const itk::DataObject *data);
+ virtual void CopyInformation(const itk::DataObject *data) override;
protected:
PlaneGeometryData();
virtual ~PlaneGeometryData();
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATA_H_HEADER_INCLUDED_C19C01E2 */
diff --git a/Modules/Core/include/mitkPlaneGeometryDataMapper2D.h b/Modules/Core/include/mitkPlaneGeometryDataMapper2D.h
index d2ae5d38d1..6538af4f16 100644
--- a/Modules/Core/include/mitkPlaneGeometryDataMapper2D.h
+++ b/Modules/Core/include/mitkPlaneGeometryDataMapper2D.h
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlaneGeometryDataMapper2D_h
#define mitkPlaneGeometryDataMapper2D_h
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include <MitkCoreExports.h>
#include <mitkWeakPointer.h>
#include <vtkSmartPointer.h>
class vtkActor2D;
class vtkPropAssembly;
class vtkFloatArray;
class vtkCellArray;
class vtkPolyDataMapper2D;
namespace mitk {
/**
* @brief Vtk-based 2D mapper for rendering a crosshair with the plane geometry.
*
* This mapper uses the mitkPlaneGeometryData from the three helper objects in
* the StdMultiWidget to render a crosshair in all 2D render windows. The crosshair
* is assembled as lines and rendered with a vtkPolyDataMapper. The mapper
* requires multiple plane geometry to compute the correct crosshair position.
* The mapper offers the following properties:
* \b Crosshair.Line width: The thickness of the crosshair.
* \b Crosshair.Gap Size: The gap between the lines in pixels.
* \b Crosshair.Orientation Decoration: Adds a PlaneOrientationProperty, which
* indicates the direction of the plane normal. See mitkPlaneOrientationProperty.
*
* @ingroup Mapper
*/
class MITKCORE_EXPORT PlaneGeometryDataMapper2D : public VtkMapper
{
public:
mitkClassMacro(PlaneGeometryDataMapper2D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::PlaneGeometryData* GetInput() const;
/** \brief returns the a prop assembly */
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/** Applies properties specific to this mapper */
virtual void ApplyAllProperties( BaseRenderer *renderer );
- virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
+ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
/** \brief set the default properties for this mapper */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/* constructor */
LocalStorage();
/* destructor */
~LocalStorage();
// actor
vtkSmartPointer<vtkActor2D> m_CrosshairActor;
vtkSmartPointer<vtkActor2D> m_CrosshairHelperLineActor;
vtkSmartPointer<vtkPropAssembly> m_CrosshairAssembly;
vtkSmartPointer<vtkPolyDataMapper2D> m_HelperLinesmapper;
vtkSmartPointer<vtkPolyDataMapper2D> m_Mapper;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
protected:
/* constructor */
PlaneGeometryDataMapper2D();
/* destructor */
virtual ~PlaneGeometryDataMapper2D();
/* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
void CreateVtkCrosshair(BaseRenderer *renderer);
/**
* \brief Returns the thick slice mode for the given datanode.
*
* This method returns the value of the 'reslice.thickslices' property for
* the given datanode.
* '0': thick slice mode disabled
* '1': thick slice mode enabled
*
* The variable 'thickSlicesNum' contains the value of the 'reslice.thickslices.num'
* property that defines how many slices are shown at once.
*/
int DetermineThickSliceMode( DataNode * dn, int &thickSlicesNum );
void DrawLine(Point3D p0, Point3D p1,
vtkCellArray *lines,
vtkPoints *points);
// member variables holding the current value of the properties used in this mapper
typedef std::vector<DataNode*> NodesVectorType;
NodesVectorType m_OtherPlaneGeometries;
typedef std::set<Self*> AllInstancesContainer;
static AllInstancesContainer s_AllInstances;
bool m_RenderOrientationArrows;
bool m_ArrowOrientationPositive;
mitk::ScalarType m_DepthValue;
void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor);
};
} // namespace mitk
#endif /* mitkPlaneGeometryDataMapper2D_h */
diff --git a/Modules/Core/include/mitkPlaneGeometryDataToSurfaceFilter.h b/Modules/Core/include/mitkPlaneGeometryDataToSurfaceFilter.h
index a16efe5ee7..7248e39971 100644
--- a/Modules/Core/include/mitkPlaneGeometryDataToSurfaceFilter.h
+++ b/Modules/Core/include/mitkPlaneGeometryDataToSurfaceFilter.h
@@ -1,227 +1,227 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD
#define MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD
#include "mitkSurfaceSource.h"
#include "mitkGeometry3D.h"
#include "vtkSystemIncludes.h"
class vtkPlaneSource;
class vtkTransformPolyDataFilter;
class vtkCubeSource;
class vtkTransform;
class vtkPlane;
class vtkCutter;
class vtkStripper;
class vtkPolyData;
class vtkPPolyDataNormals;
class vtkTriangleFilter;
class vtkTextureMapToPlane;
class vtkBox;
class vtkClipPolyData;
namespace mitk {
class PlaneGeometryData;
class PlaneGeometryDataToSurfaceFilter;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometryDataToSurfaceFilter instead. */
DEPRECATED( typedef PlaneGeometryDataToSurfaceFilter Geometry2DDataToSurfaceFilter);
/** \brief Superclass of all classes having a PlaneGeometryData as input and
* generating Images as output
*
* Currently implemented for PlaneGeometry and AbstractTransformGeometry.
* Currently, this class does not really have subclasses, but does the job
* for itself. It checks which kind of PlaneGeometry is stored in the
* PlaneGeometryData and - if it knows how - it generates the respective
* Surface. Of course, this has the disadvantage that for any new type of
* PlaneGeometry this class (PlaneGeometryDataToSurfaceFilter) has to be
* changed/extended. The idea is to move the type specific generation code in
* subclasses, and internally (within this class) use a factory to create an
* instance of the required subclass and delegate the surface generation to
* it.
*
* \sa mitk::DeformablePlane
* \todo make extension easier
* \ingroup Process
*/
class MITKCORE_EXPORT PlaneGeometryDataToSurfaceFilter : public SurfaceSource
{
public:
mitkClassMacro(PlaneGeometryDataToSurfaceFilter, SurfaceSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
const PlaneGeometryData *GetInput(void);
const PlaneGeometryData *GetInput(unsigned int idx);
virtual void SetInput(const PlaneGeometryData *image);
using itk::ProcessObject::SetInput;
virtual void SetInput(unsigned int index, const PlaneGeometryData *image);
/** \brief If \a true (default), use Geometry3D::GetParametricBounds() to define the resolution in parameter space,
* otherwise use m_XResolution and m_YResolution
*/
itkGetMacro(UseGeometryParametricBounds, bool);
/** \brief If \a true (default), use Geometry3D::GetParametricBounds() to define the resolution in parameter space,
* otherwise use m_XResolution and m_YResolution
*/
itkSetMacro(UseGeometryParametricBounds, bool);
/** \brief Get x-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in x-direction (see vtkPlaneSource::SetXResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the x-bounds of Geometry3D::GetParametricBounds() are used.
* \sa m_XResolution
*/
itkGetMacro(XResolution, int);
/** \brief Set x-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in x-direction (see vtkPlaneSource::SetXResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the x-bounds of Geometry3D::GetParametricBounds() are used.
* \sa m_XResolution
*/
itkSetMacro(XResolution, int);
/** \brief Get y-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in y-direction (see vtkPlaneSource::SetYResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the y-bounds of Geometry3D::GetParametricBounds() are used.
* \sa m_YResolution
*/
itkGetMacro(YResolution, int);
/** \brief Set y-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in y-direction (see vtkPlaneSource::SetYResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the y-bounds of Geometry3D::GetParametricBounds() are used.
* \sa m_YResolution
*/
itkSetMacro(YResolution, int);
/** \brief Get whether the Surface is at the origin and placed using the Geometry
*
* Default is \a false, i.e., the transform of the Geometry is the identity, thus
* the points within the Surface are at their final position. Otherwise
* (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is
* at the origin and the actual position is determined by the transform of the
* Geometry.
* \sa m_PlaceByGeometry
*/
itkGetConstMacro(PlaceByGeometry, bool);
/** \brief Set whether the Surface is at the origin and placed using the Geometry
*
* Default is \a false, i.e., the transform of the Geometry is the identity, thus
* the points within the Surface are at their final position. Otherwise
* (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is
* at the origin and the actual position is determined by the transform of the
* Geometry.
* \sa m_PlaceByGeometry
*/
itkSetMacro(PlaceByGeometry, bool);
itkBooleanMacro(PlaceByGeometry);
itkGetConstMacro( UseBoundingBox, bool );
itkSetMacro( UseBoundingBox, bool );
itkBooleanMacro( UseBoundingBox );
void SetBoundingBox( const BoundingBox *boundingBox );
const BoundingBox *GetBoundingBox() const;
protected:
PlaneGeometryDataToSurfaceFilter();
virtual ~PlaneGeometryDataToSurfaceFilter();
/** \brief Source to create the vtk-representation of the parameter space rectangle of the PlaneGeometry
*/
vtkPlaneSource* m_PlaneSource;
/** \brief Filter to create the vtk-representation of the PlaneGeometry, which is a
* transformation of the m_PlaneSource
*/
vtkTransformPolyDataFilter* m_VtkTransformPlaneFilter;
/** \brief If \a true, use Geometry3D::GetParametricBounds() to define the resolution in parameter space,
* otherwise use m_XResolution and m_YResolution
*/
bool m_UseGeometryParametricBounds;
/** \brief X-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in x-direction (see vtkPlaneSource::SetXResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the x-bounds of Geometry3D::GetParametricBounds() are used.
* \sa m_XResolution
*/
int m_XResolution;
/** \brief Y-resolution in parameter space
*
* The m_PlaneSource will create this many sub-rectangles
* in y-direction (see vtkPlaneSource::SetYResolution)
* \note Only used, when GetUseGeometryParametricBounds() is \a false, otherwise the
* the y-bounds of Geometry3D::GetParametricBounds() are used.
*/
int m_YResolution;
/** \brief Define whether the Surface is at the origin and placed using the Geometry
*
* Default is \a false, i.e., the transform of the Geometry is the identity, thus
* the points within the Surface are at their final position. Otherwise
* (m_PlaceByGeometry==\a true), the first cornerpoint of the created Surface is
* at the origin and the actual position is determined by the transform of the
* Geometry.
*/
bool m_PlaceByGeometry;
bool m_UseBoundingBox;
BoundingBox::ConstPointer m_BoundingBox;
vtkCubeSource *m_CubeSource;
vtkTransform *m_Transform;
vtkTransformPolyDataFilter *m_PolyDataTransformer;
vtkPlane *m_Plane;
vtkCutter *m_PlaneCutter;
vtkStripper *m_PlaneStripper;
vtkPolyData *m_PlanePolyData;
vtkPPolyDataNormals * m_NormalsUpdater;
vtkTriangleFilter *m_PlaneTriangler;
vtkTextureMapToPlane *m_TextureMapToPlane;
vtkBox *m_Box;
vtkClipPolyData *m_PlaneClipper;
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATATOSURFACEDATAFILTER_H_HEADER_INCLUDED_C10B22CD */
diff --git a/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h b/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
index 67169bf48b..0c622e6e63 100644
--- a/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
+++ b/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
@@ -1,214 +1,214 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#define MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#include <MitkCoreExports.h>
#include "mitkVtkMapper.h"
#include "mitkDataStorage.h"
#include "mitkPlaneGeometryDataToSurfaceFilter.h"
#include "mitkWeakPointer.h"
#include <vtkSystemIncludes.h>
#include <vtkCleanPolyData.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkAssembly;
class vtkFeatureEdges;
class vtkTubeFilter;
class vtkTransformPolyDataFilter;
class vtkHedgeHog;
namespace mitk {
class PlaneGeometryData;
class BaseRenderer;
class ImageVtkMapper2D;
class DataStorage;
class PlaneGeometryDataVtkMapper3D;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometryDataVTKMapper3D instead. */
DEPRECATED( typedef PlaneGeometryDataVtkMapper3D Geometry2DDataVtkMapper3D);
/**
* \brief Vtk-based mapper to display a PlaneGeometry in a 3D window
* \ingroup Mapper
*
* Uses a PlaneGeometryDataToSurfaceFilter object to create a vtkPolyData representation of a given PlaneGeometry instance.
* PlaneGeometry 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 "draw edges": (Bool) Toggle display of the tubed frame
* - \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 mitkPlaneGeometryDataVtkMapper3D.png "Internal filter pipeline"
*
*/
class MITKCORE_EXPORT PlaneGeometryDataVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(PlaneGeometryDataVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* 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);
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
+ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
/**
* \brief Get the PlaneGeometryData to map
*/
virtual const PlaneGeometryData *GetInput();
/**
* \brief All images found when traversing the (sub-) tree starting at
* \a iterator which are resliced by an ImageVtkMapper2D 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;
PlaneGeometryDataVtkMapper3D();
virtual ~PlaneGeometryDataVtkMapper3D();
- virtual void GenerateDataForRenderer(BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(BaseRenderer* renderer) override;
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;
PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator;
BoundingBox::Pointer m_SurfaceCreatorBoundingBox;
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer;
/** \brief Edge extractor for tube-shaped frame */
vtkFeatureEdges *m_Edges;
/** \brief Filter to apply object transform to the extracted edges */
vtkTransformPolyDataFilter *m_EdgeTransformer;
/** \brief Source to create the tube-shaped frame */
vtkTubeFilter *m_EdgeTuber;
/** \brief Mapper for the tube-shaped frame */
vtkPolyDataMapper *m_EdgeMapper;
/** \brief Actor for the tube-shaped frame */
vtkActor *m_EdgeActor;
/** \brief Mapper for black plane background */
vtkPolyDataMapper *m_BackgroundMapper;
/** \brief Actor for black plane background */
vtkActor *m_BackgroundActor;
/** \brief Transforms the suface before applying the glyph filter */
vtkTransformPolyDataFilter* m_NormalsTransformer;
/** \brief Mapper for normals representation (thin lines) */
vtkPolyDataMapper* m_FrontNormalsMapper;
vtkPolyDataMapper* m_BackNormalsMapper;
/** \brief Generates lines for surface normals */
vtkHedgeHog* m_FrontHedgeHog;
vtkHedgeHog* m_BackHedgeHog;
/** \brief Actor to hold the normals arrows */
vtkActor* m_FrontNormalsActor;
vtkActor* m_BackNormalsActor;
/** Cleans the polyline in order to avoid phantom boundaries */
vtkCleanPolyData *m_Cleaner;
/** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/
bool m_NormalsActorAdded;
/** \brief The DataStorage defines which part of the data tree is traversed for renderering. */
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
class MITKCORE_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< ImageVtkMapper2D *, ActorInfo > ActorList;
ActorList m_ImageActors;
// responsiblity to remove the observer upon its destruction
typedef itk::MemberCommand< PlaneGeometryDataVtkMapper3D > MemberCommandType;
MemberCommandType::Pointer m_ImageMapperDeletedCommand;
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F */
diff --git a/Modules/Core/include/mitkPlaneOrientationProperty.h b/Modules/Core/include/mitkPlaneOrientationProperty.h
index f877dfeb01..0013940cf4 100644
--- a/Modules/Core/include/mitkPlaneOrientationProperty.h
+++ b/Modules/Core/include/mitkPlaneOrientationProperty.h
@@ -1,131 +1,131 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_PLANE_DECORATION_PROPERTY__H
#define MITK_PLANE_DECORATION_PROPERTY__H
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Property which controls whether 2D line representation of a PlaneGeometry
* should have small arrows at both ends to indicate the orientation of
* the plane, and whether the arrows should be oriented in the direction of
* the plane's normal or against it.
*
* Valid values of the enumeration property are
* - PLANE_DECORATION_NONE (no arrows)
* - PLANE_DECORATION_POSITIVE_ORIENTATION (arrows pointing upwards)
* - PLANE_DECORATION_NEGATIVE_ORIENTATION (arrows pointing downwards)
*
* See also mitk::PlaneGeometryDataMapper2D::DrawOrientationArrow()
*/
class MITKCORE_EXPORT PlaneOrientationProperty : public EnumerationProperty
{
public:
mitkClassMacro( PlaneOrientationProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(PlaneOrientationProperty, const IdType&);
mitkNewMacro1Param(PlaneOrientationProperty, const std::string&);
enum
{
PLANE_DECORATION_NONE,
PLANE_DECORATION_POSITIVE_ORIENTATION,
PLANE_DECORATION_NEGATIVE_ORIENTATION
};
/**
* Returns the state of plane decoration.
*/
virtual int GetPlaneDecoration();
/**
* Sets the decoration type to no decoration.
*/
virtual void SetPlaneDecorationToNone();
/**
* Sets the decoration type to arrows in positive plane direction.
*/
virtual void SetPlaneDecorationToPositiveOrientation();
/**
* Sets the decoration type to arrows in negative plane direction.
*/
virtual void SetPlaneDecorationToNegativeOrientation();
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the decoration type to none.
*/
PlaneOrientationProperty( );
/**
* Constructor. Sets the decoration type to the given value. If it is not
* valid, the interpolation is set to none
*/
PlaneOrientationProperty( const IdType &value );
/**
* Constructor. Sets the decoration type to the given value. If it is not
* valid, the representation is set to none
*/
PlaneOrientationProperty( const std::string &value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid types.
*/
- virtual bool AddEnum( const std::string &name, const IdType &id );
+ virtual bool AddEnum( const std::string &name, const IdType &id ) override;
/**
* Adds the standard enumeration types with corresponding strings.
*/
virtual void AddDecorationTypes();
private:
// purposely not implemented
PlaneOrientationProperty& operator=(const PlaneOrientationProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkPointSet.h b/Modules/Core/include/mitkPointSet.h
index 440105740f..5bcef1652b 100755
--- a/Modules/Core/include/mitkPointSet.h
+++ b/Modules/Core/include/mitkPointSet.h
@@ -1,318 +1,318 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPointSet_H_HEADER_INCLUDED
#define MITKPointSet_H_HEADER_INCLUDED
#include "mitkBaseData.h"
#include <itkMesh.h>
#include <itkDefaultDynamicMeshTraits.h>
namespace mitk {
/**
* \brief Data structure which stores a set of points. Superclass of
* mitk::Mesh.
*
* 3D points are grouped within a point set; for time resolved usage, one point
* set is created and maintained per time step. A point entry consists of the
* point coordinates and point data.
*
* The point data includes a point ID (unique identifier to address this point
* within the point set), the selection state of the point and the type of
* the point.
*
* For further information about different point types see
* mitk::PointSpecificationType in mitkVector.h.
*
* Inserting a point is accompanied by an event, containing an index. The new
* point is inserted into the list at the specified position. At the same time
* an internal ID is generated and stored for the point. Points at specific time
* steps are accessed by specifying the time step number (which defaults to 0).
*
* The points of itk::PointSet stores the points in a pointContainer
* (MapContainer). The points are best accessed by using a ConstIterator (as
* defined in MapContainer); avoid access via index.
*
* The class internally uses an itk::Mesh for each time step, because
* mitk::Mesh is derived from mitk::PointSet and needs the itk::Mesh structure
* which is also derived from itk::PointSet. Thus several typedefs which seem
* to be in wrong place, are declared here (for example SelectedLinesType).
*
* \section mitkPointSetDisplayOptions
*
* The default mappers for this data structure are mitk::PointSetGLMapper2D and
* mitk::PointSetVtkMapper3D. See these classes for display options which can
* can be set via properties.
*
* \section Events
*
* PointSet issues the following events, for which observers can register
* (the below events are grouped into a class hierarchy as indicated by
* identation level; e.g. PointSetSizeChangeEvent comprises PointSetAddEvent
* and PointSetRemoveEvent):
*
* <tt>
* PointSetEvent <i>subsumes all PointSet events</i>
* PointSetMoveEvent <i>issued when a point of the PointSet is moved</i>
* PointSetSizeChangeEvent <i>subsumes add and remove events</i>
* PointSetAddEvent <i>issued when a point is added to the PointSet</i>
* PointSetRemoveEvent <i>issued when a point is removed from the PointSet</i>
* </tt>
* \ingroup PSIO
* \ingroup Data
*/
class MITKCORE_EXPORT PointSet : public BaseData
{
public:
mitkClassMacro(PointSet, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::ScalarType CoordinateType;
typedef mitk::ScalarType InterpolationWeightType;
static const unsigned int PointDimension = 3;
static const unsigned int MaxTopologicalDimension = 3;
/**
* \brief struct for data of a point
*/
struct MITKCORE_EXPORT PointDataType
{
unsigned int id; //to give the point a special ID
bool selected; //information about if the point is selected
mitk::PointSpecificationType pointSpec; //specifies the type of the point
bool operator==(const PointDataType& other) const;
};
/**
* \brief cellDataType, that stores all indexes of the lines, that are
* selected e.g.: points A,B and C.Between A and B there is a line with
* index 0. If vector of cellData contains 1 and 2, then the lines between
* B and C and C and A is selected.
*/
typedef std::vector<unsigned int> SelectedLinesType;
typedef SelectedLinesType::iterator SelectedLinesIter;
struct CellDataType
{
//used to set the whole cell on selected
bool selected;
//indexes of selected lines. 0 is between pointId 0 and 1
SelectedLinesType selectedLines;
//is the polygon already finished and closed
bool closed;
};
typedef itk::DefaultDynamicMeshTraits<
PointDataType, PointDimension, MaxTopologicalDimension,
CoordinateType, InterpolationWeightType, CellDataType > MeshTraits;
typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
typedef MeshType DataType;
typedef Point3D PointType;
typedef DataType::PointIdentifier PointIdentifier;
typedef DataType::PointsContainer PointsContainer;
typedef DataType::PointsContainerIterator PointsIterator;
typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
typedef DataType::PointDataContainer PointDataContainer;
typedef DataType::PointDataContainerIterator PointDataIterator;
typedef DataType::PointDataContainerIterator PointDataConstIterator;
- virtual void Expand( unsigned int timeSteps );
+ virtual void Expand( unsigned int timeSteps ) override;
/** \brief executes the given Operation */
- virtual void ExecuteOperation(Operation* operation);
+ virtual void ExecuteOperation(Operation* operation) override;
/** \brief returns the current size of the point-list */
virtual int GetSize( unsigned int t = 0 ) const;
virtual unsigned int GetPointSetSeriesSize() const;
/** \brief returns the pointset */
virtual DataType::Pointer GetPointSet( int t = 0 ) const;
PointsIterator Begin( int t = 0 );
PointsConstIterator Begin( int t = 0 ) const;
PointsIterator End( int t = 0 );
PointsConstIterator End( int t = 0 ) const;
/**
* \brief Get the point with ID id in world coordinates
*
* check if the ID exists. If it doesn't exist, then return 0,0,0
*/
PointType GetPoint( PointIdentifier id, int t = 0 ) const;
/**
* \brief Get the point with ID id in world coordinates
*
* If a point exists for the ID id, the point is returned in the parameter point
* and the method returns true. If the ID does not exist, the method returns false
*/
bool GetPointIfExists( PointIdentifier id, PointType* point, int t = 0 ) const;
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void SetPoint( PointIdentifier id, PointType point, int t = 0 );
/**
* \brief Set the given point in world coordinate system with the given PointSpecificationType
*/
void SetPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0 );
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void InsertPoint( PointIdentifier id, PointType point, int t = 0 );
/**
* \brief Set the given point in world coordinate system with given PointSpecificationType
*/
void InsertPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t );
/**
* \brief Swap a point at the given position (id) with the upper point (moveUpwards=true) or with the lower point (moveUpwards=false).
* If upper or lower index does not exist false is returned, if swap was successful true.
*/
bool SwapPointPosition( PointIdentifier id, bool moveUpwards, int t = 0 );
/**
* \brief searches a selected point and returns the id of that point.
* If no point is found, then -1 is returned
*/
virtual int SearchSelectedPoint( int t = 0 ) const;
/** \brief returns true if a point exists at this position */
virtual bool IndexExists( int position, int t = 0 ) const;
/** \brief to get the state selected/unselected of the point on the
* position
*/
virtual bool GetSelectInfo( int position, int t = 0 ) const;
virtual void SetSelectInfo( int position, bool selected, int t = 0 );
/** \brief to get the type of the point at the position and the moment */
virtual PointSpecificationType GetSpecificationTypeInfo( int position, int t ) const;
/** \brief returns the number of selected points */
virtual int GetNumberOfSelected( int t = 0 ) const;
/**
* \brief searches a point in the list == point +/- distance
*
* \param point is in world coordinates.
* \param distance is in mm.
* returns -1 if no point is found
* or the position in the list of the first match
*/
int SearchPoint( Point3D point, ScalarType distance, int t = 0 ) const;
- virtual bool IsEmptyTimeStep(unsigned int t) const;
+ virtual bool IsEmptyTimeStep(unsigned int t) const override;
//virtual methods, that need to be implemented
- virtual void UpdateOutputInformation();
- virtual void SetRequestedRegionToLargestPossibleRegion();
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
- virtual bool VerifyRequestedRegion();
- virtual void SetRequestedRegion(const itk::DataObject *data);
+ virtual void UpdateOutputInformation() override;
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
+ virtual bool VerifyRequestedRegion() override;
+ virtual void SetRequestedRegion(const itk::DataObject *data) override;
//Method for subclasses
virtual void OnPointSetChange(){};
protected:
mitkCloneMacro(Self);
PointSet();
PointSet(const PointSet &other);
virtual ~PointSet();
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const; ///< print content of the object to os
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override; ///< print content of the object to os
- virtual void ClearData();
+ virtual void ClearData() override;
- virtual void InitializeEmpty();
+ virtual void InitializeEmpty() override;
/** \brief swaps point coordinates and point data of the points with identifiers id1 and id2 */
bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0 );
typedef std::vector< DataType::Pointer > PointSetSeries;
PointSetSeries m_PointSetSeries;
/**
* @brief flag to indicate the right time to call SetBounds
**/
bool m_CalculateBoundingBox;
};
/**
* @brief Equal A function comparing two pointsets for beeing identical.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::PointSet& p1, const mitk::PointSet& p2) instead.
*
* @ingroup MITKTestingAPI
*
* The function compares the Geometry, the size and all points element-wise.
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
*
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all subsequent comparisons are true, false otherwise
*/
DEPRECATED( MITKCORE_EXPORT bool Equal( const mitk::PointSet* leftHandSide, const mitk::PointSet* rightHandSide, mitk::ScalarType eps, bool verbose ));
/**
* @brief Equal A function comparing two pointsets for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the Geometry, the size and all points element-wise.
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
*
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all subsequent comparisons are true, false otherwise
*/
MITKCORE_EXPORT bool Equal( const mitk::PointSet& leftHandSide, const mitk::PointSet& rightHandSide, mitk::ScalarType eps, bool verbose );
itkEventMacro( PointSetEvent, itk::AnyEvent );
itkEventMacro( PointSetMoveEvent, PointSetEvent );
itkEventMacro( PointSetSizeChangeEvent, PointSetEvent );
itkEventMacro( PointSetAddEvent, PointSetSizeChangeEvent );
itkEventMacro( PointSetRemoveEvent, PointSetSizeChangeEvent );
itkEventMacro( PointSetExtendTimeRangeEvent, PointSetEvent );
} // namespace mitk
#endif /* MITKPointSet_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkPointSetDataInteractor.h b/Modules/Core/include/mitkPointSetDataInteractor.h
index 65750fb9ac..96ff7d76e7 100644
--- a/Modules/Core/include/mitkPointSetDataInteractor.h
+++ b/Modules/Core/include/mitkPointSetDataInteractor.h
@@ -1,192 +1,192 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPointSetDataInteractor_h_
#define mitkPointSetDataInteractor_h_
#include "itkObject.h"
#include "itkSmartPointer.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include "mitkDataInteractor.h"
#include <mitkPointSet.h>
namespace mitk
{
/**
* Class PointSetDataInteractor
* \brief Implementation of the PointSetInteractor
*
* Interactor operates on a point set and supports to:
* - add points
* - remove points
* - move single points
* - move complete pointset
* - select/unselect a point
*
* in 2d and 3d render windows.
*
* \warn If this Interactor is assigned (SetDataNode) an empty mitk::DataNode it creates a point set,
* changing the point set of the assigned mitk::DataNode after this assignment will cause the mitk::PointSetDataInteractor
* to not work properly. So the usage has follow this general scheme:
*
* \code
// Set up interactor
m_CurrentInteractor = mitk::PointSetDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("PointSet.xml");
m_CurrentInteractor->SetEventConfig("PointSetConfig.xml");
//Create new PointSet which will receive the interaction input
m_TestPointSet = mitk::PointSet::New();
// Add the point set to the mitk::DataNode *before* the DataNode is added to the mitk::PointSetDataInteractor
m_TestPointSetNode->SetData(m_TestPointSet);
// finally add the mitk::DataNode (which already is added to the mitk::DataStorage) to the mitk::PointSetDataInteractor
m_CurrentInteractor->SetDataNode(m_TestPointSetNode);
\endcode
*
*
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKCORE_EXPORT PointSetDataInteractor: public DataInteractor
{
public:
mitkClassMacro(PointSetDataInteractor, DataInteractor)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Sets the maximum distance that is accepted when looking for a point at a certain position using the GetPointIndexByPosition function.
*/
void SetAccuracy(float accuracy);
/**
* @brief SetMaxPoints Sets the maximal number of points for the pointset
* Default ist zero, which result in infinite number of allowed points
* @param maxNumber
*/
void SetMaxPoints(unsigned int maxNumber = 0);
protected:
PointSetDataInteractor();
virtual ~PointSetDataInteractor();
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
* It is used to initialize the DataNode, e.g. if no PointSet exists yet it is created
* and added to the DataNode.
*/
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
/**
* \brief Return index in PointSet of the point that is within given accuracy to the provided position.
*
* Assumes that the DataNode contains a PointSet, if so it iterates over all points
* in the DataNode to check if it contains a point near the pointer position.
* If a point is found its index-position is returned, else -1 is returned.
*/
virtual int GetPointIndexByPosition(Point3D position, unsigned int time = 0, float accuracy = -1);
virtual bool CheckSelection( const InteractionEvent* interactionEvent );
/** Adds a point at the given coordinates.
* Every time a point is added it is also checked if the maximal number of points is reached,
* and if so an InternalEvent with the signal name "MaxNumberOfPoints" is triggered.
*/
virtual bool AddPoint(StateMachineAction*, InteractionEvent* event);
/** Removes point that is selected */
virtual bool RemovePoint(StateMachineAction*, InteractionEvent*interactionEvent);
/**
* Checks if new point is close enough to an old one,
* if so, trigger the ClosedContour signal which can be caught by the state machine.
*/
virtual bool IsClosedContour(StateMachineAction*, InteractionEvent*);
/**
* Moves the currently selected point to the new coodinates.
*/
virtual bool MovePoint(StateMachineAction*, InteractionEvent*);
/**
* Initializes the movement, stores starting position.
*/
virtual bool InitMove(StateMachineAction*, InteractionEvent*interactionEvent);
/**
* Is called when a movement is finished, changes back to regular color.
*/
virtual bool FinishMove(StateMachineAction*, InteractionEvent*);
/**
* Selects a point from the PointSet as currently active.
*/
virtual bool SelectPoint(StateMachineAction*, InteractionEvent*);
/**
* Unselects a point at the given coordinate.
*/
virtual bool UnSelectPointAtPosition(StateMachineAction*, InteractionEvent*);
/**
* Unselects all points out of reach.
*/
virtual bool UnSelectAll(StateMachineAction*, InteractionEvent*);
/**
* @brief UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the sender.
*/
virtual bool UpdatePointSet(StateMachineAction* stateMachineAction, InteractionEvent*);
/**
* Calls for inactivation of the DataInteractor
*/
virtual bool Abort(StateMachineAction*, InteractionEvent*);
/** \brief to calculate a direction vector from last point and actual
* point
*/
Point3D m_LastPoint;
/** \brief summ-vector for Movement */
Vector3D m_SumVec;
// DATA
PointSet::Pointer m_PointSet;
int m_MaxNumberOfPoints; // maximum of allowed number of points
float m_SelectionAccuracy; // accuracy that's needed to select a point
// FUNCTIONS
void UnselectAll(unsigned int timeStep , ScalarType timeInMs);
void SelectPoint(int position, unsigned int timeStep , ScalarType timeInMS);
};
}
#endif
diff --git a/Modules/Core/include/mitkPointSetInteractor.h b/Modules/Core/include/mitkPointSetInteractor.h
index 95856338d3..89c40669f4 100644
--- a/Modules/Core/include/mitkPointSetInteractor.h
+++ b/Modules/Core/include/mitkPointSetInteractor.h
@@ -1,128 +1,128 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#define MITKPOINTSETINTERACTOR_H_HEADER_INCLUDED_C11202FF
#include <MitkCoreExports.h>
#include "mitkNumericTypes.h"
#include <mitkInteractor.h>
namespace mitk
{
class DataNode;
/**
* \brief Interaction with a set of points.
*
* Points can be added, removed and moved.
* In case the interaction shall be done on a
* loaded set of points, the associated data
* object (mitkPointSet) needs to be loaded
* prior to the instanciation of this object.
* The number of points are checked and the internal
* statemachine set to the apropriate state.
* The management of 0 points is not supported.
* In this case, the amount of managed points is set to 1.
* \ingroup Interaction
*/
class MITKCORE_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;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
/**
*@brief If data changed then initialize according to numbers of loaded points
**/
- virtual void DataChanged();
+ virtual void DataChanged() override;
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 );
+ virtual bool ExecuteAction( Action* action, mitk::StateEvent const* stateEvent ) override;
/** \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/Modules/Core/include/mitkPointSetShapeProperty.h b/Modules/Core/include/mitkPointSetShapeProperty.h
index b246ca7928..03aeb268fd 100644
--- a/Modules/Core/include/mitkPointSetShapeProperty.h
+++ b/Modules/Core/include/mitkPointSetShapeProperty.h
@@ -1,127 +1,127 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINTSET_SHAPE_PROPERTY__H_
#define _MITK_POINTSET_SHAPE_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration for point set shapes. Valid values are:
* \li NONE
* \li VERTEX
* \li DASH
* \li CROSS (default)
* \li THICK_CROSS
* \li TRIANGLE
* \li SQUARE
* \li CIRCLE
* \li DIAMOND
* \li ARROW
* \li THICK_ARROW
* \li HOOKED_ARROW
*
* This class provides different shapes for the point set rendering (unselected points).
*
*/
class MITKCORE_EXPORT PointSetShapeProperty : public EnumerationProperty
{
public:
mitkClassMacro( PointSetShapeProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(PointSetShapeProperty, const IdType&);
mitkNewMacro1Param(PointSetShapeProperty, const std::string&);
enum PointSetShape
{
NONE = 0,
VERTEX = 1,
DASH = 2,
CROSS = 3,
THICK_CROSS = 4,
TRIANGLE = 5,
SQUARE = 6,
CIRCLE = 7,
DIAMOND = 8,
ARROW = 9,
THICK_ARROW = 10,
HOOKED_ARROW = 11
// Default = CROSS;
};
/**
* Returns the current shape
*/
virtual int GetPointSetShape() const;
using BaseProperty::operator=;
protected:
/** Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION).
*/
PointSetShapeProperty( );
/**
* Constructor. Sets rendering type to the given value.
*/
PointSetShapeProperty( const IdType& value );
/**
* Constructor. Sets rendering type to the given value.
*/
PointSetShapeProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid rendering types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the default enumeration types.
*/
virtual void AddPointSetShapes();
private:
// purposely not implemented
PointSetShapeProperty& operator=(const PointSetShapeProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkPointSetSource.h b/Modules/Core/include/mitkPointSetSource.h
index 3d523f9018..85870f3462 100644
--- a/Modules/Core/include/mitkPointSetSource.h
+++ b/Modules/Core/include/mitkPointSetSource.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_SET_SOURCE_H
#define _MITK_POINT_SET_SOURCE_H
#include "mitkBaseDataSource.h"
#include "mitkPointSet.h"
namespace mitk
{
/**
* @brief Superclass of all classes generating point sets (instances of class
* mitk::PointSet) 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.
* @ingroup Process
*/
class MITKCORE_EXPORT PointSetSource : public BaseDataSource
{
public:
mitkClassMacro( PointSetSource, BaseDataSource )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef PointSet OutputType;
typedef OutputType::Pointer OutputTypePointer;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
PointSetSource();
virtual ~PointSetSource();
};
}
#endif // #define _MITK_POINT_SET_SOURCE_H
diff --git a/Modules/Core/include/mitkPointSetVtkMapper2D.h b/Modules/Core/include/mitkPointSetVtkMapper2D.h
index 8f085d70f6..56abd70e00 100644
--- a/Modules/Core/include/mitkPointSetVtkMapper2D.h
+++ b/Modules/Core/include/mitkPointSetVtkMapper2D.h
@@ -1,224 +1,224 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPointSetVtkMapper2D_h
#define mitkPointSetVtkMapper2D_h
#include <MitkCoreExports.h>
#include <mitkPointSetShapeProperty.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkLocalStorageHandler.h"
//VTK
#include <vtkSmartPointer.h>
class vtkActor;
class vtkPropAssembly;
class vtkPolyData;
class vtkPolyDataMapper;
class vtkGlyphSource2D;
class vtkGlyph3D;
class vtkFloatArray;
class vtkCellArray;
namespace mitk {
class PointSet;
/**
* @brief Vtk-based 2D 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 three PolyData, one selected, and one unselected and one
* for a contour between the points. Each one is connected to an own
* PolyDataMapper and an Actor. The different color for the unselected and
* selected state and for the contour is read from properties.
*
* This mapper has several additional functionalities, such as rendering
* a contour between points, calculating and displaying distances or angles
* between 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 PointSetVTKMapper2D are:
*
* - \b "line width": (IntProperty 2) // line width of the line from one point to another
* - \b "point line width": (IntProperty 1) // line width of the cross marking a point
* - \b "point 2D size": (IntProperty 6) // size of the glyph marking a point
* - \b "show contour": (BoolProperty false) // enable contour rendering between points (lines)
* - \b "close contour": (BoolProperty false) // if enabled, the open strip is closed (first point connected with last point)
* - \b "show points": (BoolProperty true) // show or hide points
* - \b "show distances": (BoolProperty false) // show or hide distance measure
* - \b "distance decimal digits": (IntProperty 2) // set the number of decimal digits to be shown when rendering the distance information
* - \b "show angles": (BoolProperty false) // show or hide angle measurement
* - \b "show distant lines": (BoolProperty false) // show the line between to points from a distant view (equals "always on top" option)
* - \b "layer": (IntProperty 1) // default is drawing pointset above images (they have a default layer of 0)
* - \b "PointSet.2D.shape" (EnumerationProperty Cross) // provides different shapes marking a point
* 0 = "None", 1 = "Vertex", 2 = "Dash", 3 = "Cross", 4 = "ThickCross", 5 = "Triangle", 6 = "Square", 7 = "Circle",
* 8 = "Diamond", 9 = "Arrow", 10 = "ThickArrow", 11 = "HookedArrow", 12 = "Cross"
* - \b "PointSet.2D.fill shape": (BoolProperty false) // fill or do not fill the glyph shape
* - \b "Pointset.2D.distance to plane": (FloatProperty 4.0) //In the 2D render window, points are rendered which lie within a certain distance
* to the current plane. They are projected on the current plane and scalled according to their distance.
* Point markers appear smaller as the plane moves away from their true location.
* The distance threshold can be adjusted by this float property, which ables the user to delineate the points
* that lie exactly on the plane. (+/- rounding error)
*
* Other Properties used here but not defined in this class:
*
* - \b "selectedcolor": (ColorProperty (1.0f, 0.0f, 0.0f)) // default color of the selected pointset e.g. the current point is red
* - \b "contourcolor" : (ColorProperty (1.0f, 0.0f, 0.0f)) // default color for the contour is red
* - \b "color": (ColorProperty (1.0f, 1.0f, 0.0f)) // default color of the (unselected) pointset is yellow
* - \b "opacity": (FloatProperty 1.0) // opacity of point set, contours
* - \b "label": (StringProperty NULL) // a label can be defined for each point, which is rendered in proximity to the point
*
* @ingroup Mapper
*/
class MITKCORE_EXPORT PointSetVtkMapper2D : public VtkMapper
{
public:
mitkClassMacro(PointSetVtkMapper2D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::PointSet* GetInput() const;
/** \brief returns the a prop assembly */
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/** \brief set the default properties for this mapper */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/* constructor */
LocalStorage();
/* destructor */
~LocalStorage();
// points
vtkSmartPointer<vtkPoints> m_UnselectedPoints;
vtkSmartPointer<vtkPoints> m_SelectedPoints;
vtkSmartPointer<vtkPoints> m_ContourPoints;
// scales
vtkSmartPointer<vtkFloatArray> m_UnselectedScales;
vtkSmartPointer<vtkFloatArray> m_SelectedScales;
// distances
vtkSmartPointer<vtkFloatArray> m_DistancesBetweenPoints;
// lines
vtkSmartPointer<vtkCellArray> m_ContourLines;
// glyph source (provides different shapes for the points)
vtkSmartPointer<vtkGlyphSource2D> m_UnselectedGlyphSource2D;
vtkSmartPointer<vtkGlyphSource2D> m_SelectedGlyphSource2D;
// glyph
vtkSmartPointer<vtkGlyph3D> m_UnselectedGlyph3D;
vtkSmartPointer<vtkGlyph3D> m_SelectedGlyph3D;
// polydata
vtkSmartPointer<vtkPolyData> m_VtkUnselectedPointListPolyData;
vtkSmartPointer<vtkPolyData> m_VtkSelectedPointListPolyData;
vtkSmartPointer<vtkPolyData> m_VtkContourPolyData;
// actor
vtkSmartPointer<vtkActor> m_UnselectedActor;
vtkSmartPointer<vtkActor> m_SelectedActor;
vtkSmartPointer<vtkActor> m_ContourActor;
vtkSmartPointer<vtkTextActor> m_VtkTextActor;
std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextLabelActors;
std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextDistanceActors;
std::vector < vtkSmartPointer<vtkTextActor> > m_VtkTextAngleActors;
// mappers
vtkSmartPointer<vtkPolyDataMapper> m_VtkUnselectedPolyDataMapper;
vtkSmartPointer<vtkPolyDataMapper> m_VtkSelectedPolyDataMapper;
vtkSmartPointer<vtkPolyDataMapper> m_VtkContourPolyDataMapper;
// propassembly
vtkSmartPointer<vtkPropAssembly> m_PropAssembly;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
protected:
/* constructor */
PointSetVtkMapper2D();
/* destructor */
virtual ~PointSetVtkMapper2D();
/* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/* \brief Called in mitk::Mapper::Update
* If TimeSlicedGeometry or time step is not valid of point set: reset mapper so that nothing is
* displayed e.g. toggle visiblity of the propassembly */
- virtual void ResetMapper( BaseRenderer* renderer );
+ virtual void ResetMapper( BaseRenderer* renderer ) override;
/* \brief Fills the vtk objects, thus it is only called when the point set has been changed.
* This function iterates over the input point set and determines the glyphs which lie in a specific
* range around the current slice. Those glyphs are rendered using a specific shape defined in vtk glyph source
* to mark each point. The shape can be changed in MITK using the property "PointSet.2D.shape".
*
* There were issues when rendering vtk glyphs in the 2D-render windows. By default, the glyphs are
* rendered within the x-y plane in each 2D-render window, so you would only see them from the
* side in the saggital and coronal 2D-render window. The solution to this is to rotate the glyphs in order
* to be ortogonal to the current view vector. To achieve this, the rotation (vtktransform) of the current
* PlaneGeometry is applied to the orienation of the glyphs. */
virtual void CreateVTKRenderObjects(mitk::BaseRenderer* renderer);
// member variables holding the current value of the properties used in this mapper
bool m_ShowContour; // "show contour" property
bool m_CloseContour; // "close contour" property
bool m_ShowPoints; // "show points" property
bool m_ShowDistances; // "show distances" property
int m_DistancesDecimalDigits; // "distance decimal digits" property
bool m_ShowAngles; // "show angles" property
bool m_ShowDistantLines; // "show distant lines" property
int m_LineWidth; // "line width" property
int m_PointLineWidth; // "point line width" property
int m_Point2DSize; // "point 2D size" property
int m_IDShapeProperty; // ID for mitkPointSetShape Enumeration Property "Pointset.2D.shape"
bool m_FillShape; // "Pointset.2D.fill shape" property
float m_DistanceToPlane; // "Pointset.2D.distance to plane" property
};
} // namespace mitk
#endif /* mitkPointSetVtkMapper2D_h */
diff --git a/Modules/Core/include/mitkPointSetVtkMapper3D.h b/Modules/Core/include/mitkPointSetVtkMapper3D.h
index 8421e5c837..a99e80e162 100644
--- a/Modules/Core/include/mitkPointSetVtkMapper3D.h
+++ b/Modules/Core/include/mitkPointSetVtkMapper3D.h
@@ -1,159 +1,159 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273
#define MITKPointSetVtkMAPPER3D_H_HEADER_INCLUDED_C1907273
#include <MitkCoreExports.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include <vtkSmartPointer.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 MITKCORE_EXPORT PointSetVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(PointSetVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(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);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
+ virtual void UpdateVtkTransform(mitk::BaseRenderer* renderer) override;
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/*
* \deprecatedSince{2013_12} Use ReleaseGraphicsResources(mitk::BaseRenderer* renderer) instead
*/
DEPRECATED(void ReleaseGraphicsResources(vtkWindow *renWin));
- void ReleaseGraphicsResources(mitk::BaseRenderer* renderer);
+ void ReleaseGraphicsResources(mitk::BaseRenderer* renderer) override;
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
PointSetVtkMapper3D();
virtual ~PointSetVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
- virtual void ResetMapper( BaseRenderer* renderer );
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
+ virtual void ResetMapper( BaseRenderer* renderer ) override;
virtual void ApplyAllProperties(mitk::BaseRenderer* renderer, vtkActor* actor);
virtual void CreateContour();
virtual void CreateVTKRenderObjects();
vtkSmartPointer<vtkAppendPolyData> m_vtkSelectedPointList;
vtkSmartPointer<vtkAppendPolyData> m_vtkUnselectedPointList;
vtkSmartPointer<vtkPolyDataMapper> m_VtkSelectedPolyDataMapper;
vtkSmartPointer<vtkPolyDataMapper> m_VtkUnselectedPolyDataMapper;
vtkSmartPointer<vtkActor> m_SelectedActor;
vtkSmartPointer<vtkActor> m_UnselectedActor;
vtkSmartPointer<vtkActor> m_ContourActor;
vtkSmartPointer<vtkPropAssembly> m_PointsAssembly;
//help for contour between points
vtkSmartPointer<vtkAppendPolyData> m_vtkTextList;
//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/Modules/Core/include/mitkPositionTracker.h b/Modules/Core/include/mitkPositionTracker.h
index 3d950afba6..d781ec3965 100755
--- a/Modules/Core/include/mitkPositionTracker.h
+++ b/Modules/Core/include/mitkPositionTracker.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPositionTracker_H
#define MITKPositionTracker_H
#include <MitkCoreExports.h>
#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 MITKCORE_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);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
};
} // namespace mitk
#endif /* MITKPositionTracker_H */
diff --git a/Modules/Core/include/mitkPropertyAliases.h b/Modules/Core/include/mitkPropertyAliases.h
index bdb82dba2a..c652f4615f 100644
--- a/Modules/Core/include/mitkPropertyAliases.h
+++ b/Modules/Core/include/mitkPropertyAliases.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyAliases_h
#define mitkPropertyAliases_h
#include <mitkIPropertyAliases.h>
#include <map>
namespace mitk
{
class PropertyAliases : public IPropertyAliases
{
public:
PropertyAliases();
~PropertyAliases();
- bool AddAlias(const std::string& propertyName, const std::string& alias, const std::string& className);
- std::vector<std::string> GetAliases(const std::string& propertyName, const std::string& className);
- std::string GetPropertyName(const std::string& alias, const std::string& className);
- bool HasAliases(const std::string& propertyName, const std::string& className);
- void RemoveAlias(const std::string& propertyName, const std::string& alias, const std::string& className);
- void RemoveAliases(const std::string& propertyName, const std::string& className);
- void RemoveAllAliases(const std::string& className);
+ bool AddAlias(const std::string& propertyName, const std::string& alias, const std::string& className) override;
+ std::vector<std::string> GetAliases(const std::string& propertyName, const std::string& className) override;
+ std::string GetPropertyName(const std::string& alias, const std::string& className) override;
+ bool HasAliases(const std::string& propertyName, const std::string& className) override;
+ void RemoveAlias(const std::string& propertyName, const std::string& alias, const std::string& className) override;
+ void RemoveAliases(const std::string& propertyName, const std::string& className) override;
+ void RemoveAllAliases(const std::string& className) override;
private:
typedef std::map<std::string, std::vector<std::string> > AliasesMap;
typedef AliasesMap::const_iterator AliasesMapConstIterator;
typedef AliasesMap::iterator AliasesMapIterator;
PropertyAliases(const PropertyAliases&);
PropertyAliases& operator=(const PropertyAliases&);
std::map<std::string, AliasesMap> m_Aliases;
};
}
#endif
diff --git a/Modules/Core/include/mitkPropertyDescriptions.h b/Modules/Core/include/mitkPropertyDescriptions.h
index d8b6ca60aa..3747d5e2fe 100644
--- a/Modules/Core/include/mitkPropertyDescriptions.h
+++ b/Modules/Core/include/mitkPropertyDescriptions.h
@@ -1,49 +1,49 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyDescriptions_h
#define mitkPropertyDescriptions_h
#include <mitkIPropertyDescriptions.h>
#include <map>
namespace mitk
{
class PropertyDescriptions : public IPropertyDescriptions
{
public:
PropertyDescriptions();
~PropertyDescriptions();
- bool AddDescription(const std::string& propertyName, const std::string& description, const std::string& className, bool overwrite);
- std::string GetDescription(const std::string& propertyName, const std::string& className);
- bool HasDescription(const std::string& propertyName, const std::string& className);
- void RemoveAllDescriptions(const std::string& className);
- void RemoveDescription(const std::string& propertyName, const std::string& className);
+ bool AddDescription(const std::string& propertyName, const std::string& description, const std::string& className, bool overwrite) override;
+ std::string GetDescription(const std::string& propertyName, const std::string& className) override;
+ bool HasDescription(const std::string& propertyName, const std::string& className) override;
+ void RemoveAllDescriptions(const std::string& className) override;
+ void RemoveDescription(const std::string& propertyName, const std::string& className) override;
private:
typedef std::map<std::string, std::string> DescriptionMap;
typedef DescriptionMap::const_iterator DescriptionMapConstIterator;
typedef DescriptionMap::iterator DescriptionMapIterator;
PropertyDescriptions(const PropertyDescriptions&);
PropertyDescriptions& operator=(const PropertyDescriptions&);
std::map<std::string, DescriptionMap> m_Descriptions;
};
}
#endif
diff --git a/Modules/Core/include/mitkPropertyExtension.h b/Modules/Core/include/mitkPropertyExtension.h
index d32540b018..d46da1e7ab 100644
--- a/Modules/Core/include/mitkPropertyExtension.h
+++ b/Modules/Core/include/mitkPropertyExtension.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyExtension_h
#define mitkPropertyExtension_h
#include <mitkCommon.h>
#include <itkObjectFactory.h>
#include <MitkCoreExports.h>
namespace mitk
{
/** \brief Base class for all property extensions.
*/
class MITKCORE_EXPORT PropertyExtension : public itk::LightObject
{
public:
- mitkClassMacro(PropertyExtension, itk::LightObject);
+ mitkClassMacroItkParent(PropertyExtension, itk::LightObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
PropertyExtension();
virtual ~PropertyExtension();
private:
PropertyExtension(const Self& other);
Self& operator=(const Self& other);
};
}
#endif
diff --git a/Modules/Core/include/mitkPropertyExtensions.h b/Modules/Core/include/mitkPropertyExtensions.h
index b0534eabd6..5ebe1458bd 100644
--- a/Modules/Core/include/mitkPropertyExtensions.h
+++ b/Modules/Core/include/mitkPropertyExtensions.h
@@ -1,49 +1,49 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyExtensions_h
#define mitkPropertyExtensions_h
#include <mitkIPropertyExtensions.h>
#include <map>
namespace mitk
{
class PropertyExtensions : public IPropertyExtensions
{
public:
PropertyExtensions();
~PropertyExtensions();
- bool AddExtension(const std::string& propertyName, PropertyExtension::Pointer extension, const std::string& className, bool overwrite);
- PropertyExtension::Pointer GetExtension(const std::string& propertyName, const std::string& className);
- bool HasExtension(const std::string& propertyName, const std::string& className);
- void RemoveAllExtensions(const std::string& className);
- void RemoveExtension(const std::string& propertyName, const std::string& className);
+ bool AddExtension(const std::string& propertyName, PropertyExtension::Pointer extension, const std::string& className, bool overwrite) override;
+ PropertyExtension::Pointer GetExtension(const std::string& propertyName, const std::string& className) override;
+ bool HasExtension(const std::string& propertyName, const std::string& className) override;
+ void RemoveAllExtensions(const std::string& className) override;
+ void RemoveExtension(const std::string& propertyName, const std::string& className) override;
private:
typedef std::map<std::string, PropertyExtension::Pointer> ExtensionMap;
typedef ExtensionMap::const_iterator ExtensionMapConstIterator;
typedef ExtensionMap::iterator ExtensionMapIterator;
PropertyExtensions(const PropertyExtensions&);
PropertyExtensions& operator=(const PropertyExtensions&);
std::map<std::string, ExtensionMap> m_Extensions;
};
}
#endif
diff --git a/Modules/Core/include/mitkPropertyFilters.h b/Modules/Core/include/mitkPropertyFilters.h
index 914e7a9590..68b26503eb 100644
--- a/Modules/Core/include/mitkPropertyFilters.h
+++ b/Modules/Core/include/mitkPropertyFilters.h
@@ -1,46 +1,46 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyFilters_h
#define mitkPropertyFilters_h
#include <mitkIPropertyFilters.h>
#include <map>
namespace mitk
{
class PropertyFilters : public IPropertyFilters
{
public:
PropertyFilters();
~PropertyFilters();
- bool AddFilter(const PropertyFilter& filter, const std::string& className, bool overwrite);
- std::map<std::string, BaseProperty::Pointer> ApplyFilter(const std::map<std::string, BaseProperty::Pointer>& propertyMap, const std::string& className) const;
- PropertyFilter GetFilter(const std::string& className) const;
- bool HasFilter(const std::string& className) const;
- void RemoveAllFilters();
- void RemoveFilter(const std::string& className);
+ bool AddFilter(const PropertyFilter& filter, const std::string& className, bool overwrite) override;
+ std::map<std::string, BaseProperty::Pointer> ApplyFilter(const std::map<std::string, BaseProperty::Pointer>& propertyMap, const std::string& className) const override;
+ PropertyFilter GetFilter(const std::string& className) const override;
+ bool HasFilter(const std::string& className) const override;
+ void RemoveAllFilters() override;
+ void RemoveFilter(const std::string& className) override;
private:
PropertyFilters(const PropertyFilters&);
PropertyFilters& operator=(const PropertyFilters&);
std::map<std::string, PropertyFilter> m_Filters;
};
}
#endif
diff --git a/Modules/Core/include/mitkPropertyList.h b/Modules/Core/include/mitkPropertyList.h
index e7f4550f1e..3005203bbd 100644
--- a/Modules/Core/include/mitkPropertyList.h
+++ b/Modules/Core/include/mitkPropertyList.h
@@ -1,265 +1,265 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
#define PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "mitkGenericProperty.h"
#include "mitkUIDGenerator.h"
#include <itkObjectFactory.h>
#include <string>
#include <map>
namespace mitk {
class XMLWriter;
/**
* @brief Key-value list holding instances of BaseProperty
*
* This list is meant to hold an arbitrary list of "properties",
* which should describe the object associated with this list.
*
* Usually you will use PropertyList as part of a DataNode
* object - in this context the properties describe the data object
* held by the DataNode (e.g. whether the object is rendered at
* all, which color is used for rendering, what name should be
* displayed for the object, etc.)
*
* The values in the list are not fixed, you may introduce any kind
* of property that seems useful - all you have to do is inherit
* from BaseProperty.
*
* The list is organized as a key-value pairs, i.e.
*
* \li "name" : pointer to a StringProperty
* \li "visible" : pointer to a BoolProperty
* \li "color" : pointer to a ColorProperty
* \li "volume" : pointer to a FloatProperty
*
* Please see the documentation of SetProperty and ReplaceProperty for two
* quite different semantics. Normally SetProperty is what you want - this
* method will try to change the value of an existing property and will
* not allow you to replace e.g. a ColorProperty with an IntProperty.
*
* @ingroup DataManagement
*/
class MITKCORE_EXPORT PropertyList : public itk::Object
{
public:
- mitkClassMacro(PropertyList, itk::Object)
+ mitkClassMacroItkParent(PropertyList, itk::Object)
/**
* Method for creation through the object factory.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(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<T> properties
//## (T being the type of the second parameter)
//## @return @a true property was found
template <typename T>
bool GetPropertyValue(const char* propertyKey, T & value) const
{
GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey));
if ( gp != NULL )
{
value = gp->GetValue();
return true;
}
return false;
}
/**
* @brief Convenience method to access the value of a BoolProperty
*/
bool GetBoolProperty(const char* propertyKey, bool& boolValue) const;
/**
* @brief ShortCut for the above method
*/
bool Get(const char* propertyKey, bool& boolValue) const;
/**
* @brief Convenience method to set the value of a BoolProperty
*/
void SetBoolProperty( const char* propertyKey, bool boolValue);
/**
* @brief ShortCut for the above method
*/
void Set( const char* propertyKey, bool boolValue);
/**
* @brief Convenience method to access the value of an IntProperty
*/
bool GetIntProperty(const char* propertyKey, int &intValue) const;
/**
* @brief ShortCut for the above method
*/
bool Get(const char* propertyKey, int &intValue) const;
/**
* @brief Convenience method to set the value of an IntProperty
*/
void SetIntProperty(const char* propertyKey, int intValue);
/**
* @brief ShortCut for the above method
*/
void Set(const char* propertyKey, int intValue);
/**
* @brief Convenience method to access the value of a FloatProperty
*/
bool GetFloatProperty(const char* propertyKey, float &floatValue) const;
/**
* @brief ShortCut for the above method
*/
bool Get(const char* propertyKey, float &floatValue) const;
/**
* @brief Convenience method to set the value of a FloatProperty
*/
void SetFloatProperty( const char* propertyKey, float floatValue);
/**
* @brief ShortCut for the above method
*/
void Set( const char* propertyKey, float floatValue);
/**
* @brief Convenience method to access the value of a DoubleProperty
*/
bool GetDoubleProperty(const char* propertyKey, double &doubleValue) const;
/**
* @brief ShortCut for the above method
*/
bool Get(const char* propertyKey, double &doubleValue) const;
/**
* @brief Convenience method to set the value of a DoubleProperty
*/
void SetDoubleProperty( const char* propertyKey, double doubleValue);
/**
* @brief ShortCut for the above method
*/
void Set( const char* propertyKey, double doubleValue);
/**
* @brief Convenience method to access the value of a StringProperty
*/
bool GetStringProperty(const char* propertyKey, std::string& stringValue) const;
/**
* @brief ShortCut for the above method
*/
bool Get(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 ShortCut for the above method
*/
void Set( const char* propertyKey, const char* stringValue);
/**
* @brief ShortCut for the above method
*/
void Set( const char* propertyKey, const std::string& 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;
+ virtual unsigned long GetMTime() const override;
/**
* @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 void Clear();
protected:
PropertyList();
PropertyList(const PropertyList& other);
virtual ~PropertyList();
/**
* @brief Map of properties.
*/
PropertyMap m_Properties;
private:
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
} // namespace mitk
#endif /* PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D */
diff --git a/Modules/Core/include/mitkProportionalTimeGeometry.h b/Modules/Core/include/mitkProportionalTimeGeometry.h
index 8403ca8a1a..2837a4f385 100644
--- a/Modules/Core/include/mitkProportionalTimeGeometry.h
+++ b/Modules/Core/include/mitkProportionalTimeGeometry.h
@@ -1,227 +1,227 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ProportionalTimeGeometry_h
#define ProportionalTimeGeometry_h
//MITK
#include <mitkTimeGeometry.h>
#include <mitkGeometry3D.h>
#include <mitkCommon.h>
#include <MitkCoreExports.h>
namespace mitk {
/**
* \brief Organizes geometries over proportional time steps
*
* For this TimeGeometry implementation it is assumed that
* the durations of the time steps are equidistant, e.g.
* the durations of the time steps in one ProportionalTimeGeometry
* are the same. The geometries of the time steps are independent,
* and not linked to each other. Since the timeBounds of the
* geometries are different for each time step it is not possible
* to set the same geometry to different time steps. Instead
* copies should be used.
*
* \addtogroup geometry
*/
class MITKCORE_EXPORT ProportionalTimeGeometry : public TimeGeometry
{
public:
mitkClassMacro(ProportionalTimeGeometry, TimeGeometry);
ProportionalTimeGeometry();
typedef ProportionalTimeGeometry self;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Returns the number of time steps.
*
* Returns the number of time steps for which
* geometries are saved. The number of time steps
* is also the upper bound of the time steps. The
* minimum time steps is always 0.
*/
- virtual TimeStepType CountTimeSteps() const;
+ virtual TimeStepType CountTimeSteps() const override;
/**
* \brief Returns the first time point for which the object is valid.
*
* Returns the first valid time point for this geometry. If only one
* time steps available it usually goes from -max to +max. The time point
* is given in ms.
*/
- virtual TimePointType GetMinimumTimePoint () const;
+ virtual TimePointType GetMinimumTimePoint () const override;
/**
* \brief Returns the last time point for which the object is valid
*
* Gives the last time point for which a valid geometrie is saved in
* this time geometry. The time point is given in ms.
*/
- virtual TimePointType GetMaximumTimePoint () const;
+ virtual TimePointType GetMaximumTimePoint () const override;
/**
* \brief Returns the first time point for which the object is valid.
*
* Returns the first valid time point for the given TimeStep. The time point
* is given in ms.
*/
- virtual TimePointType GetMinimumTimePoint(TimeStepType step) const;
+ virtual TimePointType GetMinimumTimePoint(TimeStepType step) const override;
/**
* \brief Returns the last time point for which the object is valid
*
* Gives the last time point for the Geometry specified by the given TimeStep. The time point is given in ms.
*/
- virtual TimePointType GetMaximumTimePoint(TimeStepType step) const;
+ virtual TimePointType GetMaximumTimePoint(TimeStepType step) const override;
/**
* \brief Get the time bounds (in ms)
*/
- virtual TimeBounds GetTimeBounds( ) const;
+ virtual TimeBounds GetTimeBounds( ) const override;
/**
* \brief Get the time bounds for the given TimeStep (in ms)
*/
- virtual TimeBounds GetTimeBounds(TimeStepType step) const;
+ virtual TimeBounds GetTimeBounds(TimeStepType step) const override;
/**
* \brief Tests if a given time point is covered by this object
*
* Returns true if a geometry can be returned for the given time
* point and falls if not. The time point must be given in ms.
*/
- virtual bool IsValidTimePoint (TimePointType timePoint) const;
+ virtual bool IsValidTimePoint (TimePointType timePoint) const override;
/**
* \brief Test for the given time step if a geometry is availible
*
* Returns true if a geometry is defined for the given time step.
* Otherwise false is returned.
* The time step is defined as positiv number.
*/
- virtual bool IsValidTimeStep (TimeStepType timeStep) const;
+ virtual bool IsValidTimeStep (TimeStepType timeStep) const override;
/**
* \brief Converts a time step to a time point
*
* Converts a time step to a time point in a way that
* the new time point indicates the same geometry as the time step.
* If the original time steps does not point to a valid geometry,
* a time point is calculated that also does not point to a valid
* geometry, but no exception is raised.
*/
- virtual TimePointType TimeStepToTimePoint (TimeStepType timeStep) const;
+ virtual TimePointType TimeStepToTimePoint (TimeStepType timeStep) const override;
/**
* \brief Converts a time point to the corresponding time step
*
* Converts a time point to a time step in a way that
* the new time step indicates the same geometry as the time point.
* If a negativ invalid time point is given always time step 0 is
* returned. If an positiv invalid time step is given an invalid
* time step will be returned.
*/
- virtual TimeStepType TimePointToTimeStep (TimePointType timePoint) const;
+ virtual TimeStepType TimePointToTimeStep (TimePointType timePoint) const override;
/**
* \brief Returns the geometry which corresponds to the given time step
*
* Returns a clone of the geometry which defines the given time step. If
* the given time step is invalid an null-pointer is returned.
*/
- virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep( TimeStepType timeStep) const;
+ virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep( TimeStepType timeStep) const override;
/**
* \brief Returns the geometry which corresponds to the given time point
*
* Returns the geometry which defines the given time point. If
* the given time point is invalid an null-pointer is returned.
*
* If the returned geometry is changed this will affect the saved
* geometry.
*/
- virtual BaseGeometry::Pointer GetGeometryForTimePoint ( TimePointType timePoint) const;
+ virtual BaseGeometry::Pointer GetGeometryForTimePoint ( TimePointType timePoint) const override;
/**
* \brief Returns the geometry which corresponds to the given time step
*
* Returns the geometry which defines the given time step. If
* the given time step is invalid an null-pointer is returned.
*
* If the returned geometry is changed this will affect the saved
* geometry.
*/
- virtual BaseGeometry::Pointer GetGeometryForTimeStep ( TimeStepType timeStep) const;
+ virtual BaseGeometry::Pointer GetGeometryForTimeStep ( TimeStepType timeStep) const override;
/**
* \brief Tests if all necessary informations are set and the object is valid
*/
- virtual bool IsValid () const;
+ virtual bool IsValid () const override;
/**
* \brief Initilizes a new object with one time steps which contains an empty geometry.
*/
- virtual void Initialize();
+ virtual void Initialize() override;
/**
* \brief Expands the time geometry to the given number of time steps.
*
* Initializes the new time steps with empty geometries if no timesteps
* in the geometry so far. Otherwise fills the new times steps with
* clones of the first time step.
* Shrinking is not supported.
*/
- virtual void Expand(TimeStepType size);
+ virtual void Expand(TimeStepType size) override;
/**
* \brief Sets the geometry for the given time step
*
* This method does not afflict other time steps, since the geometry for
* each time step is saved individually.
*/
- virtual void SetTimeStepGeometry(BaseGeometry* geometry, TimeStepType timeStep);
+ virtual void SetTimeStepGeometry(BaseGeometry* geometry, TimeStepType timeStep) override;
/**
* \brief Makes a deep copy of the current object
*/
- virtual itk::LightObject::Pointer InternalClone () const;
+ virtual itk::LightObject::Pointer InternalClone () const override;
itkGetConstMacro(FirstTimePoint, TimePointType);
itkSetMacro(FirstTimePoint, TimePointType);
itkGetConstMacro(StepDuration, TimePointType);
itkSetMacro(StepDuration, TimePointType);
// void SetGeometryForTimeStep(TimeStepType timeStep, BaseGeometry& geometry);
void ClearAllGeometries ();
// void AddGeometry(BaseGeometry geometry);
void ReserveSpaceForGeometries (TimeStepType numberOfGeometries);
/**
* \brief Initializes the TimeGeometry with equally time Step geometries
*
* Saves a copy for each time step.
*/
void Initialize (BaseGeometry* geometry, TimeStepType timeSteps);
/**
* \brief Initialize the TimeGeometry with empty BaseGeometry
*/
void Initialize (TimeStepType timeSteps);
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
protected:
virtual ~ProportionalTimeGeometry();
std::vector<BaseGeometry::Pointer> m_GeometryVector;
TimePointType m_FirstTimePoint;
TimePointType m_StepDuration;
}; // end class ProportialTimeGeometry
} // end namespace MITK
#endif // ProportionalTimeGeometry_h
diff --git a/Modules/Core/include/mitkRGBToRGBACastImageFilter.h b/Modules/Core/include/mitkRGBToRGBACastImageFilter.h
index dae8043fe4..962671b9dc 100644
--- a/Modules/Core/include/mitkRGBToRGBACastImageFilter.h
+++ b/Modules/Core/include/mitkRGBToRGBACastImageFilter.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRGBTORGBACASTIMAGEFILTER_H_HEADER_INCLUDED
#define MITKRGBTORGBACASTIMAGEFILTER_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkImageToImageFilter.h"
#include "mitkImageTimeSelector.h"
#include <itkRGBPixel.h>
namespace itk {
template <class TPixel, unsigned int VImageDimension> class ITK_EXPORT Image;
}
namespace mitk {
//##Documentation
//## @brief
//## @ingroup Process
class MITKCORE_EXPORT RGBToRGBACastImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(RGBToRGBACastImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
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/Modules/Core/include/mitkReferenceCountWatcher.h b/Modules/Core/include/mitkReferenceCountWatcher.h
index 168263397a..52daa6dc38 100644
--- a/Modules/Core/include/mitkReferenceCountWatcher.h
+++ b/Modules/Core/include/mitkReferenceCountWatcher.h
@@ -1,108 +1,108 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "itkCommand.h"
#include <MitkCoreExports.h>
#include <mitkCommon.h>
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<ReferenceCountWatcher> CommandType;
- mitkClassMacro(ReferenceCountWatcher, itk::Object);
+ mitkClassMacroItkParent(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
+ int GetReferenceCount() const override
{
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/Modules/Core/include/mitkRenderWindow.h b/Modules/Core/include/mitkRenderWindow.h
index 9c81e99a37..95fac6537e 100644
--- a/Modules/Core/include/mitkRenderWindow.h
+++ b/Modules/Core/include/mitkRenderWindow.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF
#define MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF
#include <MitkCoreExports.h>
#include "mitkRenderWindowBase.h"
namespace mitk
{
class vtkEventProvider;
/**
* \brief mitkRenderWindow integrates the MITK rendering mechanism into VTK and
* is NOT QT dependent
*
*
* \ingroup Renderer
*/
class MITKCORE_EXPORT RenderWindow: public mitk::RenderWindowBase, public itk::Object
{
public:
- mitkClassMacro(RenderWindow, itk::Object);
+ mitkClassMacroItkParent(RenderWindow, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(Self, vtkRenderWindow*);
mitkNewMacro2Param(Self, vtkRenderWindow*, const char*);
mitkNewMacro3Param(Self, vtkRenderWindow*, const char*, mitk::RenderingManager*);
mitkNewMacro4Param(Self, vtkRenderWindow*, const char*, mitk::RenderingManager*, mitk::BaseRenderer::RenderingMode::Type);
virtual ~RenderWindow();
- virtual vtkRenderWindow* GetVtkRenderWindow();
- virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor();
+ virtual vtkRenderWindow* GetVtkRenderWindow() override;
+ virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() override;
// 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 );
/**
* \brief Convenience method to set the size of an mitkRenderWindow.
*
* This method sets the size of the vtkRenderWindow and tells the
* rendering that the size has changed -> adapts displayGeometry, etc.
*/
void SetSize( int width, int height );
/**
* \brief Initializes the mitkVtkEventProvider to listen to the
* currently used vtkInteractorStyle.
*
* This method makes sure that the internal mitkVtkEventProvider
* listens to the correct vtkInteractorStyle.
* This makes sure that VTK-Events are correctly translated into
* MITK-Events.
*
* \warn This method needs to be called MANUALLY as soon as the MapperID
* for this RenderWindow is changed or the vtkInteractorStyle is modified
* somehow else!
*/
void ReinitEventProvider();
protected:
RenderWindow(vtkRenderWindow * existingRenderWindow = NULL , const char* name = "unnamed renderer", mitk::RenderingManager* rm = NULL, mitk::BaseRenderer::RenderingMode::Type rmtype = mitk::BaseRenderer::RenderingMode::Standard );
void ResetView();
vtkRenderWindow * m_vtkRenderWindow;
vtkRenderWindowInteractor * m_vtkRenderWindowInteractor;
vtkEventProvider * m_vtkMitkEventProvider;
private:
};
} //namespace
#endif /* MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF */
\ No newline at end of file
diff --git a/Modules/Core/include/mitkRenderWindowBase.h b/Modules/Core/include/mitkRenderWindowBase.h
index 6f55dc1c1d..335b9c2171 100644
--- a/Modules/Core/include/mitkRenderWindowBase.h
+++ b/Modules/Core/include/mitkRenderWindowBase.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF
#define MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF
#include <MitkCoreExports.h>
#include "mitkVtkPropRenderer.h"
#include "vtkMitkRenderProp.h"
#include "mitkSliceNavigationController.h"
#include "mitkCameraRotationController.h"
#include "mitkInteractionEvent.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 MITKCORE_EXPORT RenderWindowBase
{
public:
- //mitkClassMacro(RenderWindowBase,itk::Object);
+ //mitkClassMacroItkParent(RenderWindowBase,itk::Object);
//itkFactorylessNewMacro(Self)
//itkCloneMacro(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;
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
DEPRECATED(virtual void mousePressMitkEvent(mitk::MouseEvent *me));
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
DEPRECATED(virtual void mouseReleaseMitkEvent(mitk::MouseEvent *me));
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
DEPRECATED(virtual void mouseMoveMitkEvent(mitk::MouseEvent *me));
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
DEPRECATED(virtual void wheelMitkEvent(mitk::WheelEvent *we));
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
DEPRECATED(virtual void keyPressMitkEvent(mitk::KeyEvent* mke));
/** \deprecatedSince{2013_03} Use InteractionEvent instead and pass them to HandleEvent() */
virtual void resizeMitkEvent(int width, int height);
virtual bool HandleEvent(InteractionEvent* interactionEvent);
protected:
RenderWindowBase();
// helper functions: within constructors and destructors classes are not polymorph.
void Initialize( mitk::RenderingManager* renderingManager = NULL, const char* name = "unnamed renderer",mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard );
void Destroy();
mitk::VtkPropRenderer::Pointer m_Renderer;
vtkMitkRenderProp* m_RenderProp;
bool m_InResize;
private:
};
}
#endif /* MITKRENDERWINDOWBASE_H_HEADER_INCLUDED_C1C40D66ASDF */
diff --git a/Modules/Core/include/mitkRenderWindowFrame.h b/Modules/Core/include/mitkRenderWindowFrame.h
index 43bbe3d8f3..c284e622a1 100644
--- a/Modules/Core/include/mitkRenderWindowFrame.h
+++ b/Modules/Core/include/mitkRenderWindowFrame.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkRenderWindowFrame_h
#define mitkRenderWindowFrame_h
#include <vtkSmartPointer.h>
#include <itkObject.h>
#include <MitkCoreExports.h>
#include <mitkCommon.h>
class vtkRenderer;
class vtkRenderWindow;
namespace mitk {
/**
* This is a simple class for rendering colored rectangles
* at the boarders of vtkRenderWindows.
* The rectangle rendering itself is performed by means of a
* vtkProp (vtkMitkRectangleProp).
* This class instantiates the vtkProp and a corresponding vtkRenderer instance.
*/
class MITKCORE_EXPORT RenderWindowFrame : public itk::Object
{
public:
- mitkClassMacro( RenderWindowFrame, itk::Object );
+ mitkClassMacroItkParent( RenderWindowFrame, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Sets the renderwindow, in which colored rectangle boarders will be shown.
* Make sure, you have called this function
* before calling Enable()
*/
virtual void SetRenderWindow( vtkSmartPointer<vtkRenderWindow> renderWindow );
/**
* Enables drawing of the colored rectangle.
* If you want to disable it, call the Disable() function.
*/
virtual void Enable(float col1, float col2, float col3);
/**
* Disables drawing of the colored rectangle.
* If you want to enable it, call the Enable() function.
*/
virtual void Disable();
/**
* Checks, if the text is currently
* enabled (visible)
*/
virtual bool IsEnabled();
/**
* Returns the vtkRenderWindow, which is used
* for displaying the text
*/
virtual vtkSmartPointer<vtkRenderWindow> GetRenderWindow();
/**
* Returns the renderer responsible for
* rendering the text into the
* vtkRenderWindow
*/
virtual vtkSmartPointer<vtkRenderer> GetVtkRenderer();
protected:
/**
* Constructor
*/
RenderWindowFrame();
/**
* Destructor
*/
~RenderWindowFrame();
vtkSmartPointer<vtkRenderWindow> m_RenderWindow;
vtkSmartPointer<vtkRenderer> m_RectangleRenderer;
bool m_IsEnabled;
};
} //end of namespace mitk
#endif //mitkRenderWindowFrame_h
diff --git a/Modules/Core/include/mitkRenderingManager.h b/Modules/Core/include/mitkRenderingManager.h
index 7a38d168d6..3401100344 100644
--- a/Modules/Core/include/mitkRenderingManager.h
+++ b/Modules/Core/include/mitkRenderingManager.h
@@ -1,407 +1,407 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#define MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#include <MitkCoreExports.h>
#include <vtkCallbackCommand.h>
#include <string>
#include <itkObject.h>
#include <itkObjectFactory.h>
#include "mitkPropertyList.h"
#include "mitkProperties.h"
#include "mitkTimeGeometry.h"
class vtkRenderWindow;
class vtkObject;
namespace mitk
{
class RenderingManager;
class RenderingManagerFactory;
class BaseGeometry;
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
* <em>request</em> 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 MITKCORE_EXPORT RenderingManager : public itk::Object
{
public:
- mitkClassMacro(RenderingManager,itk::Object);
+ mitkClassMacroItkParent(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. TODO: HOW IS THIS PLATFORM SPECIFIC? */
virtual bool InitializeViews( const BaseGeometry *geometry,
RequestType type = REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace = false );
virtual bool InitializeViews( const TimeGeometry *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 TimeGeometry. 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 TimeGeometry. PLATFORM SPECIFIC. */
virtual bool InitializeView( vtkRenderWindow *renderWindow, const BaseGeometry *geometry, bool initializeGlobalTimeSNC = false);
virtual bool InitializeView( vtkRenderWindow *renderWindow, const TimeGeometry *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 );
/**
* @brief Initializes the renderwindows by the aggregated geometry of
* all objects that are held in the data storage.
* This is basically a global reinit
* @param The data storage from which the bounding object can be retrieved
*/
virtual void InitializeViewsByBoundingObjects(const DataStorage * );
/** 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 );
/** 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;
/** 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<vtkRenderWindow*, RenderWindowCallbacks> RenderWindowCallbacksList;
RenderWindowCallbacksList m_RenderWindowCallbacksList;
itk::SmartPointer<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::TimeGeometry *geometry,
bool boundingBoxInitialized, int mapperID );
};
#pragma GCC visibility push(default)
itkEventMacro( RenderingManagerEvent, itk::AnyEvent );
itkEventMacro( RenderingManagerViewsInitializedEvent, RenderingManagerEvent );
#pragma GCC visibility pop
/**
* 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 MITKCORE_EXPORT TestingRenderingManager : public RenderingManager
{
public:
mitkClassMacro(TestingRenderingManager,RenderingManager);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
- virtual void GenerateRenderingRequestEvent()
+ virtual void GenerateRenderingRequestEvent() override
{
// ForceImmediateUpdateAll();
};
};
} // namespace mitk
#endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */
diff --git a/Modules/Core/include/mitkRenderingManagerFactory.h b/Modules/Core/include/mitkRenderingManagerFactory.h
index 6a25c063a6..87c41f10f9 100644
--- a/Modules/Core/include/mitkRenderingManagerFactory.h
+++ b/Modules/Core/include/mitkRenderingManagerFactory.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197
#define MITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197
#include "mitkRenderingManager.h"
namespace mitk
{
/**
* \brief Factory interface for facilitating the usage of a platform-specific
* mitk::RenderingManager instance.
*
* This class provides an interface for creating the required singleton
* instance of RenderingManager. Concrete platform-specific subclasses should
* be instantiated once during startup of the framework (e.g. as a static
* instance). Their constructor then merely has to call
* mitk::RenderingManager::SetFactory().
*
* \note Instead of using an external class for the manager
* instantiation, the factory mechanism could be integrated into the
* RenderingManager (and its subclasses) itself. However, this would make
* the framework specific instantiation more complicated. Simply creating a
* static instance somewhere would not work since RenderingManager derives from
* itk::Object, which itself depends on the initialization of static members
* (which is problematic since the order of static member initializations
* cannot easily be controlled).
* \ingroup Renderer
*/
class MITKCORE_EXPORT RenderingManagerFactory
{
public:
virtual ~RenderingManagerFactory() {};
/** \brief Factory method to create platform specific instances of
* RenderingManager. */
virtual RenderingManager::Pointer CreateRenderingManager() const = 0;
protected:
RenderingManagerFactory()
{
};
private:
};
/**
* Factory for the TestingRenderingManager
*/
class MITKCORE_EXPORT TestingRenderingManagerFactory : public RenderingManagerFactory
{
public:
TestingRenderingManagerFactory()
{
if ( !mitk::RenderingManager::HasFactory() )
{
mitk::RenderingManager::SetFactory( this );
}
};
virtual ~TestingRenderingManagerFactory() {};
- virtual mitk::RenderingManager::Pointer CreateRenderingManager() const
+ virtual mitk::RenderingManager::Pointer CreateRenderingManager() const override
{
TestingRenderingManager::Pointer specificSmartPtr = TestingRenderingManager::New();
RenderingManager::Pointer smartPtr = specificSmartPtr.GetPointer();
return smartPtr;
};
};
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkRenderingModeProperty.h b/Modules/Core/include/mitkRenderingModeProperty.h
index 146787cfca..141bafbff3 100644
--- a/Modules/Core/include/mitkRenderingModeProperty.h
+++ b/Modules/Core/include/mitkRenderingModeProperty.h
@@ -1,165 +1,165 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_RENDERING_MODE_PROPERTY__H_
#define _MITK_RENDERING_MODE_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration for rendering modes. The property human-readable name (which is
* used in the mitkWorkbench inside the Property View) is "Image Rendering.Mode". This property
* affects rendering of images and is used inside the mitkImageVtkMapper2D to define which
* rendering mode is applied to images.
* Valid values are:
*
* \li LEVELWINDOW_COLOR is DEPRECATED and mapped to LOOKUPTABLE_LEVELWINDOW_COLOR.
* \li LOOKUPTABLE_LEVELWINDOW_COLOR: A lookup table, level window and color will be applied to the image.
* As lookup table, the table object supplied by the property "LookupTable" will be used. As default,
* we apply a GRAYSCALE mitk::LookupTable. Note, if you want to use a former rainbow-like lookup table,
* set the mitk::LookupTableProperty to use a LEGACY_RAINBOW_COLOR type mitk::LookupTable.
* Our default setup using the GRAYSCALE mitk::LookupTable for a test image looks like this:
* \image html ExampleLevelWindowColor.png
* This image can be reproduced with the mitkImageVtkMapper2DColorTest or mitkImageVtkMapper2DLevelWindowTest.
* If "Image Rendering.Mode" is set to LOOKUPTABLE_LEVELWINDOW_COLOR inside the mitkWorkbench, the level window
* slider will change the rendering of the image. That means it will change the values of an internally used
* default lookup table. Note, the level window slider changes the property "levelwindow" which modifies the range
* of the internally used lookup table.
* This mode will apply the "color" property. The default color is white. If you change the "color"
* property to yellow, the test image will be rendered like this:
* \image html ExampleColorYellow.png
* This image can be reproduced with the mitkImageVtkMapper2DColorTest.
* Our test image with a lookup table mapping everything from red to blue looks like this:
* \image html ExampleLookupTable.png
* This image can be reproduced with the mitkImageVtkMapper2DLookupTableTest. Check this test code for an example how
* to apply a lookup table to an image.
* \note Changing a lookup table via the "levelwindow" property can be unintuitive and unwanted since the
* level window slider will overwrite the range of the lookup table. Use LOOKUPTABLE_COLOR if you
* don't want your lookuptable to be influenced by the "levelwindow" property.
*
* \li COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR: A color transfer function, level window and color will be applied to the image.
* Very similar mode to LOOKUPTABLE_LEVELWINDOW_COLOR. Instead of the lookup table a color transfer function will be used.
* Color transfer functions are useful to colorize floating point images and allow sometimes more flexibility than
* a lookup table. The "Image Rendering.Transfer Function" property defines the transfer function. Our test image
* with a transfer function mapping everything from to red, green and blue looks like this:
* \image html ExampleTransferFunction.png
* This image can be reproduced with the mitkImageVtkMapper2DTransferFunctionTest. Check the test code for
* an example how to define a transfer function for an image. This transfer function
* will be influenced by the property "levelwindow" and the actor will be colored by the
* "color" property.
* \note Changing a transfer function table via the "levelwindow" property can be unintuitive and unwanted since
* the level window slider will overwrite the.Use COLORTRANSFERFUNCTION_COLOR if you don't want your transfer
* function to be influenced by the level window.
*
* \li LOOKUPTABLE_COLOR: A lookup table and color will be applied to the image.
* Similar mode to LOOKUPTABLE_LEVELWINDOW_COLOR, except that the "levelwindow" property will not
* modify the range of the lookup table.
*
* \li COLORTRANSFERFUNCTION_COLOR: A color trans ferfunction and color will be applied to the image.
* Similar mode to COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR, except that the "levelwindow" property will not
* modify the range of the transfer function.
*
* The order is given by the names (e.g. LOOKUPTABLE_COLOR applies first a lookup table and next a color).
* Currently, there is no GUI (in mitkWorkbench) support for controlling lookup tables or transfer functions.
* This has to be done by the programmer. Color and level window are controlled by color widget and level window slider.
* Currently, the color is always applied. We do not set the color to white, if the user changes the mode. We assume
* that users who change the mode know that a previously set color will still be applied (on top of the respective mode).
* See VTK documentation for examples how to use vtkTransferfunction and vtkLookupTable.
*/
class MITKCORE_EXPORT RenderingModeProperty : public EnumerationProperty
{
public:
mitkClassMacro( RenderingModeProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(RenderingModeProperty, const IdType&);
mitkNewMacro1Param(RenderingModeProperty, const std::string&);
//Never (!) change this without adaptation of mitkLevelWindowManagerTest::VerifyRenderingModes and mitkLevelWindowManagerTest::TestLevelWindowSliderVisibility !
enum ImageRenderingMode
{
//0 used to be LEVELWINDOW_COLOR which is deprecated now and will be mapped to LOOKUPTABLE_LEVELWINDOW_COLOR.
//Our default lookup table property is the GRAYSCALE type which represents the
//former LEVELWINDOW_COLOR mode.
LOOKUPTABLE_LEVELWINDOW_COLOR = 1,
COLORTRANSFERFUNCTION_LEVELWINDOW_COLOR = 2,
LOOKUPTABLE_COLOR = 3,
COLORTRANSFERFUNCTION_COLOR = 4
// Default = LOOKUPTABLE_LEVELWINDOW_COLOR;
};
/**
* Returns the current rendering mode
*/
virtual int GetRenderingMode();
using BaseProperty::operator=;
protected:
/** Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION).
*/
RenderingModeProperty( );
/**
* Constructor. Sets rendering type to the given value.
*/
RenderingModeProperty( const IdType& value );
/**
* Constructor. Sets rendering type to the given value.
*/
RenderingModeProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid rendering types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the default enumeration types.
*/
virtual void AddRenderingModes();
private:
// purposely not implemented
RenderingModeProperty& operator=(const RenderingModeProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkResliceMethodProperty.h b/Modules/Core/include/mitkResliceMethodProperty.h
index 92d066b57a..862a8bc58f 100644
--- a/Modules/Core/include/mitkResliceMethodProperty.h
+++ b/Modules/Core/include/mitkResliceMethodProperty.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __MITKRESLICEMETHODENUMPROPERTY_H
#define __MITKRESLICEMETHODENUMPROPERTY_H
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the thick slices method enumeration
*/
class MITKCORE_EXPORT ResliceMethodProperty : public EnumerationProperty
{
public:
mitkClassMacro( ResliceMethodProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ResliceMethodProperty, const IdType&);
mitkNewMacro1Param(ResliceMethodProperty, const std::string&);
using BaseProperty::operator=;
protected:
ResliceMethodProperty( );
ResliceMethodProperty( const IdType& value );
ResliceMethodProperty( const std::string& value );
void AddThickSlicesTypes();
private:
// purposely not implemented
ResliceMethodProperty& operator=(const ResliceMethodProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Modules/Core/include/mitkShaderProperty.h b/Modules/Core/include/mitkShaderProperty.h
index bba7b1d2c0..1fe5486e81 100644
--- a/Modules/Core/include/mitkShaderProperty.h
+++ b/Modules/Core/include/mitkShaderProperty.h
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __MITKSHADERENUMPROPERTY_H
#define __MITKSHADERENUMPROPERTY_H
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the shader enumeration
*/
class MITKCORE_EXPORT ShaderProperty : public EnumerationProperty
{
public:
class Element {
public:
std::string name;
};
mitkClassMacro( ShaderProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ShaderProperty, const IdType&);
mitkNewMacro1Param(ShaderProperty, const std::string&);
/**
* Returns the current scalar mode value as defined by VTK constants.
* @returns the current scalar mode as VTK constant.
*/
IdType GetShaderId();
std::string GetShaderName();
void SetShader(const IdType& i);
void SetShader(const std::string& i);
using BaseProperty::operator=;
protected:
std::list<Element> shaderList;
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
ShaderProperty( );
ShaderProperty(const ShaderProperty& other);
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the scalar mode is set to default (0).
* @param value the integer representation of the scalar mode
*/
ShaderProperty( const IdType& value );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the representation is set to default (0).
* @param value the string representation of the scalar mode
*/
ShaderProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid scalar mode types.
*/
- bool AddEnum( const std::string& name, const IdType& id = 0);
+ bool AddEnum( const std::string& name, const IdType& id = 0) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
void AddShaderTypes();
private:
// purposely not implemented
ShaderProperty& operator=(const ShaderProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
- virtual bool Assign(const BaseProperty &property);
+ virtual bool Assign(const BaseProperty &property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Modules/Core/include/mitkSinglePointDataInteractor.h b/Modules/Core/include/mitkSinglePointDataInteractor.h
index 646ad8e2e8..3e6531579d 100644
--- a/Modules/Core/include/mitkSinglePointDataInteractor.h
+++ b/Modules/Core/include/mitkSinglePointDataInteractor.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSinglePointDataInteractor_h_
#define mitkSinglePointDataInteractor_h_
#include "itkObject.h"
#include "itkSmartPointer.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include "mitkPointSetDataInteractor.h"
#include <mitkPointSet.h>
namespace mitk
{
/**
* Class SinglePointDataInteractor
* \brief Implementation of the single point interaction
*
* Interactor operates on a single point set, when a data node is set, its containing point set is clear for initialization.
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKCORE_EXPORT SinglePointDataInteractor: public PointSetDataInteractor
{
public:
mitkClassMacro(SinglePointDataInteractor, PointSetDataInteractor)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
SinglePointDataInteractor();
virtual ~SinglePointDataInteractor();
/** Adds a point at the given coordinates.
* This function overwrites the behavior of PointSetDataInteractor such that instead of adding new points
* the first points position is updated. All other interaction (move,delete) is still handled by PointSetDataInteractor.
*/
- virtual bool AddPoint(StateMachineAction*, InteractionEvent* event);
+ virtual bool AddPoint(StateMachineAction*, InteractionEvent* event) override;
/**
* @brief SetMaxPoints Sets the maximal number of points for the pointset
* Overwritten, per design this class will always have a maximal number of one.
* @param maxNumber
*/
virtual void SetMaxPoints(unsigned int /*maxNumber*/ = 0)
{}
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
};
}
#endif
diff --git a/Modules/Core/include/mitkSliceNavigationController.h b/Modules/Core/include/mitkSliceNavigationController.h
index 3a8e9a846d..3ebc515cdf 100644
--- a/Modules/Core/include/mitkSliceNavigationController.h
+++ b/Modules/Core/include/mitkSliceNavigationController.h
@@ -1,598 +1,598 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F
#define SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F
#include <MitkCoreExports.h>
#include "mitkBaseController.h"
#include "mitkRenderingManager.h"
#include "mitkTimeGeometry.h"
#include "mitkMessage.h"
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
#include <itkCommand.h>
#include <sstream>
#include "mitkRestorePlanePositionOperation.h"
#include "mitkDataStorage.h"
//DEPRECATED
#include <mitkTimeSlicedGeometry.h>
namespace mitk {
#define mitkTimeSlicedGeometryEventMacro( classname , super ) \
class MITKCORE_EXPORT DEPRECATED(classname) : public super { \
public: \
typedef classname Self; \
typedef super Superclass; \
classname(TimeGeometry* aTimeGeometry, unsigned int aPos) \
: Superclass(aTimeGeometry, aPos) {} \
virtual ~classname() {} \
virtual const char * GetEventName() const { return #classname; } \
virtual bool CheckEvent(const ::itk::EventObject* e) const \
{ return dynamic_cast<const Self*>(e); } \
virtual ::itk::EventObject* MakeObject() const \
{ return new Self(GetTimeGeometry(), GetPos()); } \
private: \
void operator=(const Self&); \
}
#define mitkTimeGeometryEventMacro( classname , super ) \
class MITKCORE_EXPORT classname : public super { \
public: \
typedef classname Self; \
typedef super Superclass; \
classname(TimeGeometry* aTimeGeometry, unsigned int aPos) \
: Superclass(aTimeGeometry, aPos) {} \
virtual ~classname() {} \
virtual const char * GetEventName() const { return #classname; } \
virtual bool CheckEvent(const ::itk::EventObject* e) const \
{ return dynamic_cast<const Self*>(e); } \
virtual ::itk::EventObject* MakeObject() const \
{ return new Self(GetTimeGeometry(), GetPos()); } \
private: \
void operator=(const Self&); \
}
class PlaneGeometry;
class BaseGeometry;
class BaseRenderer;
/**
* \brief Controls the selection of the slice the associated BaseRenderer
* will display
*
* A SliceNavigationController takes a BaseGeometry or a TimeGeometry as input world geometry
* (TODO what are the exact requirements?) and generates a TimeGeometry
* as output. The TimeGeometry holds a number of SlicedGeometry3Ds and
* these in turn hold a series of PlaneGeometries. One of these PlaneGeometries 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
* PlaneGeometry from the TimeGeometry. 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
* // BaseGeometry::ConstPointer)
* sliceCtrl->SetInputWorldGeometry(geometry.GetPointer());
*
* // Tell the navigator in which direction it shall slice the data
* sliceCtrl->SetViewDirection(mitk::SliceNavigationController::Axial);
*
* // 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 MITKCORE_EXPORT SliceNavigationController : public BaseController
{
public:
mitkClassMacro(SliceNavigationController,BaseController);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(Self, const char *);
/**
* \brief Possible view directions, \a Original will uses
* the PlaneGeometry instances in a SlicedGeometry3D provided
* as input world geometry (by SetInputWorldGeometry).
*/
enum ViewDirection
{
Axial,
Sagittal,
Frontal,
Original
};
/**
* \brief Set the input world geometry3D out of which the
* geometries for slicing will be created.
*
* Any previous previous set input geometry (3D or Time) will
* be ignored in future.
*/
void SetInputWorldGeometry3D(const mitk::BaseGeometry* geometry);
itkGetConstObjectMacro(InputWorldGeometry3D, mitk::BaseGeometry);
/**
* \brief Set the input world geometry3D out of which the
* geometries for slicing will be created.
*
* Any previous previous set input geometry (3D or Time) will
* be ignored in future.
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(void SetInputWorldGeometry(const mitk::TimeSlicedGeometry* geometry));
/**
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(TimeSlicedGeometry* GetInputWorldGeometry());
void SetInputWorldTimeGeometry(const mitk::TimeGeometry* geometry);
itkGetConstObjectMacro(InputWorldTimeGeometry, mitk::TimeGeometry);
/**
* \brief Access the created geometry
*/
itkGetConstObjectMacro(CreatedWorldGeometry, mitk::TimeGeometry);
/**
* \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);
const char* GetViewDirectionAsString();
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;
#pragma GCC visibility push(default)
itkEventMacro( UpdateEvent, itk::AnyEvent );
#pragma GCC visibility pop
class MITKCORE_EXPORT TimeGeometryEvent : public itk::AnyEvent
{
public:
typedef TimeGeometryEvent Self;
typedef itk::AnyEvent Superclass;
TimeGeometryEvent(
TimeGeometry* aTimeGeometry, unsigned int aPos)
: m_TimeGeometry(aTimeGeometry), m_Pos(aPos)
{}
virtual ~TimeGeometryEvent()
{}
- virtual const char * GetEventName() const
+ virtual const char * GetEventName() const override
{ return "TimeGeometryEvent"; }
- virtual bool CheckEvent(const ::itk::EventObject* e) const
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{ return dynamic_cast<const Self*>(e); }
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{ return new Self(m_TimeGeometry, m_Pos); }
TimeGeometry* GetTimeGeometry() const
{ return m_TimeGeometry; }
unsigned int GetPos() const
{ return m_Pos; }
private:
TimeGeometry::Pointer m_TimeGeometry;
unsigned int m_Pos;
// TimeGeometryEvent(const Self&);
void operator=(const Self&); //just hide
};
/**
* \deprecatedSince{2013_09} Please use TimeGeometryEvent instead: For additional information see http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(typedef TimeGeometryEvent TimeSlicedGeometryEvent);
mitkTimeGeometryEventMacro(
GeometrySendEvent,TimeGeometryEvent );
mitkTimeGeometryEventMacro(
GeometryUpdateEvent, TimeGeometryEvent );
mitkTimeGeometryEventMacro(
GeometryTimeEvent, TimeGeometryEvent );
mitkTimeGeometryEventMacro(
GeometrySliceEvent, TimeGeometryEvent );
template <typename T>
void ConnectGeometrySendEvent(T* receiver)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry);
unsigned long tag = AddObserver(GeometrySendEvent(NULL,0), eventReceptorCommand);
m_ReceiverToObserverTagsMap[static_cast<void*>(receiver)].push_back(tag);
}
template <typename T>
void ConnectGeometryUpdateEvent(T* receiver)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry);
unsigned long tag = AddObserver(GeometryUpdateEvent(NULL,0), eventReceptorCommand);
m_ReceiverToObserverTagsMap[static_cast<void*>(receiver)].push_back(tag);
}
template <typename T>
void ConnectGeometrySliceEvent(T* receiver, bool connectSendEvent=true)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice);
unsigned long tag = AddObserver(GeometrySliceEvent(NULL,0), eventReceptorCommand);
m_ReceiverToObserverTagsMap[static_cast<void*>(receiver)].push_back(tag);
if(connectSendEvent)
ConnectGeometrySendEvent(receiver);
}
template <typename T>
void ConnectGeometryTimeEvent(T* receiver, bool connectSendEvent=true)
{
typedef typename itk::ReceptorMemberCommand<T>::Pointer
ReceptorMemberCommandPointer;
ReceptorMemberCommandPointer eventReceptorCommand =
itk::ReceptorMemberCommand<T>::New();
eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime);
unsigned long tag = AddObserver(GeometryTimeEvent(NULL,0), eventReceptorCommand);
m_ReceiverToObserverTagsMap[static_cast<void*>(receiver)].push_back(tag);
if(connectSendEvent)
ConnectGeometrySendEvent(receiver);
}
template <typename T>
void ConnectGeometryEvents(T* receiver)
{
//connect sendEvent only once
ConnectGeometrySliceEvent(receiver, false);
ConnectGeometryTimeEvent(receiver);
}
// use a templated method to get the right offset when casting to void*
template <typename T>
void Disconnect(T* receiver)
{
ObserverTagsMapType::iterator i = m_ReceiverToObserverTagsMap.find(static_cast<void*>(receiver));
if (i == m_ReceiverToObserverTagsMap.end()) return;
const std::list<unsigned long>& tags = i->second;
for (std::list<unsigned long>::const_iterator tagIter = tags.begin();
tagIter != tags.end(); ++tagIter)
{
RemoveObserver(*tagIter);
}
m_ReceiverToObserverTagsMap.erase(i);
}
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 TimeGeometry created by the SNC. */
mitk::TimeGeometry *GetCreatedWorldGeometry();
/** \brief Returns the BaseGeometry of the currently selected time step. */
const mitk::BaseGeometry *GetCurrentGeometry3D();
/** \brief Returns the currently selected Plane in the current
* BaseGeometry (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. All slices will be oriented to the given normal vector.
The given point (world coordinates) defines the selected slice.
Careful: The resulting axis vectors are not clearly defined this way. If you want to define them clearly, use
ReorientSlices (const mitk::Point3D &point, const mitk::Vector3D &axisVec0, const mitk::Vector3D &axisVec1).
*/
void ReorientSlices(
const mitk::Point3D &point, const mitk::Vector3D &normal );
/** \brief Re-orients the slice stack so that all planes are oriented according to the
* given axis vectors. The given Point eventually defines selected slice.
*/
void ReorientSlices(
const mitk::Point3D &point, const mitk::Vector3D &axisVec0, const mitk::Vector3D &axisVec1 );
virtual bool ExecuteAction(
- Action* action, mitk::StateEvent const* stateEvent);
+ Action* action, mitk::StateEvent const* stateEvent) override;
- void ExecuteOperation(Operation* operation);
+ void ExecuteOperation(Operation* operation) override;
/**
* \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();
mitk::DataNode::Pointer GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes,mitk::Point3D worldposition);
/*
template <class T>
static void buildstring( mitkIpPicDescriptor *pic, itk::Point<int, 3> p, std::string &s, T = 0)
{
std::string value;
std::stringstream stream;
stream.imbue(std::locale::classic());
stream<<s<<"; Pixelvalue: ";
if ( (p[0]>=0 && p[1] >=0 && p[2]>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] )
{
if(pic->bpe!=24)
{
stream<<(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]);
}
else
{
stream<<(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
stream<<(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
stream<<(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]);
}
s = stream.str();
}
else
{
s+= "point out of data";
}
};
*/
mitk::BaseGeometry::ConstPointer m_InputWorldGeometry3D;
mitk::TimeGeometry::ConstPointer m_InputWorldTimeGeometry;
mitk::TimeGeometry::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;
typedef std::map<void*, std::list<unsigned long> > ObserverTagsMapType;
ObserverTagsMapType m_ReceiverToObserverTagsMap;
};
} // namespace mitk
#endif /* SLICENAVIGATIONCONTROLLER_H_HEADER_INCLUDED_C1C55A2F */
diff --git a/Modules/Core/include/mitkSlicedData.h b/Modules/Core/include/mitkSlicedData.h
index 6a1e6312ea..4f4b27bd8c 100644
--- a/Modules/Core/include/mitkSlicedData.h
+++ b/Modules/Core/include/mitkSlicedData.h
@@ -1,229 +1,229 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SLICEDDATA_H_HEADER_INCLUDED
#define SLICEDDATA_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkBaseData.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 BaseGeometry containing PlaneGeometry
//## objects).
//##
//## SlicedData-objects have geometries of type SlicedGeometry3D or sub-classes.
//## @ingroup Data
class MITKCORE_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<RegionDimension> RegionType;
/** Index typedef support. An index is used to access pixel values. */
typedef itk::Index<RegionDimension> IndexType;
typedef IndexType::IndexValueType IndexValueType;
/** Offset typedef support. An offset represent relative position
* between indices. */
typedef itk::Offset<RegionDimension> OffsetType;
typedef OffsetType::OffsetValueType OffsetValueType;
/** Size typedef support. A size is used to define region bounds. */
typedef itk::Size<RegionDimension> 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 UpdateOutputInformation() override;
- virtual void PrepareForNewData();
+ virtual void PrepareForNewData() override;
//##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();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
//##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();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
//##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();
+ virtual bool VerifyRequestedRegion() override;
//##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( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
//##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);
/*! Documentation
\brief Sets the largest possible region.
The largest possible region is the entire region occupied by the data object.
Note that the largest possible region should always be bigger then the requested region
of a certain operation.*/
void SetLargestPossibleRegion(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);
+ virtual void CopyInformation(const itk::DataObject *data) override;
//##Documentation
//## @brief Get the number of channels
unsigned int GetNumberOfChannels() const
{
return m_LargestPossibleRegion.GetSize(4);
}
////##Documentation
////## @brief Return the PlaneGeometry of the slice (@a s, @a t).
////##
////## The method does not simply call GetGeometry()->GetPlaneGeometry(). Before doing this, it
////## makes sure that the PlaneGeometry is up-to-date before returning it (by
////## setting the update extent appropriately and calling
////## UpdateOutputInformation).
////##
////## @warning GetPlaneGeometry not yet completely implemented.
////## @todo Appropriate setting of the update extent is missing.
//virtual const mitk::PlaneGeometry* GetPlaneGeometry(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 BaseGeometry 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 BaseGeometry 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(BaseGeometry* aGeometry3D);
+ virtual void SetGeometry(BaseGeometry* aGeometry3D) override;
//##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);
+ virtual void SetOrigin(const Point3D& origin) override;
//##Documentation
//## @brief Convenience method for setting the spacing of
//## the SlicedGeometry3D instances of all time steps
virtual void SetSpacing(const ScalarType aSpacing[]);
//##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;
mutable RegionType m_RequestedRegion;
mutable bool m_RequestedRegionInitialized;
RegionType m_BufferedRegion;
bool m_UseLargestPossibleRegion;
};
} // namespace mitk
#endif /* SLICEDDATA_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkSlicedGeometry3D.h b/Modules/Core/include/mitkSlicedGeometry3D.h
index 690cdd88d9..571eb84f10 100644
--- a/Modules/Core/include/mitkSlicedGeometry3D.h
+++ b/Modules/Core/include/mitkSlicedGeometry3D.h
@@ -1,321 +1,321 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkBaseGeometry.h"
#include "mitkPlaneGeometry.h"
namespace mitk {
class SliceNavigationController;
class NavigationController;
/** \brief Describes the geometry of a data object consisting of slices.
*
* A PlaneGeometry can be requested for each slice. In the case of
* \em evenly-spaced, \em plane geometries (m_EvenlySpaced==true),
* only the 2D-geometry of the first slice has to be set (to an instance of
* PlaneGeometry). The 2D geometries of the other slices are calculated
* by shifting the first slice in the direction m_DirectionVector by
* m_Spacing.z * sliceNumber. The m_Spacing member (which is only
* relevant in the case m_EvenlySpaced==true) descibes the size of a voxel
* (in mm), i.e., m_Spacing.x is the voxel width in the x-direction of the
* plane. It is derived from the reference geometry of this SlicedGeometry3D,
* which usually would be the global geometry describing how datasets are to
* be resliced.
*
* By default, slices are oriented in the direction of one of the main axes
* (x, y, z). However, by means of rotation, it is possible to realign the
* slices in any possible direction. In case of an inclined plane, the spacing
* is derived as a product of the (regular) geometry spacing and the direction
* vector of the plane.
*
* SlicedGeometry3D and the associated PlaneGeometries have to be initialized in
* the method GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing pic
* tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \a itk::DataObject::UpdateOutputInformation().
*
* Rule: everything is in mm (or ms for temporal information) if not
* stated otherwise.
*
* \warning The hull (i.e., transform, bounding-box and
* time-bounds) is only guaranteed to be up-to-date after calling
* UpdateInformation().
*
* \ingroup Geometry
*/
class MITKCORE_EXPORT SlicedGeometry3D : public mitk::BaseGeometry
{
public:
mitkClassMacro(SlicedGeometry3D, BaseGeometry)
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Returns the PlaneGeometry of the slice (\a s).
*
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing[3]*s
* in the direction of m_DirectionVector.
*
* \warning The PlaneGeometries are not necessarily up-to-date and not even
* initialized.
*
* The PlaneGeometries have to be initialized in the method
* GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing
* pic tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \sa itk::DataObject::UpdateOutputInformation().
*/
virtual mitk::PlaneGeometry* GetPlaneGeometry(int s) const;
/**
* \deprecatedSince{2014_10} Please use GetPlaneGeometry
*/
DEPRECATED(const PlaneGeometry* GetGeometry2D(int s)){ return GetPlaneGeometry(s); }
/**
* \deprecatedSince{2014_10} Please use SetPlaneGeometry
*/
DEPRECATED(void SetGeometry2D(PlaneGeometry* geo, int s)){ SetPlaneGeometry(geo, s); }
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to change the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and changes the origin respectively.
- virtual void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry);
+ virtual void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override;
//virtual void SetTimeBounds( const mitk::TimeBounds& timebounds );
- virtual const mitk::BoundingBox* GetBoundingBox() const;
+ virtual const mitk::BoundingBox* GetBoundingBox() const override;
/**
* \brief Get the number of slices
*/
itkGetConstMacro(Slices, unsigned int)
/**
* \brief Set PlaneGeometry of slice \a s.
*/
virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s);
/**
* \brief Check whether a slice exists
*/
virtual bool IsValidSlice(int s = 0) const;
virtual void SetReferenceGeometry(BaseGeometry *referenceGeometry);
/**
* \brief Set the SliceNavigationController corresponding to this sliced
* geometry.
*
* The SNC needs to be informed when the number of slices in the geometry
* changes, which can occur whenthe slices are re-oriented by rotation.
*/
virtual void SetSliceNavigationController(
mitk::SliceNavigationController *snc);
mitk::SliceNavigationController *GetSliceNavigationController();
/**
* \brief Set/Get whether the SlicedGeometry3D is evenly-spaced
* (m_EvenlySpaced)
*
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored for
* the requested slice, and (c) the first slice (s=0) is a PlaneGeometry
* instance, then we calculate the geometry of the requested as the plane
* of the first slice shifted by m_Spacing.z * s in the direction of
* m_DirectionVector.
*
* \sa GetPlaneGeometry
*/
itkGetConstMacro(EvenlySpaced, bool)
virtual void SetEvenlySpaced(bool on = true);
/**
* \brief Set/Get the vector between slices for the evenly-spaced case
* (m_EvenlySpaced==true).
*
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*
* \sa m_DirectionVector
*/
virtual void SetDirectionVector(const mitk::Vector3D& directionVector);
itkGetConstMacro(DirectionVector, const mitk::Vector3D&)
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
static const std::string SLICES;
const static std::string DIRECTION_VECTOR;
const static std::string EVENLY_SPACED;
/**
* \brief Tell this instance how many PlaneGeometries it shall manage. Bounding
* box and the PlaneGeometries must be set additionally by calling the respective
* methods!
*
* \warning Bounding box and the 2D-geometries must be set additionally: use
* SetBounds(), SetGeometry().
*/
virtual void InitializeSlicedGeometry(unsigned int slices);
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided PlaneGeometry that is used as the first slice and
* for spacing calculation.
*
* Initializes the bounding box according to the width/height of the
* PlaneGeometry and \a slices. The spacing is calculated from the PlaneGeometry.
*/
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
unsigned int slices, bool flipped = false);
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided PlaneGeometry that is used as the first slice and
* for spacing calculation (except z-spacing).
*
* Initializes the bounding box according to the width/height of the
* PlaneGeometry and \a slices. The x-/y-spacing is calculated from the
* PlaneGeometry.
*/
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
mitk::ScalarType zSpacing, unsigned int slices, bool flipped = false);
/**
* \brief Completely initialize this instance as evenly-spaced plane slices
* parallel to a side of the provided BaseGeometry and using its spacing
* information.
*
* Initializes the bounding box according to the width/height of the
* BaseGeometry and the number of slices according to
* BaseGeometry::GetExtent(2).
*
* \param planeorientation side parallel to which the slices will be oriented
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Axial, for other plane locations respectively)
* \param frontside defines the side of the plane (the definition of
* front/back is somewhat arbitrary)
*
* \param rotate rotates the plane by 180 degree around its normal (the
* definition of rotated vs not rotated is somewhat arbitrary)
*/
virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D,
mitk::PlaneGeometry::PlaneOrientation planeorientation, bool top = true,
bool frontside = true, bool rotated = false);
- virtual void SetImageGeometry(const bool isAnImageGeometry);
+ virtual void SetImageGeometry(const bool isAnImageGeometry) override;
- virtual void ExecuteOperation(Operation* operation);
+ virtual void ExecuteOperation(Operation* operation) override;
static double CalculateSpacing(const mitk::Vector3D spacing, const mitk::Vector3D &d);
protected:
SlicedGeometry3D();
SlicedGeometry3D(const SlicedGeometry3D& other);
virtual ~SlicedGeometry3D();
/**
* Reinitialize plane stack after rotation. More precisely, the first plane
* of the stack needs to spatially aligned, in two respects:
*
* 1. Re-alignment with respect to the dataset center; this is necessary
* since the distance from the first plane to the center could otherwise
* continuously decrease or increase.
* 2. Re-alignment with respect to a given reference point; the reference
* point is a location which the user wants to be exactly touched by one
* plane of the plane stack. The first plane is minimally shifted to
* ensure this touching. Usually, the reference point would be the
* point around which the geometry is rotated.
*/
virtual void ReinitializePlanes(const Point3D &center,
const Point3D &referencePoint);
ScalarType GetLargestExtent(const BaseGeometry *geometry);
- void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ void PrintSelf(std::ostream& os, itk::Indent indent) const override;
/** Calculate "directed spacing", i.e. the spacing in directions
* non-orthogonal to the coordinate axes. This is done via the
* ellipsoid equation.
*/
double CalculateSpacing(const mitk::Vector3D &direction) const;
/** The extent of the slice stack, i.e. the number of slices, depends on the
* plane normal. For rotated geometries, the geometry's transform needs to
* be accounted in this calculation.
*/
mitk::Vector3D AdjustNormal(const mitk::Vector3D &normal) const;
/**
* Container for the 2D-geometries contained within this SliceGeometry3D.
*/
mutable std::vector<PlaneGeometry::Pointer> m_PlaneGeometries;
/**
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing.z*s
* in the direction of m_DirectionVector.
*
* \sa GetPlaneGeometry
*/
bool m_EvenlySpaced;
/**
* Vector between slices for the evenly-spaced case (m_EvenlySpaced==true).
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*/
mutable mitk::Vector3D m_DirectionVector;
/** Number of slices this SliceGeometry3D is descibing. */
unsigned int m_Slices;
/** Underlying BaseGeometry for this SlicedGeometry */
mitk::BaseGeometry *m_ReferenceGeometry;
/** SNC correcsponding to this geometry; used to reflect changes in the
* number of slices due to rotation. */
//mitk::NavigationController *m_NavigationController;
mitk::SliceNavigationController *m_SliceNavigationController;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing);
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override;
};
} // namespace mitk
#endif /* MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Modules/Core/include/mitkSlicesCoordinator.h b/Modules/Core/include/mitkSlicesCoordinator.h
index 30f63bf137..c71431a053 100644
--- a/Modules/Core/include/mitkSlicesCoordinator.h
+++ b/Modules/Core/include/mitkSlicesCoordinator.h
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SLICESCOORDINATOR_H_HEADER_INCLUDED_C1C55A2F
#define SLICESCOORDINATOR_H_HEADER_INCLUDED_C1C55A2F
#include <mitkStateMachine.h>
#include <vector>
namespace mitk {
class SliceNavigationController;
class Action;
class StateEvent;
#pragma GCC visibility push(default)
itkEventMacro( SliceRotationEvent, itk::AnyEvent);
#pragma GCC visibility pop
/**
* \brief Coordinates a list of SliceNavigationControllers.
*
* Each SliceNavigationController can select one slice from a
* TimeGeometry. This class (SlicesCoordinator) coordinates several
* SliceNavigationControllers to facilitate e.g. rotation of slices. A new
* class is needed, because for rotation one has to know an axis of rotation.
* Such an axis is most easily determined from the "other slices", which are
* not known by a SliceNavigationController.
* This class registers itself as a listener to GlobalInteraction and holds a
* list of SliceNavigationControllers. Any functionality, such as slice
* rotation, is done in subclasses. This separation is done for the case that
* some other multi-slice coordination should be implemented.
*/
class MITKCORE_EXPORT SlicesCoordinator : public StateMachine
{
public:
typedef std::vector<SliceNavigationController*> SNCVector;
mitkClassMacro(SlicesCoordinator, StateMachine);
mitkNewMacro1Param(Self, const char*);
/** Add to list of managed slices. Check if CreatedWorldGeometry of SNC is
* managable (i.e. there is basically only one planegeometry) */
void AddSliceController(SliceNavigationController* snc);
/** Remove one controller, which is then added as listener to
* GlobalInteraction */
void RemoveSliceController(SliceNavigationController* snc);
/* Reset all Slices to central slice, no rotation */
// void ResetAllSlices();
/** Set/Get whether planes should stay linked to each other (by fixing
* their relative angle) */
itkSetMacro( LinkPlanes, bool );
itkGetMacro( LinkPlanes, bool );
itkBooleanMacro( LinkPlanes );
/** \brief Resets the mouse cursor (if modified by the SlicesCoordinator)
* to its original state.
*
* Should be used by subclasses and from external application instead
* of using QmitkApplicationCursor directly to avoid conflicts. */
void ResetMouseCursor();
protected:
/** \brief Default Constructor */
SlicesCoordinator(const char* machine);
/** clear list of controllers */
virtual ~SlicesCoordinator();
/** \brief Sets the specified mouse cursor.
*
* Use this in subclasses instead of using QmitkApplicationCursor directly.
*/
void SetMouseCursor( const char *xpm[], int hotspotX, int hotspotY );
/** for implementation in subclasses */
virtual void OnSliceControllerAdded(SliceNavigationController* snc);
/** for implementation in subclasses */
virtual void OnSliceControllerRemoved(SliceNavigationController* snc);
/** for implementation in subclasses */
- virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent);
+ virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent) override;
SNCVector m_SliceNavigationControllers;
bool m_LinkPlanes;
bool m_MouseCursorSet;
};
} // namespace
#endif
diff --git a/Modules/Core/include/mitkSlicesRotator.h b/Modules/Core/include/mitkSlicesRotator.h
index 158de73680..0f51c6de2c 100644
--- a/Modules/Core/include/mitkSlicesRotator.h
+++ b/Modules/Core/include/mitkSlicesRotator.h
@@ -1,165 +1,165 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SLICESROTATOR_H_HEADER_INCLUDED_C1C55A2F
#define SLICESROTATOR_H_HEADER_INCLUDED_C1C55A2F
#include <mitkSlicesCoordinator.h>
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
#include <mitkNumericTypes.h>
namespace mitk {
/**
\brief Coordinates rotation of multiple visible rendering planes (represented as lines in other render windows).
\ingroup NavigationControl
This class takes care of several SliceNavigationControllers and handles slice selection
/ slice rotation. It is added as listener to GlobalInteraction by QmitkStdMultiWidget.
The SlicesRotator class adds the possibility of slice rotation to the "normal" behaviour
of SliceNavigationControllers (which is picking one plane from a stack of planes).
This additional class SlicesRotator is needed, because one has to be aware of multiple
"visible slices" (selected PlaneGeometries of some SliceNavigationControllers) in order to
choose between rotation and slice selection. Such functionality could not be implemented
by a single SliceNavigationController.
Rotation is achieved by modifying (rotating) the generated TimeGeometry of the
corresponding SliceNavigationControllers.
\section mitkSlicesRotator_StandardCase The standard case: three orthogonal views (MPR)
With SlicesRotator, the rule to choose between slice rotation and selection is simple:
For a mouse down event, count the number of visible planes, which are "near" the cursor.
If this number is 2 (one for the window, which currently holds the cursor, one for the
intersection line of another visible slice), then initiate rotation, else select slices
near the cursor. If the "LinkPlanes" flag is set, the rotation is applied to the planes
of all registered SNCs, not only of the one associated with the directly selected plane.
In contrast to the situation without the SlicesRotator, the SliceNavigationControllers
are now NOT directly registered as listeners to GlobalInteraction. SlicesRotator is
registered as a listener and decides whether something should be rotated or whether
another slice should be selected. In the latter case, a PositionEvent is just forwarded
to the SliceNavigationController.
\section mitkSlicesRotator_GeneralizedCase The generalized case: any number of views
Above section as well as the original implementation of this class assumes that we have
exactly three 2D vies in our scene. This used to be the standard setup of the MITK
associated application for a long time. With custom applications based on MITK it is
easy to create different situations. One usual use case would be to have one extra
render window display the contents of any of the other ones and behave exactly like it
(could e.g. be used on a second screen).
In this situation the above assumption "we rotate when there are exactly 2 slices close
to the cursor" will not hold: since we always have two render windows displaying the
exact same slice, the number of 2 is the minimum we get. Whenever the user clicks in one
of those windows and the cursor is close to one of the orthogonal planes, we will get a
count of 3 or more planes that are "close to the cursor".
For the class to behave correctly, we actually need to distinguish three separate cases:
1. the cursor is not close to any orthogonal planes. This should result in slice selection.
2. the cursor is close to just one orthogonal plane OR multiple which are not distinguishable visually. This should result in rotation.
3. the cursor is close to multiple orthogonal planes which are rendered as distinguishable lines on the render window. This is the case when we hit the crosshair-center of the view. In this case, we need to also just select slices.
\section mitkSlicesRotator_Solution Deciding between slice selection and rotation
The "counting nearby lines in the renderwindow" can also work for the general case
described above. Only one details needs to be accounted for: we must not count a line
when it is identical to another line. I.e. we just count how many visible lines on the
screen are very close to the cursor. When this number is 1, we rotate, otherwise we let
the SliceNavigationControllers do their slice selection job.
\sa SlicesSwiveller
*/
class MITKCORE_EXPORT SlicesRotator : public SlicesCoordinator
{
public:
mitkClassMacro(SlicesRotator, SlicesCoordinator);
static Pointer New();
/**
\brief New Macro with one parameter for creating this object with static New(..) method.
Needs to be the "slices-rotator" pattern of StateMachine.xml to work as expected.
**/
mitkNewMacro1Param(Self, const char*);
/**
\brief Callback for modifications in observed SliceNavigationControllers -- forwards to UpdateRotatableSNCs().
This method is called when an observed SliceNavigationController changes its
world geometry. The connection is established by calling the other SliceNavigationController's
method ConnectGeometrySendEvent (or similar).
*/
virtual void SetGeometry(const itk::EventObject& EventObject);
/**
\brief NOT USED by anything open-source. Deprecated. Highly obfuscated code. Use SliceNavigationController::ReorientSlices() instead!
#Deprecated
*/
virtual void RotateToPoint( SliceNavigationController *rotationPlaneSNC,
SliceNavigationController *rotatedPlaneSNC,
const Point3D &point,
bool linked = false );
protected:
SlicesRotator(const char* machine);
virtual ~SlicesRotator();
/**
\brief Called from SlicesCoordinator after a new controller is added (to internal list m_SliceNavigationControllers).
*/
- virtual void OnSliceControllerAdded(SliceNavigationController* snc);
+ virtual void OnSliceControllerAdded(SliceNavigationController* snc) override;
/*
\brief Called from SlicesCoordinator after a new controller is being removed (to internal list m_SliceNavigationControllers).
*/
- virtual void OnSliceControllerRemoved(SliceNavigationController* snc);
+ virtual void OnSliceControllerRemoved(SliceNavigationController* snc) override;
/**
\brief Check all observed SliceNavigationControllers: remember those that are rotatable in m_RotatableSNCs.
*/
virtual void UpdateRotatableSNCs();
// following methods called from superclass ExecuteAction
bool DoSelectSlice(Action*, const StateEvent*);
bool DoDecideBetweenRotationAndSliceSelection(Action*, const StateEvent*);
bool DoStartRotation(Action*, const StateEvent*);
bool DoEndRotation(Action*, const StateEvent*);
bool DoRotationStep(Action*, const StateEvent*);
SNCVector m_RotatableSNCs; /// all SNCs that currently have CreatedWorldGeometries, that can be rotated.
SNCVector m_SNCsToBeRotated; /// all SNCs that will be rotated (exceptions are the ones parallel to the one being clicked)
Point3D m_LastCursorPosition; /// used for calculation of the rotation angle
Point3D m_CenterOfRotation; /// used for calculation of the rotation angle
};
} // namespace
#endif
diff --git a/Modules/Core/include/mitkSlicesSwiveller.h b/Modules/Core/include/mitkSlicesSwiveller.h
index bb6d829e28..99e34cc282 100644
--- a/Modules/Core/include/mitkSlicesSwiveller.h
+++ b/Modules/Core/include/mitkSlicesSwiveller.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SLICESSWIVELLER_H_HEADER_INCLUDED
#define SLICESSWIVELLER_H_HEADER_INCLUDED
#include <mitkSlicesCoordinator.h>
#include <mitkNumericTypes.h>
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
namespace mitk {
/**
* \brief Enables arbitrary rotation of visible slices around a swivel point
* (for sliced geometries).
* \ingroup NavigationControl
*
* This class takes care of several SliceNavigationControllers and handles
* slice selection / slice rotation. It is added as listener to
* GlobalInteraction by QmitkStdMultiWidget.
*
* The SlicesSwiveller class adds the possibility of slice rotation to the
* "normal" behaviour of SliceNavigationControllers. This additional class
* is needed, because one has to be aware of several "visible slices"
* (selected PlaneGeometries of some SliceNavigationControllers) in order to
* choose between rotation and slice selection.
*
* Rotation is achieved by modifying (rotating) the generated
* TimeGeometry of the corresponding SliceNavigationController.
*
* With SlicesSwiveller, slice rotation works as follows: the user clicks onto
* a 2D view (2D plane) and drags the mouse; the relative direction and angle
* of the dragged mouse movement directly effects the rotation axis and
* angle. If "LinkPlanes" is set to true, the rotation is applied to the
* planes of all registered SNCs, not only of the one associated with the
* plane clicked on.
*
* In contrast to the situation without the SlicesRotator, the
* SliceNavigationControllers are now not directly registered as listeners to
* GlobalInteraction. SlicesRotator is registered as a listener and decides
* whether something should be rotated or whether another slice should be
* selected. In the latter case, a PositionEvent is just forwarded to the
* SliceNavigationController.
*
* \sa SlicesRotator
*/
class MITKCORE_EXPORT SlicesSwiveller : public SlicesCoordinator
{
public:
mitkClassMacro(SlicesSwiveller, SlicesCoordinator);
static Pointer New();
/**
* @brief New Macro with one parameter for creating this object with static New(..) method
**/
mitkNewMacro1Param(Self, const char*);
virtual void SetGeometry(const itk::EventObject& EventObject);
protected:
SlicesSwiveller(const char* machine);
// clear list of controllers
virtual ~SlicesSwiveller();
// check if the slices of this SliceNavigationController can be rotated (???) Possible
- virtual void OnSliceControllerAdded(SliceNavigationController* snc);
+ virtual void OnSliceControllerAdded(SliceNavigationController* snc) override;
- virtual void OnSliceControllerRemoved(SliceNavigationController* snc);
+ virtual void OnSliceControllerRemoved(SliceNavigationController* snc) override;
virtual void UpdateRelevantSNCs();
- virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent);
+ virtual bool ExecuteAction(Action * action, StateEvent const* stateEvent) override;
/** All SNCs that currently have CreatedWorldGeometries, that can be rotated */
SNCVector m_RelevantSNCs;
/** SNCs that will be rotated (clicked plane + all relevant others, if linked) */
SNCVector m_SNCsToBeRotated;
Point3D m_LastCursorPosition;
Point3D m_CenterOfRotation;
Point2D m_ReferenceCursor;
Vector3D m_RotationPlaneNormal;
Vector3D m_RotationPlaneXVector;
Vector3D m_RotationPlaneYVector;
Vector3D m_PreviousRotationAxis;
ScalarType m_PreviousRotationAngle;
};
} // namespace
#endif
diff --git a/Modules/Core/include/mitkSmartPointerProperty.h b/Modules/Core/include/mitkSmartPointerProperty.h
index 5f78c59b79..22227efb1f 100644
--- a/Modules/Core/include/mitkSmartPointerProperty.h
+++ b/Modules/Core/include/mitkSmartPointerProperty.h
@@ -1,108 +1,108 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#define MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "mitkUIDGenerator.h"
#include<map>
#include<list>
#include<string>
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
//##Documentation
//## @brief Property containing a smart-pointer
//## @ingroup DataManagement
class MITKCORE_EXPORT SmartPointerProperty : public BaseProperty
{
public:
mitkClassMacro(SmartPointerProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(SmartPointerProperty, itk::Object*);
typedef itk::Object::Pointer ValueType;
itk::Object::Pointer GetSmartPointer() const;
ValueType GetValue() const;
void SetSmartPointer(itk::Object*);
void SetValue(const ValueType&);
/// mainly for XML output
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
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);
using BaseProperty::operator=;
protected:
SmartPointerProperty(itk::Object* = NULL);
SmartPointerProperty(const SmartPointerProperty&);
itk::Object::Pointer m_SmartPointer;
private:
// purposely not implemented
SmartPointerProperty& operator=(const SmartPointerProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty&) const;
- virtual bool Assign(const BaseProperty&);
+ virtual bool IsEqual(const BaseProperty&) const override;
+ virtual bool Assign(const BaseProperty&) override;
typedef std::map<itk::Object*, unsigned int> ReferenceCountMapType;
typedef std::map<itk::Object*, std::string> ReferencesUIDMapType;
typedef std::map<SmartPointerProperty*, std::string> ReadInSmartPointersMapType;
typedef std::map<std::string, itk::Object*> 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;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKSMARTPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */
diff --git a/Modules/Core/include/mitkStandaloneDataStorage.h b/Modules/Core/include/mitkStandaloneDataStorage.h
index 8e4d373abe..a4603c0227 100644
--- a/Modules/Core/include/mitkStandaloneDataStorage.h
+++ b/Modules/Core/include/mitkStandaloneDataStorage.h
@@ -1,132 +1,132 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_
#define MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_
#include "mitkDataStorage.h"
#include "mitkMessage.h"
#include "itkVectorContainer.h"
#include <map>
namespace mitk {
class NodePredicateBase;
class DataNode;
//##Documentation
//## @brief Data management class that handles 'was created by' relations
//##
//## The StandaloneDataStorage 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 were used to create the new object was created from.
//## Thus, nodes are stored in a noncyclical directed graph data structure.
//## It is derived from mitk::DataStorage and implements its interface,
//## including AddNodeEvent and RemoveNodeEvent.
//## @ingroup StandaloneDataStorage
class MITKCORE_EXPORT StandaloneDataStorage : public mitk::DataStorage
{
public:
mitkClassMacro(StandaloneDataStorage, mitk::DataStorage);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//##Documentation
//## @brief Adds a DataNode containing a data object to its internal storage
//##
//## This Method adds a new data object to the StandaloneDataStorage. 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.
- void Add(mitk::DataNode* node, const mitk::DataStorage::SetOfObjects* parents = NULL);
+ void Add(mitk::DataNode* node, const mitk::DataStorage::SetOfObjects* parents = NULL) override;
//##Documentation
//## @brief Removes node from the StandaloneDataStorage
//##
- void Remove(const mitk::DataNode* node);
+ void Remove(const mitk::DataNode* node) override;
//##Documentation
//## @brief Checks if a node exists in the StandaloneDataStorage
//##
- virtual bool Exists(const mitk::DataNode* node) const;
+ virtual bool Exists(const mitk::DataNode* node) const override;
//##Documentation
//## @brief returns a set of source objects for a given node that meet the given condition(s).
//##
- SetOfObjects::ConstPointer GetSources(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectSources = true) const;
+ SetOfObjects::ConstPointer GetSources(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectSources = true) const override;
//##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.
- SetOfObjects::ConstPointer GetDerivations(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectDerivations = true) const;
+ SetOfObjects::ConstPointer GetDerivations(const mitk::DataNode* node, const NodePredicateBase* condition = NULL, bool onlyDirectDerivations = true) const override;
//##Documentation
//## @brief returns a set of all data objects that are stored in the data storage
//##
- SetOfObjects::ConstPointer GetAll() const;
+ SetOfObjects::ConstPointer GetAll() const override;
/*ITK Mutex */
mutable itk::SimpleFastMutexLock m_Mutex;
protected:
//##Documentation
//## @brief noncyclical directed graph data structure to store the nodes with their relation
typedef std::map<mitk::DataNode::ConstPointer, SetOfObjects::ConstPointer> AdjacencyList;
//##Documentation
//## @brief Standard Constructor for ::New() instantiation
StandaloneDataStorage();
//##Documentation
//## @brief Standard Destructor
virtual ~StandaloneDataStorage();
//##Documentation
//## @brief convenience method to check if the object has been initialized (i.e. a data tree has been set)
bool IsInitialized() const;
//##Documentation
//## @brief Traverses the Relation graph and extracts a list of related elements (e.g. Sources or Derivations)
SetOfObjects::ConstPointer GetRelations(const mitk::DataNode* node, const AdjacencyList& relation, const NodePredicateBase* condition = NULL, bool onlyDirectlyRelated = true) const;
//##Documentation
//## @brief deletes all references to a node in a given relation (used in Remove() and TreeListener)
void RemoveFromRelation(const mitk::DataNode* node, AdjacencyList& relation);
//##Documentation
//## @brief Prints the contents of the StandaloneDataStorage to os. Do not call directly, call ->Print() instead
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
//##Documentation
//## @brief Nodes and their relation are stored in m_SourceNodes
AdjacencyList m_SourceNodes;
//##Documentation
//## @brief Nodes are stored in reverse relation for easier traversal in the opposite direction of the relation
AdjacencyList m_DerivedNodes;
};
} // namespace mitk
#endif /* MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkState.h b/Modules/Core/include/mitkState.h
index aafd16d41c..ccaae0109e 100755
--- a/Modules/Core/include/mitkState.h
+++ b/Modules/Core/include/mitkState.h
@@ -1,134 +1,134 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STATE_H_HEADER_INCLUDED_C19A8A5D
#define STATE_H_HEADER_INCLUDED_C19A8A5D
#include <MitkCoreExports.h>
#include <string>
#include <map>
#include <set>
#include <itkObject.h>
#include <itkWeakPointer.h>
#include <itkObjectFactory.h>
#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
* \deprecatedSince{2013_03} mitk::State is deprecated. Please use the mitk::StateMachineState instead.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_EXPORT State: public itk::Object
{
public:
- mitkClassMacro(State, itk::Object)
+ mitkClassMacroItkParent(State, itk::Object)
/**
* @brief static New method to use SmartPointer
**/
mitkNewMacro2Param(Self, std::string, int)
typedef std::map<int, mitk::State::Pointer> StateMap;
typedef std::map<int, itk::WeakPointer<mitk::Transition> > 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<int> 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/Modules/Core/include/mitkStateMachine.h b/Modules/Core/include/mitkStateMachine.h
index 4b7f5538e6..2eb9a33af6 100644
--- a/Modules/Core/include/mitkStateMachine.h
+++ b/Modules/Core/include/mitkStateMachine.h
@@ -1,307 +1,307 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STATEMACHINE_H_HEADER_INCLUDED_C18896BD
#define STATEMACHINE_H_HEADER_INCLUDED_C18896BD
#include <MitkCoreExports.h>
#include <itkObject.h>
#include "mitkOperationActor.h"
#include <string>
#include "mitkState.h"
#include "mitkUndoModel.h"
namespace mitk {
class Action;
class StateEvent;
class UndoController;
// base class of statem machine functors
class MITKCORE_EXPORT TStateMachineFunctor
{
public:
virtual bool DoAction(Action*, const StateEvent*)=0; // call using function
virtual ~TStateMachineFunctor() {}
};
// the template functor for arbitrary StateMachine derivations
template <class T>
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)
+ virtual bool DoAction(Action* action, const StateEvent* stateEvent) override
{
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<Self>(this, &Self::f));
#define STATEMACHINE_INFO MITK_INFO("StateMachine") << "[type: " << GetType() << "] "
#define STATEMACHINE_WARN MITK_WARN("StateMachine") << "[type: " << GetType() << "] "
#define STATEMACHINE_FATAL MITK_FATAL("StateMachine") << "[type: " << GetType() << "] "
#define STATEMACHINE_ERROR MITK_ERROR("StateMachine") << "[type: " << GetType() << "] "
#define STATEMACHINE_DEBUG MITK_DEBUG("StateMachine") << "[type: " << GetType() << "] "
/**
@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 <i>typedef classname Self</i>
\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.
**/
/**
* \deprecatedSince{2013_03} mitk::StateMachine is deprecated. Use mitk::EventStateMachine instead.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_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<int, TStateMachineFunctor*> ActionFunctionsMapType;
/**
* @brief Type for a vector of StartStatePointers
**/
typedef std::vector<State::Pointer> 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 calculates how good this statemachine can handle 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(const StateEvent *) const;
/**
* @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);
+ virtual void ExecuteOperation(Operation* operation) override;
/**
* @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/Modules/Core/include/mitkStateMachineAction.h b/Modules/Core/include/mitkStateMachineAction.h
index dc94a29243..70470078e3 100644
--- a/Modules/Core/include/mitkStateMachineAction.h
+++ b/Modules/Core/include/mitkStateMachineAction.h
@@ -1,57 +1,57 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SMACTION_H_HEADER_INCLUDED_C19AE06B
#define SMACTION_H_HEADER_INCLUDED_C19AE06B
#include "mitkCommon.h"
#include <itkLightObject.h>
#include <itkObjectFactory.h>
#include <string>
#include "MitkCoreExports.h"
namespace mitk
{
//##Documentation
//## @brief Represents an action, that is executed after a certain event (in statemachine-mechanism)
//## TODO: implement: Is used to connect the Action-Id in an XML Statemachine description with a functor in the StateMachine
//## implementation
//## @ingroup Interaction
class MITKCORE_EXPORT StateMachineAction: public itk::LightObject
{
public:
- mitkClassMacro(StateMachineAction, itk::Object)
+ mitkClassMacroItkParent(StateMachineAction, itk::Object)
mitkNewMacro1Param(Self, const std::string&)
/**
* @brief Returns the String-Id of this action.
**/
std::string GetActionName() const;
protected:
StateMachineAction(const std::string&);
~StateMachineAction();
private:
/**
* @brief The Id-Name of this action.
**/
std::string m_ActionName;
};
} // namespace mitk
#endif /* SMACTION_H_HEADER_INCLUDED_C19AE06B */
diff --git a/Modules/Core/include/mitkStateMachineContainer.h b/Modules/Core/include/mitkStateMachineContainer.h
index 805df4af23..47c6bc883d 100755
--- a/Modules/Core/include/mitkStateMachineContainer.h
+++ b/Modules/Core/include/mitkStateMachineContainer.h
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STATEMACHINECONTAINER_H_HEADER_INCLUDED_C19AEDDD
#define STATEMACHINECONTAINER_H_HEADER_INCLUDED_C19AEDDD
#include <vtkXMLParser.h>
#include <iostream>
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkStateMachineState.h"
#include "mitkStateMachineTransition.h"
#include "mitkStateMachineAction.h"
namespace us {
class Module;
}
namespace mitk {
/**
*@brief
*
* @ingroup Interaction
**/
class StateMachineContainer : public vtkXMLParser
{
public:
static StateMachineContainer *New();
vtkTypeMacro(StateMachineContainer,vtkXMLParser);
/**
* @brief This type holds all states of one statemachine.
**/
typedef std::vector<StateMachineState::Pointer> StateMachineCollectionType;
/**
* @brief Returns the StartState of the StateMachine.
**/
StateMachineState::Pointer GetStartState() const;
/**
* @brief Loads XML resource
*
* Loads a XML resource file in the given module context.
* The files have to be placed in the Resources/Interaction folder of their respective module.
**/
bool LoadBehavior(const std::string& fileName , const us::Module* module);
/**
* brief To enable StateMachine to access states
**/
friend class InteractionStateMachine;
protected:
StateMachineContainer();
virtual ~StateMachineContainer();
/**
* @brief Derived from XMLReader
**/
- void StartElement (const char* elementName, const char **atts);
+ void StartElement (const char* elementName, const char **atts) override;
/**
* @brief Derived from XMLReader
**/
- void EndElement (const char* elementName);
+ void EndElement (const char* elementName) override;
private:
/**
* @brief Derived from XMLReader
**/
std::string ReadXMLStringAttribut( std::string name, const char** atts);
/**
* @brief Derived from XMLReader
**/
bool ReadXMLBooleanAttribut( std::string name, const char** atts );
/**
* @brief Sets the pointers in Transition (setNextState(..)) according to the extracted xml-file content
**/
void ConnectStates();
StateMachineState::Pointer m_StartState;
StateMachineState::Pointer m_CurrState;
StateMachineTransition::Pointer m_CurrTransition;
StateMachineCollectionType m_States;
bool m_StartStateFound;
bool m_errors; // use member, because of inheritance from vtkXMLParser we can't return a success value for parsing the file.
std::string m_Filename; // store file name for debug purposes.
};
} // namespace mitk
#endif /* STATEMACHINECONTAINER_H_HEADER_INCLUDED_C19AEDDD */
diff --git a/Modules/Core/include/mitkStateMachineFactory.h b/Modules/Core/include/mitkStateMachineFactory.h
index b82c7b5277..4c9b7c038b 100755
--- a/Modules/Core/include/mitkStateMachineFactory.h
+++ b/Modules/Core/include/mitkStateMachineFactory.h
@@ -1,232 +1,232 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STATEMACHINEFACTORY_H_HEADER_INCLUDED_C19AEDDD
#define STATEMACHINEFACTORY_H_HEADER_INCLUDED_C19AEDDD
#include <MitkCoreExports.h>
#include "mitkState.h"
#include "mitkTransition.h"
#include "mitkAction.h"
#include <vtkXMLParser.h>
#include <iostream>
#include <set>
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
**/
/**
* \deprecatedSince{2013_03} StateMachineFactory is deprecated. Please use mitk::StateMachineContainer instead.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKCORE_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<std::string, mitk::State::Pointer> StartStateMap;
typedef StartStateMap::iterator StartStateMapIter;
/**
* @brief Typedef to be used for parsing all states of one statemachine
**/
typedef std::set<int> HistorySet;
typedef HistorySet::iterator HistorySetIter;
/**
* @brief This type holds all states of one statemachine.
**/
typedef std::map<int,State::Pointer> StateMachineMapType;
/**
* @brief this type holds all states of all statemachines so that a specific state can be accessed for persistence
**/
typedef std::map<std::string, StateMachineMapType* > 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.
* \param type name of the pattern to add. Will be used during initialization of a new interactor.
* \param startState the start state of this pattern.
* \param 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);
+ void StartElement (const char* elementName, const char **atts) override;
/**
* @brief Derived from XMLReader
**/
- void EndElement (const char* elementName);
+ void EndElement (const char* elementName) override;
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
**/
Transition* 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/Modules/Core/include/mitkStateMachineState.h b/Modules/Core/include/mitkStateMachineState.h
index bb1ced6736..cf8f64cea4 100755
--- a/Modules/Core/include/mitkStateMachineState.h
+++ b/Modules/Core/include/mitkStateMachineState.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SMSTATE_H_HEADER_INCLUDED_C19A8A5D
#define SMSTATE_H_HEADER_INCLUDED_C19A8A5D
#include <string>
#include <itkLightObject.h>
#include "mitkStateMachineTransition.h"
#include "MitkCoreExports.h"
namespace mitk {
/**
* \class StateMachineState
* Represents a state of a state machine pattern.
* It holds transitions to other states (mitk::StateMachineTransition) and the mode of the current state, see
* m_StateMode .
*/
class MITKCORE_EXPORT StateMachineState : public itk::LightObject
{
public:
- mitkClassMacro(StateMachineState, itk::LightObject);
+ mitkClassMacroItkParent(StateMachineState, itk::LightObject);
mitkNewMacro2Param(Self, const std::string&, const std::string&);
typedef std::vector<mitk::StateMachineState::Pointer> StateMap;
typedef std::vector<StateMachineTransition::Pointer> TransitionVector;
bool AddTransition( StateMachineTransition::Pointer transition );
/**
* @brief Return Transition which matches given event description.
*
* \deprecatedSince{2013_09} Use method GetTransitionList() instead.
*/
DEPRECATED(StateMachineTransition::Pointer GetTransition(const std::string& eventClass,const std::string& eventVariant));
/**
* @brief Return Transitions that match given event description.
**/
TransitionVector GetTransitionList(const std::string& eventClass,const std::string& eventVariant);
/**
* @brief Returns the name.
**/
std::string GetName() const;
std::string GetMode() 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:
StateMachineState(const std::string& name, const std::string& stateMode);
~StateMachineState();
private:
/**
* @brief Name of this State.
**/
std::string m_Name;
/**
* State Modus, which determines the behavior of the dispatcher. A State can be in three different modes:
* REGULAR - standard dispatcher behavior
* GRAB_INPUT - all events are given to the statemachine in this modus, if they are not processed by this statemachine the events are dropped.
* PREFER_INPUT - events are first given to this statemachine, and if not processed, offered to the other statemachines.
*/
std::string m_StateMode;
/**
* @brief map of transitions that lead from this state to the next state
**/
TransitionVector m_Transitions;
};
} // namespace mitk
#endif /* SMSTATE_H_HEADER_INCLUDED_C19A8A5D */
diff --git a/Modules/Core/include/mitkStateMachineTransition.h b/Modules/Core/include/mitkStateMachineTransition.h
index c698b1e58f..5551581920 100755
--- a/Modules/Core/include/mitkStateMachineTransition.h
+++ b/Modules/Core/include/mitkStateMachineTransition.h
@@ -1,110 +1,110 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SMTRANSITION_H_HEADER_INCLUDED
#define SMTRANSITION_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include <itkLightObject.h>
#include <string>
#include "mitkStateMachineAction.h"
#include "mitkStateMachineCondition.h"
#include "mitkInteractionEvent.h"
#include "MitkCoreExports.h"
namespace mitk
{
class StateMachineState;
typedef std::vector<mitk::StateMachineAction::Pointer> ActionVectorType;
typedef std::vector<StateMachineCondition> ConditionVectorType;
typedef itk::SmartPointer<StateMachineState> SpStateMachineState;
/**
* \class StateMachineTransition
* \brief Connects two states, and holds references to corresponding actions and conditions.
*
* This class represents a transition between two states of a statemachine. It holds a
* list of conditions that have to be fulfilled in order to be executed correctly.
* It also holds a list of actions that will be executed if all conditions are fulfilled.
*
* \ingroup Interaction
**/
class MITKCORE_EXPORT StateMachineTransition : public itk::LightObject
{
friend class StateMachineFactory;
friend class StateMachineContainer;
public:
- mitkClassMacro(StateMachineTransition, itk::LightObject);
+ mitkClassMacroItkParent(StateMachineTransition, itk::LightObject);
mitkNewMacro3Param(Self, const std::string&, const std::string&, const std::string&);
SpStateMachineState GetNextState() const;
std::string GetNextStateName() const;
/**
* Check for equality. Equality is given if event variant is the same and
* classes are the same or the first argument is a superclass of the second.
* \warn Here the order of arguments matters. !
*/
bool operator==(const StateMachineTransition& transition) const;
/**
* @brief Get an iterator on the first action in list.
**/
ActionVectorType GetActions() const;
const ConditionVectorType& GetConditions() const;
/**
* @brief Set the next state of this object.
**/
void SetNextState(const SpStateMachineState& nextState);
protected:
StateMachineTransition(const std::string& nextStateName, const std::string& eventClass, const std::string& eventVariant);
virtual ~StateMachineTransition();
// Triggering Event
std::string m_EventClass;
std::string m_EventVariant;
private:
void AddAction(const StateMachineAction::Pointer& action);
void AddCondition(const StateMachineCondition& condition);
SpStateMachineState m_NextState;
std::string m_NextStateName;
InteractionEvent::Pointer m_TransitionEvent;
/**
* @brief The list of actions, that are executed if this transition is done.
**/
std::vector<StateMachineAction::Pointer> m_Actions;
ConditionVectorType m_Conditions;
};
} // namespace mitk
#endif /* SMTRANSITION_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkStatusBarImplementation.h b/Modules/Core/include/mitkStatusBarImplementation.h
index c1403cb6b3..a8817f539b 100644
--- a/Modules/Core/include/mitkStatusBarImplementation.h
+++ b/Modules/Core/include/mitkStatusBarImplementation.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSTATUSBARIMPLEMENTATION_H
#define MITKSTATUSBARIMPLEMENTATION_H
#include <MitkCoreExports.h>
-#include <itkMacro.h>
+#include <mitkCommon.h>
namespace mitk {
//##Documentation
//## @brief GUI indepentent Interface for all Gui depentent implementations of a StatusBar.
class MITKCORE_EXPORT StatusBarImplementation
{
public:
- itkTypeMacroNoParent(StatusBarImplementation)
+ mitkClassMacroNoParent(StatusBarImplementation)
//##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/Modules/Core/include/mitkStepper.h b/Modules/Core/include/mitkStepper.h
index 0c9eefb2cc..070b956615 100644
--- a/Modules/Core/include/mitkStepper.h
+++ b/Modules/Core/include/mitkStepper.h
@@ -1,152 +1,152 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STEPPER_H_HEADER_INCLUDED_C1E77191
#define STEPPER_H_HEADER_INCLUDED_C1E77191
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "mitkNumericTypes.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <string>
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 MITKCORE_EXPORT Stepper : public itk::Object
{
public:
- mitkClassMacro(Stepper, itk::Object);
+ mitkClassMacroItkParent(Stepper, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetConstMacro(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();
}
}
itkGetConstMacro(Steps, unsigned int);
itkSetMacro(Steps, unsigned int);
itkGetConstMacro(AutoRepeat, bool);
itkSetMacro(AutoRepeat, bool);
itkBooleanMacro(AutoRepeat);
/** Causes the stepper to shift direction when the boundary is reached */
itkSetMacro(PingPong, bool);
itkGetConstMacro(PingPong, bool);
itkBooleanMacro(PingPong);
/** If set to true, the Next() decreases the stepper and Previous()
* decreases it */
itkSetMacro(InverseDirection, bool);
itkGetConstMacro(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/Modules/Core/include/mitkStringProperty.h b/Modules/Core/include/mitkStringProperty.h
index 07a53ad081..993f3265f5 100644
--- a/Modules/Core/include/mitkStringProperty.h
+++ b/Modules/Core/include/mitkStringProperty.h
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491
#define MITKSTRINGPROPERTY_H_HEADER_INCLUDED_C1C02491
#include <itkConfigure.h>
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include <string>
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* @brief Property for strings
* @ingroup DataManagement
*/
class MITKCORE_EXPORT StringProperty : public BaseProperty
{
protected:
std::string m_Value;
StringProperty( const char* string = 0 );
StringProperty( const std::string& s );
StringProperty(const StringProperty&);
public:
mitkClassMacro(StringProperty, BaseProperty);
typedef std::string ValueType;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(StringProperty, const char*);
mitkNewMacro1Param(StringProperty, const std::string&)
itkGetStringMacro(Value);
itkSetStringMacro(Value);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
static const char* PATH;
using BaseProperty::operator=;
private:
// purposely not implemented
StringProperty& operator=(const StringProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property ) const;
- virtual bool Assign(const BaseProperty& property );
+ virtual bool IsEqual(const BaseProperty& property ) const override;
+ virtual bool Assign(const BaseProperty& property ) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkSurface.h b/Modules/Core/include/mitkSurface.h
index b91d7a0a06..9f92cd7bf0 100644
--- a/Modules/Core/include/mitkSurface.h
+++ b/Modules/Core/include/mitkSurface.h
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurface_h
#define mitkSurface_h
#include "mitkBaseData.h"
#include "itkImageRegion.h"
#include <vtkSmartPointer.h>
class vtkPolyData;
namespace mitk
{
/**
* \brief Class for storing surfaces (vtkPolyData).
* \ingroup Data
*/
class MITKCORE_EXPORT Surface : public BaseData
{
public:
typedef itk::ImageRegion<5> RegionType;
mitkClassMacro(Surface, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void CalculateBoundingBox();
- virtual void CopyInformation(const itk::DataObject *data);
- virtual void ExecuteOperation(Operation *operation);
- virtual void Expand( unsigned int timeSteps = 1 );
+ virtual void CopyInformation(const itk::DataObject *data) override;
+ virtual void ExecuteOperation(Operation *operation) override;
+ virtual void Expand( unsigned int timeSteps = 1 ) override;
const RegionType& GetLargestPossibleRegion() const;
virtual const RegionType& GetRequestedRegion() const;
unsigned int GetSizeOfPolyDataSeries() const;
virtual vtkPolyData* GetVtkPolyData(unsigned int t = 0) const;
- virtual void Graft( const DataObject* data );
- virtual bool IsEmptyTimeStep(unsigned int t) const;
- virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
- virtual void SetRequestedRegion(const itk::DataObject *data);
+ virtual void Graft( const DataObject* data ) override;
+ virtual bool IsEmptyTimeStep(unsigned int t) const override;
+ virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const override;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
+ virtual void SetRequestedRegion(const itk::DataObject *data) override;
virtual void SetRequestedRegion(Surface::RegionType *region);
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
virtual void SetVtkPolyData(vtkPolyData* polydata, unsigned int t = 0);
virtual void Swap(Surface& other);
- virtual void Update();
- virtual void UpdateOutputInformation();
- virtual bool VerifyRequestedRegion();
+ virtual void Update() override;
+ virtual void UpdateOutputInformation() override;
+ virtual bool VerifyRequestedRegion() override;
protected:
mitkCloneMacro(Self);
Surface();
virtual ~Surface();
Surface(const Surface& other);
Surface& operator=(Surface other);
- virtual void ClearData();
- virtual void InitializeEmpty();
+ virtual void ClearData() override;
+ virtual void InitializeEmpty() override;
private:
std::vector< vtkSmartPointer<vtkPolyData> > m_PolyDatas;
mutable RegionType m_LargestPossibleRegion;
mutable RegionType m_RequestedRegion;
bool m_CalculateBoundingBox;
};
/**
* @brief Equal Compare two surfaces for equality, returns true if found equal.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const mitk::Surface& s1, const mitk::Surface& s2) instead
* @ingroup MITKTestingAPI
* @param rightHandSide Surface to compare.
* @param leftHandSide Surface to compare.
* @param eps Epsilon to use for floating point comparison. Most of the time mitk::eps will be sufficient.
* @param verbose Flag indicating if the method should give a detailed console output.
* @return True if every comparison is true, false in any other case.
*/
DEPRECATED( MITKCORE_EXPORT bool Equal( mitk::Surface* leftHandSide, mitk::Surface* rightHandSide, mitk::ScalarType eps, bool verbose));
/**
* @brief Equal Compare two surfaces for equality, returns true if found equal.
* @ingroup MITKTestingAPI
* @param rightHandSide Surface to compare.
* @param leftHandSide Surface to compare.
* @param eps Epsilon to use for floating point comparison. Most of the time mitk::eps will be sufficient.
* @param verbose Flag indicating if the method should give a detailed console output.
* @return True if every comparison is true, false in any other case.
*/
MITKCORE_EXPORT bool Equal( mitk::Surface& leftHandSide, mitk::Surface& rightHandSide, mitk::ScalarType eps, bool verbose);
/**
* @brief Equal Compare two vtk PolyDatas for equality, returns true if found equal.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const vtkPolyData& p1, const vtkPolyData& p2) instead
* @ingroup MITKTestingAPI
* @param rightHandSide Surface to compare.
* @param leftHandSide Surface to compare.
* @param eps Epsilon to use for floating point comparison. Most of the time mitk::eps will be sufficient.
* @param verbose Flag indicating if the method should give a detailed console output.
* @return True if every comparison is true, false in any other case.
*
* This will only check if the number of cells, vertices, polygons, stripes and lines is the same and whether
* all the two poly datas have the same number of points with the same coordinates. It is not checked whether
* all points are correctly connected.
*/
DEPRECATED( MITKCORE_EXPORT bool Equal( vtkPolyData* leftHandSide, vtkPolyData* rightHandSide, mitk::ScalarType eps, bool verbose));
/**
* @brief Equal Compare two vtk PolyDatas for equality, returns true if found equal.
* @ingroup MITKTestingAPI
* @param rightHandSide Surface to compare.
* @param leftHandSide Surface to compare.
* @param eps Epsilon to use for floating point comparison. Most of the time mitk::eps will be sufficient.
* @param verbose Flag indicating if the method should give a detailed console output.
* @return True if every comparison is true, false in any other case.
*
* This will only check if the number of cells, vertices, polygons, stripes and lines is the same and whether
* all the two poly datas have the same number of points with the same coordinates. It is not checked whether
* all points are correctly connected.
*/
MITKCORE_EXPORT bool Equal( vtkPolyData& leftHandSide, vtkPolyData& rightHandSide, mitk::ScalarType eps, bool verbose);
}
#endif
diff --git a/Modules/Core/include/mitkSurfaceSource.h b/Modules/Core/include/mitkSurfaceSource.h
index f8d9330add..89a4bdc70b 100644
--- a/Modules/Core/include/mitkSurfaceSource.h
+++ b/Modules/Core/include/mitkSurfaceSource.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSURFACEDATASOURCE_H_HEADER_INCLUDED_C10B4740
#define MITKSURFACEDATASOURCE_H_HEADER_INCLUDED_C10B4740
#include "mitkBaseDataSource.h"
namespace mitk {
class Surface;
/**
* @brief Superclass of all classes generating surfaces (instances of class
* Surface) 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::SurfaceSource.
* @ingroup Process
*/
class MITKCORE_EXPORT SurfaceSource : public BaseDataSource
{
public:
mitkClassMacro(SurfaceSource, BaseDataSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef Surface OutputType;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
SurfaceSource();
virtual ~SurfaceSource();
};
} // namespace mitk
#endif /* MITKSURFACEDATASOURCE_H_HEADER_INCLUDED_C10B4740 */
diff --git a/Modules/Core/include/mitkSurfaceToImageFilter.h b/Modules/Core/include/mitkSurfaceToImageFilter.h
index 4d6ef8629b..2030534e46 100644
--- a/Modules/Core/include/mitkSurfaceToImageFilter.h
+++ b/Modules/Core/include/mitkSurfaceToImageFilter.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkSurfaceToImageFilter_h__
#define _mitkSurfaceToImageFilter_h__
#include "mitkCommon.h"
#include "MitkCoreExports.h"
#include "mitkImageSource.h"
#include "mitkSurface.h"
//#include "mitkImage.h"
class vtkPolyData;
namespace mitk {
//class Mesh;
//class VectorOfContourLines;
/**
*
* @brief Converts surface data to pixel data. Requires a surface and an
* image, which header information defines the output image.
*
* The resulting image has the same dimension, size, and Geometry3D
* as the input image. The image is cut using a vtkStencil.
* The user can decide if he wants to keep the original values or create a
* binary image by setting MakeBinaryOutputOn (default is \a false). If
* set to \a true all voxels inside the surface are set to one and all
* outside voxel are set to zero.
*
* NOTE: Since the reference input image is passed to the vtkStencil in
* any case, the image needs to be initialized with pixel values greater than
* the numerical minimum of the used pixel type (e.g. at least -127 for
* unsigned char images, etc.) to produce a correct binary image
* representation of the surface in MakeOutputBinary mode.
*
* @ingroup SurfaceFilters
* @ingroup Process
*/
class MITKCORE_EXPORT SurfaceToImageFilter : public ImageSource
{
public:
mitkClassMacro(SurfaceToImageFilter, ImageSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(MakeOutputBinary, bool);
itkGetMacro(MakeOutputBinary, bool);
itkBooleanMacro(MakeOutputBinary);
itkGetConstMacro(BackgroundValue,float);
itkSetMacro(BackgroundValue,float);
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
const mitk::Surface *GetInput(void);
using itk::ProcessObject::SetInput;
virtual void SetInput(const mitk::Surface *surface);
void SetImage(const mitk::Image *source);
const mitk::Image *GetImage(void);
protected:
SurfaceToImageFilter();
virtual ~SurfaceToImageFilter();
void Stencil3DImage(int time = 0);
bool m_MakeOutputBinary;
float m_BackgroundValue;
};
} // namespace mitk
#endif /* MITKCOONSPATCHFILTER_H_HEADER_INCLUDED_C10B22CD */
diff --git a/Modules/Core/include/mitkSurfaceVtkMapper2D.h b/Modules/Core/include/mitkSurfaceVtkMapper2D.h
index 72d651818a..b97d0403ee 100644
--- a/Modules/Core/include/mitkSurfaceVtkMapper2D.h
+++ b/Modules/Core/include/mitkSurfaceVtkMapper2D.h
@@ -1,209 +1,209 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurfaceVtkMapper2D_h
#define mitkSurfaceVtkMapper2D_h
#include <MitkCoreExports.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkLocalStorageHandler.h"
//VTK
#include <vtkSmartPointer.h>
class vtkAssembly;
class vtkCutter;
class vtkPlane;
class vtkLookupTable;
class vtkGlyph3D;
class vtkArrowSource;
class vtkReverseSense;
namespace mitk {
class Surface;
/**
* @brief Vtk-based mapper for cutting 2D slices out of Surfaces.
*
* The mapper uses a vtkCutter filter to cut out slices (contours) of the 3D
* volume and render these slices as vtkPolyData. The data is transformed
* according to its geometry before cutting, to support the geometry concept
* of MITK.
*
* Properties:
* \b Surface.2D.Line Width: Thickness of the rendered lines in 2D.
* \b Surface.2D.Normals.Draw Normals: enables drawing of normals as 3D arrows
* in the 2D render window. The normals are created with a vtkGlyph3D from
* the vtkPolyData.
* \b Surface.2D.Normals.Draw Inverse Normals: same as normals, but in the
* other direction. The inverse normals are computed with a vtkReverseSense
* filter.
* \b Surface.2D.Normals.(Inverse) Normals Color: Color of the (inverse) normals.
* \b Surface.2D.Normals.(Inverse) Normals Scale Factor: Regulates the size of the normals.
*
* @ingroup Mapper
*/
class MITKCORE_EXPORT SurfaceVtkMapper2D : public VtkMapper
{
public:
mitkClassMacro(SurfaceVtkMapper2D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::Surface* GetInput() const;
/** \brief returns the prop assembly */
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/** \brief set the default properties for this mapper */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/**
* @brief m_PropAssembly Contains all vtkProps for the final rendering.
*
* Consists of 3 actors:
* The surface cut (the slice from the 3D surface).
* The normals and the inverse normals.
*/
vtkSmartPointer<vtkAssembly> m_PropAssembly;
/**
* @brief m_Actor actor for the surface cut.
*/
vtkSmartPointer<vtkActor> m_Actor;
/**
* @brief m_NormalActor actor for the normals.
*/
vtkSmartPointer<vtkActor> m_NormalActor;
/**
* @brief m_InverseNormalActor actor for the inverse normals.
*/
vtkSmartPointer<vtkActor> m_InverseNormalActor;
/**
* @brief m_Mapper VTK mapper for all types of 2D polydata e.g. werewolves.
*/
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
/**
* @brief m_Cutter Filter to cut out the 2D slice.
*/
vtkSmartPointer<vtkCutter> m_Cutter;
/**
* @brief m_CuttingPlane The plane where to cut off the 2D slice.
*/
vtkSmartPointer<vtkPlane> m_CuttingPlane;
/**
* @brief m_NormalMapper Mapper for the normals.
*/
vtkSmartPointer<vtkPolyDataMapper> m_NormalMapper;
/**
* @brief m_InverseNormalMapper Mapper for the inverse normals.
*/
vtkSmartPointer<vtkPolyDataMapper> m_InverseNormalMapper;
/**
* @brief m_NormalGlyph Glyph for creating normals.
*/
vtkSmartPointer<vtkGlyph3D> m_NormalGlyph;
/**
* @brief m_InverseNormalGlyph Glyph for creating inverse normals.
*/
vtkSmartPointer<vtkGlyph3D> m_InverseNormalGlyph;
/**
* @brief m_ArrowSource Arrow representation of the normals.
*/
vtkSmartPointer<vtkArrowSource> m_ArrowSource;
/**
* @brief m_ReverseSense Filter to invert the normals.
*/
vtkSmartPointer<vtkReverseSense> m_ReverseSense;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/**
* @brief UpdateVtkTransform Overwrite the method of the base class.
*
* The base class transforms the actor according to the respective
* geometry which is correct for most cases. This mapper, however,
* uses a vtkCutter to cut out a contour. To cut out the correct
* contour, the data has to be transformed beforehand. Else the
* current plane geometry will point the cutter to en empty location
* (if the surface does have a geometry, which is a rather rare case).
*/
- void UpdateVtkTransform(mitk::BaseRenderer* /*renderer*/)
+ void UpdateVtkTransform(mitk::BaseRenderer* /*renderer*/) override
{
}
protected:
/**
* @brief SurfaceVtkMapper2D default constructor.
*/
SurfaceVtkMapper2D();
/**
* @brief ~SurfaceVtkMapper2D default destructor.
*/
virtual ~SurfaceVtkMapper2D();
/**
* @brief GenerateDataForRenderer produces all the data.
* @param renderer The respective renderer of the mitkRenderWindow.
*/
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/**
* @brief ResetMapper Called in mitk::Mapper::Update to hide objects.
* If TimeSlicedGeometry or time step is not valid, reset the mapper.
* so that nothing is displayed e.g. toggle visiblity of the propassembly.
*
* @param renderer The respective renderer of the mitkRenderWindow.
*/
- virtual void ResetMapper( BaseRenderer* renderer );
+ virtual void ResetMapper( BaseRenderer* renderer ) override;
/**
* @brief ApplyAllProperties Pass all the properties to VTK.
* @param renderer The respective renderer of the mitkRenderWindow.
*/
void ApplyAllProperties( BaseRenderer* renderer);
/**
* @brief Update Check if data should be generated.
* @param renderer The respective renderer of the mitkRenderWindow.
*/
- void Update(BaseRenderer* renderer);
+ void Update(BaseRenderer* renderer) override;
};
} // namespace mitk
#endif /* mitkSurfaceVtkMapper2D_h */
diff --git a/Modules/Core/include/mitkSurfaceVtkMapper3D.h b/Modules/Core/include/mitkSurfaceVtkMapper3D.h
index 2fe348df24..c93061b640 100644
--- a/Modules/Core/include/mitkSurfaceVtkMapper3D.h
+++ b/Modules/Core/include/mitkSurfaceVtkMapper3D.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurfaceVtkMapper3D_h
#define mitkSurfaceVtkMapper3D_h
#include <MitkCoreExports.h>
#include <mitkSurface.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkLocalStorageHandler.h"
#include <vtkActor.h>
#include <vtkPainterPolyDataMapper.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkPlaneCollection.h>
#include <vtkDepthSortPolyData.h>
#include <vtkSmartPointer.h>
namespace mitk {
/**
* @brief Vtk-based mapper for Surfaces.
*
* The mapper renders a surface in 3D. The actor is adapted according to the geometry in
* the base class in mitk::VtkMapper::UpdateVtkTransform().
*
* Properties that can be set for surfaces and influence the surfaceVTKMapper3D are:
*
* - \b "Backface Culling": True enables backface culling, which means only front-facing polygons will be visualized. False/disabled by default.
* - \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 "material.pointSize": (FloatProperty) Size in pixels of the points drawn.
* - \b "scalar visibility": (BoolProperty) If the scarlars of the surface are visible
* - \b "Surface.TransferFunction (TransferFunctionProperty) Set a transferfunction for coloring the surface
* - \b "LookupTable (LookupTableProperty) LookupTable
* 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 MITKCORE_EXPORT SurfaceVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(SurfaceVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(GenerateNormals, bool);
itkGetMacro(GenerateNormals, bool);
virtual const mitk::Surface* GetInput();
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
virtual void ApplyAllProperties(mitk::BaseRenderer* renderer, vtkActor* actor);
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 GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
- virtual void ResetMapper( mitk::BaseRenderer* renderer );
+ virtual void ResetMapper( mitk::BaseRenderer* renderer ) override;
/** 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;
public:
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkSmartPointer<vtkActor> m_Actor;
vtkSmartPointer<vtkPainterPolyDataMapper> m_VtkPolyDataMapper;
vtkSmartPointer<vtkPolyDataNormals> m_VtkPolyDataNormals;
vtkSmartPointer<vtkPlaneCollection> m_ClippingPlaneCollection;
vtkSmartPointer<vtkDepthSortPolyData> m_DepthSort;
itk::TimeStamp m_ShaderTimestampUpdate;
LocalStorage()
{
m_VtkPolyDataMapper = vtkSmartPointer<vtkPainterPolyDataMapper>::New();
m_VtkPolyDataNormals = vtkSmartPointer<vtkPolyDataNormals>::New();
m_Actor = vtkSmartPointer<vtkActor>::New();
m_ClippingPlaneCollection = vtkSmartPointer<vtkPlaneCollection>::New();
m_Actor->SetMapper(m_VtkPolyDataMapper);
m_DepthSort = vtkSmartPointer<vtkDepthSortPolyData>::New();
}
~LocalStorage()
{
}
};
mitk::LocalStorageHandler<LocalStorage> m_LSH;
static void ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node, vtkProperty* property, mitk::BaseRenderer* renderer);
static void SetDefaultPropertiesForVtkProperty(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite);
};
} // namespace mitk
#endif /* mitkSurfaceVtkMapper3D_h */
diff --git a/Modules/Core/include/mitkThinPlateSplineCurvedGeometry.h b/Modules/Core/include/mitkThinPlateSplineCurvedGeometry.h
index f1b19e1042..5962787017 100644
--- a/Modules/Core/include/mitkThinPlateSplineCurvedGeometry.h
+++ b/Modules/Core/include/mitkThinPlateSplineCurvedGeometry.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkLandmarkProjectorBasedCurvedGeometry.h"
class vtkPoints;
class vtkThinPlateSplineTransform;
namespace mitk {
//##Documentation
//## @brief Thin-plate-spline-based landmark-based curved geometry
//##
//## @ingroup Geometry
class MITKCORE_EXPORT ThinPlateSplineCurvedGeometry : public LandmarkProjectorBasedCurvedGeometry
{
public:
mitkClassMacro(ThinPlateSplineCurvedGeometry, LandmarkProjectorBasedCurvedGeometry);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void ComputeGeometry();
+ virtual void ComputeGeometry() override;
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
vtkThinPlateSplineTransform* GetThinPlateSplineTransform() const
{
return m_ThinPlateSplineTransform;
}
virtual void SetSigma(double sigma);
virtual double GetSigma() const;
- virtual bool IsValid() const;
+ virtual bool IsValid() const override;
protected:
ThinPlateSplineCurvedGeometry();
ThinPlateSplineCurvedGeometry(const ThinPlateSplineCurvedGeometry& other);
virtual ~ThinPlateSplineCurvedGeometry();
vtkThinPlateSplineTransform* m_ThinPlateSplineTransform;
vtkPoints* m_VtkTargetLandmarks;
vtkPoints* m_VtkProjectedLandmarks;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){ Superclass::PreSetSpacing(aSpacing); };
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{ Superclass::PreSetSpacing(aSpacing); };
};
} // namespace mitk
#endif /* MITKTHINPLATESPLINECURVEDGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/Core/include/mitkTimeGeometry.h b/Modules/Core/include/mitkTimeGeometry.h
index 055af58bdf..153f1ebb58 100644
--- a/Modules/Core/include/mitkTimeGeometry.h
+++ b/Modules/Core/include/mitkTimeGeometry.h
@@ -1,305 +1,305 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TimeGeometry_h
#define TimeGeometry_h
//ITK
#include <itkObject.h>
//MITK
#include <mitkCommon.h>
#include <MitkCoreExports.h>
#include "mitkOperationActor.h"
#include <mitkBaseGeometry.h>
namespace mitk {
/**
* \deprecatedSince{2013_09} GlobalInteraction is deprecated. It is replaced by mitk::Dispatcher.
* Please use the new implementation described in \see DataInteractionPage .
*/
typedef mitk::ScalarType TimePointType;
typedef std::size_t TimeStepType;
/**
* \brief Manages the geometries of a data object for each time step
*
* This class is an abstract class. The concrete implementation
* depends on the way the different time steps are managed.
*
* The time is defined either by a time step or a time point. Time steps
* are non-negativ integers starting from 0. A time point is is a ScalarType value
* which gives the passed time since start in ms. Be aware that the starting
* point is not fixed so it is possible that the same time point defines two
* different time depending on the start time of the used time geometry.
*
* \addtogroup geometry
*/
class MITKCORE_EXPORT TimeGeometry : public itk::Object, public OperationActor
{
protected:
TimeGeometry();
virtual ~TimeGeometry();
/**
* \brief Contains a bounding box which includes all time steps
*/
BoundingBox::Pointer m_BoundingBox;
/**
* \brief Makes a deep copy of the current object
*/
- virtual LightObject::Pointer InternalClone() const;
+ virtual LightObject::Pointer InternalClone() const override;
public:
mitkClassMacro(TimeGeometry, itk::Object)
itkCloneMacro(Self)
itkCreateAnotherMacro(Self)
/**
* \brief Returns the number of time steps.
*
* Returns the number of time steps for which
* geometries are saved. The number of time steps
* is also the upper bound of the time steps. The
* minimum time steps is always 0.
*/
virtual TimeStepType CountTimeSteps() const = 0;
/**
* \brief Returns the first time point for which the object is valid.
*
* Returns the first valid time point for this geometry. If only one
* time steps available it usually goes from -max to +max. The time point
* is given in ms.
*/
virtual TimePointType GetMinimumTimePoint() const = 0;
/**
* \brief Returns the last time point for which the object is valid
*
* Gives the last time point for which a valid geometrie is saved in
* this time geometry. The time point is given in ms.
*/
virtual TimePointType GetMaximumTimePoint() const = 0;
/**
* \brief Returns the first time point for which the object is valid.
*
* Returns the first valid time point for the given TimeStep. The time point
* is given in ms.
*/
virtual TimePointType GetMinimumTimePoint(TimeStepType step) const = 0;
/**
* \brief Returns the last time point for which the object is valid
*
* Gives the last time point for the Geometry specified by the given TimeStep. The time point is given in ms.
*/
virtual TimePointType GetMaximumTimePoint(TimeStepType step) const = 0;
/**
* \brief Get the time bounds (in ms)
*/
virtual TimeBounds GetTimeBounds() const = 0;
/**
* \brief Get the time bounds for the given TimeStep (in ms)
*/
virtual TimeBounds GetTimeBounds(TimeStepType step) const = 0;
/**
* \brief Tests if a given time point is covered by this object
*
* Returns true if a geometry can be returned for the given time
* point and falls if not. The time point must be given in ms.
*/
virtual bool IsValidTimePoint (TimePointType timePoint) const = 0;
/**
* \brief Test for the given time step if a geometry is availible
*
* Returns true if a geometry is defined for the given time step.
* Otherwise false is returned.
* The time step is defined as positiv number.
*/
virtual bool IsValidTimeStep (TimeStepType timeStep) const = 0;
/**
* \brief Converts a time step to a time point
*
* Converts a time step to a time point in a way that
* the new time point indicates the same geometry as the time step.
* If the original time steps does not point to a valid geometry,
* a time point is calculated that also does not point to a valid
* geometry, but no exception is raised.
*/
virtual TimePointType TimeStepToTimePoint (TimeStepType timeStep) const = 0;
/**
* \brief Converts a time point to the corresponding time step
*
* Converts a time point to a time step in a way that
* the new time step indicates the same geometry as the time point.
* If a negativ invalid time point is given always time step 0 is
* returned. If an positiv invalid time step is given an invalid
* time step will be returned.
*/
virtual TimeStepType TimePointToTimeStep (TimePointType timePoint) const = 0;
/**
* \brief Returns the geometry of a specific time point
*
* Returns the geometry which defines the given time point. If
* the given time point is invalid an null-pointer is returned.
*
* The pointer to the returned geometry may point to the saved
* geometry but this is not necessarily the case. So a change to
* the returned geometry may or may not afflict the geometry for the
* time point or all time points depending on the used implementation
* of TimeGeometry.
*/
virtual BaseGeometry::Pointer GetGeometryForTimePoint ( TimePointType timePoint) const = 0;
/**
* \brief Returns the geometry which corresponds to the given time step
*
* Returns the geometry which defines the given time step. If
* the given time step is invalid an null-pointer is returned.
*
* The pointer to the returned geometry may point to the saved
* geometry but this is not necessarily the case. So a change to
* the returned geometry may or may not afflict the geometry for the
* time step or all time steps depending on the used implementation
* of TimeGeometry.
*/
virtual BaseGeometry::Pointer GetGeometryForTimeStep ( TimeStepType timeStep) const = 0;
/**
* \brief Returns a clone of the geometry of a specific time point
*
* If an invalid time step is given (e.g. no geometry is defined for this time step)
* a null-pointer will be returned.
*/
virtual BaseGeometry::Pointer GetGeometryCloneForTimeStep( TimeStepType timeStep) const = 0;
/**
* \brief Sets the geometry for a given time step
*
* Sets the geometry for the given time steps. This may also afflects other
* time steps, depending on the implementation of TimeGeometry.
*/
virtual void SetTimeStepGeometry(BaseGeometry* geometry, TimeStepType timeStep) = 0;
/**
* \brief Expands to the given number of time steps
*
* Expands to the given number of time steps. Each new created time
* step is filled with an empty geometry.
* Shrinking is not supported!
*/
virtual void Expand(TimeStepType size) = 0;
/**
* \brief Tests if all necessary informations are set and the object is valid
*/
virtual bool IsValid () const = 0;
/**
* \brief Get the position of the corner number \a id (in world coordinates)
*
* See SetImageGeometry for how a corner is defined on images.
*/
Point3D GetCornerPointInWorld(int id) const;
/**
* \brief Get the position of a corner (in world coordinates)
*
* See SetImageGeometry for how a corner is defined on images.
*/
Point3D GetCornerPointInWorld(bool xFront=true, bool yFront=true, bool zFront=true) const;
/**
* \brief Get the center of the bounding-box in mm
*/
Point3D GetCenterInWorld() const;
/**
* \brief Get the squared length of the diagonal of the bounding-box in mm
*/
double GetDiagonalLength2InWorld() const;
/**
* \brief Get the length of the diagonal of the bounding-box in mm
*/
double GetDiagonalLengthInWorld() const;
/**
* \brief Test whether the point \a p (world coordinates in mm) is inside the bounding box
*/
bool IsWorldPointInside(const mitk::Point3D& p) const;
/**
* \brief Updates the bounding box to cover the area used in all time steps
*
* The bounding box is updated by this method. The new bounding box
* covers an area which includes all bounding boxes during
* all times steps.
*/
void UpdateBoundingBox();
/**
* \brief Returns a bounding box that covers all time steps
*/
BoundingBox* GetBoundingBoxInWorld() const
{
return m_BoundingBox;
}
/**
* \brief Returns the world bounds of the object that cover all time steps
*/
BoundingBox::BoundsArrayType GetBoundsInWorld() const
{
return m_BoundingBox->GetBounds();
}
/**
* \brief Returns the Extend of the bounding in the given direction
*/
ScalarType GetExtentInWorld (unsigned int direction) const;
/**
* \brief Initializes the TimeGeometry
*/
virtual void Initialize();
/**
* \brief Updates the geometry
*/
void Update();
/**
* \brief Updates everything except the Bounding box
*
* This class should be overwritten by child classes.
* The method is called when Update() is required.
*/
virtual void UpdateWithoutBoundingBox()
{};
/**
* \brief Executes the given operation on all time steps
*/
- virtual void ExecuteOperation(Operation *op);
+ virtual void ExecuteOperation(Operation *op) override;
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
}; // end class TimeGeometry
} // end namespace MITK
#endif // TimeGeometry_h
diff --git a/Modules/Core/include/mitkTransferFunction.h b/Modules/Core/include/mitkTransferFunction.h
index 1572d1294e..d9740c1eeb 100644
--- a/Modules/Core/include/mitkTransferFunction.h
+++ b/Modules/Core/include/mitkTransferFunction.h
@@ -1,207 +1,207 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
#define MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
#include "mitkHistogramGenerator.h"
#include <MitkCoreExports.h>
#include "mitkImage.h"
#include <itkObject.h>
#include <itkRGBPixel.h>
#include <itkHistogram.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkSmartPointer.h>
#include <vector>
#include <algorithm>
#include <set>
namespace mitk {
/**
* @brief The TransferFunction class A wrapper class for VTK scalar opacity,
* gradient opacity, and color transfer functions.
* @ingroup DataManagement
*
* 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.
*
* @note If you want to use this as a property for an mitk::Image, make sure
* to use the mitk::TransferFunctionProperty and set the mitk::RenderingModeProperty
* to a mode which supports transfer functions (e.g. COLORTRANSFERFUNCTION_COLOR).
* Make sure to check the documentation of the mitk::RenderingModeProperty. For a
* code example how to use the mitk::TransferFunction check the
* mitkImageVtkMapper2DTransferFunctionTest.cpp in Core\Code\Testing.
*/
class MITKCORE_EXPORT TransferFunction : public itk::Object
{
public:
typedef std::vector<std::pair<double, double> > ControlPoints;
typedef std::vector<std::pair<double, itk::RGBPixel<double> > > RGBControlPoints;
- mitkClassMacro(TransferFunction, itk::DataObject);
+ mitkClassMacroItkParent(TransferFunction, itk::DataObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(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*);
itkSetMacro(ColorTransferFunction,vtkSmartPointer<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<double>* 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();
TransferFunction(const TransferFunction& other);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
- void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ void PrintSelf(std::ostream &os, itk::Indent indent) const override;
/** Wrapped VTK scalar opacity transfer function */
vtkSmartPointer<vtkPiecewiseFunction> m_ScalarOpacityFunction;
/** Wrapped VTK gradient opacity transfer function */
vtkSmartPointer<vtkPiecewiseFunction> m_GradientOpacityFunction;
/** Wrapped VTK color transfer function */
vtkSmartPointer<vtkColorTransferFunction> 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/Modules/Core/include/mitkTransferFunctionInitializer.h b/Modules/Core/include/mitkTransferFunctionInitializer.h
index 0b06f6b0be..f466eee374 100644
--- a/Modules/Core/include/mitkTransferFunctionInitializer.h
+++ b/Modules/Core/include/mitkTransferFunctionInitializer.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED
#define MITK_TRANSFER_FUNCTION_MODE_CREATOR_H_HEADER_INCLUDED
#include <vtkPiecewiseFunction.h>
#include <vtkColorTransferFunction.h>
#include <vtkSmartPointer.h>
#include "mitkTransferFunction.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <MitkCoreExports.h>
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 MITKCORE_EXPORT TransferFunctionInitializer : public itk::Object
{
public:
- mitkClassMacro(TransferFunctionInitializer, itk::Object);
+ mitkClassMacroItkParent(TransferFunctionInitializer, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(TransferFunctionInitializer, TransferFunction::Pointer);
static void GetPresetNames(std::vector<std::string>& 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/Modules/Core/include/mitkTransferFunctionProperty.h b/Modules/Core/include/mitkTransferFunctionProperty.h
index e9c724c57a..f68df91d68 100644
--- a/Modules/Core/include/mitkTransferFunctionProperty.h
+++ b/Modules/Core/include/mitkTransferFunctionProperty.h
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#define MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#include "mitkBaseProperty.h"
#include "mitkTransferFunction.h"
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* @brief The TransferFunctionProperty class Property class for the mitk::TransferFunction.
* @ingroup DataManagement
*
* @note If you want to use this property for an mitk::Image, make sure
* to set the mitk::RenderingModeProperty to a mode which supports transfer
* functions (e.g. COLORTRANSFERFUNCTION_COLOR). Make sure to check the
* documentation of the mitk::RenderingModeProperty. For a code example how
* to use the mitk::TransferFunction check the
* mitkImageVtkMapper2DTransferFunctionTest.cpp in Core\Code\Testing.
*/
class MITKCORE_EXPORT TransferFunctionProperty : public BaseProperty
{
public:
typedef mitk::TransferFunction::Pointer ValueType;
mitkClassMacro(TransferFunctionProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(TransferFunctionProperty, mitk::TransferFunction::Pointer);
itkSetMacro(Value, mitk::TransferFunction::Pointer );
itkGetConstMacro(Value, mitk::TransferFunction::Pointer );
- std::string GetValueAsString() const;
+ std::string GetValueAsString() const override;
using BaseProperty::operator=;
protected:
mitk::TransferFunction::Pointer m_Value;
TransferFunctionProperty();
TransferFunctionProperty(const TransferFunctionProperty& other);
TransferFunctionProperty( mitk::TransferFunction::Pointer value );
private:
// purposely not implemented
TransferFunctionProperty& operator=(const TransferFunctionProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkUndoModel.h b/Modules/Core/include/mitkUndoModel.h
index be7a1b080d..ebfdeb73b7 100644
--- a/Modules/Core/include/mitkUndoModel.h
+++ b/Modules/Core/include/mitkUndoModel.h
@@ -1,92 +1,92 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef UNDOMODEL_H_HEADER_INCLUDED_C16ED098
#define UNDOMODEL_H_HEADER_INCLUDED_C16ED098
#include "mitkCommon.h"
#include "mitkOperation.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk {
class UndoStackItem;
class OperationEvent;
class OperationActor;
//##Documentation
//## @brief superclass for all UndoModels
//##
//## all necessary operations, that all UndoModels share.
//## @ingroup Undo
class MITKCORE_EXPORT UndoModel : public itk::Object
{
public:
- mitkClassMacro(UndoModel, itk::Object);
+ mitkClassMacroItkParent(UndoModel, itk::Object);
// no New Macro because this is an abstract class!
virtual bool SetOperationEvent(UndoStackItem* stackItem) = 0;
virtual bool Undo() = 0;
virtual bool Undo(bool fine) = 0;
virtual bool Redo() = 0;
virtual bool Redo(bool fine) = 0;
//##Documentation
//## @brief clears undo and Redolist
virtual void Clear() = 0;
//##Documentation
//## @brief clears the RedoList
virtual void ClearRedoList() = 0;
//##Documentation
//## @brief true if RedoList is empty
virtual bool RedoListEmpty() = 0;
//##Documentation
//## @brief returns the ObjectEventId of the
//## top Element in the OperationHistory of the selected
//## UndoModel
virtual int GetLastObjectEventIdInList() = 0;
//##Documentation
//## @brief returns the GroupEventId of the
//## top Element in the OperationHistory of the selected
//## UndoModel
virtual int GetLastGroupEventIdInList() = 0;
//##Documentation
//## @brief returns the last specified OperationEvent in Undo-list
//## corresponding to the given values; if nothing found, then returns NULL
//##
//## needed to get the old Position of an Element for declaring an UndoOperation
virtual OperationEvent* GetLastOfType(OperationActor* destination, OperationType opType) = 0;
protected:
UndoModel(){};
virtual ~UndoModel(){};
};
}// namespace mitk
#endif /* UNDOMODEL_H_HEADER_INCLUDED_C16ED098 */
diff --git a/Modules/Core/include/mitkVerboseLimitedLinearUndo.h b/Modules/Core/include/mitkVerboseLimitedLinearUndo.h
index d204d658e8..8ed9e2c8c2 100644
--- a/Modules/Core/include/mitkVerboseLimitedLinearUndo.h
+++ b/Modules/Core/include/mitkVerboseLimitedLinearUndo.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96
#define VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96
// MITK header
#include <MitkCoreExports.h>
#include "mitkLimitedLinearUndo.h"
// STL header
#include <vector>
#include <list>
#include <utility>
#include <string>
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 MITKCORE_EXPORT VerboseLimitedLinearUndo : public LimitedLinearUndo
{
public:
mitkClassMacro(VerboseLimitedLinearUndo, LimitedLinearUndo);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef std::pair<int,std::string> StackDescriptionItem;
typedef std::vector<StackDescriptionItem> StackDescription; /// a list of pairs (int,string), representing a stack with ObjectEventIDs and descriptions
- virtual bool SetOperationEvent(UndoStackItem* undoStackItem);
+ virtual bool SetOperationEvent(UndoStackItem* undoStackItem) override;
virtual StackDescription GetUndoDescriptions();
virtual StackDescription GetRedoDescriptions();
protected:
VerboseLimitedLinearUndo();
virtual ~VerboseLimitedLinearUndo();
};
} // namespace mitk
#endif /* VERBOSELIMITEDLINEARUNDO_H_HEADER_INCLUDED_C16E96 */
diff --git a/Modules/Core/include/mitkVolumeCalculator.h b/Modules/Core/include/mitkVolumeCalculator.h
index dc7504a1a6..1fc9f74ba4 100644
--- a/Modules/Core/include/mitkVolumeCalculator.h
+++ b/Modules/Core/include/mitkVolumeCalculator.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VOLUME_CALCULATOR_H_HEADER_INCLUDED
#define VOLUME_CALCULATOR_H_HEADER_INCLUDED
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkImage.h"
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT VolumeCalculator : public itk::Object
{
public:
- mitkClassMacro(VolumeCalculator,itk::Object);
+ mitkClassMacroItkParent(VolumeCalculator,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetObjectMacro(Image,Image);
/**
* Sets threshold, all voxels that are equal or greater are accepted.
*/
itkSetMacro(Threshold,int);
/**
* In case of a 2D image this returns the calculated volume in square cm, in case of 3D images the result is given
* in cubic cm. For 4D data refer to the GetVolumes() function.
* @see GetVolumes()
*/
itkGetMacro(Volume,float);
/**
* Returns the number of accepted voxels.
*/
itkGetMacro(VoxelCount,unsigned long int);
/**
* Returns the volume for 4D images, as a vector where each volume is represented by an item in the vector (in cubic cm).
\note Also for 2D+t images the result will be returned in cubic cm.
*/
std::vector<float> 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(const itk::Image< TPixel, VImageDimension >* itkImage);
Image::ConstPointer m_Image;
int m_Threshold;
float m_Volume;
unsigned long int m_VoxelCount;
std::vector<float> m_Volumes;
ImageTimeSelector::Pointer m_TimeSelector;
};
} // namespace mitk
#endif /* VOLUME_CALCULATOR_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkVolumeDataVtkMapper3D.h b/Modules/Core/include/mitkVolumeDataVtkMapper3D.h
index 3120c5ceab..a2c298f567 100644
--- a/Modules/Core/include/mitkVolumeDataVtkMapper3D.h
+++ b/Modules/Core/include/mitkVolumeDataVtkMapper3D.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED
#define MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkImage.h"
#include <vtkVolumeProperty.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPlane.h>
#include <vtkImplicitPlaneWidget.h>
#include <vtkImageMask.h>
#include <vector>
#include <set>
class vtkAssembly;
class vtkVolumeRayCastMapper;
class vtkFixedPointVolumeRayCastMapper;
class vtkVolumeTextureMapper2D;
class vtkVolumeMapper;
class vtkVolume;
class vtkObject;
class vtkImageShiftScale;
class vtkImageChangeInformation;
class vtkLODProp3D;
class vtkImageResample;
class vtkCubeSource;
class vtkPolyDataMapper;
class vtkActor;
namespace mitk {
/************************************************************************/
/* Properties that influence the mapper are:
*
* - \b "level window": for the level window of the volume data
* - \b "LookupTable" : for the lookup table of the volume data
* - \b "TransferFunction" (mitk::TransferFunctionProperty): for the used transfer function of the volume data
************************************************************************/
//##Documentation
//## @brief Vtk-based mapper for VolumeData
//##
//## @ingroup Mapper
class MITKCORE_EXPORT VolumeDataVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(VolumeDataVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::Image* GetInput();
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 bool IsLODEnabled( BaseRenderer *renderer = NULL ) const override;
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
protected:
VolumeDataVtkMapper3D();
virtual ~VolumeDataVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
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/Modules/Core/include/mitkVtkEventProvider.h b/Modules/Core/include/mitkVtkEventProvider.h
index 778e53e3db..83ea6d65c3 100644
--- a/Modules/Core/include/mitkVtkEventProvider.h
+++ b/Modules/Core/include/mitkVtkEventProvider.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723
#define VTKMITKEVENTPROVIDER_H_HEADER_INCLUDED_C1C53723
#include <MitkCoreExports.h>
#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 MITKCORE_EXPORT vtkEventProvider : public vtkInteractorObserver
{
public:
static vtkEventProvider *New();
vtkTypeMacro(vtkEventProvider,vtkInteractorObserver);
// Satisfy the superclass API. Enable/disable listening for events.
- virtual void SetEnabled(int);
- virtual void SetInteractor(vtkRenderWindowInteractor* iren);
+ virtual void SetEnabled(int) override;
+ virtual void SetInteractor(vtkRenderWindowInteractor* iren) override;
// 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<unsigned long> 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/Modules/Core/include/mitkVtkInteractorCameraController.h b/Modules/Core/include/mitkVtkInteractorCameraController.h
index 657365c08c..7cb11f124b 100644
--- a/Modules/Core/include/mitkVtkInteractorCameraController.h
+++ b/Modules/Core/include/mitkVtkInteractorCameraController.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVTKINTERACTORCAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722
#define MITKVTKINTERACTORCAMERACONTROLLER_H_HEADER_INCLUDED_C1C53722
#include <MitkCoreExports.h>
#include "mitkCameraController.h"
#include "vtkRenderWindowInteractor.h"
class vtkRenderWindow;
namespace mitk {
//##Documentation
//## @brief vtk-based camera controller
//## @ingroup NavigationControl
class MITKCORE_EXPORT VtkInteractorCameraController : public CameraController
{
public:
mitkClassMacro(VtkInteractorCameraController, CameraController);
itkFactorylessNewMacro(Self)
itkCloneMacro(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*);
+ virtual void Resize(int w, int h) override;
+ virtual void MousePressEvent(mitk::MouseEvent*) override;
+ virtual void MouseReleaseEvent(mitk::MouseEvent*) override;
+ virtual void MouseMoveEvent(mitk::MouseEvent*) override;
+ virtual void KeyPressEvent(mitk::KeyEvent*) override;
//##Documentation
//## @brief Set the BaseRenderer to be controlled by this vtk-based camera controller
- virtual void SetRenderer(const mitk::BaseRenderer* renderer);
+ virtual void SetRenderer(const mitk::BaseRenderer* renderer) override;
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/Modules/Core/include/mitkVtkInteractorStyle.h b/Modules/Core/include/mitkVtkInteractorStyle.h
index 590603ccb6..10604b683c 100644
--- a/Modules/Core/include/mitkVtkInteractorStyle.h
+++ b/Modules/Core/include/mitkVtkInteractorStyle.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/**
* \brief Implements the handling of events that are missing for MITK interaction.
*
* This class inherits from vtkInteractorStyleUser, a class that handles
* VTK-Events and invokes callbacks by means of an observer pattern.
*
* Most event-types needed for typical MITK interaction have already
* been implemented in vtkInteractorStyleUser (Mouse-Buttons + Keyboard).
* However, wheel-events and widgetModifed-events (whatever these are)
* have not been handled so far. This is the purpose of this class.
*/
#ifndef __mitkVtkInteractorStyle_h
#define __mitkVtkInteractorStyle_h
#include "MitkCoreExports.h"
#include <vtkInteractorStyleUser.h>
class MITKCORE_EXPORT mitkVtkInteractorStyle : public vtkInteractorStyleUser
{
public:
// default VTK c'tor
static mitkVtkInteractorStyle *New();
vtkTypeMacro(mitkVtkInteractorStyle,vtkInteractorStyleUser);
/**
* \brief Called when scrolling forwards with the mouse-wheel.
*/
- virtual void OnMouseWheelForward();
+ virtual void OnMouseWheelForward() override;
/**
* \brief Called when scrolling backwards with the mouse-wheel.
*/
- virtual void OnMouseWheelBackward();
+ virtual void OnMouseWheelBackward() override;
protected:
mitkVtkInteractorStyle();
~mitkVtkInteractorStyle();
private:
mitkVtkInteractorStyle(const mitkVtkInteractorStyle&); // Not implemented.
void operator=(const mitkVtkInteractorStyle&); // Not implemented.
};
#endif
diff --git a/Modules/Core/include/mitkVtkInterpolationProperty.h b/Modules/Core/include/mitkVtkInterpolationProperty.h
index 37ed6f6497..3546983ff6 100644
--- a/Modules/Core/include/mitkVtkInterpolationProperty.h
+++ b/Modules/Core/include/mitkVtkInterpolationProperty.h
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VTK_INTERPOLATION_PROPERTY__H_
#define _MITK_VTK_INTERPOLATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration vtkInterpolation. Valid values are
* (VTK constant/Id/string representation):
* VTK_FLAT/0/Flat, VTK_GOURAUD/1/Gouraud, VTK_PHONG/2/Phong
* Default is the Gouraud interpolation
*/
class MITKCORE_EXPORT VtkInterpolationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkInterpolationProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(VtkInterpolationProperty, const IdType&);
mitkNewMacro1Param(VtkInterpolationProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
* @returns the current interpolation as VTK constant.
*/
virtual int GetVtkInterpolation();
/**
* Sets the interpolation type to VTK_FLAT.
*/
virtual void SetInterpolationToFlat();
/**
* Sets the interpolation type to VTK_WIREFRAME.
*/
virtual void SetInterpolationToGouraud();
/**
* Sets the interpolation type to VTK_SURFACE.
*/
virtual void SetInterpolationToPhong();
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
VtkInterpolationProperty( );
/**
* Constructor. Sets the interpolation to the given value. If it is not
* valid, the interpolation is set to gouraud(1)
* @param value the integer representation of the interpolation
*/
VtkInterpolationProperty( const IdType& value );
/**
* Constructor. Sets the interpolation to the given value. If it is not
* valid, the representation is set to gouraud(1)
* @param value the string representation of the interpolation
*/
VtkInterpolationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
private:
// purposely not implemented
VtkInterpolationProperty& operator=(const VtkInterpolationProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkVtkLoggingAdapter.h b/Modules/Core/include/mitkVtkLoggingAdapter.h
index fde5430f0b..789f5b2bdc 100644
--- a/Modules/Core/include/mitkVtkLoggingAdapter.h
+++ b/Modules/Core/include/mitkVtkLoggingAdapter.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VtkLoggingAdapter_H_HEADER_INCLUDED
#define VtkLoggingAdapter_H_HEADER_INCLUDED
#include <MitkCoreExports.h>
#include <vtkOutputWindow.h>
#include <vtkSmartPointer.h>
namespace mitk {
/**
* @brief Adapter that overwrites the standard vtk logging output window and sends the logging messages to the MITK logging instead.
* @ingroup IO
*/
class MITKCORE_EXPORT VtkLoggingAdapter : public vtkOutputWindow
{
public:
static VtkLoggingAdapter* New();
/** @brief Initializes the logging adapter. Vtk logging
* messages are redirected to MITK logging afterwards.
*/
static void Initialize();
- virtual void DisplayText(const char* t);
+ virtual void DisplayText(const char* t) override;
- virtual void DisplayErrorText(const char *t);
+ virtual void DisplayErrorText(const char *t) override;
- virtual void DisplayWarningText(const char *t);
+ virtual void DisplayWarningText(const char *t) override;
- virtual void DisplayGenericWarningText(const char *t);
+ virtual void DisplayGenericWarningText(const char *t) override;
- virtual void DisplayDebugText(const char *t);
+ virtual void DisplayDebugText(const char *t) override;
protected:
};
} // namespace mitk
#endif /* VtkLoggingAdapter_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkVtkMapper.h b/Modules/Core/include/mitkVtkMapper.h
index 6bb8b77393..7bb0e0de77 100644
--- a/Modules/Core/include/mitkVtkMapper.h
+++ b/Modules/Core/include/mitkVtkMapper.h
@@ -1,188 +1,188 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// change number
#ifndef VTKMAPPER_H_HEADER_INCLUDED_C1C5453B
#define VTKMAPPER_H_HEADER_INCLUDED_C1C5453B
#include <MitkCoreExports.h>
#include "mitkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkDataNode.h"
#include "mitkVtkPropRenderer.h"
#include "mitkLocalStorageHandler.h"
#include "mitkIShaderRepository.h"
#include <mitkCoreServices.h>
#include <vtkProp3D.h>
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkLinearTransform.h>
#include <vtkMapper.h>
#include <vtkPropAssembly.h>
#include <vtkPolyDataMapper.h>
#include <vtkProp3DCollection.h>
class vtkProp;
class vtkProp3D;
class vtkActor;
namespace mitk {
/** \brief Base class of all Vtk Mappers in order to display primitives
* by exploiting Vtk functionality.
*
* Rendering of opaque, translucent or volumetric geometry and overlays
* is done in consecutive render passes.
*
* \ingroup Mapper
*/
class MITKCORE_EXPORT VtkMapper : public Mapper
{
public:
mitkClassMacro(VtkMapper,Mapper);
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) = 0;
/** \brief Re-issues all drawing commands required to describe
* the entire scene each time a new frame is required,
* regardless of actual changes.
*/
static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper);
/**
* \brief Returns whether this is an vtk-based mapper
* \deprecatedSince{2013_03} All mappers of superclass VTKMapper are vtk based, use a dynamic_cast instead
*/
- DEPRECATED( virtual bool IsVtkBased() const );
+ DEPRECATED( virtual bool IsVtkBased() const override );
/** \brief Determines which geometry should be rendered
* (opaque, translucent, volumetric, overlay)
* and calls the appropriate function.
*
* Called by mitk::VtkPropRenderer::Render
*/
- void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type);
+ void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) override;
/** \brief Checks visibility and renders the overlay */
virtual void MitkRenderOverlay(BaseRenderer* renderer);
/** \brief Checks visibility and renders untransparent geometry */
virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer);
/** \brief Checks visiblity and renders transparent geometry */
virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer);
/** \brief Checks visibility and renders volumes */
virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer);
/** \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 Set the vtkTransform of the m_Prop3D for
* the current time step of \a renderer
*
* Called by mitk::VtkPropRenderer::Update before rendering. This
* method will transform all actors (e.g. of an vtkAssembly) according
* the geometry.
*
* \warning This method transforms only props which derive
* from vtkProp3D. Make sure to use vtkAssembly, if you have
* multiple props. vtkPropAssembly does not work, since it derives
* from vtkProp.
*/
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
/**
* \brief Apply color and opacity properties read from the PropertyList
* \deprecatedSince{2013_03} Use ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor) instead
*/
DEPRECATED(inline virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer))
{
ApplyColorAndOpacityProperties(renderer, actor);
}
/**
* \brief SHADERTODO
*/
void ApplyShaderProperties( mitk::BaseRenderer* renderer);
/**
* \brief Apply color and opacity properties read from the PropertyList.
* Called by mapper subclasses.
*/
- virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor);
+ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor) override;
/**
* \brief Release vtk-based graphics resources that are being consumed by this mapper.
*
* Method called by mitk::VtkPropRenderer. The parameter renderer could be used to
* determine which graphic resources to release. The local storage is accessible
* by the parameter renderer. Should be overwritten in subclasses.
*/
virtual void ReleaseGraphicsResources(mitk::BaseRenderer* /*renderer*/)
{
}
class VtkMapperLocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
mitk::IShaderRepository::ShaderProgram::Pointer m_ShaderProgram;
itk::TimeStamp m_ModifiedTimeStamp;
VtkMapperLocalStorage()
{
IShaderRepository* shaderRepo = CoreServices::GetShaderRepository();
if (shaderRepo)
{
m_ShaderProgram = shaderRepo->CreateShaderProgram();
}
}
~VtkMapperLocalStorage()
{
}
};
mitk::LocalStorageHandler<VtkMapperLocalStorage> m_VtkMapperLSH;
protected:
/** constructor */
VtkMapper();
/** virtual destructor in order to derive from this class */
virtual ~VtkMapper();
private:
/** copy constructor */
VtkMapper( const VtkMapper &);
/** assignment operator */
VtkMapper & operator=(const VtkMapper &);
};
} // namespace mitk
#endif /* VTKMAPPER_H_HEADER_INCLUDED_C1C5453B */
diff --git a/Modules/Core/include/mitkVtkOverlay.h b/Modules/Core/include/mitkVtkOverlay.h
index a81545da71..4dcf1d7d4e 100644
--- a/Modules/Core/include/mitkVtkOverlay.h
+++ b/Modules/Core/include/mitkVtkOverlay.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VTKOVERLAY_H
#define VTKOVERLAY_H
#include <MitkCoreExports.h>
#include "mitkOverlay.h"
#include <vtkSmartPointer.h>
class vtkProp;
namespace mitk {
/**
* @brief The VtkOverlay class is the base for all Overlays which are using the VTK framework to render
*the elements.
*/
class MITKCORE_EXPORT VtkOverlay : public Overlay {
public:
mitkClassMacro(VtkOverlay, Overlay);
- void Update(BaseRenderer *renderer);
- void AddToBaseRenderer(BaseRenderer *renderer);
- void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer);
- void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer);
- void RemoveFromBaseRenderer(BaseRenderer *renderer);
+ void Update(BaseRenderer *renderer) override;
+ void AddToBaseRenderer(BaseRenderer *renderer) override;
+ void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
+ void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
+ void RemoveFromBaseRenderer(BaseRenderer *renderer) override;
/**
* \brief Paints the overlay.
*
* This method forces a paint of the overlay as it is configured at the moment.
* \warn Should only be used as alternative to the OverlayManager mechanism
* in GL-Mappers.
*/
void Paint( BaseRenderer* renderer );
protected:
/**
* @brief This method is implemented by the specific VTKOverlays in order to create the element as a vtkProp
* @param renderer
* @return The element that was created by the subclasses as a vtkProp.
*/
virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const = 0;
virtual void UpdateVtkOverlay(BaseRenderer *renderer) = 0;
/** \brief explicit constructor which disallows implicit conversions */
explicit VtkOverlay();
/** \brief virtual destructor in order to derive from this class */
virtual ~VtkOverlay();
private:
/** \brief copy constructor */
VtkOverlay( const VtkOverlay &);
/** \brief assignment operator */
VtkOverlay &operator=(const VtkOverlay &);
};
} // namespace mitk
#endif // OVERLAY_H
diff --git a/Modules/Core/include/mitkVtkOverlay2D.h b/Modules/Core/include/mitkVtkOverlay2D.h
index 204d2740e4..46f0ce24ff 100644
--- a/Modules/Core/include/mitkVtkOverlay2D.h
+++ b/Modules/Core/include/mitkVtkOverlay2D.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VTKOVERLAY2D_H
#define VTKOVERLAY2D_H
#include <MitkCoreExports.h>
#include "mitkVtkOverlay.h"
#include <vtkSmartPointer.h>
class vtkActor2D;
class vtkProperty2D;
namespace mitk {
/**
* @brief The VtkOverlay2D class is the basis for all VTK based Overlays which create
* a vtkActor2D element that will be drawn on the renderer.
*/
class MITKCORE_EXPORT VtkOverlay2D : public VtkOverlay {
public:
mitkClassMacro(VtkOverlay2D, VtkOverlay);
- virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const;
- virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds& bounds);
+ virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
+ virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds& bounds) override;
void SetPosition2D(const Point2D& position2D, mitk::BaseRenderer* renderer = NULL);
Point2D GetPosition2D(mitk::BaseRenderer* renderer = NULL) const;
void SetOffsetVector(const Point2D& OffsetVector, BaseRenderer* renderer = NULL);
Point2D GetOffsetVector(mitk::BaseRenderer* renderer = NULL) const;
protected:
- virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const override;
+ virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
virtual void UpdateVtkOverlay2D(BaseRenderer *renderer) = 0;
virtual vtkActor2D* GetVtkActor2D(BaseRenderer *renderer) const = 0;
/** \brief explicit constructor which disallows implicit conversions */
explicit VtkOverlay2D();
/** \brief virtual destructor in order to derive from this class */
virtual ~VtkOverlay2D();
private:
/** \brief copy constructor */
VtkOverlay2D( const VtkOverlay2D &);
/** \brief assignment operator */
VtkOverlay2D &operator=(const VtkOverlay2D &);
};
} // namespace mitk
#endif // VTKOVERLAY2D_H
diff --git a/Modules/Core/include/mitkVtkOverlay3D.h b/Modules/Core/include/mitkVtkOverlay3D.h
index 4b5ecfb07a..36603c9c7b 100644
--- a/Modules/Core/include/mitkVtkOverlay3D.h
+++ b/Modules/Core/include/mitkVtkOverlay3D.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VTKOVERLAY3D_H
#define VTKOVERLAY3D_H
#include <MitkCoreExports.h>
#include "mitkVtkOverlay.h"
#include <vtkSmartPointer.h>
namespace mitk {
/**
* @brief The VtkOverlay3D class is the basis for all VTK based Overlays which create
* any 3D element as a vtkProp that will be drawn on the renderer.
*/
class MITKCORE_EXPORT VtkOverlay3D : public VtkOverlay {
public:
void SetPosition3D(const Point3D& position3D, mitk::BaseRenderer* renderer = NULL);
Point3D GetPosition3D(mitk::BaseRenderer* renderer = NULL) const;
void SetOffsetVector(const Point3D& OffsetVector, mitk::BaseRenderer* renderer = NULL);
Point3D GetOffsetVector(mitk::BaseRenderer* renderer = NULL) const;
mitkClassMacro(VtkOverlay3D, VtkOverlay);
protected:
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) = 0;
+ virtual void UpdateVtkOverlay(BaseRenderer *renderer) override = 0;
/** \brief explicit constructor which disallows implicit conversions */
explicit VtkOverlay3D();
/** \brief virtual destructor in order to derive from this class */
virtual ~VtkOverlay3D();
private:
/** \brief copy constructor */
VtkOverlay3D( const VtkOverlay3D &);
/** \brief assignment operator */
VtkOverlay3D &operator=(const VtkOverlay3D &);
};
} // namespace mitk
#endif // OVERLAY_H
diff --git a/Modules/Core/include/mitkVtkPropRenderer.h b/Modules/Core/include/mitkVtkPropRenderer.h
index 79d68261b1..ac61c3d99b 100644
--- a/Modules/Core/include/mitkVtkPropRenderer.h
+++ b/Modules/Core/include/mitkVtkPropRenderer.h
@@ -1,268 +1,268 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkVtkPropRenderer_h
#define mitkVtkPropRenderer_h
#include <MitkCoreExports.h>
#include "mitkBaseRenderer.h"
#include <mitkDataStorage.h>
#include <mitkRenderingManager.h>
#include <itkCommand.h>
#include <map>
#include <utility>
class vtkRenderWindow;
class vtkLight;
class vtkLightKit;
class vtkWorldPointPicker;
class vtkPointPicker;
class vtkCellPicker;
class vtkTextActor;
class vtkTextProperty;
class vtkAssemblyPath;
namespace mitk
{
class Mapper;
/*!
\brief VtkPropRenderer
VtkPropRenderer organizes the MITK rendering process. The MITK rendering process is completely integrated into the VTK rendering pipeline.
The vtkMitkRenderProp is a custom vtkProp derived class, which implements the rendering interface between MITK and VTK. It redirects render() calls to the VtkPropRenderer, which is responsible for rendering of the datatreenodes.
VtkPropRenderer replaces the old OpenGLRenderer.
\sa rendering
\ingroup rendering
*/
class MITKCORE_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* );
mitkNewMacro4Param(VtkPropRenderer, const char*, vtkRenderWindow *, mitk::RenderingManager*, mitk::BaseRenderer::RenderingMode::Type );
typedef std::map<int,Mapper*> MappersMapType;
// Render - called by vtkMitkRenderProp, returns the number of props rendered
enum RenderType{Opaque,Translucent,Overlay,Volumetric};
int Render(RenderType type);
/** \brief This methods contains all method neceassary before a VTK Render() call */
virtual void PrepareRender();
// Active current renderwindow
virtual void MakeCurrent();
- virtual void SetDataStorage( mitk::DataStorage* storage ); ///< set the datastorage that will be used for rendering
+ virtual void SetDataStorage( mitk::DataStorage* storage ) override; ///< set the datastorage that will be used for rendering
- virtual void InitRenderer(vtkRenderWindow* renderwindow);
+ virtual void InitRenderer(vtkRenderWindow* renderwindow) override;
virtual void Update(mitk::DataNode* datatreenode);
- virtual void SetMapperID(const MapperSlotId mapperId);
+ virtual void SetMapperID(const MapperSlotId mapperId) override;
// Size
- virtual void InitSize(int w, int h);
- virtual void Resize(int w, int h);
+ virtual void InitSize(int w, int h) override;
+ virtual void Resize(int w, int h) override;
// Picking
enum PickingMode{ WorldPointPicking, PointPicking, CellPicking};
/** \brief Set the picking mode.
This method is used to set the picking mode for 3D object picking. The user can select one of
the three options WorldPointPicking, PointPicking and CellPicking. The first option uses the zBuffer
from graphics rendering, the second uses the 3D points from the closest surface mesh, and the third
option uses the cells of that mesh. The last option is the slowest, the first one the fastest.
However, the first option cannot use transparent data object and the tolerance of the picked position
to the selected point should be considered. PointPicking also need a tolerance around the picking
position to select the closest point in the mesh. The CellPicker performs very well, if the
foreground surface part (i.e. the surfacepart that is closest to the scene's cameras) needs to be
picked. */
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;
+ virtual void PickWorldPoint(const Point2D& displayPoint, Point3D& worldPoint) const override;
+ virtual mitk::DataNode *PickObject( const Point2D &displayPosition, Point3D &worldPosition ) const override;
/**
* @brief WriteSimpleText Write a text in a renderwindow.
*
* Writes some 2D text as overlay. Function returns an unique int Text_ID for each call, which can be used via the GetTextLabelProperty(int text_id) function
in order to get a vtkTextProperty. This property enables the setup of font, font size, etc.
*
* @deprecatedSince{next_release} Please use mitkTextOverlay2D instead.
* See mitkTextOverlay2DRenderingTest for an example.
*/
DEPRECATED(int WriteSimpleText(std::string text, double posX, double posY, double color1 = 0.0, double color2 = 1.0, double color3 = 0.0, float opacity = 1.0));
/**
* @brief CGetTextLabelProperty an be used in order to get a vtkTextProperty for
* a specific text_id. This property enables the setup of font, font size, etc.
* @param text_id the id of the text property.
* @deprecatedSince{next_release} Please use mitkTextOverlay2D instead.
* See mitkTextOverlay2DRenderingTest for an example.
*/
DEPRECATED(vtkTextProperty* GetTextLabelProperty(int text_id));
/** 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();
+ virtual bool SetWorldGeometryToDataStorageBounds() override;
/**
* \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();
int GetNumberOfPaths();
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, mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard );
virtual ~VtkPropRenderer();
- virtual void Update();
+ virtual void Update() override;
static void RenderingCallback(
vtkObject *caller, unsigned long eid, void *clientdata, void *calldata );
/**
\brief Convert display geometry coordinates to VTK coordinates.
For use within WriteSimpleText: the input is display geometry coordinates
but the text actor needs positions that fit in a specified viewport.
Conversion is done in this method.
*/
mitk::Point2D TransformOpenGLPointToViewport( mitk::Point2D point );
private:
/** \brief This method sets up the camera on the actor (e.g. an image) of all
* 2D vtkRenderWindows. The view is centered; zooming and panning of VTK are called inside.
*
* \image html ImageMapperdisplayGeometry.png
*
* Similar to the textured plane of an image
* (cf. void mitkImageVtkMapper2D::GeneratePlane(mitk::BaseRenderer* renderer,
* double planeBounds[6])), the mitkDisplayGeometry defines a view plane (or
* projection plane). This plane is used to set the camera parameters. The view plane
* center (VC) is important for camera positioning (cf. the image above).
*
* The following figure shows the combination of the textured plane and the view plane.
*
* \image html cameraPositioning.png
*
* The view plane center (VC) is the center of the textured plane (C) and the focal point
* (FP) at the same time. The FP defines the direction the camera faces. Since
* the textured plane is always in the XY-plane and orthographic projection is applied, the
* distance between camera and plane is theoretically irrelevant (because in the orthographic
* projection the center of projection is at infinity and the size of objects depends only on
* a scaling parameter). As a consequence, the direction of projection (DOP) is (0; 0; -1).
* The camera up vector is always defined as (0; 1; 0).
*
* \warning Due to a VTK clipping bug the distance between textured plane and camera is really huge.
* Otherwise, VTK would clip off some slices. Same applies for the clipping range size.
*
* \note The camera position is defined through the mitkDisplayGeometry.
* This facilitates zooming and panning, because the display
* geometry changes and the textured plane does not.
*
* \image html scaling.png
*
* The textured plane is scaled to fill the render window via
* camera->SetParallelScale( imageHeightInMM / 2). In the orthographic projection all extends,
* angles and sizes are preserved. Therefore, the image is scaled by one parameter which defines
* the size of the rendered image. A higher value will result in smaller images. In order to render
* just the whole image, the scale is set to half of the image height in worldcoordinates
* (cf. the picture above).
*
* For zooming purposes, a factor is computed as follows:
* factor = image height / display height (in worldcoordinates).
* When the display geometry gets smaller (zoom in), the factor becomes bigger. When the display
* geometry gets bigger (zoom out), the factor becomes smaller. The used VTK method
* camera->Zoom( factor ) also works with an inverse scale.
*/
void AdjustCameraToScene();
// prepare all mitk::mappers for rendering
void PrepareMapperQueue();
/** \brief Set parallel projection, remove the interactor and the lights of VTK. */
bool Initialize2DvtkCamera();
bool m_InitNeeded;
bool m_ResizeNeeded;
MapperSlotId m_CameraInitializedForMapperID;
// 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_CurrentWorldPlaneGeometryMapper;
vtkLightKit* m_LightKit;
// sorted list of mappers
MappersMapType m_MappersMap;
// rendering of text
vtkRenderer * m_TextRenderer;
typedef std::map<unsigned int,vtkTextActor*> TextMapType;
TextMapType m_TextCollection;
DataStorage::SetOfObjects::ConstPointer m_PickingObjects;
DataStorage::SetOfObjects::const_iterator m_PickingObjectsIterator;
};
} // namespace mitk
#endif /* mitkVtkPropRenderer_h */
diff --git a/Modules/Core/include/mitkVtkRepresentationProperty.h b/Modules/Core/include/mitkVtkRepresentationProperty.h
index db63ca54fb..3cc8cc3c5a 100644
--- a/Modules/Core/include/mitkVtkRepresentationProperty.h
+++ b/Modules/Core/include/mitkVtkRepresentationProperty.h
@@ -1,120 +1,120 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VTK_REPRESENTATION_PROPERTY__H_
#define _MITK_VTK_REPRESENTATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration vtkRepresentation. Valid values are
* (VTK constant/Id/string representation):
* VTK_POINTS/0/Points, VTK_WIREFRAME/1/Wireframe, VTK_SURFACE/2/Surface
* Default is the Surface representation
*/
class MITKCORE_EXPORT VtkRepresentationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkRepresentationProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(VtkRepresentationProperty, const IdType&);
mitkNewMacro1Param(VtkRepresentationProperty, const std::string&);
/**
* Returns the current representation value as defined by VTK constants.
* @returns the current representation as VTK constant.
*/
virtual int GetVtkRepresentation();
/**
* Sets the representation type to VTK_POINTS.
*/
virtual void SetRepresentationToPoints();
/**
* Sets the representation type to VTK_WIREFRAME.
*/
virtual void SetRepresentationToWireframe();
/**
* Sets the representation type to VTK_SURFACE.
*/
virtual void SetRepresentationToSurface();
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of Surface(2)
*/
VtkRepresentationProperty( );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Surface(2)
* @param value the integer representation of the representation
*/
VtkRepresentationProperty( const IdType& value );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Surface(2)
* @param value the string representation of the representation
*/
VtkRepresentationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid representation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRepresentationTypes();
private:
// purposely not implemented
VtkRepresentationProperty& operator=(const VtkRepresentationProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkVtkResliceInterpolationProperty.h b/Modules/Core/include/mitkVtkResliceInterpolationProperty.h
index 4f28968668..764f485c97 100644
--- a/Modules/Core/include/mitkVtkResliceInterpolationProperty.h
+++ b/Modules/Core/include/mitkVtkResliceInterpolationProperty.h
@@ -1,117 +1,117 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VTK_RESLICE_INTERPOLATION_PROPERTY__H_
#define _MITK_VTK_RESLICE_INTERPOLATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <vtkImageReslice.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration for reslice interpolation. Valid values are
* (VTK constant/Id/string representation):
* VTK_RESLICE_NEAREST, VTK_RESLICE_LINEAR, VTK_RESLICE_CUBIC
* Default is VTK_RESLICE_NEAREST
*/
class MITKCORE_EXPORT VtkResliceInterpolationProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkResliceInterpolationProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(VtkResliceInterpolationProperty, const IdType&);
mitkNewMacro1Param(VtkResliceInterpolationProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetInterpolation();
/**
* Sets the interpolation type to VTK_RESLICE_NEAREST.
*/
virtual void SetInterpolationToNearest();
/**
* Sets the interpolation type to VTK_RESLICE_LINEAR.
*/
virtual void SetInterpolationToLinear();
/**
* Sets the interpolation type to VTK_RESLICE_CUBIC.
*/
virtual void SetInterpolationToCubic();
using BaseProperty::operator=;
protected:
/** Sets reslice interpolation mode to default (VTK_RESLICE_NEAREST).
*/
VtkResliceInterpolationProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
VtkResliceInterpolationProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
VtkResliceInterpolationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
private:
// purposely not implemented
VtkResliceInterpolationProperty& operator=(const VtkResliceInterpolationProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkVtkScalarModeProperty.h b/Modules/Core/include/mitkVtkScalarModeProperty.h
index 7fcb45cd96..1b08acb10d 100644
--- a/Modules/Core/include/mitkVtkScalarModeProperty.h
+++ b/Modules/Core/include/mitkVtkScalarModeProperty.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VTK_SCALARMODE_PROPERTY__H_
#define _MITK_VTK_SCALARMODE_PROPERTY__H_
#include "mitkEnumerationProperty.h"
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration vtkInterpolation. Valid values are
* (VTK constant/Id/string representation):
* \li VTK_SCALAR_MODE_DEFAULT/0/Default,
* \li VTK_SCALAR_MODE_USE_POINT_DATA/1/PointData,
* \li VTK_SCALAR_MODE_USE_CELL_DATA/2/CellData
* \li VTK_SCALAR_MODE_USE_POINT_FIELD_DATA/3/PointFieldData
* \li VTK_SCALAR_MODE_USE_CELL_FIELD_DATA/4/CellFieldData
*/
class MITKCORE_EXPORT VtkScalarModeProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkScalarModeProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(VtkScalarModeProperty, const IdType&);
mitkNewMacro1Param(VtkScalarModeProperty, const std::string&);
/**
* Returns the current scalar mode value as defined by VTK constants.
* @returns the current scalar mode as VTK constant.
*/
virtual int GetVtkScalarMode();
virtual void SetScalarModeToDefault();
virtual void SetScalarModeToPointData();
virtual void SetScalarModeToCellData();
virtual void SetScalarModeToPointFieldData();
virtual void SetScalarModeToCellFieldData();
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of surface(2)
*/
VtkScalarModeProperty( );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the scalar mode is set to default (0).
* @param value the integer representation of the scalar mode
*/
VtkScalarModeProperty( const IdType& value );
/**
* \brief Sets the scalar mode to the given value. If it is not
* valid, the representation is set to default (0).
* @param value the string representation of the scalar mode
*/
VtkScalarModeProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid scalar mode types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
private:
// purposely not implemented
VtkScalarModeProperty& operator=(const VtkScalarModeProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif //_MITK_VTK_SCALARMODE_PROPERTY__H_
diff --git a/Modules/Core/include/mitkVtkVolumeRenderingProperty.h b/Modules/Core/include/mitkVtkVolumeRenderingProperty.h
index 7f62cdd039..9c825ad7f0 100644
--- a/Modules/Core/include/mitkVtkVolumeRenderingProperty.h
+++ b/Modules/Core/include/mitkVtkVolumeRenderingProperty.h
@@ -1,113 +1,113 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VTK_VOLUME_RENDERING_PROPERTY__H_
#define _MITK_VTK_VOLUME_RENDERING_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#define VTK_RAY_CAST_COMPOSITE_FUNCTION 1
#define VTK_VOLUME_RAY_CAST_MIP_FUNCTION 2
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration for volume rendering. Valid values are
* (VTK constant/Id/string representation):
* VTK_VOLUME_RAY_CAST_MIP_FUNCTION
* VTK_RAY_CAST_COMPOSITE_FUNCTION
* Default is NULL
*/
class MITKCORE_EXPORT VtkVolumeRenderingProperty : public EnumerationProperty
{
public:
mitkClassMacro( VtkVolumeRenderingProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(VtkVolumeRenderingProperty, const IdType&);
mitkNewMacro1Param(VtkVolumeRenderingProperty, const std::string&);
/**
* Returns the current volume rendering type
*/
virtual int GetRenderingType();
/**
* Sets the rendering type to VTK_VOLUME_RAY_CAST_MIP_FUNCTION
*/
virtual void SetRenderingTypeToMIP();
/**
* Sets the rendering type to VTK_RAY_CAST_COMPOSITE_FUNCTION
*/
virtual void SetRenderingTypeToComposite();
using BaseProperty::operator=;
protected:
/** Sets rendering type to default (VTK_RAY_CAST_COMPOSITE_FUNCTION).
*/
VtkVolumeRenderingProperty( );
/**
* Constructor. Sets rendering type to the given value.
*/
VtkVolumeRenderingProperty( const IdType& value );
/**
* Constructor. Sets rendering type to the given value.
*/
VtkVolumeRenderingProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid rendering types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingTypes();
private:
// purposely not implemented
VtkVolumeRenderingProperty& operator=(const VtkVolumeRenderingProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkVtkWidgetRendering.h b/Modules/Core/include/mitkVtkWidgetRendering.h
index 93a90de675..76b3c5e7d3 100644
--- a/Modules/Core/include/mitkVtkWidgetRendering.h
+++ b/Modules/Core/include/mitkVtkWidgetRendering.h
@@ -1,143 +1,143 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _vtk_Widget_Rendering_h_
#define _vtk_Widget_Rendering_h_
#include <mitkBaseData.h>
class vtkRenderer;
class vtkRenderWindow;
class vtkInteractorObserver;
namespace mitk {
class RenderWindow;
/**
* \brief Mechanism for rendering a vtkWidget in the foreground of a RenderWindow.
*
* To use this class, specify the vtkRenderWindow of the window into which the
* vtkWidget shall be placed, and set the vtkWidget using SetVtkWidget().
* After enabling the vtkWidget and calling Enable() of this class, the widget
* should be rendered.
*
* Note: this class only provides a basic mechanism for adding widget; all widget
* configuration such as placement, size, and en-/disabling of interaction
* mechanisms need to be done in the vtkWidget object.
*/
class MITKCORE_EXPORT VtkWidgetRendering : public BaseData
{
public:
mitkClassMacro( VtkWidgetRendering, BaseData );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Sets the renderwindow, in which the widget
* will be shown. Make sure, you have called this function
* before calling Enable()
*/
virtual void SetRenderWindow( vtkRenderWindow* renderWindow );
/**
* Enables drawing of the widget.
* If you want to disable it, call the Disable() function.
*/
virtual void Enable();
/**
* Disables drawing of the widget.
* If you want to enable it, call the Enable() function.
*/
virtual void Disable();
/**
* Checks, if the widget is currently
* enabled (visible)
*/
virtual bool IsEnabled();
/**
* Empty implementation, since the VtkWidgetRendering doesn't
* support the requested region concept
*/
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
/**
* Empty implementation, since the VtkWidgetRendering doesn't
* support the requested region concept
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
* Empty implementation, since the VtkWidgetRendering doesn't
* support the requested region concept
*/
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
/**
* Empty implementation, since the VtkWidgetRendering doesn't
* support the requested region concept
*/
- virtual void SetRequestedRegion( const itk::DataObject*);
+ virtual void SetRequestedRegion( const itk::DataObject*) override;
/**
* Returns the vtkRenderWindow, which is used
* for displaying the widget
*/
virtual vtkRenderWindow* GetRenderWindow();
/**
* Returns the renderer responsible for
* rendering the widget into the
* vtkRenderWindow
*/
virtual vtkRenderer* GetVtkRenderer();
/** Set the vtkWidget to be rendered */
void SetVtkWidget( vtkInteractorObserver *widget );
/** Get the vtkWidget to be rendered */
vtkInteractorObserver *GetVtkWidget() const;
protected:
/**
* Constructor
*/
VtkWidgetRendering();
/**
* Destructor
*/
~VtkWidgetRendering();
vtkRenderWindow* m_RenderWindow;
vtkRenderer* m_Renderer;
vtkInteractorObserver *m_VtkWidget;
bool m_IsEnabled;
};
} //end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkWeakPointerProperty.h b/Modules/Core/include/mitkWeakPointerProperty.h
index 4b059d553b..e5bc441700 100644
--- a/Modules/Core/include/mitkWeakPointerProperty.h
+++ b/Modules/Core/include/mitkWeakPointerProperty.h
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#define MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791
#include <MitkCoreExports.h>
#include "mitkBaseProperty.h"
#include "itkWeakPointer.h"
namespace mitk {
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
//##Documentation
//## @brief Property containing a smart-pointer
//##
//## @ingroup DataManagement
class MITKCORE_EXPORT WeakPointerProperty : public BaseProperty
{
public:
mitkClassMacro(WeakPointerProperty, BaseProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(WeakPointerProperty, itk::Object*);
virtual ~WeakPointerProperty();
typedef itk::WeakPointer<itk::Object> ValueType;
ValueType GetWeakPointer() const;
ValueType GetValue() const;
void SetWeakPointer(itk::Object* pointer);
void SetValue(const ValueType& value);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator=;
protected:
itk::WeakPointer<itk::Object> m_WeakPointer;
WeakPointerProperty(const WeakPointerProperty&);
WeakPointerProperty(itk::Object* pointer = 0);
private:
// purposely not implemented
WeakPointerProperty& operator=(const WeakPointerProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKWEAKPOINTERPROPERTY_H_HEADER_INCLUDED_C126B791 */
diff --git a/Modules/Core/include/mitkXML2EventParser.h b/Modules/Core/include/mitkXML2EventParser.h
index 6467e71a46..786dd6f0a0 100755
--- a/Modules/Core/include/mitkXML2EventParser.h
+++ b/Modules/Core/include/mitkXML2EventParser.h
@@ -1,105 +1,105 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkXML2EventParser_h
#define mitkXML2EventParser_h
#include <MitkCoreExports.h>
#include "mitkPropertyList.h"
#include <vtkXMLParser.h>
#include "mitkInteractionEvent.h"
namespace us {
class Module;
}
namespace mitk
{
/**
* \class InteractionEventList
* \brief Generates a list of InteractionEvents based on an XML file-
*
* @sa EventRecorder
* @ingroup Interaction
**/
class MITKCORE_EXPORT XML2EventParser : public vtkXMLParser
{
public:
/**
* @brief Construct an InteractionEventList object based on a XML configuration file.
*
* Uses the specified resource file containing an XML event configuration to
* construct an EventConfig object. If the resource is invalid, the created
* EventConfig object will also be invalid.
*
* @param filename The resource name relative to the Interactions resource folder.
* @param module
*/
XML2EventParser(const std::string& filename, const us::Module* module = NULL);
/**
* @brief Construct an InteractionEventList object based on a XML configuration file.
*
* Uses the specified istream refering to a file containing an XML event configuration to
* construct an EventConfig object. If the resource is invalid, the created
* EventConfig object will also be invalid.
*
* @param inputStream std::ifstream to XML configuration file
*/
XML2EventParser(std::istream &inputStream);
typedef std::vector<mitk::InteractionEvent::Pointer> EventContainerType;
EventContainerType GetInteractions()
{
return m_InteractionList;
}
~XML2EventParser(){};
protected:
/**
* @brief Derived from XMLReader
**/
- void StartElement(const char* elementName, const char **atts);
+ void StartElement(const char* elementName, const char **atts) override;
/**
* @brief Derived from XMLReader
**/
- void EndElement(const char* elementName);
+ void EndElement(const char* elementName) override;
std::string ReadXMLStringAttribute(const std::string& name, const char** atts);
bool ReadXMLBooleanAttribute(const std::string& name, const char** atts);
private:
PropertyList::Pointer m_EventPropertyList;
EventContainerType m_InteractionList;
};
} // namespace mitk
#endif /* mitkStateMachineConfig_h */
diff --git a/Modules/Core/include/vtkMitkLevelWindowFilter.h b/Modules/Core/include/vtkMitkLevelWindowFilter.h
index 4cec00320e..38e3af0157 100644
--- a/Modules/Core/include/vtkMitkLevelWindowFilter.h
+++ b/Modules/Core/include/vtkMitkLevelWindowFilter.h
@@ -1,104 +1,104 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkMitkLevelWindowFilter_h
#define __vtkMitkLevelWindowFilter_h
class vtkScalarsToColors;
class vtkPiecewiseFunction;
#include <vtkImageData.h>
#include <vtkThreadedImageAlgorithm.h>
#include <MitkCoreExports.h>
/** Documentation
* \brief Applies the grayvalue or color/opacity level window to scalar or RGB(A) images.
*
* This filter is used to apply the color level window to RGB images (e.g.
* diffusion tensor images). Therefore, the RGB channels are converted to
* the HSI color space, where the level window can be applied. Afterwards,
* the HSI values transformed back to the RGB space.
*
* The filter is also able to apply an opacity level window to RGBA images.
*
* \ingroup Renderer
*/
class MITKCORE_EXPORT vtkMitkLevelWindowFilter : public vtkThreadedImageAlgorithm
{
public:
vtkTypeMacro(vtkMitkLevelWindowFilter,vtkThreadedImageAlgorithm);
static vtkMitkLevelWindowFilter *New();
- virtual unsigned long int GetMTime();
+ virtual unsigned long int GetMTime() override;
/** \brief Get the lookup table for the RGB level window */
vtkScalarsToColors* GetLookupTable();
/** \brief Set the lookup table for the RGB level window */
void SetLookupTable(vtkScalarsToColors *lookupTable);
/** \brief Get the piecewise function used to map scalar to alpha component value (only
* used when the lookupTable is a vtkColorTransferFunction) */
vtkPiecewiseFunction* GetOpacityPiecewiseFunction()
{ return m_OpacityFunction; }
/** \brief Set the piecewise function used to map scalar to alpha component value (only
* used when the lookupTable is a vtkColorTransferFunction) */
void SetOpacityPiecewiseFunction(vtkPiecewiseFunction *opacityFunction);
/** \brief Get/Set the lower window opacity for the alpha level window */
void SetMinOpacity(double minOpacity);
inline double GetMinOpacity() const;
/** \brief Get/Set the upper window opacity for the alpha level window */
void SetMaxOpacity(double maxOpacity);
inline double GetMaxOpacity() const;
/** \brief Set clipping bounds for the opaque part of the resliced 2d image */
void SetClippingBounds(double*);
protected:
/** Default constructor. */
vtkMitkLevelWindowFilter();
/** Default deconstructor. */
~vtkMitkLevelWindowFilter();
/** \brief Method for threaded execution of the filter.
* \param *inData: The input.
* \param *outData: The output of the filter.
* \param extent: Specifies the region of the image to be updated inside this thread.
* It is a six-component array of the form (xmin, xmax, ymin, ymax, zmin, zmax).
* \param id: The thread id.
*/
- void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,int extent[6], int id);
+ void ThreadedExecute(vtkImageData *inData, vtkImageData *outData,int extent[6], int id) override;
// /** Standard VTK filter method to apply the filter. See VTK documentation.*/
- int RequestInformation(vtkInformation* request,vtkInformationVector** inputVector, vtkInformationVector* outputVector);
+ int RequestInformation(vtkInformation* request,vtkInformationVector** inputVector, vtkInformationVector* outputVector) override;
// /** Standard VTK filter method to apply the filter. See VTK documentation. Not used at the moment.*/
// void ExecuteInformation(vtkImageData *vtkNotUsed(inData), vtkImageData *vtkNotUsed(outData));
private:
/** m_LookupTable contains the lookup table for the RGB level window.*/
vtkScalarsToColors* m_LookupTable;
/** The transfer function to map the scalar to alpha (4th component of the RGBA output value) */
vtkPiecewiseFunction* m_OpacityFunction;
/** m_MinOpacity contains the lower bound for the alpha level window.*/
double m_MinOpacity;
/** m_MaxOpacity contains the upper bound for the alpha level window.*/
double m_MaxOpacity;
double m_ClippingBounds[4];
};
#endif
diff --git a/Modules/Core/include/vtkMitkRectangleProp.h b/Modules/Core/include/vtkMitkRectangleProp.h
index 4fdd2d659a..4b34c30482 100644
--- a/Modules/Core/include/vtkMitkRectangleProp.h
+++ b/Modules/Core/include/vtkMitkRectangleProp.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef vtkMitkRectangleProp_h
#define vtkMitkRectangleProp_h
#include <MitkCoreExports.h>
#include <vtkRenderWindow.h>
#include <vtkSmartPointer.h>
#include <vtkProp.h>
class vtkActor2D;
class vtkPolyData;
/**
* @brief The vtkMitkRectangleProp2 class Renders a rectangle into a renderwindow as a frame.
*
* This class is a replacement for the deprecated vtkMitkRectangleProp, which
* used to render the same effect with pure OpenGL.
*/
class MITKCORE_EXPORT vtkMitkRectangleProp : public vtkProp
{
public:
static vtkMitkRectangleProp* New();
vtkTypeMacro(vtkMitkRectangleProp,vtkProp);
/**
* @brief RenderOverlay Calls the render method of the actor and renders it.
* @param viewport viewport of the renderwindow.
* @return
*/
- int RenderOverlay(vtkViewport* viewport);
+ int RenderOverlay(vtkViewport* viewport) override;
/**
* @brief SetRenderWindow Set the renderwindow.
* @param renWin
*/
void SetRenderWindow(vtkSmartPointer<vtkRenderWindow> renWin);
/**
* @brief SetColor Set the color of the rectangle.
* @param col1 red
* @param col2 green
* @param col3 blue
*/
void SetColor(float col1, float col2, float col3);
protected:
vtkMitkRectangleProp();
virtual ~vtkMitkRectangleProp();
/**
* @brief m_RenderWindow renderwindow to add the rectangle to.
*/
vtkSmartPointer<vtkRenderWindow> m_RenderWindow;
/**
* @brief m_Color color of the rectangle.
*/
float m_Color[3];
/**
* @brief CreateRectangle internal helper to fill a vtkPolydata with a rectangle.
*/
void CreateRectangle();
/**
* @brief m_PolyData holds the rectangle.
*/
vtkSmartPointer<vtkPolyData> m_PolyData;
/**
* @brief m_RectangleActor actor to render the rectangle.
*/
vtkSmartPointer<vtkActor2D> m_RectangleActor;
/**
* @brief IDs of the corner points (the corners of the renderwindow).
*/
vtkIdType m_BottomLeft, m_BottomRight, m_TopRight, m_TopLeft;
};
#endif /* vtkMitkRectangleProp_h */
diff --git a/Modules/Core/include/vtkMitkRenderProp.h b/Modules/Core/include/vtkMitkRenderProp.h
index 832d7c50af..e8d7850a9d 100644
--- a/Modules/Core/include/vtkMitkRenderProp.h
+++ b/Modules/Core/include/vtkMitkRenderProp.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VTKMITKRENDERPROP_H_HEADER_INCLUDED_C1C53723
#define VTKMITKRENDERPROP_H_HEADER_INCLUDED_C1C53723
#include "vtkProp.h"
#include "mitkVtkPropRenderer.h"
/*!
\brief vtkMitkRenderProp
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.
\sa rendering
\ingroup rendering
*/
class MITKCORE_EXPORT vtkMitkRenderProp : public vtkProp
{
public:
static vtkMitkRenderProp *New();
vtkTypeMacro(vtkMitkRenderProp,vtkProp);
void SetPropRenderer(mitk::VtkPropRenderer::Pointer propRenderer);
- int RenderOpaqueGeometry(vtkViewport* viewport);
+ int RenderOpaqueGeometry(vtkViewport* viewport) override;
- int RenderOverlay(vtkViewport* viewport);
+ int RenderOverlay(vtkViewport* viewport) override;
- double *GetBounds();
+ double *GetBounds() override;
- void ReleaseGraphicsResources(vtkWindow* window);
+ void ReleaseGraphicsResources(vtkWindow* window) override;
/**
* \brief Used by vtkPointPicker/vtkPicker.
* This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
*/
- virtual void InitPathTraversal();
+ virtual void InitPathTraversal() override;
/**
* \brief Used by vtkPointPicker/vtkPicker.
* This will query a list of all objects in MITK and provide every vtk based mapper to the picker.
*/
- virtual vtkAssemblyPath* GetNextPath();
+ virtual vtkAssemblyPath* GetNextPath() override;
- virtual int GetNumberOfPaths();
+ virtual int GetNumberOfPaths() override;
//BUG (#1551) added method for depth peeling support
- virtual int HasTranslucentPolygonalGeometry();
- virtual int RenderTranslucentPolygonalGeometry( vtkViewport *);
- virtual int RenderVolumetricGeometry( vtkViewport *);
+ virtual int HasTranslucentPolygonalGeometry() override;
+ virtual int RenderTranslucentPolygonalGeometry( vtkViewport *) override;
+ virtual int RenderVolumetricGeometry( vtkViewport *) override;
protected:
vtkMitkRenderProp();
~vtkMitkRenderProp();
mitk::VtkPropRenderer::Pointer m_VtkPropRenderer;
};
#endif /* VTKMITKRENDERPROP_H_HEADER_INCLUDED_C1C53723 */
diff --git a/Modules/Core/include/vtkMitkThickSlicesFilter.h b/Modules/Core/include/vtkMitkThickSlicesFilter.h
index b82d3a0fd9..77e2fd9109 100644
--- a/Modules/Core/include/vtkMitkThickSlicesFilter.h
+++ b/Modules/Core/include/vtkMitkThickSlicesFilter.h
@@ -1,110 +1,110 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// .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 <MitkCoreExports.h>
#include "vtkThreadedImageAlgorithm.h"
class MITKCORE_EXPORT vtkMitkThickSlicesFilter : public vtkThreadedImageAlgorithm
{
public:
static vtkMitkThickSlicesFilter *New();
vtkTypeMacro(vtkMitkThickSlicesFilter,vtkThreadedImageAlgorithm);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// 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,
MINIP,
MEAN
};
protected:
vtkMitkThickSlicesFilter();
~vtkMitkThickSlicesFilter() {};
int HandleBoundaries;
int Dimensionality;
virtual int RequestInformation (vtkInformation*,
vtkInformationVector**,
- vtkInformationVector*);
+ vtkInformationVector*) override;
virtual int RequestUpdateExtent(vtkInformation*,
vtkInformationVector**,
- vtkInformationVector*);
+ vtkInformationVector*) override;
virtual int RequestData(vtkInformation*,
vtkInformationVector**,
- vtkInformationVector*);
+ vtkInformationVector*) override;
void ThreadedRequestData(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*,
vtkImageData*** inData,
vtkImageData** outData,
int outExt[6],
- int threadId);
+ int threadId) override;
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/Modules/Core/include/vtkNeverTranslucentTexture.h b/Modules/Core/include/vtkNeverTranslucentTexture.h
index 77e7d7c1a5..eafb5afb8f 100644
--- a/Modules/Core/include/vtkNeverTranslucentTexture.h
+++ b/Modules/Core/include/vtkNeverTranslucentTexture.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkNeverTranslucentTexture_h
#define mitkNeverTranslucentTexture_h
#include <MitkCoreExports.h>
#include <vtkOpenGLTexture.h>
#include <vtkObjectFactory.h>
/**
\brief VTK Fix to speed up our image rendering.
The way we render images while changing the contrast via level/window
extremely slows down rendering.
The cause of this slowdown is that VTK asks a texture
(via a call to IsTranslucent) if it is translucent.
When the texture refers to a lookup table this question
is answered in a most expensive way: pushing every pixel
through the lookup table to see whether it would render
translucent.
We can speed this up extremely by always answering NO.
2D Image rendering in the context of MITK is still correct.
This class is injected into the VTK system by registering
it with vtkObjectFactory as a replacement for vtkTexture.
We chose vtkOpenGLTexture as super class, because it seems
that the other texture super class is deprecated:
http://www.cmake.org/Wiki/VTK:How_I_mangled_Mesa
\sa ImageVtkMapper2D
*/
/* NOT exported, this is a 2D image mapper helper */
class MITKCORE_EXPORT vtkNeverTranslucentTexture : public vtkOpenGLTexture
{
public:
static vtkNeverTranslucentTexture* New();
vtkTypeMacro(vtkNeverTranslucentTexture, vtkTexture);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
/**
\brief The FIX (see class description).
VTK Description: Is this Texture Translucent?
Returns false (0) if the texture is either fully opaque or has
only fully transparent pixels and fully opaque pixels and the
Interpolate flag is turn off.
*/
- virtual int IsTranslucent();
+ virtual int IsTranslucent() override;
protected:
vtkNeverTranslucentTexture();
private:
vtkNeverTranslucentTexture(const vtkNeverTranslucentTexture&); // Not implemented.
void operator=(const vtkNeverTranslucentTexture&); // Not implemented.
};
/**
\brief Factory for vtkNeverTranslucentTexture (see this class!).
Registered in CoreActivator to replace all instances of vtkTexture
with vtkNeverTranslucentTexture.
Required to make rendering of images during level/window operations
acceptably fast.
*/
class vtkNeverTranslucentTextureFactory : public vtkObjectFactory
{
public:
vtkNeverTranslucentTextureFactory();
static vtkNeverTranslucentTextureFactory* New();
- virtual const char* GetVTKSourceVersion();
- const char* GetDescription();
+ virtual const char* GetVTKSourceVersion() override;
+ const char* GetDescription() override;
protected:
vtkNeverTranslucentTextureFactory(const vtkNeverTranslucentTextureFactory&);
void operator=(const vtkNeverTranslucentTextureFactory&);
};
#endif
diff --git a/Modules/Core/src/IO/mitkAbstractFileReader.cpp b/Modules/Core/src/IO/mitkAbstractFileReader.cpp
index 5bedb1b4d0..6c0fe3973c 100644
--- a/Modules/Core/src/IO/mitkAbstractFileReader.cpp
+++ b/Modules/Core/src/IO/mitkAbstractFileReader.cpp
@@ -1,414 +1,414 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkAbstractFileReader.h>
#include <mitkIOUtil.h>
#include <mitkCustomMimeType.h>
#include <mitkStandaloneDataStorage.h>
#include <mitkFileReaderWriterBase.h>
#include <usGetModuleContext.h>
#include <usModuleContext.h>
#include <usPrototypeServiceFactory.h>
#include <itksys/SystemTools.hxx>
#include <fstream>
namespace mitk {
AbstractFileReader::InputStream::InputStream(IFileReader* reader, std::ios_base::openmode mode)
: std::istream(NULL)
, m_Stream(NULL)
{
std::istream* stream = reader->GetInputStream();
if (stream)
{
this->init(stream->rdbuf());
}
else
{
m_Stream = new std::ifstream(reader->GetInputLocation().c_str(), mode);
this->init(m_Stream->rdbuf());
}
}
AbstractFileReader::InputStream::~InputStream()
{
delete m_Stream;
}
class AbstractFileReader::Impl : public FileReaderWriterBase
{
public:
Impl()
: FileReaderWriterBase()
, m_Stream(NULL)
, m_PrototypeFactory(NULL)
{}
Impl(const Impl& other)
: FileReaderWriterBase(other)
, m_Stream(NULL)
, m_PrototypeFactory(NULL)
{}
std::string m_Location;
std::string m_TmpFile;
std::istream* m_Stream;
us::PrototypeServiceFactory* m_PrototypeFactory;
us::ServiceRegistration<IFileReader> m_Reg;
};
AbstractFileReader::AbstractFileReader()
: d(new Impl)
{
}
AbstractFileReader::~AbstractFileReader()
{
UnregisterService();
delete d->m_PrototypeFactory;
if (!d->m_TmpFile.empty())
{
std::remove(d->m_TmpFile.c_str());
}
}
AbstractFileReader::AbstractFileReader(const AbstractFileReader& other)
: IFileReader(),
d(new Impl(*other.d.get()))
{
}
AbstractFileReader::AbstractFileReader(const CustomMimeType& mimeType, const std::string& description)
: d(new Impl)
{
d->SetMimeType(mimeType);
d->SetDescription(description);
}
////////////////////// Reading /////////////////////////
std::vector<BaseData::Pointer> AbstractFileReader::Read()
{
std::vector<BaseData::Pointer> result;
DataStorage::Pointer ds = StandaloneDataStorage::New().GetPointer();
this->Read(*ds);
DataStorage::SetOfObjects::ConstPointer dataNodes = ds->GetAll();
for (DataStorage::SetOfObjects::ConstIterator iter = dataNodes->Begin(),
iterEnd = dataNodes->End(); iter != iterEnd; ++iter)
{
result.push_back(iter.Value()->GetData());
}
return result;
}
DataStorage::SetOfObjects::Pointer AbstractFileReader::Read(DataStorage& ds)
{
DataStorage::SetOfObjects::Pointer result = DataStorage::SetOfObjects::New();
std::vector<BaseData::Pointer> data = this->Read();
for (std::vector<BaseData::Pointer>::iterator iter = data.begin();
iter != data.end(); ++iter)
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(*iter);
this->SetDefaultDataNodeProperties(node, this->GetInputLocation());
ds.Add(node);
result->InsertElement(result->Size(), node);
}
return result;
}
IFileReader::ConfidenceLevel AbstractFileReader::GetConfidenceLevel() const
{
if (d->m_Stream)
{
if (*d->m_Stream) return Supported;
}
else
{
if (itksys::SystemTools::FileExists(this->GetInputLocation().c_str(), true))
{
return Supported;
}
}
return Unsupported;
}
//////////// µS Registration & Properties //////////////
us::ServiceRegistration<IFileReader> AbstractFileReader::RegisterService(us::ModuleContext* context)
{
if (d->m_PrototypeFactory) return us::ServiceRegistration<IFileReader>();
if(context == NULL)
{
context = us::GetModuleContext();
}
d->RegisterMimeType(context);
if (this->GetMimeType()->GetName().empty())
{
MITK_WARN << "Not registering reader due to empty MIME type.";
return us::ServiceRegistration<IFileReader>();
}
struct PrototypeFactory : public us::PrototypeServiceFactory
{
AbstractFileReader* const m_Prototype;
PrototypeFactory(AbstractFileReader* prototype)
: m_Prototype(prototype)
{}
- us::InterfaceMap GetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/)
+ us::InterfaceMap GetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/) override
{
return us::MakeInterfaceMap<IFileReader>(m_Prototype->Clone());
}
void UngetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/,
- const us::InterfaceMap& service)
+ const us::InterfaceMap& service) override
{
delete us::ExtractInterface<IFileReader>(service);
}
};
d->m_PrototypeFactory = new PrototypeFactory(this);
us::ServiceProperties props = this->GetServiceProperties();
d->m_Reg = context->RegisterService<IFileReader>(d->m_PrototypeFactory, props);
return d->m_Reg;
}
void AbstractFileReader::UnregisterService()
{
try
{
d->m_Reg.Unregister();
}
catch (const std::exception&)
{}
}
us::ServiceProperties AbstractFileReader::GetServiceProperties() const
{
us::ServiceProperties result;
result[IFileReader::PROP_DESCRIPTION()] = this->GetDescription();
result[IFileReader::PROP_MIMETYPE()] = this->GetMimeType()->GetName();
result[us::ServiceConstants::SERVICE_RANKING()] = this->GetRanking();
return result;
}
us::ServiceRegistration<CustomMimeType> AbstractFileReader::RegisterMimeType(us::ModuleContext* context)
{
return d->RegisterMimeType(context);
}
void AbstractFileReader::SetMimeType(const CustomMimeType& mimeType)
{
d->SetMimeType(mimeType);
}
void AbstractFileReader::SetDescription(const std::string& description)
{
d->SetDescription(description);
}
void AbstractFileReader::SetRanking(int ranking)
{
d->SetRanking(ranking);
}
int AbstractFileReader::GetRanking() const
{
return d->GetRanking();
}
std::string AbstractFileReader::GetLocalFileName() const
{
std::string localFileName;
if (d->m_Stream)
{
if (d->m_TmpFile.empty())
{
// write the stream contents to temporary file
std::string ext = itksys::SystemTools::GetFilenameExtension(this->GetInputLocation());
std::ofstream tmpStream;
localFileName = mitk::IOUtil::CreateTemporaryFile(tmpStream, std::ios_base::out | std::ios_base::trunc | std::ios_base::binary,
"XXXXXX" + ext);
tmpStream << d->m_Stream->rdbuf();
d->m_TmpFile = localFileName;
}
else
{
localFileName = d->m_TmpFile;
}
}
else
{
localFileName = d->m_Location;
}
return localFileName;
}
//////////////////////// Options ///////////////////////
void AbstractFileReader::SetDefaultOptions(const IFileReader::Options& defaultOptions)
{
d->SetDefaultOptions(defaultOptions);
}
IFileReader::Options AbstractFileReader::GetDefaultOptions() const
{
return d->GetDefaultOptions();
}
void AbstractFileReader::SetInput(const std::string& location)
{
d->m_Location = location;
d->m_Stream = NULL;
}
void AbstractFileReader::SetInput(const std::string& location, std::istream* is)
{
if (d->m_Stream != is && !d->m_TmpFile.empty())
{
std::remove(d->m_TmpFile.c_str());
d->m_TmpFile.clear();
}
d->m_Location = location;
d->m_Stream = is;
}
std::string AbstractFileReader::GetInputLocation() const
{
return d->m_Location;
}
std::istream*AbstractFileReader::GetInputStream() const
{
return d->m_Stream;
}
MimeType AbstractFileReader::GetRegisteredMimeType() const
{
return d->GetRegisteredMimeType();
}
IFileReader::Options AbstractFileReader::GetOptions() const
{
return d->GetOptions();
}
us::Any AbstractFileReader::GetOption(const std::string& name) const
{
return d->GetOption(name);
}
void AbstractFileReader::SetOptions(const Options& options)
{
d->SetOptions(options);
}
void AbstractFileReader::SetOption(const std::string& name, const us::Any& value)
{
d->SetOption(name, value);
}
////////////////// MISC //////////////////
void AbstractFileReader::AddProgressCallback(const ProgressCallback& callback)
{
d->AddProgressCallback(callback);
}
void AbstractFileReader::RemoveProgressCallback(const ProgressCallback& callback)
{
d->RemoveProgressCallback(callback);
}
////////////////// µS related Getters //////////////////
const CustomMimeType* AbstractFileReader::GetMimeType() const
{
return d->GetMimeType();
}
void AbstractFileReader::SetMimeTypePrefix(const std::string& prefix)
{
d->SetMimeTypePrefix(prefix);
}
std::string AbstractFileReader::GetMimeTypePrefix() const
{
return d->GetMimeTypePrefix();
}
std::string AbstractFileReader::GetDescription() const
{
return d->GetDescription();
}
void AbstractFileReader::SetDefaultDataNodeProperties(DataNode* node, const std::string& filePath)
{
// path
if (!filePath.empty())
{
mitk::StringProperty::Pointer pathProp = mitk::StringProperty::New( itksys::SystemTools::GetFilenamePath(filePath) );
node->SetProperty(StringProperty::PATH, pathProp);
}
// name already defined?
mitk::StringProperty::Pointer nameProp = dynamic_cast<mitk::StringProperty*>(node->GetProperty("name"));
if(nameProp.IsNull() || (strcmp(nameProp->GetValue(),"No Name!")==0))
{
// name already defined in BaseData
mitk::StringProperty::Pointer baseDataNameProp = dynamic_cast<mitk::StringProperty*>(node->GetData()->GetProperty("name").GetPointer() );
if(baseDataNameProp.IsNull() || (strcmp(baseDataNameProp->GetValue(),"No Name!")==0))
{
// name neither defined in node, nor in BaseData -> name = filebasename;
nameProp = mitk::StringProperty::New( this->GetRegisteredMimeType().GetFilenameWithoutExtension(filePath) );
node->SetProperty("name", nameProp);
}
else
{
// name defined in BaseData!
nameProp = mitk::StringProperty::New(baseDataNameProp->GetValue());
node->SetProperty("name", nameProp);
}
}
// visibility
if(!node->GetProperty("visible"))
{
node->SetVisibility(true);
}
}
}
diff --git a/Modules/Core/src/IO/mitkAbstractFileWriter.cpp b/Modules/Core/src/IO/mitkAbstractFileWriter.cpp
index a5d4e541dd..f8e6b63a5d 100644
--- a/Modules/Core/src/IO/mitkAbstractFileWriter.cpp
+++ b/Modules/Core/src/IO/mitkAbstractFileWriter.cpp
@@ -1,395 +1,395 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkAbstractFileWriter.h>
#include <mitkBaseData.h>
#include <mitkIOUtil.h>
#include <mitkCustomMimeType.h>
#include <mitkExceptionMacro.h>
#include <mitkFileReaderWriterBase.h>
#include <usGetModuleContext.h>
#include <usModuleContext.h>
#include <usPrototypeServiceFactory.h>
#include <itksys/SystemTools.hxx>
#include <fstream>
namespace mitk {
struct AbstractFileWriter::LocalFile::Impl
{
Impl(const std::string& location, std::ostream* os)
: m_Location(location)
, m_Stream(os)
{}
std::string m_Location;
std::string m_TmpFileName;
std::ostream* m_Stream;
};
AbstractFileWriter::LocalFile::LocalFile(IFileWriter *writer)
: d(new Impl(writer->GetOutputLocation(), writer->GetOutputStream()))
{
}
AbstractFileWriter::LocalFile::~LocalFile()
{
if (d->m_Stream && !d->m_TmpFileName.empty())
{
std::ifstream ifs(d->m_TmpFileName.c_str(), std::ios_base::binary);
*d->m_Stream << ifs.rdbuf();
d->m_Stream->flush();
ifs.close();
std::remove(d->m_TmpFileName.c_str());
}
}
std::string AbstractFileWriter::LocalFile::GetFileName()
{
if (d->m_Stream == NULL)
{
return d->m_Location;
}
else if (d->m_TmpFileName.empty())
{
std::string ext = itksys::SystemTools::GetFilenameExtension(d->m_Location);
d->m_TmpFileName = IOUtil::CreateTemporaryFile("XXXXXX" + ext);
}
return d->m_TmpFileName;
}
AbstractFileWriter::OutputStream::OutputStream(IFileWriter* writer, std::ios_base::openmode mode)
: std::ostream(NULL)
, m_Stream(NULL)
{
std::ostream* stream = writer->GetOutputStream();
if (stream)
{
this->init(stream->rdbuf());
}
else
{
m_Stream = new std::ofstream(writer->GetOutputLocation().c_str(), mode);
this->init(m_Stream->rdbuf());
}
}
AbstractFileWriter::OutputStream::~OutputStream()
{
delete m_Stream;
}
class AbstractFileWriter::Impl : public FileReaderWriterBase
{
public:
Impl()
: FileReaderWriterBase()
, m_BaseData(NULL)
, m_Stream(NULL)
, m_PrototypeFactory(NULL)
{}
Impl(const Impl& other)
: FileReaderWriterBase(other)
, m_BaseDataType(other.m_BaseDataType)
, m_BaseData(NULL)
, m_Stream(NULL)
, m_PrototypeFactory(NULL)
{}
std::string m_BaseDataType;
const BaseData* m_BaseData;
std::string m_Location;
std::ostream* m_Stream;
us::PrototypeServiceFactory* m_PrototypeFactory;
us::ServiceRegistration<IFileWriter> m_Reg;
};
void AbstractFileWriter::SetInput(const BaseData* data)
{
d->m_BaseData = data;
}
const BaseData* AbstractFileWriter::GetInput() const
{
return d->m_BaseData;
}
void AbstractFileWriter::SetOutputLocation(const std::string& location)
{
d->m_Location = location;
d->m_Stream = NULL;
}
std::string AbstractFileWriter::GetOutputLocation() const
{
return d->m_Location;
}
void AbstractFileWriter::SetOutputStream(const std::string& location, std::ostream* os)
{
d->m_Location = location;
d->m_Stream = os;
}
std::ostream* AbstractFileWriter::GetOutputStream() const
{
return d->m_Stream;
}
AbstractFileWriter::~AbstractFileWriter()
{
UnregisterService();
delete d->m_PrototypeFactory;
}
AbstractFileWriter::AbstractFileWriter(const AbstractFileWriter& other)
: IFileWriter(),
d(new Impl(*other.d.get()))
{
}
AbstractFileWriter::AbstractFileWriter(const std::string& baseDataType)
: d(new Impl)
{
d->m_BaseDataType = baseDataType;
}
AbstractFileWriter::AbstractFileWriter(const std::string& baseDataType, const CustomMimeType& mimeType,
const std::string& description)
: d(new Impl)
{
d->m_BaseDataType = baseDataType;
d->SetMimeType(mimeType);
d->SetDescription(description);
}
////////////////////// Writing /////////////////////////
IFileWriter::ConfidenceLevel AbstractFileWriter::GetConfidenceLevel() const
{
if (d->m_BaseData == NULL) return Unsupported;
std::vector<std::string> classHierarchy = d->m_BaseData->GetClassHierarchy();
if (std::find(classHierarchy.begin(), classHierarchy.end(), d->m_BaseDataType) ==
classHierarchy.end())
{
return Unsupported;
}
return Supported;
}
MimeType AbstractFileWriter::GetRegisteredMimeType() const
{
return d->GetRegisteredMimeType();
}
//////////// µS Registration & Properties //////////////
us::ServiceRegistration<IFileWriter> AbstractFileWriter::RegisterService(us::ModuleContext* context)
{
if (d->m_PrototypeFactory) return us::ServiceRegistration<IFileWriter>();
if(context == NULL)
{
context = us::GetModuleContext();
}
d->RegisterMimeType(context);
if (this->GetMimeType()->GetName().empty())
{
MITK_WARN << "Not registering writer due to empty MIME type.";
return us::ServiceRegistration<IFileWriter>();
}
struct PrototypeFactory : public us::PrototypeServiceFactory
{
AbstractFileWriter* const m_Prototype;
PrototypeFactory(AbstractFileWriter* prototype)
: m_Prototype(prototype)
{}
- us::InterfaceMap GetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/)
+ us::InterfaceMap GetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/) override
{
return us::MakeInterfaceMap<IFileWriter>(m_Prototype->Clone());
}
void UngetService(us::Module* /*module*/, const us::ServiceRegistrationBase& /*registration*/,
- const us::InterfaceMap& service)
+ const us::InterfaceMap& service) override
{
delete us::ExtractInterface<IFileWriter>(service);
}
};
d->m_PrototypeFactory = new PrototypeFactory(this);
us::ServiceProperties props = this->GetServiceProperties();
d->m_Reg = context->RegisterService<IFileWriter>(d->m_PrototypeFactory, props);
return d->m_Reg;
}
void AbstractFileWriter::UnregisterService()
{
try
{
d->m_Reg.Unregister();
}
catch (const std::exception&)
{}
}
us::ServiceProperties AbstractFileWriter::GetServiceProperties() const
{
us::ServiceProperties result;
result[IFileWriter::PROP_DESCRIPTION()] = this->GetDescription();
result[IFileWriter::PROP_MIMETYPE()] = this->GetMimeType()->GetName();
result[IFileWriter::PROP_BASEDATA_TYPE()] = d->m_BaseDataType;
result[us::ServiceConstants::SERVICE_RANKING()] = this->GetRanking();
// for (IFileWriter::OptionList::const_iterator it = d->m_Options.begin(); it != d->m_Options.end(); ++it)
// {
// result[it->first] = std::string("true");
// }
return result;
}
const CustomMimeType* AbstractFileWriter::GetMimeType() const
{
return d->GetMimeType();
}
void AbstractFileWriter::SetMimeTypePrefix(const std::string& prefix)
{
d->SetMimeTypePrefix(prefix);
}
std::string AbstractFileWriter::GetMimeTypePrefix() const
{
return d->GetMimeTypePrefix();
}
us::ServiceRegistration<CustomMimeType> AbstractFileWriter::RegisterMimeType(us::ModuleContext* context)
{
return d->RegisterMimeType(context);
}
void AbstractFileWriter::SetMimeType(const CustomMimeType& mimeType)
{
d->SetMimeType(mimeType);
}
void AbstractFileWriter::SetRanking(int ranking)
{
d->SetRanking(ranking);
}
//////////////////////// Options ///////////////////////
void AbstractFileWriter::SetDefaultOptions(const IFileWriter::Options& defaultOptions)
{
d->SetDefaultOptions(defaultOptions);
}
IFileWriter::Options AbstractFileWriter::GetDefaultOptions() const
{
return d->GetDefaultOptions();
}
IFileWriter::Options AbstractFileWriter::GetOptions() const
{
return d->GetOptions();
}
us::Any AbstractFileWriter::GetOption(const std::string& name) const
{
return d->GetOption(name);
}
void AbstractFileWriter::SetOption(const std::string& name, const us::Any& value)
{
d->SetOption(name, value);
}
void AbstractFileWriter::SetOptions(const Options& options)
{
d->SetOptions(options);
}
////////////////// MISC //////////////////
void AbstractFileWriter::AddProgressCallback(const ProgressCallback& callback)
{
d->AddProgressCallback(callback);
}
void AbstractFileWriter::RemoveProgressCallback(const ProgressCallback& callback)
{
d->RemoveProgressCallback(callback);
}
////////////////// µS related Getters //////////////////
int AbstractFileWriter::GetRanking() const
{
return d->GetRanking();
}
void AbstractFileWriter::SetBaseDataType(const std::string& baseDataType)
{
d->m_BaseDataType = baseDataType;
}
std::string AbstractFileWriter::GetDescription() const
{
return d->GetDescription();
}
std::string AbstractFileWriter::GetBaseDataType() const
{
return d->m_BaseDataType;
}
void AbstractFileWriter::ValidateOutputLocation() const
{
if (this->GetOutputStream() == NULL)
{
// check if a file name is set and if we can write to it
const std::string fileName = this->GetOutputLocation();
if (fileName.empty())
{
mitkThrow() << "No output location or stream specified";
}
}
}
void AbstractFileWriter::SetDescription(const std::string& description)
{
d->SetDescription(description);
}
}
diff --git a/Modules/Core/src/IO/mitkDicomSeriesReaderService.h b/Modules/Core/src/IO/mitkDicomSeriesReaderService.h
index ef86a0255a..55b727b7a1 100644
--- a/Modules/Core/src/IO/mitkDicomSeriesReaderService.h
+++ b/Modules/Core/src/IO/mitkDicomSeriesReaderService.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDICOMSERIESREADERSERVICE_H
#define MITKDICOMSERIESREADERSERVICE_H
#include <mitkAbstractFileReader.h>
namespace mitk {
class DicomSeriesReaderService : public AbstractFileReader
{
public:
DicomSeriesReaderService();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
- virtual DicomSeriesReaderService* Clone() const;
+ virtual DicomSeriesReaderService* Clone() const override;
};
}
#endif // MITKDICOMSERIESREADERSERVICE_H
diff --git a/Modules/Core/src/IO/mitkIOUtil.cpp b/Modules/Core/src/IO/mitkIOUtil.cpp
index a5a01f2842..dbce68ea97 100644
--- a/Modules/Core/src/IO/mitkIOUtil.cpp
+++ b/Modules/Core/src/IO/mitkIOUtil.cpp
@@ -1,1111 +1,1111 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkIOUtil.h"
#include <usGetModuleContext.h>
#include <usModuleContext.h>
#include <usLDAPProp.h>
#include <mitkStandaloneDataStorage.h>
#include <mitkIDataNodeReader.h>
#include <mitkProgressBar.h>
#include <mitkExceptionMacro.h>
#include <mitkCoreObjectFactory.h>
#include <mitkFileReaderRegistry.h>
#include <mitkFileWriterRegistry.h>
#include <mitkCoreServices.h>
#include <mitkIMimeTypeProvider.h>
#include <usModuleResource.h>
#include <usModuleResourceStream.h>
//ITK
#include <itksys/SystemTools.hxx>
//VTK
#include <vtkPolyData.h>
#include <vtkTriangleFilter.h>
#include <vtkSmartPointer.h>
#include <cerrno>
#include <cstdlib>
static std::string GetLastErrorStr()
{
#ifdef US_PLATFORM_POSIX
return std::string(strerror(errno));
#else
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );
std::string errMsg((LPCTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
return errMsg;
#endif
}
#ifdef US_PLATFORM_WINDOWS
#include <io.h>
#include <direct.h>
// make the posix flags point to the obsolte bsd types on windows
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#else
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/stat.h>
static const char validLetters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
// A cross-platform version of the mkstemps function
static int mkstemps_compat(char* tmpl, int suffixlen)
{
static unsigned long long value = 0;
int savedErrno = errno;
// Lower bound on the number of temporary files to attempt to generate.
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
const unsigned int attempts = TMP_MAX;
#else
const unsigned int attempts = ATTEMPTS_MIN;
#endif
const int len = strlen(tmpl);
if ((len - suffixlen) < 6 || strncmp(&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
{
errno = EINVAL;
return -1;
}
/* This is where the Xs start. */
char* XXXXXX = &tmpl[len - 6 - suffixlen];
/* Get some more or less random data. */
#ifdef US_PLATFORM_WINDOWS
{
SYSTEMTIME stNow;
FILETIME ftNow;
// get system time
GetSystemTime(&stNow);
stNow.wMilliseconds = 500;
if (!SystemTimeToFileTime(&stNow, &ftNow))
{
errno = -1;
return -1;
}
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(ftNow.dwHighDateTime) << 32)
| static_cast<unsigned long long>(ftNow.dwLowDateTime));
value = randomTimeBits ^ static_cast<unsigned long long>(GetCurrentThreadId());
}
#else
{
struct timeval tv;
gettimeofday(&tv, NULL);
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(tv.tv_usec) << 32)
| static_cast<unsigned long long>(tv.tv_sec));
value = randomTimeBits ^ static_cast<unsigned long long>(getpid());
}
#endif
for (unsigned int count = 0; count < attempts; value += 7777, ++count)
{
unsigned long long v = value;
/* Fill in the random bits. */
XXXXXX[0] = validLetters[v % 62];
v /= 62;
XXXXXX[1] = validLetters[v % 62];
v /= 62;
XXXXXX[2] = validLetters[v % 62];
v /= 62;
XXXXXX[3] = validLetters[v % 62];
v /= 62;
XXXXXX[4] = validLetters[v % 62];
v /= 62;
XXXXXX[5] = validLetters[v % 62];
int fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
if (fd >= 0)
{
errno = savedErrno;
return fd;
}
else if (errno != EEXIST)
{
return -1;
}
}
/* We got out of the loop because we ran out of combinations to try. */
errno = EEXIST;
return -1;
}
// A cross-platform version of the POSIX mkdtemp function
static char* mkdtemps_compat(char* tmpl, int suffixlen)
{
static unsigned long long value = 0;
int savedErrno = errno;
// Lower bound on the number of temporary dirs to attempt to generate.
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary dir. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
const unsigned int attempts = TMP_MAX;
#else
const unsigned int attempts = ATTEMPTS_MIN;
#endif
const int len = strlen(tmpl);
if ((len - suffixlen) < 6 || strncmp(&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
{
errno = EINVAL;
return NULL;
}
/* This is where the Xs start. */
char* XXXXXX = &tmpl[len - 6 - suffixlen];
/* Get some more or less random data. */
#ifdef US_PLATFORM_WINDOWS
{
SYSTEMTIME stNow;
FILETIME ftNow;
// get system time
GetSystemTime(&stNow);
stNow.wMilliseconds = 500;
if (!SystemTimeToFileTime(&stNow, &ftNow))
{
errno = -1;
return NULL;
}
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(ftNow.dwHighDateTime) << 32)
| static_cast<unsigned long long>(ftNow.dwLowDateTime));
value = randomTimeBits ^ static_cast<unsigned long long>(GetCurrentThreadId());
}
#else
{
struct timeval tv;
gettimeofday(&tv, NULL);
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(tv.tv_usec) << 32)
| static_cast<unsigned long long>(tv.tv_sec));
value = randomTimeBits ^ static_cast<unsigned long long>(getpid());
}
#endif
unsigned int count = 0;
for (; count < attempts; value += 7777, ++count)
{
unsigned long long v = value;
/* Fill in the random bits. */
XXXXXX[0] = validLetters[v % 62];
v /= 62;
XXXXXX[1] = validLetters[v % 62];
v /= 62;
XXXXXX[2] = validLetters[v % 62];
v /= 62;
XXXXXX[3] = validLetters[v % 62];
v /= 62;
XXXXXX[4] = validLetters[v % 62];
v /= 62;
XXXXXX[5] = validLetters[v % 62];
#ifdef US_PLATFORM_WINDOWS
int fd = _mkdir (tmpl); //, _S_IREAD | _S_IWRITE | _S_IEXEC);
#else
int fd = mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
#endif
if (fd >= 0)
{
errno = savedErrno;
return tmpl;
}
else if (errno != EEXIST)
{
return NULL;
}
}
/* We got out of the loop because we ran out of combinations to try. */
errno = EEXIST;
return NULL;
}
//#endif
//**************************************************************
// mitk::IOUtil method definitions
namespace mitk {
const std::string IOUtil::DEFAULTIMAGEEXTENSION = ".nrrd";
const std::string IOUtil::DEFAULTSURFACEEXTENSION = ".stl";
const std::string IOUtil::DEFAULTPOINTSETEXTENSION = ".mps";
struct IOUtil::Impl
{
struct FixedReaderOptionsFunctor : public ReaderOptionsFunctorBase
{
FixedReaderOptionsFunctor(const IFileReader::Options& options)
: m_Options(options)
{}
- virtual bool operator()(LoadInfo& loadInfo)
+ virtual bool operator()(LoadInfo& loadInfo) override
{
IFileReader* reader = loadInfo.m_ReaderSelector.GetSelected().GetReader();
if (reader)
{
reader->SetOptions(m_Options);
}
return false;
}
private:
const IFileReader::Options& m_Options;
};
struct FixedWriterOptionsFunctor : public WriterOptionsFunctorBase
{
FixedWriterOptionsFunctor(const IFileReader::Options& options)
: m_Options(options)
{}
- virtual bool operator()(SaveInfo& saveInfo)
+ virtual bool operator()(SaveInfo& saveInfo) override
{
IFileWriter* writer = saveInfo.m_WriterSelector.GetSelected().GetWriter();
if (writer)
{
writer->SetOptions(m_Options);
}
return false;
}
private:
const IFileWriter::Options& m_Options;
};
static BaseData::Pointer LoadBaseDataFromFile(const std::string& path);
static void SetDefaultDataNodeProperties(mitk::DataNode* node, const std::string& filePath = std::string());
};
#ifdef US_PLATFORM_WINDOWS
std::string IOUtil::GetProgramPath()
{
char path[512];
std::size_t index = std::string(path, GetModuleFileName(NULL, path, 512)).find_last_of('\\');
return std::string(path, index);
}
#elif defined(US_PLATFORM_APPLE)
#include <mach-o/dyld.h>
std::string IOUtil::GetProgramPath()
{
char path[512];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0)
{
std::size_t index = std::string(path).find_last_of('/');
std::string strPath = std::string(path, index);
//const char* execPath = strPath.c_str();
//mitk::StandardFileLocations::GetInstance()->AddDirectoryForSearch(execPath,false);
return strPath;
}
return std::string();
}
#else
#include <sys/types.h>
#include <unistd.h>
#include <sstream>
std::string IOUtil::GetProgramPath()
{
std::stringstream ss;
ss << "/proc/" << getpid() << "/exe";
char proc[512] = {0};
ssize_t ch = readlink(ss.str().c_str(), proc, 512);
if (ch == -1) return std::string();
std::size_t index = std::string(proc).find_last_of('/');
return std::string(proc, index);
}
#endif
char IOUtil::GetDirectorySeparator()
{
#ifdef US_PLATFORM_WINDOWS
return '\\';
#else
return '/';
#endif
}
std::string IOUtil::GetTempPath()
{
static std::string result;
if (result.empty())
{
#ifdef US_PLATFORM_WINDOWS
char tempPathTestBuffer[1];
DWORD bufferLength = ::GetTempPath(1, tempPathTestBuffer);
if (bufferLength == 0)
{
mitkThrow() << GetLastErrorStr();
}
std::vector<char> tempPath(bufferLength);
bufferLength = ::GetTempPath(bufferLength, &tempPath[0]);
if (bufferLength == 0)
{
mitkThrow() << GetLastErrorStr();
}
result.assign(tempPath.begin(), tempPath.begin() + static_cast<std::size_t>(bufferLength));
#else
result = "/tmp/";
#endif
}
return result;
}
std::string IOUtil::CreateTemporaryFile(const std::string& templateName, std::string path)
{
ofstream tmpOutputStream;
std::string returnValue = CreateTemporaryFile(tmpOutputStream,templateName,path);
tmpOutputStream.close();
return returnValue;
}
std::string IOUtil::CreateTemporaryFile(std::ofstream& f, const std::string& templateName, std::string path)
{
return CreateTemporaryFile(f, std::ios_base::out | std::ios_base::trunc, templateName, path);
}
std::string IOUtil::CreateTemporaryFile(std::ofstream& f, std::ios_base::openmode mode, const std::string& templateName, std::string path)
{
if (path.empty())
{
path = GetTempPath();
}
path += GetDirectorySeparator() + templateName;
std::vector<char> dst_path(path.begin(), path.end());
dst_path.push_back('\0');
std::size_t lastX = path.find_last_of('X');
std::size_t firstX = path.find_last_not_of('X', lastX);
int firstNonX = firstX == std::string::npos ? - 1 : firstX - 1;
while (lastX != std::string::npos && (lastX - firstNonX) < 6)
{
lastX = path.find_last_of('X', firstX);
firstX = path.find_last_not_of('X', lastX);
firstNonX = firstX == std::string::npos ? - 1 : firstX - 1;
}
std::size_t suffixlen = lastX == std::string::npos ? path.size() : path.size() - lastX - 1;
int fd = mkstemps_compat(&dst_path[0], suffixlen);
if(fd != -1)
{
path.assign(dst_path.begin(), dst_path.end() - 1);
f.open(path.c_str(), mode | std::ios_base::out | std::ios_base::trunc);
close(fd);
}
else
{
mitkThrow() << "Creating temporary file " << &dst_path[0] << " failed: " << GetLastErrorStr();
}
return path;
}
std::string IOUtil::CreateTemporaryDirectory(const std::string& templateName, std::string path)
{
if (path.empty())
{
path = GetTempPath();
}
path += GetDirectorySeparator() + templateName;
std::vector<char> dst_path(path.begin(), path.end());
dst_path.push_back('\0');
std::size_t lastX = path.find_last_of('X');
std::size_t firstX = path.find_last_not_of('X', lastX);
int firstNonX = firstX == std::string::npos ? - 1 : firstX - 1;
while (lastX != std::string::npos && (lastX - firstNonX) < 6)
{
lastX = path.find_last_of('X', firstX);
firstX = path.find_last_not_of('X', lastX);
firstNonX = firstX == std::string::npos ? - 1 : firstX - 1;
}
std::size_t suffixlen = lastX == std::string::npos ? path.size() : path.size() - lastX - 1;
if(mkdtemps_compat(&dst_path[0], suffixlen) == NULL)
{
mitkThrow() << "Creating temporary directory " << &dst_path[0] << " failed: " << GetLastErrorStr();
}
path.assign(dst_path.begin(), dst_path.end() - 1);
return path;
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::string& path, DataStorage& storage)
{
std::vector<std::string> paths;
paths.push_back(path);
return Load(paths, storage);
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::string& path,
const IFileReader::Options& options,
DataStorage& storage)
{
std::vector<LoadInfo> loadInfos;
loadInfos.push_back(LoadInfo(path));
DataStorage::SetOfObjects::Pointer nodeResult = DataStorage::SetOfObjects::New();
Impl::FixedReaderOptionsFunctor optionsCallback(options);
std::string errMsg = Load(loadInfos, nodeResult, &storage, &optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return nodeResult;
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::string& path)
{
std::vector<std::string> paths;
paths.push_back(path);
return Load(paths);
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::string& path, const IFileReader::Options& options)
{
std::vector<LoadInfo> loadInfos;
loadInfos.push_back(LoadInfo(path));
Impl::FixedReaderOptionsFunctor optionsCallback(options);
std::string errMsg = Load(loadInfos, NULL, NULL, &optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return loadInfos.front().m_Output;
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::vector<std::string>& paths, DataStorage& storage)
{
DataStorage::SetOfObjects::Pointer nodeResult = DataStorage::SetOfObjects::New();
std::vector<LoadInfo> loadInfos;
for (std::vector<std::string>::const_iterator iter = paths.begin(), iterEnd = paths.end();
iter != iterEnd; ++iter)
{
LoadInfo loadInfo(*iter);
loadInfos.push_back(loadInfo);
}
std::string errMsg = Load(loadInfos, nodeResult, &storage, NULL);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return nodeResult;
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::vector<std::string>& paths)
{
std::vector<BaseData::Pointer> result;
std::vector<LoadInfo> loadInfos;
for (std::vector<std::string>::const_iterator iter = paths.begin(), iterEnd = paths.end();
iter != iterEnd; ++iter)
{
LoadInfo loadInfo(*iter);
loadInfos.push_back(loadInfo);
}
std::string errMsg = Load(loadInfos, NULL, NULL, NULL);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
for (std::vector<LoadInfo>::const_iterator iter = loadInfos.begin(), iterEnd = loadInfos.end();
iter != iterEnd; ++iter)
{
result.insert(result.end(), iter->m_Output.begin(), iter->m_Output.end());
}
return result;
}
int IOUtil::LoadFiles(const std::vector<std::string> &fileNames, DataStorage& ds)
{
return static_cast<int>(Load(fileNames, ds)->Size());
}
DataStorage::Pointer IOUtil::LoadFiles(const std::vector<std::string>& fileNames)
{
mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
Load(fileNames, *ds);
return ds.GetPointer();
}
BaseData::Pointer IOUtil::LoadBaseData(const std::string& path)
{
return Impl::LoadBaseDataFromFile(path);
}
BaseData::Pointer IOUtil::Impl::LoadBaseDataFromFile(const std::string& path)
{
std::vector<BaseData::Pointer> baseDataList = Load(path);
// The Load(path) call above should throw an exception if nothing could be loaded
assert(!baseDataList.empty());
return baseDataList.front();
}
DataNode::Pointer IOUtil::LoadDataNode(const std::string& path)
{
BaseData::Pointer baseData = Impl::LoadBaseDataFromFile(path);
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(baseData);
Impl::SetDefaultDataNodeProperties(node, path);
return node;
}
Image::Pointer IOUtil::LoadImage(const std::string& path)
{
BaseData::Pointer baseData = Impl::LoadBaseDataFromFile(path);
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(baseData.GetPointer());
if(image.IsNull())
{
mitkThrow() << path << " is not a mitk::Image but a " << baseData->GetNameOfClass();
}
return image;
}
Surface::Pointer IOUtil::LoadSurface(const std::string& path)
{
BaseData::Pointer baseData = Impl::LoadBaseDataFromFile(path);
mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(baseData.GetPointer());
if(surface.IsNull())
{
mitkThrow() << path << " is not a mitk::Surface but a " << baseData->GetNameOfClass();
}
return surface;
}
PointSet::Pointer IOUtil::LoadPointSet(const std::string& path)
{
BaseData::Pointer baseData = Impl::LoadBaseDataFromFile(path);
mitk::PointSet::Pointer pointset = dynamic_cast<mitk::PointSet*>(baseData.GetPointer());
if(pointset.IsNull())
{
mitkThrow() << path << " is not a mitk::PointSet but a " << baseData->GetNameOfClass();
}
return pointset;
}
std::string IOUtil::Load(std::vector<LoadInfo>& loadInfos,
DataStorage::SetOfObjects* nodeResult, DataStorage* ds,
ReaderOptionsFunctorBase* optionsCallback)
{
if (loadInfos.empty())
{
return "No input files given";
}
int filesToRead = loadInfos.size();
mitk::ProgressBar::GetInstance()->AddStepsToDo(2*filesToRead);
std::string errMsg;
std::map<std::string, FileReaderSelector::Item> usedReaderItems;
for(std::vector<LoadInfo>::iterator infoIter = loadInfos.begin(),
infoIterEnd = loadInfos.end(); infoIter != infoIterEnd; ++infoIter)
{
std::vector<FileReaderSelector::Item> readers = infoIter->m_ReaderSelector.Get();
if (readers.empty())
{
if (!itksys::SystemTools::FileExists(infoIter->m_Path.c_str()))
{
errMsg += "File '" + infoIter->m_Path + "' does not exist\n";
}
else
{
errMsg += "No reader available for '" + infoIter->m_Path + "'\n";
}
continue;
}
bool callOptionsCallback = readers.size() > 1 || !readers.front().GetReader()->GetOptions().empty();
// check if we already used a reader which should be re-used
std::vector<MimeType> currMimeTypes = infoIter->m_ReaderSelector.GetMimeTypes();
std::string selectedMimeType;
for (std::vector<MimeType>::const_iterator mimeTypeIter = currMimeTypes.begin(),
mimeTypeIterEnd = currMimeTypes.end(); mimeTypeIter != mimeTypeIterEnd; ++mimeTypeIter)
{
std::map<std::string, FileReaderSelector::Item>::const_iterator oldSelectedItemIter =
usedReaderItems.find(mimeTypeIter->GetName());
if (oldSelectedItemIter != usedReaderItems.end())
{
// we found an already used item for a mime-type which is contained
// in the current reader set, check all current readers if there service
// id equals the old reader
for (std::vector<FileReaderSelector::Item>::const_iterator currReaderItem = readers.begin(),
currReaderItemEnd = readers.end(); currReaderItem != currReaderItemEnd; ++currReaderItem)
{
if (currReaderItem->GetMimeType().GetName() == mimeTypeIter->GetName() &&
currReaderItem->GetServiceId() == oldSelectedItemIter->second.GetServiceId() &&
currReaderItem->GetConfidenceLevel() >= oldSelectedItemIter->second.GetConfidenceLevel())
{
// okay, we used the same reader already, re-use its options
selectedMimeType = mimeTypeIter->GetName();
callOptionsCallback = false;
infoIter->m_ReaderSelector.Select(oldSelectedItemIter->second.GetServiceId());
infoIter->m_ReaderSelector.GetSelected().GetReader()->SetOptions(
oldSelectedItemIter->second.GetReader()->GetOptions());
break;
}
}
if (!selectedMimeType.empty()) break;
}
}
if (callOptionsCallback && optionsCallback)
{
callOptionsCallback = (*optionsCallback)(*infoIter);
if (!callOptionsCallback && !infoIter->m_Cancel)
{
usedReaderItems.erase(selectedMimeType);
FileReaderSelector::Item selectedItem = infoIter->m_ReaderSelector.GetSelected();
usedReaderItems.insert(std::make_pair(selectedItem.GetMimeType().GetName(),
selectedItem));
}
}
if (infoIter->m_Cancel)
{
errMsg += "Reading operation(s) cancelled.";
break;
}
IFileReader* reader = infoIter->m_ReaderSelector.GetSelected().GetReader();
if (reader == NULL)
{
errMsg += "Unexpected NULL reader.";
break;
}
// Do the actual reading
try
{
DataStorage::SetOfObjects::Pointer nodes;
if (ds != NULL)
{
nodes = reader->Read(*ds);
}
else
{
nodes = DataStorage::SetOfObjects::New();
std::vector<mitk::BaseData::Pointer> baseData = reader->Read();
for (std::vector<mitk::BaseData::Pointer>::iterator iter = baseData.begin();
iter != baseData.end(); ++iter)
{
if (iter->IsNotNull())
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(*iter);
nodes->InsertElement(nodes->Size(), node);
}
}
}
for (DataStorage::SetOfObjects::ConstIterator nodeIter = nodes->Begin(),
nodeIterEnd = nodes->End(); nodeIter != nodeIterEnd; ++nodeIter)
{
const mitk::DataNode::Pointer& node = nodeIter->Value();
mitk::BaseData::Pointer data = node->GetData();
if (data.IsNull())
{
continue;
}
mitk::StringProperty::Pointer pathProp = mitk::StringProperty::New(infoIter->m_Path);
data->SetProperty("path", pathProp);
infoIter->m_Output.push_back(data);
if (nodeResult)
{
nodeResult->push_back(nodeIter->Value());
}
}
if (infoIter->m_Output.empty() || (nodeResult && nodeResult->Size() == 0))
{
errMsg += "Unknown read error occurred reading " + infoIter->m_Path;
}
}
catch (const std::exception& e)
{
errMsg += "Exception occured when reading file " + infoIter->m_Path + ":\n" + e.what() + "\n\n";
}
mitk::ProgressBar::GetInstance()->Progress(2);
--filesToRead;
}
if (!errMsg.empty())
{
MITK_ERROR << errMsg;
}
mitk::ProgressBar::GetInstance()->Progress(2*filesToRead);
return errMsg;
}
std::vector<BaseData::Pointer> IOUtil::Load(const us::ModuleResource &usResource, std::ios_base::openmode mode)
{
us::ModuleResourceStream resStream(usResource,mode);
mitk::CoreServicePointer<mitk::IMimeTypeProvider> mimeTypeProvider(mitk::CoreServices::GetMimeTypeProvider());
std::vector<MimeType> mimetypes = mimeTypeProvider->GetMimeTypesForFile(usResource.GetResourcePath());
std::vector<mitk::BaseData::Pointer> data;
if(mimetypes.empty())
{
mitkThrow() << "No mimetype for resource stream: "<< usResource.GetResourcePath();
return data;
}
mitk::FileReaderRegistry fileReaderRegistry;
std::vector<us::ServiceReference<IFileReader> > refs = fileReaderRegistry.GetReferences(mimetypes[0]);
if(refs.empty())
{
mitkThrow() << "No reader available for resource stream: "<< usResource.GetResourcePath();
return data;
}
mitk::IFileReader* reader = fileReaderRegistry.GetReader(refs[0]);
reader->SetInput(usResource.GetResourcePath(),&resStream);
data = reader->Read();
return data;
}
void IOUtil::Save(const BaseData* data, const std::string& path)
{
Save(data, path, IFileWriter::Options());
}
void IOUtil::Save(const BaseData* data, const std::string& path, const IFileWriter::Options& options)
{
Save(data, std::string(), path, options);
}
void IOUtil::Save(const BaseData* data, const std::string& mimeType, const std::string& path,
bool addExtension)
{
Save(data, mimeType, path, IFileWriter::Options(), addExtension);
}
void IOUtil::Save(const BaseData* data, const std::string& mimeType, const std::string& path,
const IFileWriter::Options& options, bool addExtension)
{
if ((data == NULL) || (data->IsEmpty()))
mitkThrow() << "BaseData cannotbe null or empty for save methods in IOUtil.h.";
std::string errMsg;
if (options.empty())
{
errMsg = Save(data, mimeType, path, NULL, addExtension);
}
else
{
Impl::FixedWriterOptionsFunctor optionsCallback(options);
errMsg = Save(data, mimeType, path, &optionsCallback, addExtension);
}
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
}
void IOUtil::Save(std::vector<IOUtil::SaveInfo>& saveInfos)
{
std::string errMsg = Save(saveInfos, NULL);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
}
bool IOUtil::SaveImage(mitk::Image::Pointer image, const std::string& path)
{
Save(image, path);
return true;
}
bool IOUtil::SaveSurface(Surface::Pointer surface, const std::string& path)
{
Save(surface, path);
return true;
}
bool IOUtil::SavePointSet(PointSet::Pointer pointset, const std::string& path)
{
Save(pointset, path);
return true;
}
bool IOUtil::SaveBaseData( mitk::BaseData* data, const std::string& path)
{
Save(data, path);
return true;
}
std::string IOUtil::Save(const BaseData* data, const std::string& mimeTypeName, const std::string& path,
WriterOptionsFunctorBase* optionsCallback, bool addExtension)
{
if (path.empty())
{
return "No output filename given";
}
mitk::CoreServicePointer<mitk::IMimeTypeProvider> mimeTypeProvider(mitk::CoreServices::GetMimeTypeProvider());
MimeType mimeType = mimeTypeProvider->GetMimeTypeForName(mimeTypeName);
SaveInfo saveInfo(data, mimeType, path);
std::string ext = itksys::SystemTools::GetFilenameExtension(path);
if (saveInfo.m_WriterSelector.IsEmpty())
{
return std::string("No suitable writer found for the current data of type ") + data->GetNameOfClass() +
(mimeType.IsValid() ? (std::string(" and mime-type ") + mimeType.GetName()) : std::string()) +
(ext.empty() ? std::string() : (std::string(" with extension ") + ext));
}
// Add an extension if not already specified
if (ext.empty() && addExtension)
{
ext = saveInfo.m_MimeType.GetExtensions().empty() ? std::string() : "." + saveInfo.m_MimeType.GetExtensions().front();
}
std::vector<SaveInfo> infos;
infos.push_back(saveInfo);
return Save(infos, optionsCallback);
}
std::string IOUtil::Save(std::vector<SaveInfo>& saveInfos, WriterOptionsFunctorBase* optionsCallback)
{
if (saveInfos.empty())
{
return "No data for saving available";
}
int filesToWrite = saveInfos.size();
mitk::ProgressBar::GetInstance()->AddStepsToDo(2*filesToWrite);
std::string errMsg;
std::set<SaveInfo> usedSaveInfos;
for (std::vector<SaveInfo>::iterator infoIter = saveInfos.begin(),
infoIterEnd = saveInfos.end(); infoIter != infoIterEnd; ++infoIter)
{
const std::string baseDataType = infoIter->m_BaseData->GetNameOfClass();
std::vector<FileWriterSelector::Item> writers = infoIter->m_WriterSelector.Get();
// Error out if no compatible Writer was found
if (writers.empty())
{
errMsg += std::string("No writer available for ") + baseDataType + " data.\n";
continue;
}
bool callOptionsCallback = writers.size() > 1 || !writers[0].GetWriter()->GetOptions().empty();
// check if we already used a writer for this base data type
// which should be re-used
std::set<SaveInfo>::const_iterator oldSaveInfoIter = usedSaveInfos.find(*infoIter);
if (oldSaveInfoIter != usedSaveInfos.end())
{
// we previously saved a base data object of the same data with the same mime-type,
// check if the same writer is contained in the current writer set and if the
// confidence level matches
FileWriterSelector::Item oldSelectedItem =
oldSaveInfoIter->m_WriterSelector.Get(oldSaveInfoIter->m_WriterSelector.GetSelectedId());
for (std::vector<FileWriterSelector::Item>::const_iterator currWriterItem = writers.begin(),
currWriterItemEnd = writers.end(); currWriterItem != currWriterItemEnd; ++currWriterItem)
{
if (currWriterItem->GetServiceId() == oldSelectedItem.GetServiceId() &&
currWriterItem->GetConfidenceLevel() >= oldSelectedItem.GetConfidenceLevel())
{
// okay, we used the same writer already, re-use its options
callOptionsCallback = false;
infoIter->m_WriterSelector.Select(oldSaveInfoIter->m_WriterSelector.GetSelectedId());
infoIter->m_WriterSelector.GetSelected().GetWriter()->SetOptions(
oldSelectedItem.GetWriter()->GetOptions());
break;
}
}
}
if (callOptionsCallback && optionsCallback)
{
callOptionsCallback = (*optionsCallback)(*infoIter);
if (!callOptionsCallback && !infoIter->m_Cancel)
{
usedSaveInfos.erase(*infoIter);
usedSaveInfos.insert(*infoIter);
}
}
if (infoIter->m_Cancel)
{
errMsg += "Writing operation(s) cancelled.";
break;
}
IFileWriter* writer = infoIter->m_WriterSelector.GetSelected().GetWriter();
if (writer == NULL)
{
errMsg += "Unexpected NULL writer.";
break;
}
// Do the actual writing
try
{
writer->SetOutputLocation(infoIter->m_Path);
writer->Write();
}
catch(const std::exception& e)
{
errMsg += std::string("Exception occurred when writing to ") + infoIter->m_Path + ":\n" + e.what() + "\n";
}
mitk::ProgressBar::GetInstance()->Progress(2);
--filesToWrite;
}
if (!errMsg.empty())
{
MITK_ERROR << errMsg;
}
mitk::ProgressBar::GetInstance()->Progress(2*filesToWrite);
return errMsg;
}
// This method can be removed after the deprecated LoadDataNode() method was removed
void IOUtil::Impl::SetDefaultDataNodeProperties(DataNode* node, const std::string& filePath)
{
// path
mitk::StringProperty::Pointer pathProp = mitk::StringProperty::New( itksys::SystemTools::GetFilenamePath(filePath) );
node->SetProperty(StringProperty::PATH, pathProp);
// name already defined?
mitk::StringProperty::Pointer nameProp = dynamic_cast<mitk::StringProperty*>(node->GetProperty("name"));
if(nameProp.IsNull() || (strcmp(nameProp->GetValue(),"No Name!")==0))
{
// name already defined in BaseData
mitk::StringProperty::Pointer baseDataNameProp = dynamic_cast<mitk::StringProperty*>(node->GetData()->GetProperty("name").GetPointer() );
if(baseDataNameProp.IsNull() || (strcmp(baseDataNameProp->GetValue(),"No Name!")==0))
{
// name neither defined in node, nor in BaseData -> name = filename
nameProp = mitk::StringProperty::New( itksys::SystemTools::GetFilenameWithoutExtension(filePath));
node->SetProperty("name", nameProp);
}
else
{
// name defined in BaseData!
nameProp = mitk::StringProperty::New(baseDataNameProp->GetValue());
node->SetProperty("name", nameProp);
}
}
// visibility
if(!node->GetProperty("visible"))
{
node->SetVisibility(true);
}
}
IOUtil::SaveInfo::SaveInfo(const BaseData* baseData, const MimeType& mimeType,
const std::string& path)
: m_BaseData(baseData)
, m_WriterSelector(baseData, mimeType.GetName(), path)
, m_MimeType(mimeType.IsValid() ? mimeType // use the original mime-type
: (m_WriterSelector.IsEmpty() ? mimeType // no writer found, use the original invalid mime-type
: m_WriterSelector.GetDefault().GetMimeType() // use the found default mime-type
)
)
, m_Path(path)
, m_Cancel(false)
{
}
bool IOUtil::SaveInfo::operator<(const IOUtil::SaveInfo& other) const
{
int r = strcmp(m_BaseData->GetNameOfClass(), other.m_BaseData->GetNameOfClass());
if (r == 0)
{
return m_WriterSelector.GetSelected().GetMimeType() <
other.m_WriterSelector.GetSelected().GetMimeType();
}
return r < 0;
}
IOUtil::LoadInfo::LoadInfo(const std::string& path)
: m_Path(path)
, m_ReaderSelector(path)
, m_Cancel(false)
{
}
}
diff --git a/Modules/Core/src/IO/mitkImageVtkLegacyIO.h b/Modules/Core/src/IO/mitkImageVtkLegacyIO.h
index 6d4c81e2ec..f84d9b442d 100644
--- a/Modules/Core/src/IO/mitkImageVtkLegacyIO.h
+++ b/Modules/Core/src/IO/mitkImageVtkLegacyIO.h
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEVTKLEGACYIO_H
#define MITKIMAGEVTKLEGACYIO_H
#include "mitkAbstractFileIO.h"
namespace mitk {
class ImageVtkLegacyIO : public mitk::AbstractFileIO
{
public:
ImageVtkLegacyIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<BaseData::Pointer> Read();
+ virtual std::vector<BaseData::Pointer> Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
private:
- ImageVtkLegacyIO* IOClone() const;
+ ImageVtkLegacyIO* IOClone() const override;
};
}
#endif // MITKIMAGEVTKLEGACYIO_H
diff --git a/Modules/Core/src/IO/mitkImageVtkXmlIO.h b/Modules/Core/src/IO/mitkImageVtkXmlIO.h
index 4463a5326d..e79c054540 100644
--- a/Modules/Core/src/IO/mitkImageVtkXmlIO.h
+++ b/Modules/Core/src/IO/mitkImageVtkXmlIO.h
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEVTKXMLIO_H
#define MITKIMAGEVTKXMLIO_H
#include "mitkAbstractFileIO.h"
namespace mitk {
class ImageVtkXmlIO : public mitk::AbstractFileIO
{
public:
ImageVtkXmlIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<BaseData::Pointer> Read();
+ virtual std::vector<BaseData::Pointer> Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
private:
- ImageVtkXmlIO* IOClone() const;
+ ImageVtkXmlIO* IOClone() const override;
};
}
#endif // MITKIMAGEVTKXMLIO_H
diff --git a/Modules/Core/src/IO/mitkLegacyFileReaderService.h b/Modules/Core/src/IO/mitkLegacyFileReaderService.h
index 238ac555d8..330d86a2f5 100644
--- a/Modules/Core/src/IO/mitkLegacyFileReaderService.h
+++ b/Modules/Core/src/IO/mitkLegacyFileReaderService.h
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLEGACYFILEREADERSERVICE_H
#define MITKLEGACYFILEREADERSERVICE_H
#include <mitkAbstractFileReader.h>
namespace mitk {
// This class wraps mitk::FileReader instances registered as
// "mitkIOAdapter" via the ITK object factory system as a
// micro service.
class LegacyFileReaderService : public mitk::AbstractFileReader
{
public:
LegacyFileReaderService(const LegacyFileReaderService& other);
LegacyFileReaderService(const std::vector<std::string>& extensions, const std::string& category);
virtual ~LegacyFileReaderService();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
- LegacyFileReaderService* Clone() const;
+ LegacyFileReaderService* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} // namespace mitk
#endif /* MITKLEGACYFILEREADERSERVICE_H */
diff --git a/Modules/Core/src/IO/mitkLegacyFileWriterService.h b/Modules/Core/src/IO/mitkLegacyFileWriterService.h
index 92b35c7b15..0819dd278f 100644
--- a/Modules/Core/src/IO/mitkLegacyFileWriterService.h
+++ b/Modules/Core/src/IO/mitkLegacyFileWriterService.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LegacyFileWriterService_H_HEADER_INCLUDED_C1E7E521
#define LegacyFileWriterService_H_HEADER_INCLUDED_C1E7E521
#include <mitkAbstractFileWriter.h>
#include <mitkFileWriter.h>
namespace mitk {
class LegacyFileWriterService : public mitk::AbstractFileWriter
{
public:
LegacyFileWriterService(mitk::FileWriter::Pointer legacyWriter,
const std::string& description);
~LegacyFileWriterService();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
private:
- LegacyFileWriterService* Clone() const;
+ LegacyFileWriterService* Clone() const override;
mitk::FileWriter::Pointer m_LegacyWriter;
us::ServiceRegistration<IFileWriter> m_ServiceRegistration;
};
} // namespace mitk
#endif /* LegacyFileWriterService_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/Core/src/IO/mitkMimeTypeProvider.h b/Modules/Core/src/IO/mitkMimeTypeProvider.h
index 9e7de95120..2307b3dc8e 100644
--- a/Modules/Core/src/IO/mitkMimeTypeProvider.h
+++ b/Modules/Core/src/IO/mitkMimeTypeProvider.h
@@ -1,85 +1,85 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMIMETYPEPROVIDER_H
#define MITKMIMETYPEPROVIDER_H
#include "mitkIMimeTypeProvider.h"
#include "mitkCustomMimeType.h"
#include "usServiceTracker.h"
#include "usServiceTrackerCustomizer.h"
#include <set>
namespace mitk {
struct MimeTypeTrackerTypeTraits : public us::TrackedTypeTraitsBase<MimeType,MimeTypeTrackerTypeTraits>
{
typedef MimeType TrackedType;
static bool IsValid(const TrackedType& t)
{
return t.IsValid();
}
static TrackedType DefaultValue()
{
return TrackedType();
}
static void Dispose(TrackedType& /*t*/)
{
}
};
class MimeTypeProvider : public IMimeTypeProvider,
private us::ServiceTrackerCustomizer<CustomMimeType, MimeType>
{
public:
MimeTypeProvider();
~MimeTypeProvider();
void Start();
void Stop();
- virtual std::vector<MimeType> GetMimeTypes() const;
- virtual std::vector<MimeType> GetMimeTypesForFile(const std::string& filePath) const;
- virtual std::vector<MimeType> GetMimeTypesForCategory(const std::string& category) const;
- virtual MimeType GetMimeTypeForName(const std::string& name) const;
+ virtual std::vector<MimeType> GetMimeTypes() const override;
+ virtual std::vector<MimeType> GetMimeTypesForFile(const std::string& filePath) const override;
+ virtual std::vector<MimeType> GetMimeTypesForCategory(const std::string& category) const override;
+ virtual MimeType GetMimeTypeForName(const std::string& name) const override;
- virtual std::vector<std::string> GetCategories() const;
+ virtual std::vector<std::string> GetCategories() const override;
private:
- virtual TrackedType AddingService(const ServiceReferenceType& reference);
- virtual void ModifiedService(const ServiceReferenceType& reference, TrackedType service);
- virtual void RemovedService(const ServiceReferenceType& reference, TrackedType service);
+ virtual TrackedType AddingService(const ServiceReferenceType& reference) override;
+ virtual void ModifiedService(const ServiceReferenceType& reference, TrackedType service) override;
+ virtual void RemovedService(const ServiceReferenceType& reference, TrackedType service) override;
MimeType GetMimeType(const ServiceReferenceType& reference) const;
us::ServiceTracker<CustomMimeType, MimeTypeTrackerTypeTraits>* m_Tracker;
typedef std::map<std::string, std::set<MimeType> > MapType;
MapType m_NameToMimeTypes;
std::map<std::string, MimeType> m_NameToMimeType;
};
}
#endif // MITKMIMETYPEPROVIDER_H
diff --git a/Modules/Core/src/IO/mitkPointSetReaderService.h b/Modules/Core/src/IO/mitkPointSetReaderService.h
index a125deaea8..df87265a71 100644
--- a/Modules/Core/src/IO/mitkPointSetReaderService.h
+++ b/Modules/Core/src/IO/mitkPointSetReaderService.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_SET_READER_SERVICE__H_
#define _MITK_POINT_SET_READER_SERVICE__H_
// MITK
#include <mitkAbstractFileReader.h>
#include <mitkPointSet.h>
class TiXmlElement;
namespace mitk
{
/**
* @internal
*
* @brief reads xml representations of mitk::PointSets from a file
*
* Reader for xml files containing one or multiple xml represenations of
* mitk::PointSet. If multiple mitk::PointSet objects are stored in one file,
* these are assigned to multiple BaseData objects.
*
* The reader is able to read the old 3D Pointsets without the "specification" and "timeseries" tags and the new 4D Pointsets.
*
* @ingroup IO
*/
class PointSetReaderService: public AbstractFileReader
{
public:
PointSetReaderService();
virtual ~PointSetReaderService();
using AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<BaseData> > Read();
+ virtual std::vector< itk::SmartPointer<BaseData> > Read() override;
private:
PointSetReaderService(const PointSetReaderService& other);
mitk::PointSet::Pointer ReadPoint(mitk::PointSet::Pointer newPointSet,
TiXmlElement* currentTimeSeries, unsigned int currentTimeStep);
- virtual PointSetReaderService* Clone() const;
+ virtual PointSetReaderService* Clone() const override;
};
}
#endif
diff --git a/Modules/Core/src/IO/mitkPointSetWriterService.h b/Modules/Core/src/IO/mitkPointSetWriterService.h
index 275522c1c8..9ad8a5a58b 100644
--- a/Modules/Core/src/IO/mitkPointSetWriterService.h
+++ b/Modules/Core/src/IO/mitkPointSetWriterService.h
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_SET_WRITER_SERVICE__H_
#define _MITK_POINT_SET_WRITER_SERVICE__H_
#include <mitkAbstractFileWriter.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* @internal
*
* @brief XML-based writer for mitk::PointSets
*
* XML-based writer for mitk::PointSet. Multiple PointSets can be written in
* a single XML file by simply setting multiple inputs to the filter.
*
* @ingroup IO
*/
class PointSetWriterService : public AbstractFileWriter
{
public:
PointSetWriterService();
virtual ~PointSetWriterService();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
private:
PointSetWriterService(const PointSetWriterService& other);
- virtual mitk::PointSetWriterService* Clone() const;
+ virtual mitk::PointSetWriterService* Clone() const override;
/**
* Converts an arbitrary type to a string. The type has to
* support the << operator. This works fine at least for integral
* data types as float, int, long etc.
* @param value the value to convert
* @returns the string representation of value
*/
template < typename T>
std::string ConvertToString( T value );
/**
* Writes an XML representation of the given point set to
* an outstream. The XML-Header an root node is not included!
* @param pointSet the point set to be converted to xml
* @param out the stream to write to.
*/
void WriteXML( const mitk::PointSet* pointSet, std::ostream& out );
/**
* Writes an standard xml header to the given stream.
* @param file the stream in which the header is written.
*/
void WriteXMLHeader( std::ostream &file );
/**
* Write an end element tag
* End-Elements following character data should pass indent = false.
*/
void WriteEndElement( const std::string& tag, std::ostream &file, const bool& indent = true );
/** Write a start element tag */
void WriteStartElement( const std::string &tag, std::ostream &file );
/** Write character data inside a tag. */
void WriteCharacterData( const std::string &data, std::ostream &file );
/** Writes empty spaces to the stream according to m_IndentDepth and m_Indent */
void WriteIndent( std::ostream& file );
unsigned int m_IndentDepth;
const unsigned int m_Indent;
static const std::string XML_POINT_SET;
static const std::string XML_TIME_SERIES;
static const std::string XML_TIME_SERIES_ID;
static const std::string XML_POINT_SET_FILE;
static const std::string XML_FILE_VERSION;
static const std::string XML_POINT;
static const std::string XML_SPEC;
static const std::string XML_ID;
static const std::string XML_X;
static const std::string XML_Y;
static const std::string XML_Z;
static const std::string VERSION_STRING;
};
}
#endif
diff --git a/Modules/Core/src/IO/mitkRawImageFileReader.h b/Modules/Core/src/IO/mitkRawImageFileReader.h
index d9501e0d6f..8709aceb41 100644
--- a/Modules/Core/src/IO/mitkRawImageFileReader.h
+++ b/Modules/Core/src/IO/mitkRawImageFileReader.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRAWIMAGEFILEREADER_H_
#define MITKRAWIMAGEFILEREADER_H_
#include "mitkAbstractFileReader.h"
namespace mitk
{
/**
* 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.
*/
class RawImageFileReaderService : public AbstractFileReader
{
public:
/** Supported pixel types. */
typedef enum {UCHAR,SCHAR,USHORT,SSHORT, UINT, SINT, FLOAT, DOUBLE} IOPixelType;
/** Endianity of bits. */
typedef enum {LITTLE, BIG} EndianityType;
RawImageFileReaderService();
protected:
RawImageFileReaderService(const RawImageFileReaderService& other);
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
using mitk::AbstractFileReader::Read;
private:
template <typename TPixel, unsigned int VImageDimensions>
mitk::BaseData::Pointer TypedRead(const std::string& path, EndianityType endianity, int* size);
- RawImageFileReaderService* Clone() const;
+ RawImageFileReaderService* Clone() const override;
/** Vector containing dimensions of image to be read. */
itk::Vector<int, 3> m_Dimensions;
};
} // namespace mitk
#endif /* MITKRAWIMAGEFILEREADER_H_ */
diff --git a/Modules/Core/src/IO/mitkSurfaceStlIO.h b/Modules/Core/src/IO/mitkSurfaceStlIO.h
index 8c1638b0f3..b618192cf5 100644
--- a/Modules/Core/src/IO/mitkSurfaceStlIO.h
+++ b/Modules/Core/src/IO/mitkSurfaceStlIO.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SURFACE_STL_IO_H_
#define _MITK_SURFACE_STL_IO_H_
#include "mitkSurfaceVtkIO.h"
namespace mitk
{
class SurfaceStlIO : public mitk::SurfaceVtkIO
{
public:
SurfaceStlIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
+ virtual void Write() override;
private:
- SurfaceStlIO* IOClone() const;
+ SurfaceStlIO* IOClone() const override;
static std::string OPTION_MERGE_POINTS();
static std::string OPTION_TAG_SOLIDS();
static std::string OPTION_CLEAN();
};
}
#endif //_MITK_SURFACE_STL_IO_H_
diff --git a/Modules/Core/src/IO/mitkSurfaceVtkIO.h b/Modules/Core/src/IO/mitkSurfaceVtkIO.h
index 4eb9fbff64..8b611ca9e4 100644
--- a/Modules/Core/src/IO/mitkSurfaceVtkIO.h
+++ b/Modules/Core/src/IO/mitkSurfaceVtkIO.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SURFACE_VTK_IO_H_
#define _MITK_SURFACE_VTK_IO_H_
#include <mitkAbstractFileIO.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
namespace mitk
{
/**
* @internal
* @brief VTK-based reader and writer for mitk::Surface
*
* If the mitk::Surface contains multiple points of
* time, multiple files are written. The life-span (time-bounds) of each
* each point of time is included in the filename according to the
* following scheme:
* &lt;filename&gt;_S&lt;timebounds[0]&gt;E&lt;timebounds[1]&gt;_T&lt;framenumber&gt;
* (S=start, E=end, T=time).
* Writing of multiple files according to a given filename pattern is not
* yet supported.
*/
class SurfaceVtkIO : public mitk::AbstractFileIO
{
public:
SurfaceVtkIO(const std::string& baseDataType, const CustomMimeType& mimeType,
const std::string& description);
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
protected:
vtkSmartPointer<vtkPolyData> GetPolyData(unsigned int t, std::string& fileName);
};
}
#endif //_MITK_SURFACE_VTK_IO_H_
diff --git a/Modules/Core/src/IO/mitkSurfaceVtkLegacyIO.h b/Modules/Core/src/IO/mitkSurfaceVtkLegacyIO.h
index e2d799ece9..490e1ffb9a 100644
--- a/Modules/Core/src/IO/mitkSurfaceVtkLegacyIO.h
+++ b/Modules/Core/src/IO/mitkSurfaceVtkLegacyIO.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SURFACE_VTK_LEGACY_IO_H_
#define _MITK_SURFACE_VTK_LEGACY_IO_H_
#include "mitkSurfaceVtkIO.h"
#include "mitkBaseData.h"
namespace mitk
{
class SurfaceVtkLegacyIO : public mitk::SurfaceVtkIO
{
public:
SurfaceVtkLegacyIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<BaseData::Pointer> Read();
+ virtual std::vector<BaseData::Pointer> Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
+ virtual void Write() override;
private:
- SurfaceVtkLegacyIO* IOClone() const;
+ SurfaceVtkLegacyIO* IOClone() const override;
};
}
#endif //_MITK_SURFACE_VTK_LEGACY_IO_H_
diff --git a/Modules/Core/src/IO/mitkSurfaceVtkXmlIO.h b/Modules/Core/src/IO/mitkSurfaceVtkXmlIO.h
index 973a7d3088..5a96a7b4bc 100644
--- a/Modules/Core/src/IO/mitkSurfaceVtkXmlIO.h
+++ b/Modules/Core/src/IO/mitkSurfaceVtkXmlIO.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SURFACE_VTK_XML_IO_H_
#define _MITK_SURFACE_VTK_XML_IO_H_
#include "mitkSurfaceVtkIO.h"
#include "mitkBaseData.h"
namespace mitk {
class SurfaceVtkXmlIO : public mitk::SurfaceVtkIO
{
public:
SurfaceVtkXmlIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<BaseData::Pointer> Read();
+ virtual std::vector<BaseData::Pointer> Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
+ virtual void Write() override;
private:
- SurfaceVtkXmlIO* IOClone() const;
+ SurfaceVtkXmlIO* IOClone() const override;
};
}
#endif //_MITK_SURFACE_VTK_XML_IO_H_
diff --git a/Modules/Core/src/Interactions/mitkEventConfig.cpp b/Modules/Core/src/Interactions/mitkEventConfig.cpp
index d27904ac6f..9f82f2a2bc 100755
--- a/Modules/Core/src/Interactions/mitkEventConfig.cpp
+++ b/Modules/Core/src/Interactions/mitkEventConfig.cpp
@@ -1,425 +1,425 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkEventConfig.h"
#include "mitkEventFactory.h"
#include "mitkInteractionEvent.h"
#include "mitkInternalEvent.h"
#include "mitkInteractionKeyEvent.h"
#include "mitkInteractionEventConst.h"
// VTK
#include <vtkXMLParser.h>
#include <vtkXMLDataElement.h>
// us
#include "usGetModuleContext.h"
#include "usModule.h"
#include "usModuleResource.h"
#include "usModuleResourceStream.h"
namespace mitk {
class EventConfigXMLParser : public vtkXMLParser
{
public:
EventConfigXMLParser(EventConfigPrivate* d);
protected:
/**
* @brief Derived from XMLReader
**/
- void StartElement(const char* elementName, const char **atts);
+ void StartElement(const char* elementName, const char **atts) override;
/**
* @brief Derived from XMLReader
**/
- void EndElement(const char* elementName);
+ void EndElement(const char* elementName) override;
std::string ReadXMLStringAttribute(const std::string& name, const char** atts);
bool ReadXMLBooleanAttribute(const std::string& name, const char** atts);
private:
EventConfigPrivate* const d;
};
struct EventConfigPrivate : public us::SharedData
{
EventConfigPrivate();
EventConfigPrivate(const EventConfigPrivate& other);
struct EventMapping
{
std::string variantName;
InteractionEvent::ConstPointer interactionEvent;
};
typedef std::list<EventMapping> EventListType;
/**
* Checks if mapping with the same parameters already exists, if so, it is replaced,
* else the new mapping added
*/
void InsertMapping(const EventMapping& mapping);
void CopyMapping( const EventListType );
/**
* @brief List of all global properties of the config object.
*/
PropertyList::Pointer m_PropertyList;
/**
* @brief Temporal list of all prMousePressEventoperties of a Event. Used to parse an Input-Event and collect all parameters between the two <input>
* and </event_variant> tags.
*/
PropertyList::Pointer m_EventPropertyList;
EventMapping m_CurrEventMapping;
/**
* Stores InteractionEvents and their corresponding VariantName
*/
EventListType m_EventList;
bool m_Errors; // use member, because of inheritance from vtkXMLParser we can't return a success value for parsing the file.
EventConfigXMLParser m_XmlParser;
};
}
mitk::EventConfigPrivate::EventConfigPrivate()
: m_PropertyList(PropertyList::New())
, m_EventPropertyList( PropertyList::New() )
, m_Errors(false)
, m_XmlParser(this)
{
// Avoid VTK warning: Trying to delete object with non-zero reference count.
m_XmlParser.SetReferenceCount(0);
}
mitk::EventConfigPrivate::EventConfigPrivate(const EventConfigPrivate& other)
: us::SharedData(other)
, m_PropertyList(other.m_PropertyList->Clone())
, m_EventPropertyList(other.m_EventPropertyList->Clone())
, m_CurrEventMapping(other.m_CurrEventMapping)
, m_EventList(other.m_EventList)
, m_Errors(other.m_Errors)
, m_XmlParser(this)
{
// Avoid VTK warning: Trying to delete object with non-zero reference count.
m_XmlParser.SetReferenceCount(0);
}
void mitk::EventConfigPrivate::InsertMapping(const EventMapping& mapping)
{
for (EventListType::iterator it = m_EventList.begin(); it != m_EventList.end(); ++it)
{
if (*(it->interactionEvent) == *mapping.interactionEvent)
{
//MITK_INFO<< "Configuration overwritten:" << (*it).variantName;
m_EventList.erase(it);
break;
}
}
m_EventList.push_back(mapping);
}
void mitk::EventConfigPrivate::CopyMapping( const EventListType eventList )
{
EventListType::const_iterator iter;
for( iter=eventList.begin(); iter!=eventList.end(); iter++ )
{
InsertMapping( *(iter) );
}
}
mitk::EventConfigXMLParser::EventConfigXMLParser(EventConfigPrivate *d)
: d(d)
{
}
void mitk::EventConfigXMLParser::StartElement(const char* elementName, const char **atts)
{
std::string name(elementName);
if (name == InteractionEventConst::xmlTagConfigRoot())
{
//
}
else if (name == InteractionEventConst::xmlTagParam())
{
std::string name = ReadXMLStringAttribute(InteractionEventConst::xmlParameterName(), atts);
std::string value = ReadXMLStringAttribute(InteractionEventConst::xmlParameterValue(), atts);
d->m_PropertyList->SetStringProperty(name.c_str(), value.c_str());
}
else if (name == InteractionEventConst::xmlTagEventVariant())
{
std::string eventClass = ReadXMLStringAttribute(InteractionEventConst::xmlParameterEventClass(), atts);
std::string eventVariant = ReadXMLStringAttribute(InteractionEventConst::xmlParameterName(), atts);
// New list in which all parameters are stored that are given within the <input/> tag
d->m_EventPropertyList = PropertyList::New();
d->m_EventPropertyList->SetStringProperty(InteractionEventConst::xmlParameterEventClass().c_str(), eventClass.c_str());
d->m_EventPropertyList->SetStringProperty(InteractionEventConst::xmlParameterEventVariant().c_str(), eventVariant.c_str());
d->m_CurrEventMapping.variantName = eventVariant;
}
else if (name == InteractionEventConst::xmlTagAttribute())
{
// Attributes that describe an Input Event, such as which MouseButton triggered the event,or which modifier keys are pressed
std::string name = ReadXMLStringAttribute(InteractionEventConst::xmlParameterName(), atts);
std::string value = ReadXMLStringAttribute(InteractionEventConst::xmlParameterValue(), atts);
d->m_EventPropertyList->SetStringProperty(name.c_str(), value.c_str());
}
}
void mitk::EventConfigXMLParser::EndElement(const char* elementName)
{
std::string name(elementName);
// At end of input section, all necessary infos are collected to created an interaction event.
if (name == InteractionEventConst::xmlTagEventVariant())
{
InteractionEvent::Pointer event = EventFactory::CreateEvent(d->m_EventPropertyList);
if (event.IsNotNull())
{
d->m_CurrEventMapping.interactionEvent = event;
d->InsertMapping(d->m_CurrEventMapping);
}
else
{
MITK_WARN<< "EventConfig: Unknown Event-Type in config. Entry skipped: " << name;
}
}
}
std::string mitk::EventConfigXMLParser::ReadXMLStringAttribute(const std::string& name, const char** atts)
{
if (atts)
{
const char** attsIter = atts;
while (*attsIter)
{
if (name == *attsIter)
{
attsIter++;
return *attsIter;
}
attsIter += 2;
}
}
return std::string();
}
bool mitk::EventConfigXMLParser::ReadXMLBooleanAttribute(const std::string& name, const char** atts)
{
std::string s = ReadXMLStringAttribute(name, atts);
std::transform(s.begin(), s.end(), s.begin(), ::toupper);
return s == "TRUE";
}
mitk::EventConfig::EventConfig()
: d(new EventConfigPrivate)
{
}
mitk::EventConfig::EventConfig(const EventConfig &other)
: d(other.d)
{
}
mitk::EventConfig::EventConfig(const std::string& filename, const us::Module* module)
: d(new EventConfigPrivate)
{
if (module == NULL)
{
module = us::GetModuleContext()->GetModule();
}
us::ModuleResource resource = module->GetResource("Interactions/" + filename);
if (!resource.IsValid())
{
MITK_ERROR << "Resource not valid. State machine pattern in module " << module->GetName()
<< " not found: /Interactions/" << filename;
return;
}
EventConfig newConfig;
us::ModuleResourceStream stream(resource);
newConfig.d->m_XmlParser.SetStream(&stream);
bool success = newConfig.d->m_XmlParser.Parse() && !newConfig.d->m_Errors;
if (success)
{
*this = newConfig;
}
}
mitk::EventConfig::EventConfig(std::istream &inputStream)
: d(new EventConfigPrivate)
{
EventConfig newConfig;
newConfig.d->m_XmlParser.SetStream(&inputStream);
bool success = newConfig.d->m_XmlParser.Parse() && !newConfig.d->m_Errors;
if (success)
{
*this = newConfig;
}
}
mitk::EventConfig::EventConfig(const std::vector<PropertyList::Pointer> &configDescription)
: d(new EventConfigPrivate)
{
std::vector<PropertyList::Pointer>::const_iterator it_end = configDescription.end();
for (std::vector<PropertyList::Pointer>::const_iterator it = configDescription.begin(); it != it_end; ++it)
{
std::string typeVariant;
(*it)->GetStringProperty(InteractionEventConst::xmlTagEventVariant().c_str(), typeVariant);
if ( typeVariant != "" )
{
InteractionEvent::Pointer event = EventFactory::CreateEvent(*it);
if (event.IsNotNull())
{
d->m_CurrEventMapping.interactionEvent = event;
std::string eventVariant;
(*it)->GetStringProperty(InteractionEventConst::xmlTagEventVariant().c_str(), eventVariant);
d->m_CurrEventMapping.variantName = eventVariant;
d->InsertMapping(d->m_CurrEventMapping);
}
else
{
MITK_WARN<< "EventConfig: Unknown Event-Type in config. When constructing from PropertyList.";
}
}
else
{
(*it)->GetStringProperty(InteractionEventConst::xmlTagParam().c_str(), typeVariant);
if ( typeVariant != "" )
{
std::string name, value;
(*it)->GetStringProperty(InteractionEventConst::xmlParameterName().c_str(), name);
(*it)->GetStringProperty(InteractionEventConst::xmlParameterValue().c_str(), value);
d->m_PropertyList->SetStringProperty(name.c_str(), value.c_str());
}
}
}
}
mitk::EventConfig& mitk::EventConfig::operator =(const mitk::EventConfig& other)
{
d = other.d;
return *this;
}
mitk::EventConfig::~EventConfig()
{
}
bool mitk::EventConfig::IsValid() const
{
return !( d->m_EventList.empty() && d->m_PropertyList->IsEmpty() );
}
bool mitk::EventConfig::AddConfig(const std::string& fileName, const us::Module* module)
{
if (module == NULL)
{
module = us::GetModuleContext()->GetModule();
}
us::ModuleResource resource = module->GetResource("Interactions/" + fileName);
if (!resource.IsValid())
{
MITK_ERROR << "Resource not valid. State machine pattern in module " << module->GetName()
<< " not found: /Interactions/" << fileName;
return false;
}
EventConfig newConfig(*this);
us::ModuleResourceStream stream(resource);
newConfig.d->m_XmlParser.SetStream(&stream);
bool success = newConfig.d->m_XmlParser.Parse() && !newConfig.d->m_Errors;
if (success)
{
*this = newConfig;
}
return success;
}
bool mitk::EventConfig::AddConfig(const EventConfig& config)
{
if (!config.IsValid()) return false;
d->m_PropertyList->ConcatenatePropertyList(config.d->m_PropertyList->Clone(), true);
d->m_EventPropertyList = config.d->m_EventPropertyList->Clone();
d->m_CurrEventMapping = config.d->m_CurrEventMapping;
d->CopyMapping( config.d->m_EventList );
return true;
}
mitk::PropertyList::Pointer mitk::EventConfig::GetAttributes() const
{
return d->m_PropertyList;
}
std::string mitk::EventConfig::GetMappedEvent(const EventType& interactionEvent) const
{
// internal events are excluded from mapping
if (std::strcmp(interactionEvent->GetNameOfClass(), "InternalEvent") == 0)
{
InternalEvent* internalEvent = dynamic_cast<InternalEvent*>(interactionEvent.GetPointer());
return internalEvent->GetSignalName();
}
for (EventConfigPrivate::EventListType::const_iterator it = d->m_EventList.begin();
it != d->m_EventList.end(); ++it)
{
if (*(it->interactionEvent) == *interactionEvent)
{
return (*it).variantName;
}
}
// if this part is reached, no mapping has been found,
// so here we handle key events and map a key event to the string "Std" + letter/code
// so "A" will be returned as "StdA"
if (std::strcmp(interactionEvent->GetNameOfClass(), "InteractionKeyEvent") == 0)
{
InteractionKeyEvent* keyEvent = dynamic_cast<InteractionKeyEvent*>(interactionEvent.GetPointer());
return ("Std" + keyEvent->GetKey());
}
return "";
}
void mitk::EventConfig::ClearConfig()
{
d->m_PropertyList->Clear();
d->m_EventPropertyList->Clear();
d->m_CurrEventMapping.variantName.clear();
d->m_CurrEventMapping.interactionEvent = NULL;
d->m_EventList.clear();
d->m_Errors = false;
}
diff --git a/Modules/Core/src/mitkCoreActivator.cpp b/Modules/Core/src/mitkCoreActivator.cpp
index 6d01ef12f3..40b76b7980 100644
--- a/Modules/Core/src/mitkCoreActivator.cpp
+++ b/Modules/Core/src/mitkCoreActivator.cpp
@@ -1,468 +1,468 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkCoreActivator.h"
// File IO
#include <mitkIOUtil.h>
#include <mitkIOMimeTypes.h>
#include <mitkItkImageIO.h>
#include <mitkMimeTypeProvider.h>
#include <mitkPointSetReaderService.h>
#include <mitkPointSetWriterService.h>
#include <mitkRawImageFileReader.h>
#include <mitkSurfaceStlIO.h>
#include <mitkSurfaceVtkLegacyIO.h>
#include <mitkSurfaceVtkXmlIO.h>
#include <mitkImageVtkXmlIO.h>
#include <mitkImageVtkLegacyIO.h>
#include <mitkFileWriter.h>
#include "mitkLegacyFileWriterService.h"
#include "mitkDicomSeriesReaderService.h"
#include <itkNiftiImageIO.h>
#include <itkGDCMImageIO.h>
// Micro Services
#include <usGetModuleContext.h>
#include <usModuleInitialization.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usModuleSettings.h>
#include <usModuleEvent.h>
#include <usModule.h>
#include <usModuleResource.h>
#include <usModuleResourceStream.h>
#include <usServiceTracker.h>
// ITK "injects" static initialization code for IO factories
// via the itkImageIOFactoryRegisterManager.h header (which
// is generated in the application library build directory).
// To ensure that the code is called *before* the CppMicroServices
// static initialization code (which triggers the Activator::Start
// method), we include the ITK header here.
#include <itkImageIOFactoryRegisterManager.h>
void HandleMicroServicesMessages(us::MsgType type, const char* msg)
{
switch (type)
{
case us::DebugMsg:
MITK_DEBUG << msg;
break;
case us::InfoMsg:
MITK_INFO << msg;
break;
case us::WarningMsg:
MITK_WARN << msg;
break;
case us::ErrorMsg:
MITK_ERROR << msg;
break;
}
}
void AddMitkAutoLoadPaths(const std::string& programPath)
{
us::ModuleSettings::AddAutoLoadPath(programPath);
#ifdef __APPLE__
// Walk up three directories since that is where the .dylib files are located
// for build trees.
std::string additionalPath = programPath;
bool addPath = true;
for(int i = 0; i < 3; ++i)
{
std::size_t index = additionalPath.find_last_of('/');
if (index != std::string::npos)
{
additionalPath = additionalPath.substr(0, index);
}
else
{
addPath = false;
break;
}
}
if (addPath)
{
us::ModuleSettings::AddAutoLoadPath(additionalPath);
}
#endif
}
class ShaderRepositoryTracker : public us::ServiceTracker<mitk::IShaderRepository>
{
public:
ShaderRepositoryTracker()
: Superclass(us::GetModuleContext())
{
}
- virtual void Close()
+ virtual void Close() override
{
us::GetModuleContext()->RemoveModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent);
Superclass::Close();
}
- virtual void Open()
+ virtual void Open() override
{
us::GetModuleContext()->AddModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent);
Superclass::Open();
}
private:
typedef us::ServiceTracker<mitk::IShaderRepository> Superclass;
- TrackedType AddingService(const ServiceReferenceType &reference)
+ TrackedType AddingService(const ServiceReferenceType &reference) override
{
mitk::IShaderRepository* shaderRepo = Superclass::AddingService(reference);
if (shaderRepo)
{
// Add all existing shaders from modules to the new shader repository.
// If the shader repository is registered in a modules activator, the
// GetLoadedModules() function call below will also return the module
// which is currently registering the repository. The HandleModuleEvent
// method contains code to avoid double registrations due to a fired
// ModuleEvent::LOADED event after the activators Load() method finished.
std::vector<us::Module*> modules = us::ModuleRegistry::GetLoadedModules();
for (std::vector<us::Module*>::const_iterator iter = modules.begin(),
endIter = modules.end(); iter != endIter; ++iter)
{
this->AddModuleShaderToRepository(*iter, shaderRepo);
}
m_ShaderRepositories.push_back(shaderRepo);
}
return shaderRepo;
}
- void RemovedService(const ServiceReferenceType& /*reference*/, TrackedType tracked)
+ void RemovedService(const ServiceReferenceType& /*reference*/, TrackedType tracked) override
{
m_ShaderRepositories.erase(std::remove(m_ShaderRepositories.begin(), m_ShaderRepositories.end(), tracked),
m_ShaderRepositories.end());
}
void HandleModuleEvent(const us::ModuleEvent moduleEvent)
{
if (moduleEvent.GetType() == us::ModuleEvent::LOADED)
{
std::vector<mitk::IShaderRepository*> shaderRepos;
for (std::map<mitk::IShaderRepository*, std::map<long, std::vector<int> > >::const_iterator shaderMapIter = m_ModuleIdToShaderIds.begin(),
shaderMapEndIter = m_ModuleIdToShaderIds.end(); shaderMapIter != shaderMapEndIter; ++shaderMapIter)
{
if (shaderMapIter->second.find(moduleEvent.GetModule()->GetModuleId()) == shaderMapIter->second.end())
{
shaderRepos.push_back(shaderMapIter->first);
}
}
AddModuleShadersToRepositories(moduleEvent.GetModule(), shaderRepos);
}
else if (moduleEvent.GetType() == us::ModuleEvent::UNLOADED)
{
RemoveModuleShadersFromRepositories(moduleEvent.GetModule(), m_ShaderRepositories);
}
}
void AddModuleShadersToRepositories(us::Module* module, const std::vector<mitk::IShaderRepository*>& shaderRepos)
{
// search and load shader files
std::vector<us::ModuleResource> shaderResources = module->FindResources("Shaders", "*.xml", true);
for (std::vector<us::ModuleResource>::iterator i = shaderResources.begin();
i != shaderResources.end(); ++i)
{
if (*i)
{
us::ModuleResourceStream rs(*i);
for (std::vector<mitk::IShaderRepository*>::const_iterator shaderRepoIter = shaderRepos.begin(),
shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter)
{
int id = (*shaderRepoIter)->LoadShader(rs, i->GetBaseName());
if (id >= 0)
{
m_ModuleIdToShaderIds[*shaderRepoIter][module->GetModuleId()].push_back(id);
}
}
rs.seekg(0, std::ios_base::beg);
}
}
}
void AddModuleShaderToRepository(us::Module* module, mitk::IShaderRepository* shaderRepo)
{
std::vector<mitk::IShaderRepository*> shaderRepos;
shaderRepos.push_back(shaderRepo);
this->AddModuleShadersToRepositories(module, shaderRepos);
}
void RemoveModuleShadersFromRepositories(us::Module* module,
const std::vector<mitk::IShaderRepository*>& shaderRepos)
{
for (std::vector<mitk::IShaderRepository*>::const_iterator shaderRepoIter = shaderRepos.begin(),
shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter)
{
std::map<long, std::vector<int> >& moduleIdToShaderIds = m_ModuleIdToShaderIds[*shaderRepoIter];
std::map<long, std::vector<int> >::iterator shaderIdsIter =
moduleIdToShaderIds.find(module->GetModuleId());
if (shaderIdsIter != moduleIdToShaderIds.end())
{
for (std::vector<int>::iterator idIter = shaderIdsIter->second.begin();
idIter != shaderIdsIter->second.end(); ++idIter)
{
(*shaderRepoIter)->UnloadShader(*idIter);
}
moduleIdToShaderIds.erase(shaderIdsIter);
}
}
}
private:
// Maps to each shader repository a map containing module ids and related
// shader registration ids
std::map<mitk::IShaderRepository*, std::map<long, std::vector<int> > > m_ModuleIdToShaderIds;
std::vector<mitk::IShaderRepository*> m_ShaderRepositories;
};
class FixedNiftiImageIO : public itk::NiftiImageIO
{
public:
/** Standard class typedefs. */
typedef FixedNiftiImageIO Self;
typedef itk::NiftiImageIO Superclass;
typedef itk::SmartPointer< Self > Pointer;
/** Method for creation through the object factory. */
itkNewMacro(Self)
/** Run-time type information (and related methods). */
itkTypeMacro(FixedNiftiImageIO, Superclass)
- virtual bool SupportsDimension(unsigned long dim)
+ virtual bool SupportsDimension(unsigned long dim) override
{
return dim > 1 && dim < 5;
}
};
void MitkCoreActivator::Load(us::ModuleContext* context)
{
// Handle messages from CppMicroServices
us::installMsgHandler(HandleMicroServicesMessages);
this->m_Context = context;
// Add the current application directory to the auto-load paths.
// This is useful for third-party executables.
std::string programPath = mitk::IOUtil::GetProgramPath();
if (programPath.empty())
{
MITK_WARN << "Could not get the program path.";
}
else
{
AddMitkAutoLoadPaths(programPath);
}
m_ShaderRepositoryTracker.reset(new ShaderRepositoryTracker);
//m_RenderingManager = mitk::RenderingManager::New();
//context->RegisterService<mitk::RenderingManager>(renderingManager.GetPointer());
m_PlanePositionManager.reset(new mitk::PlanePositionManagerService);
context->RegisterService<mitk::PlanePositionManagerService>(m_PlanePositionManager.get());
m_PropertyAliases.reset(new mitk::PropertyAliases);
context->RegisterService<mitk::IPropertyAliases>(m_PropertyAliases.get());
m_PropertyDescriptions.reset(new mitk::PropertyDescriptions);
context->RegisterService<mitk::IPropertyDescriptions>(m_PropertyDescriptions.get());
m_PropertyExtensions.reset(new mitk::PropertyExtensions);
context->RegisterService<mitk::IPropertyExtensions>(m_PropertyExtensions.get());
m_PropertyFilters.reset(new mitk::PropertyFilters);
context->RegisterService<mitk::IPropertyFilters>(m_PropertyFilters.get());
m_MimeTypeProvider.reset(new mitk::MimeTypeProvider);
m_MimeTypeProvider->Start();
m_MimeTypeProviderReg = context->RegisterService<mitk::IMimeTypeProvider>(m_MimeTypeProvider.get());
this->RegisterDefaultMimeTypes();
this->RegisterItkReaderWriter();
this->RegisterVtkReaderWriter();
// Add custom Reader / Writer Services
m_FileReaders.push_back(new mitk::PointSetReaderService());
m_FileWriters.push_back(new mitk::PointSetWriterService());
m_FileReaders.push_back(new mitk::DicomSeriesReaderService());
m_FileReaders.push_back(new mitk::RawImageFileReaderService());
m_ShaderRepositoryTracker->Open();
/*
There IS an option to exchange ALL vtkTexture instances against vtkNeverTranslucentTextureFactory.
This code is left here as a reminder, just in case we might need to do that some time.
vtkNeverTranslucentTextureFactory* textureFactory = vtkNeverTranslucentTextureFactory::New();
vtkObjectFactory::RegisterFactory( textureFactory );
textureFactory->Delete();
*/
this->RegisterLegacyWriter();
}
void MitkCoreActivator::Unload(us::ModuleContext* )
{
for(std::vector<mitk::IFileReader*>::iterator iter = m_FileReaders.begin(),
endIter = m_FileReaders.end(); iter != endIter; ++iter)
{
delete *iter;
}
for(std::vector<mitk::IFileWriter*>::iterator iter = m_FileWriters.begin(),
endIter = m_FileWriters.end(); iter != endIter; ++iter)
{
delete *iter;
}
for(std::vector<mitk::AbstractFileIO*>::iterator iter = m_FileIOs.begin(),
endIter = m_FileIOs.end(); iter != endIter; ++iter)
{
delete *iter;
}
for(std::vector<mitk::IFileWriter*>::iterator iter = m_LegacyWriters.begin(),
endIter = m_LegacyWriters.end(); iter != endIter; ++iter)
{
delete *iter;
}
// The mitk::ModuleContext* argument of the Unload() method
// will always be 0 for the Mitk library. It makes no sense
// to use it at this stage anyway, since all libraries which
// know about the module system have already been unloaded.
// we need to close the internal service tracker of the
// MimeTypeProvider class here. Otherwise it
// would hold on to the ModuleContext longer than it is
// actually valid.
m_MimeTypeProviderReg.Unregister();
m_MimeTypeProvider->Stop();
for (std::vector<mitk::CustomMimeType*>::const_iterator mimeTypeIter = m_DefaultMimeTypes.begin(),
iterEnd = m_DefaultMimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter)
{
delete *mimeTypeIter;
}
m_ShaderRepositoryTracker->Close();
}
void MitkCoreActivator::RegisterDefaultMimeTypes()
{
// Register some default mime-types
std::vector<mitk::CustomMimeType*> mimeTypes = mitk::IOMimeTypes::Get();
for (std::vector<mitk::CustomMimeType*>::const_iterator mimeTypeIter = mimeTypes.begin(),
iterEnd = mimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter)
{
m_DefaultMimeTypes.push_back(*mimeTypeIter);
m_Context->RegisterService(m_DefaultMimeTypes.back());
}
}
void MitkCoreActivator::RegisterItkReaderWriter()
{
std::list<itk::LightObject::Pointer> allobjects =
itk::ObjectFactoryBase::CreateAllInstance("itkImageIOBase");
for (std::list<itk::LightObject::Pointer >::iterator i = allobjects.begin(),
endIter = allobjects.end(); i != endIter; ++i)
{
itk::ImageIOBase* io = dynamic_cast<itk::ImageIOBase*>(i->GetPointer());
// NiftiImageIO does not provide a correct "SupportsDimension()" methods
// and the supported read/write extensions are not ordered correctly
if (dynamic_cast<itk::NiftiImageIO*>(io)) continue;
// Use a custom mime-type for GDCMImageIO below
if (dynamic_cast<itk::GDCMImageIO*>(i->GetPointer()))
{
// MITK provides its own DICOM reader (which internally uses GDCMImageIO).
continue;
}
if (io)
{
m_FileIOs.push_back(new mitk::ItkImageIO(io));
}
else
{
MITK_WARN << "Error ImageIO factory did not return an ImageIOBase: "
<< ( *i )->GetNameOfClass();
}
}
FixedNiftiImageIO::Pointer itkNiftiIO = FixedNiftiImageIO::New();
mitk::ItkImageIO* niftiIO = new mitk::ItkImageIO(mitk::IOMimeTypes::NIFTI_MIMETYPE(),
itkNiftiIO.GetPointer(), 0);
m_FileIOs.push_back(niftiIO);
}
void MitkCoreActivator::RegisterVtkReaderWriter()
{
m_FileIOs.push_back(new mitk::SurfaceVtkXmlIO());
m_FileIOs.push_back(new mitk::SurfaceStlIO());
m_FileIOs.push_back(new mitk::SurfaceVtkLegacyIO());
m_FileIOs.push_back(new mitk::ImageVtkXmlIO());
m_FileIOs.push_back(new mitk::ImageVtkLegacyIO());
}
void MitkCoreActivator::RegisterLegacyWriter()
{
std::list<itk::LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance("IOWriter");
for( std::list<itk::LightObject::Pointer>::iterator i = allobjects.begin();
i != allobjects.end(); ++i)
{
mitk::FileWriter::Pointer io = dynamic_cast<mitk::FileWriter*>(i->GetPointer());
if(io)
{
std::string description = std::string("Legacy ") + io->GetNameOfClass() + " Writer";
mitk::IFileWriter* writer = new mitk::LegacyFileWriterService(io, description);
m_LegacyWriters.push_back(writer);
}
else
{
MITK_ERROR << "Error IOWriter override is not of type mitk::FileWriter: "
<< (*i)->GetNameOfClass()
<< std::endl;
}
}
}
US_EXPORT_MODULE_ACTIVATOR(MitkCoreActivator)
// Call CppMicroservices initialization code at the end of the file.
// This especially ensures that VTK object factories have already
// been registered (VTK initialization code is injected by implicitly
// include VTK header files at the top of this file).
US_INITIALIZE_MODULE
diff --git a/Modules/Core/src/mitkCoreActivator.h b/Modules/Core/src/mitkCoreActivator.h
index 430802b067..feafa21c7f 100644
--- a/Modules/Core/src/mitkCoreActivator.h
+++ b/Modules/Core/src/mitkCoreActivator.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOREACTIVATOR_H_
#define MITKCOREACTIVATOR_H_
// File IO
#include <mitkIFileReader.h>
#include <mitkIFileWriter.h>
#include <mitkAbstractFileIO.h>
#include <mitkIShaderRepository.h>
#include <mitkPlanePositionManager.h>
#include <mitkPropertyAliases.h>
#include <mitkPropertyDescriptions.h>
#include <mitkPropertyExtensions.h>
#include <mitkPropertyFilters.h>
#include <mitkMimeTypeProvider.h>
// Micro Services
#include <usModuleActivator.h>
#include <usModuleEvent.h>
#include <usServiceRegistration.h>
#include <usServiceTracker.h>
#include <memory>
/*
* This is the module activator for the "Mitk" module. It registers core services
* like ...
*/
class MitkCoreActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext* context);
- void Unload(us::ModuleContext* );
+ void Load(us::ModuleContext* context) override;
+ void Unload(us::ModuleContext* ) override;
private:
void HandleModuleEvent(const us::ModuleEvent moduleEvent);
void RegisterDefaultMimeTypes();
void RegisterItkReaderWriter();
void RegisterVtkReaderWriter();
void RegisterLegacyWriter();
std::auto_ptr<us::ServiceTracker<mitk::IShaderRepository> > m_ShaderRepositoryTracker;
//mitk::RenderingManager::Pointer m_RenderingManager;
std::auto_ptr<mitk::PlanePositionManagerService> m_PlanePositionManager;
std::auto_ptr<mitk::PropertyAliases> m_PropertyAliases;
std::auto_ptr<mitk::PropertyDescriptions> m_PropertyDescriptions;
std::auto_ptr<mitk::PropertyExtensions> m_PropertyExtensions;
std::auto_ptr<mitk::PropertyFilters> m_PropertyFilters;
std::auto_ptr<mitk::MimeTypeProvider> m_MimeTypeProvider;
// File IO
std::vector<mitk::IFileReader*> m_FileReaders;
std::vector<mitk::IFileWriter*> m_FileWriters;
std::vector<mitk::AbstractFileIO*> m_FileIOs;
std::vector<mitk::IFileWriter*> m_LegacyWriters;
std::vector<mitk::CustomMimeType*> m_DefaultMimeTypes;
us::ServiceRegistration<mitk::IMimeTypeProvider> m_MimeTypeProviderReg;
us::ModuleContext* m_Context;
};
#endif // MITKCOREACTIVATOR_H_
diff --git a/Modules/Core/test/mitkArrayTypeConversionTest.cpp b/Modules/Core/test/mitkArrayTypeConversionTest.cpp
index 8955142ebc..48ffe89a34 100644
--- a/Modules/Core/test/mitkArrayTypeConversionTest.cpp
+++ b/Modules/Core/test/mitkArrayTypeConversionTest.cpp
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include "mitkNumericConstants.h"
#include "mitkArray.h"
class mitkArrayTypeConversionTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkArrayTypeConversionTestSuite);
MITK_TEST(EqualArray_ReturnsTrue);
MITK_TEST(EqualArray_ReturnsFalse);
MITK_TEST(FillVector3D_CorrectlyFilled);
MITK_TEST(FillVector4D_CorrectlyFilled);
CPPUNIT_TEST_SUITE_END();
private:
mitk::ScalarType a[3];
mitk::ScalarType b[3];
public:
- void setUp(void)
+ void setUp(void) override
{
b[0] = a[0] = 1.0;
b[1] = a[1] = 2.12;
b[2] = a[2] = 3.13;
}
- void tearDown(void)
+ void tearDown(void) override
{
}
void EqualArray_ReturnsTrue(void)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("test if EqualArray method returns true for two equal arrays.",
true, mitk::EqualArray(a, b, 3));
}
void EqualArray_ReturnsFalse(void)
{
b[2] += mitk::eps;
CPPUNIT_ASSERT_EQUAL_MESSAGE("test if EqualArray method returns false for two non-equal arrays.",
false, mitk::EqualArray(a, b, 3));
}
void FillVector3D_CorrectlyFilled(void)
{
mitk::ScalarType c[3];
mitk::FillVector3D(c, a[0], a[1], a[2]);
CPPUNIT_ASSERT_EQUAL_MESSAGE("test if FillVector3D correctly fills array types.",
true, mitk::EqualArray(a, c, 3));
}
void FillVector4D_CorrectlyFilled(void)
{
mitk::ScalarType e[4];
mitk::ScalarType f[4];
e[0] = 1.0;
e[1] = 2.12;
e[2] = 3.13;
e[3] = 4.14;
mitk::FillVector4D(f, e[0], e[1], e[2], e[3]);
CPPUNIT_ASSERT_EQUAL_MESSAGE("test if FillVector4D correctly fills array types.",
true, mitk::EqualArray(e, f, 4));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkArrayTypeConversion)
diff --git a/Modules/Core/test/mitkBaseGeometryTest.cpp b/Modules/Core/test/mitkBaseGeometryTest.cpp
index 9cf4436011..76be898b55 100644
--- a/Modules/Core/test/mitkBaseGeometryTest.cpp
+++ b/Modules/Core/test/mitkBaseGeometryTest.cpp
@@ -1,1282 +1,1282 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkTestingConfig.h>
#include <mitkTestFixture.h>
#include <mitkBaseGeometry.h>
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "mitkOperationActor.h"
#include <itkBoundingBox.h>
#include "mitkVector.h"
#include <itkAffineGeometryFrame.h>
#include <itkQuaternionRigidTransform.h>
#include "itkScalableAffineTransform.h"
#include <itkIndex.h>
#include <vtkMatrixToLinearTransform.h>
#include <vtkMatrix4x4.h>
#include "mitkRotationOperation.h"
#include "mitkInteractionConst.h"
#include <mitkMatrixConvert.h>
#include <mitkImageCast.h>
class vtkMatrix4x4;
class vtkMatrixToLinearTransform;
class vtkLinearTransform;
typedef itk::BoundingBox<unsigned long, 3, mitk::ScalarType> BoundingBox;
typedef itk::BoundingBox<unsigned long, 3, mitk::ScalarType> BoundingBoxType;
typedef BoundingBoxType::BoundsArrayType BoundsArrayType;
typedef BoundingBoxType::Pointer BoundingBoxPointer;
// Dummy instance of abstract base class
class DummyTestClass : public mitk::BaseGeometry
{
public:
DummyTestClass(){};
DummyTestClass(const DummyTestClass& other) : BaseGeometry(other){};
~DummyTestClass(){};
mitkClassMacro(DummyTestClass, mitk::BaseGeometry);
itkNewMacro(Self);
mitkNewMacro1Param(Self, const Self&);
- itk::LightObject::Pointer InternalClone() const
+ itk::LightObject::Pointer InternalClone() const override
{
Self::Pointer newGeometry = new Self(*this);
newGeometry->UnRegister();
return newGeometry.GetPointer();
}
protected:
- virtual void PrintSelf(std::ostream& /*os*/, itk::Indent /*indent*/) const{};
+ virtual void PrintSelf(std::ostream& /*os*/, itk::Indent /*indent*/) const override{};
//##Documentation
//## @brief Pre- and Post-functions are empty in BaseGeometry
//##
//## These virtual functions allow for a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use {}.
//## If this class is inherited from a subclass of BaseGeometry, call {Superclass::Pre...();};, example: DisplayGeometry class
- virtual void PreSetSpacing(const mitk::Vector3D& aSpacing){};
+ virtual void PreSetSpacing(const mitk::Vector3D& aSpacing) override{};
};
class mitkBaseGeometryTestSuite : public mitk::TestFixture
{
// List of Tests
CPPUNIT_TEST_SUITE(mitkBaseGeometryTestSuite);
//Constructor
MITK_TEST(TestConstructors);
MITK_TEST(TestInitialize);
//Set
MITK_TEST(TestSetOrigin);
MITK_TEST(TestSetBounds);
MITK_TEST(TestSetFloatBounds);
MITK_TEST(TestSetFloatBoundsDouble);
MITK_TEST(TestSetFrameOfReferenceID);
MITK_TEST(TestSetIndexToWorldTransform);
MITK_TEST(TestSetIndexToWorldTransformWithoutChangingSpacing);
MITK_TEST(TestSetIndexToWorldTransform_WithPointerToSameTransform);
MITK_TEST(TestSetSpacing);
MITK_TEST(TestTransferItkToVtkTransform);
MITK_TEST(TestSetIndexToWorldTransformByVtkMatrix);
MITK_TEST(TestSetIdentity);
MITK_TEST(TestSetImageGeometry);
//Equal
MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
MITK_TEST(Equal_DifferentOrigin_ReturnsFalse);
MITK_TEST(Equal_DifferentIndexToWorldTransform_ReturnsFalse);
MITK_TEST(Equal_DifferentSpacing_ReturnsFalse);
MITK_TEST(Equal_InputIsNull_ReturnsFalse);
MITK_TEST(Equal_DifferentBoundingBox_ReturnsFalse);
//other Functions
MITK_TEST(TestComposeTransform);
MITK_TEST(TestComposeVtkMatrix);
MITK_TEST(TestTranslate);
MITK_TEST(TestIndexToWorld);
MITK_TEST(TestExecuteOperation);
MITK_TEST(TestCalculateBoundingBoxRelToTransform);
//MITK_TEST(TestSetTimeBounds);
MITK_TEST(TestIs2DConvertable);
MITK_TEST(TestGetCornerPoint);
MITK_TEST(TestExtentInMM);
MITK_TEST(TestGetAxisVector);
MITK_TEST(TestGetCenter);
MITK_TEST(TestGetDiagonalLength);
MITK_TEST(TestGetExtent);
MITK_TEST(TestIsInside);
MITK_TEST(TestGetMatrixColumn);
CPPUNIT_TEST_SUITE_END();
// Used Variables
private:
mitk::Point3D aPoint;
float aFloatSpacing[3];
mitk::Vector3D aSpacing;
mitk::AffineTransform3D::Pointer aTransform;
BoundingBoxPointer aBoundingBox;
mitk::AffineTransform3D::MatrixType aMatrix;
mitk::Point3D anotherPoint;
mitk::Vector3D anotherSpacing;
BoundingBoxPointer anotherBoundingBox;
BoundingBoxPointer aThirdBoundingBox;
mitk::AffineTransform3D::Pointer anotherTransform;
mitk::AffineTransform3D::Pointer aThirdTransform;
mitk::AffineTransform3D::MatrixType anotherMatrix;
mitk::AffineTransform3D::MatrixType aThirdMatrix;
DummyTestClass::Pointer aDummyGeometry;
DummyTestClass::Pointer anotherDummyGeometry;
public:
// Set up for variables
- void setUp()
+ void setUp() override
{
mitk::FillVector3D(aFloatSpacing, 1,1,1);
mitk::FillVector3D(aSpacing, 1,1,1);
mitk::FillVector3D(aPoint, 0,0,0);
//Transform
aTransform = mitk::AffineTransform3D::New();
aTransform->SetIdentity();
aMatrix.SetIdentity();
anotherTransform = mitk::AffineTransform3D::New();
anotherMatrix.SetIdentity();
anotherMatrix(1,1) = 2;
anotherTransform->SetMatrix( anotherMatrix );
aThirdTransform = mitk::AffineTransform3D::New();
aThirdMatrix.SetIdentity();
aThirdMatrix(1,1) = 7;
aThirdTransform->SetMatrix( aThirdMatrix );
//Bounding Box
float bounds[6] = {0,1,0,1,0,1};
mitk::BoundingBox::BoundsArrayType b;
const float *input = bounds;
int j=0;
for(mitk::BoundingBox::BoundsArrayType::Iterator it = b.Begin(); j < 6 ;++j) *it++ = (mitk::ScalarType)*input++;
aBoundingBox = BoundingBoxType::New();
BoundingBoxType::PointsContainer::Pointer pointscontainer = BoundingBoxType::PointsContainer::New();
BoundingBoxType::PointType p;
BoundingBoxType::PointIdentifier pointid;
for(pointid=0; pointid<2;++pointid)
{
unsigned int i;
for(i=0; i<3; ++i)
{
p[i] = bounds[2*i+pointid];
}
pointscontainer->InsertElement(pointid, p);
}
aBoundingBox->SetPoints(pointscontainer);
aBoundingBox->ComputeBoundingBox();
anotherBoundingBox = BoundingBoxType::New();
p[0]=11;
p[1]=12;
p[2]=13;
pointscontainer->InsertElement(1, p);
anotherBoundingBox->SetPoints(pointscontainer);
anotherBoundingBox->ComputeBoundingBox();
aThirdBoundingBox = BoundingBoxType::New();
p[0]=22;
p[1]=23;
p[2]=24;
pointscontainer->InsertElement(1, p);
aThirdBoundingBox->SetPoints(pointscontainer);
aThirdBoundingBox->ComputeBoundingBox();
mitk::FillVector3D(anotherPoint, 2,3,4);
mitk::FillVector3D(anotherSpacing, 5,6.5,7);
aDummyGeometry = DummyTestClass::New();
aDummyGeometry->Initialize();
anotherDummyGeometry = aDummyGeometry->Clone();
}
- void tearDown()
+ void tearDown() override
{
aDummyGeometry = NULL;
anotherDummyGeometry = NULL;
}
// Test functions
void TestSetOrigin()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetOrigin(anotherPoint);
CPPUNIT_ASSERT(mitk::Equal(anotherPoint,dummy->GetOrigin()));
//undo changes, new and changed object need to be the same!
dummy->SetOrigin(aPoint);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy, newDummy, "TestSetOrigin");
}
void TestSetImageGeometry()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetImageGeometry(true);
CPPUNIT_ASSERT(dummy->GetImageGeometry());
//undo changes, new and changed object need to be the same!
dummy->SetImageGeometry(false);
CPPUNIT_ASSERT(dummy->GetImageGeometry()==false);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy, "TestSetImageGeometry");
}
void TestSetFloatBounds(){
float bounds[6] = {0,11,0,12,0,13};
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "BoundingBox equality");
//Wrong bounds, test needs to fail
bounds[1]=7;
dummy->SetFloatBounds(bounds);
MITK_ASSERT_NOT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "BoundingBox not equal");
//undo changes, new and changed object need to be the same!
float originalBounds[6] = {0,1,0,1,0,1};
dummy->SetFloatBounds(originalBounds);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy, "Undo and equal");
}
void TestSetBounds(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetBounds(anotherBoundingBox->GetBounds());
MITK_ASSERT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "Setting bounds");
//Test needs to fail now
dummy->SetBounds(aThirdBoundingBox->GetBounds());
MITK_ASSERT_NOT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "Setting unequal bounds");
//undo changes, new and changed object need to be the same!
dummy->SetBounds(aBoundingBox->GetBounds());
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy, "Undo set bounds");
}
void TestSetFloatBoundsDouble(){
double bounds[6] = {0,11,0,12,0,13};
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "Float bounds");
//Test needs to fail now
bounds[3]=7;
dummy->SetFloatBounds(bounds);
MITK_ASSERT_NOT_EQUAL(BoundingBox::ConstPointer(dummy->GetBoundingBox()), anotherBoundingBox, "Float bounds unequal");
//undo changes, new and changed object need to be the same!
double originalBounds[6] = {0,1,0,1,0,1};
dummy->SetFloatBounds(originalBounds);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy, "Undo set float bounds");
}
void TestSetFrameOfReferenceID()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetFrameOfReferenceID(5);
CPPUNIT_ASSERT(dummy->GetFrameOfReferenceID()==5);
//undo changes, new and changed object need to be the same!
dummy->SetFrameOfReferenceID(0);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy, "Undo set frame of reference");
}
void TestSetIndexToWorldTransform()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform);
MITK_ASSERT_EQUAL(anotherTransform,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compare IndexToWorldTransform 1");
//Test needs to fail now
dummy->SetIndexToWorldTransform(aThirdTransform);
MITK_ASSERT_NOT_EQUAL(anotherTransform,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compare IndexToWorldTransform 2");
//undo changes, new and changed object need to be the same!
dummy->SetIndexToWorldTransform(aTransform);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Compare IndexToWorldTransform 3");
}
void TestSetIndexToWorldTransformWithoutChangingSpacing()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransformWithoutChangingSpacing(anotherTransform);
CPPUNIT_ASSERT(mitk::Equal(aSpacing,dummy->GetSpacing(),mitk::eps,true));
//calculate a new version of anotherTransform, so that the spacing should be the same as the original spacing of aTransform.
mitk::AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = anotherTransform->GetMatrix().GetVnlMatrix();
mitk::VnlVector col;
col = vnlmatrix.get_column(0); col.normalize(); col*=aSpacing[0]; vnlmatrix.set_column(0, col);
col = vnlmatrix.get_column(1); col.normalize(); col*=aSpacing[1]; vnlmatrix.set_column(1, col);
col = vnlmatrix.get_column(2); col.normalize(); col*=aSpacing[2]; vnlmatrix.set_column(2, col);
mitk::Matrix3D matrix;
matrix = vnlmatrix;
anotherTransform->SetMatrix(matrix);
CPPUNIT_ASSERT(mitk::Equal(anotherTransform,dummy->GetIndexToWorldTransform(),mitk::eps,true));
}
void TestSetIndexToWorldTransform_WithPointerToSameTransform()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetOrigin(anotherPoint);
dummy->SetIndexToWorldTransform(anotherTransform);
dummy->SetSpacing(anotherSpacing);
mitk::AffineTransform3D::Pointer testTransfrom = dummy->GetIndexToWorldTransform();
mitk::Vector3D modifiedPoint = anotherPoint.GetVectorFromOrigin() *2.;
testTransfrom->SetOffset(modifiedPoint);
dummy->SetIndexToWorldTransform(testTransfrom);
CPPUNIT_ASSERT(mitk::Equal(modifiedPoint, dummy->GetOrigin().GetVectorFromOrigin()));
}
void TestSetIndexToWorldTransformByVtkMatrix()
{
vtkMatrix4x4* vtkmatrix;
vtkmatrix = vtkMatrix4x4::New();
vtkmatrix->Identity();
vtkmatrix->SetElement(1,1,2);
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransformByVtkMatrix(vtkmatrix);
MITK_ASSERT_EQUAL(anotherTransform,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compare IndexToWorldTransformByVtkMatrix 1");
//test needs to fail now
vtkmatrix->SetElement(1,1,7);
dummy->SetIndexToWorldTransformByVtkMatrix(vtkmatrix);
MITK_ASSERT_NOT_EQUAL(anotherTransform,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compare IndexToWorldTransformByVtkMatrix 2");
//undo changes, new and changed object need to be the same!
vtkmatrix->SetElement(1,1,1);
dummy->SetIndexToWorldTransformByVtkMatrix(vtkmatrix);
vtkmatrix->Delete();
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Compare IndexToWorldTransformByVtkMatrix 3");
}
void TestSetIdentity()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
//Change IndextoWorldTransform and Origin
dummy->SetIndexToWorldTransform(anotherTransform);
dummy->SetOrigin(anotherPoint);
//Set Identity should reset ITWT and Origin
dummy->SetIdentity();
MITK_ASSERT_EQUAL(aTransform,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Test set identity 1");
CPPUNIT_ASSERT(mitk::Equal(aPoint,dummy->GetOrigin()));
CPPUNIT_ASSERT(mitk::Equal(aSpacing,dummy->GetSpacing()));
//new and changed object need to be the same!
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Test set identity 2");
}
void TestSetSpacing()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetSpacing(anotherSpacing);
CPPUNIT_ASSERT(mitk::Equal(anotherSpacing,dummy->GetSpacing()));
//undo changes, new and changed object need to be the same!
dummy->SetSpacing(aSpacing);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy spacing");
}
void TestTransferItkToVtkTransform()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform); //calls TransferItkToVtkTransform
mitk::AffineTransform3D::Pointer dummyTransform = dummy->GetIndexToWorldTransform();
CPPUNIT_ASSERT(mitk::MatrixEqualElementWise( anotherMatrix, dummyTransform->GetMatrix() ));
}
void TestConstructors()
{
//test standard constructor
DummyTestClass::Pointer dummy1 = DummyTestClass::New();
bool test = dummy1->IsValid();
CPPUNIT_ASSERT(test == true);
CPPUNIT_ASSERT(dummy1->GetFrameOfReferenceID() == 0);
CPPUNIT_ASSERT(dummy1->GetIndexToWorldTransformLastModified() == 0);
CPPUNIT_ASSERT(mitk::Equal(dummy1->GetSpacing(), aSpacing));
CPPUNIT_ASSERT(mitk::Equal(dummy1->GetOrigin(), aPoint));
CPPUNIT_ASSERT(dummy1->GetImageGeometry()==false);
MITK_ASSERT_EQUAL(mitk::AffineTransform3D::Pointer(dummy1->GetIndexToWorldTransform()), aTransform,"Contructor test 1");
MITK_ASSERT_EQUAL(mitk::BaseGeometry::BoundingBoxType::ConstPointer(dummy1->GetBoundingBox()), aBoundingBox, "Constructor test 2");
DummyTestClass::Pointer dummy2 = DummyTestClass::New();
dummy2->SetOrigin(anotherPoint);
float bounds[6] = {0,11,0,12,0,13};
dummy2->SetFloatBounds(bounds);
dummy2->SetIndexToWorldTransform(anotherTransform);
dummy2->SetSpacing(anotherSpacing);
DummyTestClass::Pointer dummy3 = DummyTestClass::New(*dummy2);
MITK_ASSERT_EQUAL(dummy3,dummy2,"Dummy contructor");
}
//Equal Tests
void Equal_CloneAndOriginal_ReturnsTrue()
{
MITK_ASSERT_EQUAL( aDummyGeometry, anotherDummyGeometry, "Clone test");
}
void Equal_DifferentOrigin_ReturnsFalse()
{
anotherDummyGeometry->SetOrigin(anotherPoint);
MITK_ASSERT_NOT_EQUAL(aDummyGeometry, anotherDummyGeometry, "Different origin test");
}
void Equal_DifferentIndexToWorldTransform_ReturnsFalse()
{
anotherDummyGeometry->SetIndexToWorldTransform(anotherTransform);
MITK_ASSERT_NOT_EQUAL( aDummyGeometry, anotherDummyGeometry, "Different index to world");
}
void Equal_DifferentSpacing_ReturnsFalse()
{
anotherDummyGeometry->SetSpacing(anotherSpacing);
MITK_ASSERT_NOT_EQUAL( aDummyGeometry, anotherDummyGeometry, "Different spacing");
}
void Equal_InputIsNull_ReturnsFalse()
{
DummyTestClass::Pointer geometryNull = NULL;
CPPUNIT_ASSERT_THROW( MITK_ASSERT_EQUAL(geometryNull,anotherDummyGeometry,"Input is null") , mitk::Exception );
}
void Equal_DifferentBoundingBox_ReturnsFalse()
{
//create different bounds to make the comparison false
mitk::ScalarType bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
anotherDummyGeometry->SetBounds(bounds);
MITK_ASSERT_NOT_EQUAL( aDummyGeometry, anotherDummyGeometry , "Different bounding box");
}
void TestComposeTransform(){
//Create Transformations to set and compare
mitk::AffineTransform3D::Pointer transform1;
transform1 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix1;
matrix1.SetIdentity();
matrix1(1,1) = 2;
transform1->SetMatrix( matrix1 ); //Spacing = 2
mitk::AffineTransform3D::Pointer transform2;
transform2 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix2;
matrix2.SetIdentity();
matrix2(1,1) = 2;
transform2->SetMatrix( matrix2 ); //Spacing = 2
mitk::AffineTransform3D::Pointer transform3;
transform3 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix3;
matrix3.SetIdentity();
matrix3(1,1) = 4;
transform3->SetMatrix( matrix3 ); //Spacing = 4
mitk::AffineTransform3D::Pointer transform4;
transform4 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix4;
matrix4.SetIdentity();
matrix4(1,1) = 0.25;
transform4->SetMatrix( matrix4 ); //Spacing = 0.25
//Vector to compare spacing
mitk::Vector3D expectedSpacing;
expectedSpacing.Fill(1.0);
expectedSpacing[1] = 4;
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(transform1); //Spacing = 2
dummy->Compose(transform2); //Spacing = 4
CPPUNIT_ASSERT(mitk::Equal(dummy->GetSpacing(), expectedSpacing));
MITK_ASSERT_EQUAL(transform3,mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compose transform 2"); // 4=4
//undo changes, new and changed object need to be the same!
dummy->Compose(transform4); //Spacing = 1
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Compose transform 3"); // 1=1
}
void TestComposeVtkMatrix(){
//Create Transformations to set and compare
mitk::AffineTransform3D::Pointer transform1;
transform1 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix1;
matrix1.SetIdentity();
matrix1(1,1) = 2;
transform1->SetMatrix( matrix1 ); //Spacing = 2
vtkMatrix4x4* vtkmatrix2;
vtkmatrix2 = vtkMatrix4x4::New();
vtkmatrix2->Identity();
vtkmatrix2->SetElement(1,1,2); //Spacing = 2
mitk::AffineTransform3D::Pointer transform3;
transform3 = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType matrix3;
matrix3.SetIdentity();
matrix3(1,1) = 4;
transform3->SetMatrix( matrix3 ); //Spacing = 4
vtkMatrix4x4* vtkmatrix4;
vtkmatrix4 = vtkMatrix4x4::New();
vtkmatrix4->Identity();
vtkmatrix4->SetElement(1,1,0.25); //Spacing = 0.25
//Vector to compare spacing
mitk::Vector3D expectedSpacing;
expectedSpacing.Fill(1.0);
expectedSpacing[1] = 4;
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(transform1); //Spacing = 2
dummy->Compose(vtkmatrix2); //Spacing = 4
vtkmatrix2->Delete();
MITK_ASSERT_EQUAL(transform3, mitk::AffineTransform3D::Pointer(dummy->GetIndexToWorldTransform()),"Compose vtk matrix"); // 4=4
CPPUNIT_ASSERT(mitk::Equal(dummy->GetSpacing(), expectedSpacing));
//undo changes, new and changed object need to be the same!
dummy->Compose(vtkmatrix4); //Spacing = 1
vtkmatrix4->Delete();
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Compose vtk"); // 1=1
}
void TestTranslate(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetOrigin(anotherPoint);
CPPUNIT_ASSERT(mitk::Equal(anotherPoint,dummy->GetOrigin()));
//use some random values for translation
mitk::Vector3D translationVector;
translationVector.SetElement(0, 17.5f);
translationVector.SetElement(1, -32.3f);
translationVector.SetElement(2, 4.0f);
//compute ground truth
mitk::Point3D tmpResult = anotherPoint + translationVector;
dummy->Translate(translationVector);
CPPUNIT_ASSERT( mitk::Equal( dummy->GetOrigin(), tmpResult ));
//undo changes
translationVector*=-1;
dummy->Translate(translationVector);
CPPUNIT_ASSERT( mitk::Equal( dummy->GetOrigin(), anotherPoint ));
//undo changes, new and changed object need to be the same!
translationVector.SetElement(0, -1 * anotherPoint[0]);
translationVector.SetElement(1, -1 * anotherPoint[1]);
translationVector.SetElement(2, -1 * anotherPoint[2]);
dummy->Translate(translationVector);
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Translate test");
}
// a part of the test requires axis-parallel coordinates
int testIndexAndWorldConsistency(DummyTestClass::Pointer dummyGeometry)
{
//Testing consistency of index and world coordinate systems
mitk::Point3D origin = dummyGeometry->GetOrigin();
mitk::Point3D dummyPoint;
//Testing index->world->index conversion consistency
dummyGeometry->WorldToIndex(origin, dummyPoint);
dummyGeometry->IndexToWorld(dummyPoint, dummyPoint);
CPPUNIT_ASSERT(mitk::EqualArray(dummyPoint, origin, 3, mitk::eps, true));
//Testing WorldToIndex(origin, mitk::Point3D)==(0,0,0)
mitk::Point3D globalOrigin;
mitk::FillVector3D(globalOrigin, 0,0,0);
mitk::Point3D originContinuousIndex;
dummyGeometry->WorldToIndex(origin, originContinuousIndex);
CPPUNIT_ASSERT(mitk::EqualArray(originContinuousIndex, globalOrigin, 3, mitk::eps, true));
//Testing WorldToIndex(origin, itk::Index)==(0,0,0)
itk::Index<3> itkindex;
dummyGeometry->WorldToIndex(origin, itkindex);
itk::Index<3> globalOriginIndex;
mitk::vtk2itk(globalOrigin, globalOriginIndex);
CPPUNIT_ASSERT(mitk::EqualArray(itkindex, globalOriginIndex, 3, mitk::eps, true));
//Testing WorldToIndex(origin-0.5*spacing, itk::Index)==(0,0,0)
mitk::Vector3D halfSpacingStep = dummyGeometry->GetSpacing()*0.5;
mitk::Matrix3D rotation;
mitk::Point3D originOffCenter = origin-halfSpacingStep;
dummyGeometry->WorldToIndex(originOffCenter, itkindex);
CPPUNIT_ASSERT(mitk::EqualArray(itkindex, globalOriginIndex, 3, mitk::eps, true));
//Testing WorldToIndex(origin+0.5*spacing-eps, itk::Index)==(0,0,0)
originOffCenter = origin+halfSpacingStep;
originOffCenter -= 0.0001;
dummyGeometry->WorldToIndex( originOffCenter, itkindex);
CPPUNIT_ASSERT(mitk::EqualArray(itkindex, globalOriginIndex, 3, mitk::eps, true));
//Testing WorldToIndex(origin+0.5*spacing, itk::Index)==(1,1,1)");
originOffCenter = origin+halfSpacingStep;
itk::Index<3> global111;
mitk::FillVector3D(global111, 1,1,1);
dummyGeometry->WorldToIndex( originOffCenter, itkindex);
CPPUNIT_ASSERT(mitk::EqualArray(itkindex, global111, 3, mitk::eps, true));
//Testing WorldToIndex(GetCenter())==BoundingBox.GetCenter
mitk::Point3D center = dummyGeometry->GetCenter();
mitk::Point3D centerContIndex;
dummyGeometry->WorldToIndex(center, centerContIndex);
mitk::BoundingBox::ConstPointer boundingBox = dummyGeometry->GetBoundingBox();
mitk::BoundingBox::PointType centerBounds = boundingBox->GetCenter();
CPPUNIT_ASSERT(mitk::Equal(centerContIndex,centerBounds));
//Testing GetCenter()==IndexToWorld(BoundingBox.GetCenter)
center = dummyGeometry->GetCenter();
mitk::Point3D centerBoundsInWorldCoords;
dummyGeometry->IndexToWorld(centerBounds, centerBoundsInWorldCoords);
CPPUNIT_ASSERT(mitk::Equal(center,centerBoundsInWorldCoords));
//Test using random point,
//Testing consistency of index and world coordinate systems
mitk::Point3D point;
mitk::FillVector3D(point,3.5,-2,4.6);
//Testing index->world->index conversion consistency
dummyGeometry->WorldToIndex(point, dummyPoint);
dummyGeometry->IndexToWorld(dummyPoint, dummyPoint);
CPPUNIT_ASSERT(mitk::EqualArray(dummyPoint, point, 3, mitk::eps, true));
return EXIT_SUCCESS;
}
int testIndexAndWorldConsistencyForVectors(DummyTestClass::Pointer dummyGeometry)
{
//Testing consistency of index and world coordinate systems for vectors
mitk::Vector3D xAxisMM = dummyGeometry->GetAxisVector(0);
mitk::Vector3D xAxisContinuousIndex;
mitk::Point3D p, pIndex, origin;
origin = dummyGeometry->GetOrigin();
p[0] = xAxisMM[0]+origin[0];
p[1] = xAxisMM[1]+origin[1];
p[2] = xAxisMM[2]+origin[2];
dummyGeometry->WorldToIndex(p,pIndex);
dummyGeometry->WorldToIndex(xAxisMM,xAxisContinuousIndex);
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[0], pIndex[0]));
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[1], pIndex[1]));
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[2], pIndex[2]));
dummyGeometry->IndexToWorld(xAxisContinuousIndex,xAxisContinuousIndex);
dummyGeometry->IndexToWorld(pIndex,p);
CPPUNIT_ASSERT(xAxisContinuousIndex == xAxisMM);
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[0], p[0]-origin[0]));
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[1], p[1]-origin[1]));
CPPUNIT_ASSERT(mitk::Equal(xAxisContinuousIndex[2], p[2]-origin[2]));
//Test consictency for random vector
mitk::Vector3D vector;
mitk::FillVector3D(vector, 2.5,-3.2,8.1);
mitk::Vector3D vectorContinuousIndex;
p[0] = vector[0]+origin[0];
p[1] = vector[1]+origin[1];
p[2] = vector[2]+origin[2];
dummyGeometry->WorldToIndex(p,pIndex);
dummyGeometry->WorldToIndex(vector,vectorContinuousIndex);
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[0], pIndex[0]));
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[1], pIndex[1]));
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[2], pIndex[2]));
dummyGeometry->IndexToWorld(vectorContinuousIndex,vectorContinuousIndex);
dummyGeometry->IndexToWorld(pIndex,p);
CPPUNIT_ASSERT(vectorContinuousIndex == vector);
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[0], p[0]-origin[0]));
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[1], p[1]-origin[1]));
CPPUNIT_ASSERT(mitk::Equal(vectorContinuousIndex[2], p[2]-origin[2]));
return EXIT_SUCCESS;
}
int testIndexAndWorldConsistencyForIndex(DummyTestClass::Pointer dummyGeometry)
{
//Testing consistency of index and world coordinate systems
// creating testing data
itk::Index<4> itkIndex4, itkIndex4b;
itk::Index<3> itkIndex3, itkIndex3b;
itk::Index<2> itkIndex2, itkIndex2b;
itk::Index<3> mitkIndex, mitkIndexb;
itkIndex4[0] = itkIndex4[1] = itkIndex4[2] = itkIndex4[3] = 4;
itkIndex3[0] = itkIndex3[1] = itkIndex3[2] = 6;
itkIndex2[0] = itkIndex2[1] = 2;
mitkIndex[0] = mitkIndex[1] = mitkIndex[2] = 13;
// check for constistency
mitk::Point3D point;
dummyGeometry->IndexToWorld(itkIndex2,point);
dummyGeometry->WorldToIndex(point,itkIndex2b);
CPPUNIT_ASSERT(
((itkIndex2b[0] == itkIndex2[0]) &&
(itkIndex2b[1] == itkIndex2[1])));
//Testing itk::index<2> for IndexToWorld/WorldToIndex consistency
dummyGeometry->IndexToWorld(itkIndex3,point);
dummyGeometry->WorldToIndex(point,itkIndex3b);
CPPUNIT_ASSERT(
((itkIndex3b[0] == itkIndex3[0]) &&
(itkIndex3b[1] == itkIndex3[1]) &&
(itkIndex3b[2] == itkIndex3[2])));
//Testing itk::index<3> for IndexToWorld/WorldToIndex consistency
dummyGeometry->IndexToWorld(itkIndex4,point);
dummyGeometry->WorldToIndex(point,itkIndex4b);
CPPUNIT_ASSERT(
((itkIndex4b[0] == itkIndex4[0]) &&
(itkIndex4b[1] == itkIndex4[1]) &&
(itkIndex4b[2] == itkIndex4[2]) &&
(itkIndex4b[3] == 0)));
//Testing itk::index<3> for IndexToWorld/WorldToIndex consistency
dummyGeometry->IndexToWorld(mitkIndex,point);
dummyGeometry->WorldToIndex(point,mitkIndexb);
CPPUNIT_ASSERT(
((mitkIndexb[0] == mitkIndex[0]) &&
(mitkIndexb[1] == mitkIndex[1]) &&
(mitkIndexb[2] == mitkIndex[2])));
//Testing mitk::Index for IndexToWorld/WorldToIndex consistency
return EXIT_SUCCESS;
}
void TestIndexToWorld(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
testIndexAndWorldConsistency(dummy);
testIndexAndWorldConsistencyForVectors(dummy);
testIndexAndWorldConsistencyForIndex(dummy);
//Geometry must not have changed
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy index to world");
//Test with other geometries
dummy->SetOrigin(anotherPoint);
testIndexAndWorldConsistency(dummy);
testIndexAndWorldConsistencyForVectors(dummy);
testIndexAndWorldConsistencyForIndex(dummy);
dummy->SetIndexToWorldTransform(anotherTransform);
testIndexAndWorldConsistency(dummy);
testIndexAndWorldConsistencyForVectors(dummy);
testIndexAndWorldConsistencyForIndex(dummy);
dummy->SetOrigin(anotherPoint);
testIndexAndWorldConsistency(dummy);
testIndexAndWorldConsistencyForVectors(dummy);
testIndexAndWorldConsistencyForIndex(dummy);
dummy->SetSpacing(anotherSpacing);
testIndexAndWorldConsistency(dummy);
testIndexAndWorldConsistencyForVectors(dummy);
testIndexAndWorldConsistencyForIndex(dummy);
}
void TestExecuteOperation(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
//Do same Operations with new Dummy and compare
DummyTestClass::Pointer newDummy = DummyTestClass::New();
//Test operation Nothing
mitk::Operation* opN = new mitk::Operation(mitk::OpNOTHING);
dummy->ExecuteOperation(opN);
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy execute operation 1");
//Test operation Move
mitk::PointOperation* opP = new mitk::PointOperation(mitk::OpMOVE,anotherPoint);
dummy->ExecuteOperation(opP);
CPPUNIT_ASSERT(mitk::Equal(anotherPoint,dummy->GetOrigin()));
newDummy->SetOrigin(anotherPoint);
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy execute operation 2");
//Test operation Scale, Scale sets spacing to scale+1
mitk::Point3D spacing;
spacing[0]=anotherSpacing[0]-1.;
spacing[1]=anotherSpacing[1]-1.;
spacing[2]=anotherSpacing[2]-1.;
mitk::PointOperation* opS = new mitk::PointOperation(mitk::OpSCALE,spacing);
dummy->ExecuteOperation(opS);
CPPUNIT_ASSERT(mitk::Equal(anotherSpacing,dummy->GetSpacing()));
newDummy->SetSpacing(anotherSpacing);
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy execute operation 3");
//change Geometry to test more cases
dummy->SetIndexToWorldTransform(anotherTransform);
dummy->SetSpacing(anotherSpacing);
//Testing a rotation of the geometry
double angle = 35.0;
mitk::Vector3D rotationVector; mitk::FillVector3D( rotationVector, 1, 0, 0 );
mitk::Point3D center = dummy->GetCenter();
mitk::RotationOperation* opR = new mitk::RotationOperation( mitk::OpROTATE, center, rotationVector, angle );
dummy->ExecuteOperation(opR);
mitk::Matrix3D rotation;
mitk::GetRotation(dummy, rotation);
mitk::Vector3D voxelStep=rotation*anotherSpacing;
mitk::Vector3D voxelStepIndex;
dummy->WorldToIndex(voxelStep, voxelStepIndex);
mitk::Vector3D expectedVoxelStepIndex;
expectedVoxelStepIndex.Fill(1);
CPPUNIT_ASSERT(mitk::Equal(voxelStepIndex,expectedVoxelStepIndex));
delete opR;
delete opN;
delete opS;
delete opP;
}
void TestCalculateBoundingBoxRelToTransform(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetExtentInMM(0,15);
dummy->SetExtentInMM(1,20);
dummy->SetExtentInMM(2,8);
mitk::BoundingBox::Pointer dummyBoundingBox = dummy->CalculateBoundingBoxRelativeToTransform(anotherTransform);
mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New();
mitk::BoundingBox::PointIdentifier pointid=0;
unsigned char i;
mitk::AffineTransform3D::Pointer inverse = mitk::AffineTransform3D::New();
anotherTransform->GetInverse(inverse);
for(i=0; i<8; ++i)
pointscontainer->InsertElement( pointid++, inverse->TransformPoint( dummy->GetCornerPoint(i) ));
mitk::BoundingBox::Pointer result = mitk::BoundingBox::New();
result->SetPoints(pointscontainer);
result->ComputeBoundingBox();
MITK_ASSERT_EQUAL(result,dummyBoundingBox,"BBox rel to transform");
//dummy still needs to be unchanged, except for extend
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetExtentInMM(0,15);
newDummy->SetExtentInMM(1,20);
newDummy->SetExtentInMM(2,8);
MITK_ASSERT_EQUAL(dummy,newDummy,"Dummy BBox");
}
//void TestSetTimeBounds(){
// mitk::TimeBounds timeBounds;
// timeBounds[0] = 1;
// timeBounds[1] = 9;
// DummyTestClass::Pointer dummy = DummyTestClass::New();
// dummy->SetTimeBounds(timeBounds);
// mitk::TimeBounds timeBounds2 = dummy->GetTimeBounds();
// CPPUNIT_ASSERT(timeBounds[0]==timeBounds2[0]);
// CPPUNIT_ASSERT(timeBounds[1]==timeBounds2[1]);
// //undo changes, new and changed object need to be the same!
// timeBounds[0]=mitk::ScalarTypeNumericTraits::NonpositiveMin();
// timeBounds[1]=mitk::ScalarTypeNumericTraits::max();
// DummyTestClass::Pointer newDummy = DummyTestClass::New();
// CPPUNIT_ASSERT(mitk::Equal(dummy,newDummy,mitk::eps,true));
//}
void TestIs2DConvertable(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
//new initialized geometry is 2D convertable
CPPUNIT_ASSERT(dummy->Is2DConvertable());
//Wrong Spacing needs to fail
dummy->SetSpacing(anotherSpacing);
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
//undo
dummy->SetSpacing(aSpacing);
CPPUNIT_ASSERT(dummy->Is2DConvertable());
//Wrong Origin needs to fail
dummy->SetOrigin(anotherPoint);
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
//undo
dummy->SetOrigin(aPoint);
CPPUNIT_ASSERT(dummy->Is2DConvertable());
//third dimension must not be transformed
mitk::AffineTransform3D::Pointer dummyTransform = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType dummyMatrix;
dummyMatrix.SetIdentity();
dummyTransform->SetMatrix( dummyMatrix );
dummy->SetIndexToWorldTransform(dummyTransform);
//identity matrix is 2DConvertable
CPPUNIT_ASSERT(dummy->Is2DConvertable());
dummyMatrix(0,2) = 3;
dummyTransform->SetMatrix( dummyMatrix );
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
dummyMatrix.SetIdentity();
dummyMatrix(1,2) = 0.4;
dummyTransform->SetMatrix( dummyMatrix );
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
dummyMatrix.SetIdentity();
dummyMatrix(2,2) = 3;
dummyTransform->SetMatrix( dummyMatrix );
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
dummyMatrix.SetIdentity();
dummyMatrix(2,1) = 3;
dummyTransform->SetMatrix( dummyMatrix );
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
dummyMatrix.SetIdentity();
dummyMatrix(2,0) = 3;
dummyTransform->SetMatrix( dummyMatrix );
CPPUNIT_ASSERT(dummy->Is2DConvertable()==false);
//undo changes, new and changed object need to be the same!
dummyMatrix.SetIdentity();
dummyTransform->SetMatrix( dummyMatrix );
DummyTestClass::Pointer newDummy = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy,newDummy,"Is 2D convertable");
}
void TestGetCornerPoint(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform);
double bounds[6] = {0,11,0,12,0,13};
dummy->SetFloatBounds(bounds);
mitk::Point3D corner, refCorner;
//Corner 0
mitk::FillVector3D(refCorner,bounds[0],bounds[2],bounds[4]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(0);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(true,true,true);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 1
mitk::FillVector3D(refCorner,bounds[0],bounds[2],bounds[5]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(1);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(true,true,false);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 2
mitk::FillVector3D(refCorner,bounds[0],bounds[3],bounds[4]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(2);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(true,false,true);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 3
mitk::FillVector3D(refCorner,bounds[0],bounds[3],bounds[5]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(3);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(true,false,false);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 4
mitk::FillVector3D(refCorner,bounds[1],bounds[2],bounds[4]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(4);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(false,true,true);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 5
mitk::FillVector3D(refCorner,bounds[1],bounds[2],bounds[5]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(5);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(false,true,false);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 6
mitk::FillVector3D(refCorner,bounds[1],bounds[3],bounds[4]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(6);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(false,false,true);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Corner 7
mitk::FillVector3D(refCorner,bounds[1],bounds[3],bounds[5]);
refCorner = anotherTransform->TransformPoint(refCorner);
corner=dummy->GetCornerPoint(7);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
corner=dummy->GetCornerPoint(false,false,false);
CPPUNIT_ASSERT(mitk::Equal(refCorner,corner));
//Wrong Corner needs to fail
CPPUNIT_ASSERT_THROW(dummy->GetCornerPoint(20),itk::ExceptionObject);
//dummy geometry must not have changed!
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetIndexToWorldTransform(anotherTransform);
newDummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(dummy,newDummy,"Corner point");
}
void TestExtentInMM()
{
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetExtentInMM(0,50);
CPPUNIT_ASSERT(mitk::Equal(50.,dummy->GetExtentInMM(0)));
//Vnl Matrix has changed. The next line only works because the spacing is 1!
CPPUNIT_ASSERT(mitk::Equal(50.,dummy->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(0).magnitude()));
//Smaller extent than original
dummy->SetExtentInMM(0,5);
CPPUNIT_ASSERT(mitk::Equal(5.,dummy->GetExtentInMM(0)));
CPPUNIT_ASSERT(mitk::Equal(5.,dummy->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(0).magnitude()));
dummy->SetExtentInMM(1,4);
CPPUNIT_ASSERT(mitk::Equal(4.,dummy->GetExtentInMM(1)));
CPPUNIT_ASSERT(mitk::Equal(4.,dummy->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(1).magnitude()));
dummy->SetExtentInMM(2,2.5);
CPPUNIT_ASSERT(mitk::Equal(2.5,dummy->GetExtentInMM(2)));
CPPUNIT_ASSERT(mitk::Equal(2.5,dummy->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2).magnitude()));
}
void TestGetAxisVector(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform);
double bounds[6] = {0,11,0,12,0,13};
dummy->SetFloatBounds(bounds);
mitk::Vector3D vector;
mitk::FillVector3D(vector,bounds[1],0,0);
dummy->IndexToWorld(vector,vector);
CPPUNIT_ASSERT(mitk::Equal(dummy->GetAxisVector(0),vector));
mitk::FillVector3D(vector,0,bounds[3],0);
dummy->IndexToWorld(vector,vector);
CPPUNIT_ASSERT(mitk::Equal(dummy->GetAxisVector(1),vector));
mitk::FillVector3D(vector,0,0,bounds[5]);
dummy->IndexToWorld(vector,vector);
CPPUNIT_ASSERT(mitk::Equal(dummy->GetAxisVector(2),vector));
}
void TestGetCenter(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform);
double bounds[6] = {0,11,2,12,1,13};
dummy->SetFloatBounds(bounds);
mitk::Point3D refCenter;
for( int i=0;i<3;i++)
refCenter.SetElement(i,( bounds[2 * i] + bounds[2 * i + 1] ) / 2.0);
dummy->IndexToWorld(refCenter,refCenter);
CPPUNIT_ASSERT(mitk::Equal(dummy->GetCenter(),refCenter));
}
void TestGetDiagonalLength(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
double bounds[6] = {1,3,5,8,7.5,11.5};
dummy->SetFloatBounds(bounds);
//3-1=2, 8-5=3, 11.5-7.5=4; 2^2+3^2+4^2 = 29
double expectedLength = sqrt(29.);
CPPUNIT_ASSERT(mitk::Equal(expectedLength, dummy->GetDiagonalLength(), mitk::eps, true));
CPPUNIT_ASSERT(mitk::Equal(29., dummy->GetDiagonalLength2(), mitk::eps, true));
//dummy must not have changed
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(dummy,newDummy,"Diagonal length");
}
void TestGetExtent(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
double bounds[6] = {1,3,5,8,7.5,11.5};
dummy->SetFloatBounds(bounds);
CPPUNIT_ASSERT(mitk::Equal(2.,dummy->GetExtent(0)));
CPPUNIT_ASSERT(mitk::Equal(3.,dummy->GetExtent(1)));
CPPUNIT_ASSERT(mitk::Equal(4.,dummy->GetExtent(2)));
//dummy must not have changed
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(dummy,newDummy,"Extend");
}
void TestIsInside(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
double bounds[6] = {1,3,5,8,7.5,11.5};
dummy->SetFloatBounds(bounds);
mitk::Point3D insidePoint;
mitk::Point3D outsidePoint;
mitk::FillVector3D(insidePoint,2,6,7.6);
mitk::FillVector3D(outsidePoint,0,9,8.2);
CPPUNIT_ASSERT(dummy->IsIndexInside(insidePoint));
CPPUNIT_ASSERT(false==dummy->IsIndexInside(outsidePoint));
dummy->IndexToWorld(insidePoint,insidePoint);
dummy->IndexToWorld(outsidePoint,outsidePoint);
CPPUNIT_ASSERT(dummy->IsInside(insidePoint));
CPPUNIT_ASSERT(false==dummy->IsInside(outsidePoint));
//dummy must not have changed
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetFloatBounds(bounds);
MITK_ASSERT_EQUAL(dummy,newDummy,"Is inside");
}
void TestInitialize()
{
//test standard constructor
DummyTestClass::Pointer dummy1 = DummyTestClass::New();
DummyTestClass::Pointer dummy2 = DummyTestClass::New();
dummy2->SetOrigin(anotherPoint);
dummy2->SetBounds(anotherBoundingBox->GetBounds());
//mitk::TimeBounds timeBounds;
//timeBounds[0] = 1;
//timeBounds[1] = 9;
//dummy2->SetTimeBounds(timeBounds);
dummy2->SetIndexToWorldTransform(anotherTransform);
dummy2->SetSpacing(anotherSpacing);
dummy1->InitializeGeometry(dummy2);
MITK_ASSERT_EQUAL(dummy1,dummy2,"Initialize 1");
dummy1->Initialize();
DummyTestClass::Pointer dummy3 = DummyTestClass::New();
MITK_ASSERT_EQUAL(dummy3,dummy1,"Initialize 2");
}
void TestGetMatrixColumn(){
DummyTestClass::Pointer dummy = DummyTestClass::New();
dummy->SetIndexToWorldTransform(anotherTransform);
mitk::Vector3D testVector,refVector;
testVector.SetVnlVector(dummy->GetMatrixColumn(0));
mitk::FillVector3D(refVector,1,0,0);
CPPUNIT_ASSERT(testVector==refVector);
testVector.SetVnlVector(dummy->GetMatrixColumn(1));
mitk::FillVector3D(refVector,0,2,0);
CPPUNIT_ASSERT(testVector==refVector);
testVector.SetVnlVector(dummy->GetMatrixColumn(2));
mitk::FillVector3D(refVector,0,0,1);
CPPUNIT_ASSERT(testVector==refVector);
//dummy must not have changed
DummyTestClass::Pointer newDummy = DummyTestClass::New();
newDummy->SetIndexToWorldTransform(anotherTransform);
MITK_ASSERT_EQUAL(dummy,newDummy,"GetMatrixColumn");
}
/*
void (){
DummyTestClass::Pointer dummy = DummyTestClass::New();
CPPUNIT_ASSERT();
//undo changes, new and changed object need to be the same!
DummyTestClass::Pointer newDummy = DummyTestClass::New();
CPPUNIT_ASSERT(mitk::Equal(dummy,newDummy,mitk::eps,true));
}
*/
};//end class mitkBaseGeometryTestSuite
MITK_TEST_SUITE_REGISTRATION(mitkBaseGeometry)
diff --git a/Modules/Core/test/mitkDICOMLocaleTest.cpp b/Modules/Core/test/mitkDICOMLocaleTest.cpp
index 5e1ed3fef0..6b514da15a 100644
--- a/Modules/Core/test/mitkDICOMLocaleTest.cpp
+++ b/Modules/Core/test/mitkDICOMLocaleTest.cpp
@@ -1,141 +1,141 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*
This test is meant to reproduce the following error:
- The machine or current user has a German locale.
- This esp. means that stream IO expects the decimal separator as a comma: ","
- DICOM files use a point "." as the decimal separator to be locale independent
- The parser used by MITK (ITK's GDCM) seems to use the current locale instead of the "C" or "POSIX" locale
- This leads to spacings (and probably other numbers) being trimmed/rounded,
e.g. the correct spacing of 0.314 is read as 1.0 etc.
*/
#include "mitkStandardFileLocations.h"
#include "mitkDicomSeriesReader.h"
#include "mitkIOUtil.h"
#include "mitkImage.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <list>
#include <locale>
#include <locale.h>
class mitkDICOMLocaleTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkDICOMLocaleTestSuite);
CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS(addDICOMLocaleWithReferenceImageTests);
CPPUNIT_TEST_SUITE_END();
private:
// A custom method for adding a combination of filename and locale tests
static void addDICOMLocaleWithReferenceImageTests(TestSuiteBuilderContextType& context)
{
std::vector<std::string> fileArgs;
fileArgs.push_back("spacing-ok-ct.dcm");
fileArgs.push_back("spacing-ok-mr.dcm");
fileArgs.push_back("spacing-ok-sc.dcm");
// load a reference DICOM file with German locales being set
std::vector<std::string> localeArgs;
localeArgs.push_back("C");
localeArgs.push_back("de_DE");
localeArgs.push_back("de_DE.utf8");
localeArgs.push_back("de_DE.UTF8");
localeArgs.push_back("de_DE@euro");
localeArgs.push_back("German_Germany");
for (std::size_t fileIndex = 0; fileIndex < fileArgs.size(); ++fileIndex)
{
for (std::size_t localeIndex = 0; localeIndex < localeArgs.size(); ++localeIndex)
{
MITK_PARAMETERIZED_TEST_2(testLocaleWithReferenceImage, fileArgs[fileIndex], localeArgs[localeIndex]);
}
}
}
private:
std::string m_FileName;
std::string m_Locale;
bool m_SkipImageTest;
char* m_OldLocale;
void SetTestParameter()
{
std::vector<std::string> parameter = GetTestParameter();
CPPUNIT_ASSERT(parameter.size() == 2);
m_FileName = GetTestDataFilePath(parameter[0]);
m_Locale = parameter[1];
}
public:
mitkDICOMLocaleTestSuite() : m_OldLocale(NULL) {}
// Change the current locale to m_Locale
- void setUp()
+ void setUp() override
{
m_SkipImageTest = false;
m_OldLocale = NULL;
SetTestParameter();
try
{
m_OldLocale = setlocale(LC_ALL, NULL);
MITK_TEST_OUTPUT(<< " ** Changing locale from " << m_OldLocale << " to '" << m_Locale << "'")
setlocale(LC_ALL, m_Locale.c_str());
std::cin.imbue(std::locale(m_Locale.c_str()));
}
catch(...)
{
MITK_TEST_OUTPUT(<< "Could not activate locale " << m_Locale)
m_SkipImageTest = true;
}
}
- void tearDown()
+ void tearDown() override
{
if (m_OldLocale)
{
setlocale(LC_ALL, m_OldLocale);
std::cin.imbue(std::locale(m_OldLocale));
}
}
void testLocaleWithReferenceImage()
{
if (m_SkipImageTest) return;
mitk::Image::Pointer image = mitk::IOUtil::LoadImage(m_FileName);
CPPUNIT_ASSERT(image.IsNotNull());
// note importance of minor differences in spacings:
// DICOM has order y-spacing, x-spacing, while in MITK we assume x-spacing, y-spacing (both meant for 0 and 1 index in array)
CPPUNIT_ASSERT_MESSAGE("incorrect x spacing", mitk::Equal(image->GetGeometry()->GetSpacing()[0], 0.3141592));
CPPUNIT_ASSERT_MESSAGE("incorrect y spacing ", mitk::Equal(image->GetGeometry()->GetSpacing()[1], 0.3411592));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkDICOMLocale)
diff --git a/Modules/Core/test/mitkExceptionTest.cpp b/Modules/Core/test/mitkExceptionTest.cpp
index 7a2e51cf54..541fe5b111 100644
--- a/Modules/Core/test/mitkExceptionTest.cpp
+++ b/Modules/Core/test/mitkExceptionTest.cpp
@@ -1,324 +1,324 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkExceptionMacro.h"
#include "mitkTestingMacros.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <mitkCommon.h>
class SpecializedTestException : public mitk::Exception
{
public:
mitkExceptionClassMacro(SpecializedTestException,mitk::Exception);
};
class ExceptionTestClass : public itk::Object
{
public:
- mitkClassMacro( ExceptionTestClass , itk::Object );
+ mitkClassMacroItkParent( ExceptionTestClass , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void throwExceptionManually()
//this method is ONLY to test the constructor and no code example
//normally exceptions should only be thrown by using the exception macro!
{
throw mitk::Exception("test.cpp",155,"","");
}
void throwSpecializedExceptionManually()
//this method is ONLY to test the constructor and no code example
//normally exceptions should only be thrown by using the exception macro!
{
throw SpecializedTestException("test.cpp",155,"","");
}
void throwExceptionManually(std::string message1, std::string message2)
//this method is ONLY to test methods of mitk::Exception and no code example
//normally exceptions should only be thrown by using the exception macro!
{
throw mitk::Exception("testfile.cpp",155,message1.c_str(),"") << message2;
}
void throwExceptionWithThrowMacro()
{
mitkThrow()<<"TEST EXCEPION THROWING WITH mitkThrow()";
}
void throwExceptionWithThrowMacro(std::string message)
{
mitkThrow()<<message.c_str();
}
void throwSpecializedExceptionWithThrowMacro(std::string message)
{
mitkThrowException(mitk::Exception)<<message;
}
void throwSpecializedExceptionWithThrowMacro2(std::string message)
{
mitkThrowException(SpecializedTestException)<<message;
}
void reThrowExceptionWithReThrowMacro(std::string messageThrow, std::string messageReThrow)
{
try
{
throwExceptionWithThrowMacro(messageThrow);
}
catch(mitk::Exception e)
{
mitkReThrow(e) << messageReThrow;
}
}
static void TestExceptionConstructor()
{
bool exceptionThrown = false;
ExceptionTestClass::Pointer myExceptionTestObject = ExceptionTestClass::New();
try
{
myExceptionTestObject->throwExceptionManually();
}
catch(mitk::Exception)
{
exceptionThrown = true;
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown,"Testing constructor of mitkException");
exceptionThrown = false;
try
{
myExceptionTestObject->throwSpecializedExceptionManually();
}
catch(SpecializedTestException)
{
exceptionThrown = true;
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown,"Testing constructor specialized exception (deriving from mitkException)");
}
static void TestExceptionMessageStream()
{
//##### this method is ONLY to test the streaming operators of the exceptions and
//##### NO code example. Please do not instantiate exceptions by yourself in normal code!
//##### Normally exceptions should only be thrown by using the exception macro!
mitk::Exception myException = mitk::Exception("testfile.cpp",111,"testmessage");
myException << " and additional stream";
MITK_TEST_CONDITION_REQUIRED(myException.GetDescription() == std::string("testmessage and additional stream"),"Testing mitkException message stream (adding std::string)");
myException.SetDescription("testmessage2");
myException << ' ' << 'a' << 'n' << 'd' << ' ' << 'c' << 'h' << 'a' << 'r' << 's';
MITK_TEST_CONDITION_REQUIRED(myException.GetDescription() == std::string("testmessage2 and chars"),"Testing mitkException message stream (adding single chars)");
myException.SetDescription("testmessage3");
myException << myException; //adding the object itself makes no sense but should work
MITK_TEST_CONDITION_REQUIRED(myException.GetDescription() != std::string(""),"Testing mitkException message stream (adding object)");
SpecializedTestException mySpecializedException = SpecializedTestException("testfile.cpp",111,"testmessage","test");
mySpecializedException << " and additional stream";
MITK_TEST_CONDITION_REQUIRED(mySpecializedException.GetDescription() == std::string("testmessage and additional stream"),"Testing specialized exception message stream (adding std::string)");
}
static void TestExceptionMessageStreamThrowing()
{
bool exceptionThrown = false;
ExceptionTestClass::Pointer myExceptionTestObject = ExceptionTestClass::New();
std::string thrownMessage = "";
try
{
myExceptionTestObject->throwExceptionManually("message1"," and message2");
}
catch(mitk::Exception e)
{
thrownMessage = e.GetDescription();
exceptionThrown = true;
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown && (thrownMessage == std::string("message1 and message2")),"Testing throwing and streaming of mitk::Exception together.")
}
static void TestMitkThrowMacro()
{
bool exceptionThrown = false;
ExceptionTestClass::Pointer myExceptionTestObject = ExceptionTestClass::New();
//case 1: test throwing
try
{
myExceptionTestObject->throwExceptionWithThrowMacro();
}
catch(mitk::Exception)
{
exceptionThrown = true;
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown,"Testing mitkThrow()");
//case 2: test message text
exceptionThrown = false;
std::string messageText = "";
try
{
myExceptionTestObject->throwExceptionWithThrowMacro("test123");
}
catch(mitk::Exception e)
{
exceptionThrown = true;
messageText = e.GetDescription();
}
MITK_TEST_CONDITION_REQUIRED((exceptionThrown && (messageText=="test123")),"Testing message test of mitkThrow()");
//case 3: specialized exception / command mitkThrow(mitk::Exception)
exceptionThrown = false;
messageText = "";
try
{
myExceptionTestObject->throwSpecializedExceptionWithThrowMacro("test123");
}
catch(mitk::Exception e)
{
exceptionThrown = true;
messageText = e.GetDescription();
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown && messageText=="test123","Testing special exception with mitkThrow(mitk::Exception)");
//case 4: specialized exception / command mitkThrow(mitk::SpecializedException)
exceptionThrown = false;
messageText = "";
try
{
myExceptionTestObject->throwSpecializedExceptionWithThrowMacro2("test123");
}
catch(SpecializedTestException e)
{
exceptionThrown = true;
messageText = e.GetDescription();
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown && messageText=="test123","Testing special exception with mitkThrow(mitk::SpecializedException)");
}
static void TestRethrowInformation()
//this method is ONLY to test methods of mitk::Exception and no code example
//normally exceptions should only be instantiated and thrown by using the exception macros!
{
//first: testing rethrow information methods, when no information is stored
//case 1.1: method GetNumberOfRethrows()
mitk::Exception e = mitk::Exception("test.cpp",155,"","");
MITK_TEST_CONDITION_REQUIRED(e.GetNumberOfRethrows()==0,"Testing GetNumberOfRethrows() with empty rethrow information");
//case 1.2: GetRethrowData() with negative number
{
std::string file = "invalid";
int line = -1;
std::string message = "invalid";
e.GetRethrowData(-1,file,line,message);
MITK_TEST_CONDITION_REQUIRED(((file == "")&&(line==0)&&(message == "")),"Testing GetRethrowData() with invalid rethrow number (negative).");
}
//case 1.3: GetRethrowData() with number 0
{
std::string file = "invalid";
int line= -1;
std::string message = "invalid";
e.GetRethrowData(0,file,line,message);
MITK_TEST_CONDITION_REQUIRED(((file == "")&&(line==0)&&(message == "")),"Testing GetRethrowData() with non-existing rethrow number (0).");
}
//case 1.4: GetRethrowData() with number 1
{
std::string file = "invalid";
int line= -1;
std::string message = "invalid";
e.GetRethrowData(1,file,line,message);
MITK_TEST_CONDITION_REQUIRED(((file == "")&&(line==0)&&(message == "")),"Testing GetRethrowData() with non-existing rethrow number (1).");
}
//second: add rethrow data
e.AddRethrowData("test2.cpp",10,"Rethrow one");
MITK_TEST_CONDITION_REQUIRED(e.GetNumberOfRethrows()==1,"Testing adding of rethrow data.");
e.AddRethrowData("test3.cpp",15,"Rethrow two");
MITK_TEST_CONDITION_REQUIRED(e.GetNumberOfRethrows()==2,"Testing adding of more rethrow data.");
//third: test if this rethrow data was stored properly
{
std::string file = "invalid";
int line= -1;
std::string message = "invalid";
e.GetRethrowData(0,file,line,message);
MITK_TEST_CONDITION_REQUIRED(((file == "test2.cpp")&&(line==10)&&(message == "Rethrow one")),"Testing stored information of first rethrow.");
}
{
std::string file = "invalid";
int line= -1;
std::string message = "invalid";
e.GetRethrowData(1,file,line,message);
MITK_TEST_CONDITION_REQUIRED(((file == "test3.cpp")&&(line==15)&&(message == "Rethrow two")),"Testing stored information of second rethrow.");
}
}
static void TestRethrowMacro()
{
bool exceptionThrown = false;
std::string message = "";
ExceptionTestClass::Pointer myExceptionTestObject = ExceptionTestClass::New();
//case 1: test throwing
try
{
myExceptionTestObject->reThrowExceptionWithReThrowMacro("Test original message.","Test rethrow message.");
}
catch(mitk::Exception e)
{
message = e.GetDescription();
exceptionThrown = true;
}
MITK_TEST_CONDITION_REQUIRED(exceptionThrown,"Testing mitkReThrow()");
MITK_TEST_CONDITION_REQUIRED(message == "Test original message.Test rethrow message.", "Testing message/descriprion after rethrow.")
}
};
int mitkExceptionTest(int /*argc*/, char* /*argv*/[])
{
MITK_TEST_BEGIN("MITKException");
ExceptionTestClass::TestExceptionConstructor();
ExceptionTestClass::TestExceptionMessageStream();
ExceptionTestClass::TestExceptionMessageStreamThrowing();
ExceptionTestClass::TestMitkThrowMacro();
ExceptionTestClass::TestRethrowInformation();
ExceptionTestClass::TestRethrowMacro();
MITK_TEST_END();
}
diff --git a/Modules/Core/test/mitkFileReaderRegistryTest.cpp b/Modules/Core/test/mitkFileReaderRegistryTest.cpp
index b335b9e12b..c681db28dc 100644
--- a/Modules/Core/test/mitkFileReaderRegistryTest.cpp
+++ b/Modules/Core/test/mitkFileReaderRegistryTest.cpp
@@ -1,220 +1,220 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include "mitkAbstractFileReader.h"
#include "mitkIFileReader.h"
#include "mitkFileReaderRegistry.h"
#include <mitkBaseData.h>
#include <mitkImage.h>
#include <mitkCustomMimeType.h>
class DummyReader : public mitk::AbstractFileReader
{
public:
DummyReader(const DummyReader& other)
: mitk::AbstractFileReader(other)
{
}
DummyReader(const std::string& mimeTypeName, const std::string& extension, int priority)
: mitk::AbstractFileReader()
{
mitk::CustomMimeType mimeType(mimeTypeName);
mimeType.AddExtension(extension);
mimeType.SetComment("This is a dummy description");
this->SetMimeType(mimeType);
this->SetRanking(priority);
m_ServiceReg = this->RegisterService();
}
~DummyReader()
{
if (m_ServiceReg) m_ServiceReg.Unregister();
}
using mitk::AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<mitk::BaseData> > Read()
+ virtual std::vector< itk::SmartPointer<mitk::BaseData> > Read() override
{
std::vector<mitk::BaseData::Pointer> result;
return result;
}
private:
- DummyReader* Clone() const
+ DummyReader* Clone() const override
{
return new DummyReader(*this);
}
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
}; // End of internal dummy reader
class DummyReader2 : public mitk::AbstractFileReader
{
public:
DummyReader2(const DummyReader2& other)
: mitk::AbstractFileReader(other)
{
}
DummyReader2(const std::string& mimeTypeName, const std::string& extension, int priority)
: mitk::AbstractFileReader()
{
mitk::CustomMimeType mimeType(mimeTypeName);
mimeType.AddExtension(extension);
mimeType.SetComment("This is a second dummy description");
this->SetMimeType(mimeType);
this->SetRanking(priority);
m_ServiceReg = this->RegisterService();
}
~DummyReader2()
{
if (m_ServiceReg) m_ServiceReg.Unregister();
}
using mitk::AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<mitk::BaseData> > Read()
+ virtual std::vector< itk::SmartPointer<mitk::BaseData> > Read() override
{
std::vector<mitk::BaseData::Pointer> result;
return result;
}
private:
- DummyReader2* Clone() const
+ DummyReader2* Clone() const override
{
return new DummyReader2(*this);
}
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
}; // End of internal dummy reader 2
/**
* TODO
*/
int mitkFileReaderRegistryTest(int /*argc*/ , char* /*argv*/[])
{
// always start with this!
MITK_TEST_BEGIN("FileReaderRegistry");
// mitk::FileReaderRegistry::Pointer frm = mitk::FileReaderRegistry::New();
// MITK_TEST_CONDITION_REQUIRED(argc == 2,"Testing FileReaderRegistry instantiation");
//DummyReader testDR("application/dummy", "test",1);
//DummyReader otherDR("application/dummy2", "other",1);
//MITK_TEST_CONDITION_REQUIRED(!testDR.CanRead("/this/is/a/folder/file.tes"),"Negative test of default CanRead() implementation");
//mitk::FileReaderRegistry* readerRegistry = new mitk::FileReaderRegistry;
//mitk::IFileReader* returned = readerRegistry->GetReader("bla.test");
//MITK_TEST_CONDITION_REQUIRED(returned && &static_cast<mitk::IFileReader&>(testDR) != returned,"Testing correct retrieval of FileReader 1/2");
//returned = readerRegistry->GetReader("other");
//MITK_TEST_CONDITION_REQUIRED(returned && &static_cast<mitk::IFileReader&>(otherDR) != returned,"Testing correct retrieval of FileReader 2/2");
//DummyReader mediocreTestDR("application/dummy", "test", 20);
//DummyReader prettyFlyTestDR("application/dummy", "test", 50);
//DummyReader2 awesomeTestDR("application/dummy", "test", 100);
//returned = readerRegistry->GetReader("test");
//MITK_TEST_CONDITION_REQUIRED(dynamic_cast<DummyReader2*>(returned), "Testing correct priorized retrieval of FileReader: Best reader");
// Now to give those readers some options, then we will try again
// mitk::IFileReader::OptionList options;
// options.push_back(std::make_pair("isANiceGuy", true));
// mediocreTestDR.SetOptions(options);
// options.clear();
// options.push_back(std::make_pair("canFly", true));
// prettyFlyTestDR.SetOptions(options);
// options.push_back(std::make_pair("isAwesome", true));
// awesomeTestDR.SetOptions(options); //note: awesomeReader canFly and isAwesome
// // Reset Options, use to define what we want the reader to do
// options.clear();
// mitk::IFileReader::OptionNames optionsFilter;
// optionsFilter.push_back("canFly");
// returned = readerRegistry->GetReader("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returned && &static_cast<mitk::IFileReader&>(awesomeTestDR) != returned, "Testing correct retrieval of FileReader with Options: Best reader with options");
// optionsFilter.push_back("isAwesome");
// returned = readerRegistry->GetReader("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returned && &static_cast<mitk::IFileReader&>(awesomeTestDR) != returned, "Testing correct retrieval of FileReader with multiple Options: Best reader with options");
// optionsFilter.clear();
// optionsFilter.push_back("isANiceGuy");
// returned = readerRegistry->GetReader("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returned && &static_cast<mitk::IFileReader&>(mediocreTestDR) != returned, "Testing correct retrieval of specific FileReader with Options: Low priority reader with specific option");
// optionsFilter.push_back("canFly");
// returned = readerRegistry->GetReader("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returned == NULL, "Testing correct return of 0 value when no matching reader was found");
// // Onward to test the retrieval of multiple readers
// std::vector< mitk::IFileReader* > returnedList;
// returnedList = readerRegistry->GetReaders("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returnedList.empty(), "Testing correct return of zero readers when no matching reader was found, asking for all compatibles");
// optionsFilter.clear();
// optionsFilter.push_back("canFly");
// returnedList = readerRegistry->GetReaders("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returnedList.size() == 2, "Testing correct return of two readers when two matching reader was found, asking for all compatibles");
// MITK_TEST_CONDITION_REQUIRED(dynamic_cast<DummyReader2*>(returnedList.front()), "Testing correct priorization of returned Readers with options 1/2");
// optionsFilter.clear();
// optionsFilter.push_back("isAwesome");
// returnedList = readerRegistry->GetReaders("test", optionsFilter);
// MITK_TEST_CONDITION_REQUIRED(returnedList.size() == 1, "Testing correct return of one readers when one matching reader was found, asking for all compatibles");
// MITK_TEST_CONDITION_REQUIRED(dynamic_cast<DummyReader2*>(returnedList.front()), "Testing correctness of result from former query");
// And now to verify a working read chain for a mps file:
//mitk::PointSetReader::Pointer psr = mitk::PointSetReader::New();
//std::vector<mitk::BaseData::Pointer> basedata;
//basedata = mitk::FileReaderRegistry::Read("F://Build//MITK-Data//pointSet.mps");
//MITK_TEST_CONDITION_REQUIRED(basedata.size() > 0, "Testing correct read of PointSet");
// Testing templated call to ReaderRegistry
//mitk::PointSet::Pointer pointset = mitk::FileReaderRegistry::Read< mitk::PointSet >("F://Build//MITK-Data//pointSet.mps");
//MITK_TEST_CONDITION_REQUIRED(pointset.IsNotNull(), "Testing templated call of Read()");
// And now for something completely different... (Debug)
// mitk::LegacyFileReaderService::Pointer lfr = mitk::LegacyFileReaderService::New(".nrrd", "Nearly Raw Raster Data");
//returned = mitk::FileReaderRegistry::GetReader(".nrrd");
//MITK_TEST_CONDITION_REQUIRED(lfr == returned, "Testing correct retrieval of specific FileReader with Options: Low priority reader with specific option");
//std::vector<mitk::BaseData::Pointer> image = mitk::FileReaderRegistry::Read("F://Build//MITK-Data//Pic2DplusT.nrrd");
//MITK_TEST_CONDITION_REQUIRED(image.size() > 0, "Testing whether image was returned or not");
//mitk::Image::Pointer image2 = dynamic_cast<mitk::Image*> (image.front().GetPointer());
//MITK_TEST_CONDITION_REQUIRED(image2.IsNotNull(), "Testing if BaseData is an image");
// Delete this here because it will call the PrototypeServiceFactory::Unget() method
// of the dummy readers.
//delete readerRegistry;
// always end with this!
MITK_TEST_END();
}
diff --git a/Modules/Core/test/mitkGeometry3DEqualTest.cpp b/Modules/Core/test/mitkGeometry3DEqualTest.cpp
index d0b72e6523..faa9fc4e7e 100644
--- a/Modules/Core/test/mitkGeometry3DEqualTest.cpp
+++ b/Modules/Core/test/mitkGeometry3DEqualTest.cpp
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkGeometry3D.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
class mitkGeometry3DEqualTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkGeometry3DEqualTestSuite);
MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
MITK_TEST(Equal_DifferentOrigin_ReturnsFalse);
MITK_TEST(Equal_DifferentIndexToWorldTransform_ReturnsFalse);
MITK_TEST(Equal_DifferentSpacing_ReturnsFalse);
MITK_TEST(Equal_DifferentImageGeometry_ReturnsFalse);
MITK_TEST(Equal_DifferentBoundingBox_ReturnsFalse);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
mitk::Geometry3D::Pointer m_Geometry3D;
mitk::Geometry3D::Pointer m_AnotherGeometry3D;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_Geometry3D = mitk::Geometry3D::New();
m_Geometry3D->Initialize();
m_AnotherGeometry3D = m_Geometry3D->Clone();
}
- void tearDown()
+ void tearDown() override
{
m_Geometry3D = NULL;
m_AnotherGeometry3D = NULL;
}
void Equal_CloneAndOriginal_ReturnsTrue()
{
MITK_ASSERT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "A clone should be equal to its original.");
}
void Equal_DifferentOrigin_ReturnsFalse()
{
mitk::Point3D origin;
origin[0] = 0.0;
origin[1] = 0.0;
origin[2] = 1.0 + 2*mitk::eps;
m_AnotherGeometry3D->SetOrigin(origin);
MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "Origin was modified. Result should be false.");
}
void Equal_DifferentIndexToWorldTransform_ReturnsFalse()
{
//Create another index to world transform and make it different somehow
mitk::AffineTransform3D::Pointer differentIndexToWorldTransform = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType differentMatrix;
differentMatrix.SetIdentity();
differentMatrix(1,1) = 2;
differentIndexToWorldTransform->SetMatrix( differentMatrix );
m_AnotherGeometry3D->SetIndexToWorldTransform(differentIndexToWorldTransform);
MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "IndexToWorldTransform was modified. Result should be false.");
}
void Equal_DifferentSpacing_ReturnsFalse()
{
mitk::Vector3D differentSpacing;
differentSpacing[0] = 1.0;
differentSpacing[1] = 1.0 + 2*mitk::eps;
differentSpacing[2] = 1.0;
m_AnotherGeometry3D->SetSpacing(differentSpacing);
MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "Spacing was modified. Result should be false.");
}
void Equal_DifferentImageGeometry_ReturnsFalse()
{
m_AnotherGeometry3D->SetImageGeometry(true);
MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "One Geometry is image, the other is not. Result should be false.");
}
void Equal_DifferentBoundingBox_ReturnsFalse()
{
//create different bounds to make the comparison false
mitk::ScalarType bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
m_AnotherGeometry3D->SetBounds(bounds);
MITK_ASSERT_NOT_EQUAL( m_Geometry3D, m_AnotherGeometry3D, "Bounds are different. Result should be false.");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkGeometry3DEqual)
diff --git a/Modules/Core/test/mitkIOUtilTest.cpp b/Modules/Core/test/mitkIOUtilTest.cpp
index 0ec7a35d80..e33346a245 100644
--- a/Modules/Core/test/mitkIOUtilTest.cpp
+++ b/Modules/Core/test/mitkIOUtilTest.cpp
@@ -1,233 +1,233 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkTestingConfig.h>
#include <mitkTestFixture.h>
#include <mitkIOUtil.h>
#include <mitkImageGenerator.h>
#include <itksys/SystemTools.hxx>
class mitkIOUtilTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkIOUtilTestSuite);
MITK_TEST(TestTempMethods);
MITK_TEST(TestSaveEmptyData);
MITK_TEST(TestLoadAndSaveImage);
MITK_TEST(TestNullLoad);
MITK_TEST(TestNullSave);
MITK_TEST(TestLoadAndSavePointSet);
MITK_TEST(TestLoadAndSaveSurface);
MITK_TEST(TestTempMethodsForUniqueFilenames);
MITK_TEST(TestTempMethodsForUniqueFilenames);
CPPUNIT_TEST_SUITE_END();
private:
std::string m_ImagePath;
std::string m_SurfacePath;
std::string m_PointSetPath;
public:
- void setUp()
+ void setUp() override
{
m_ImagePath = GetTestDataFilePath("Pic3D.nrrd");
m_SurfacePath = GetTestDataFilePath("binary.stl");
m_PointSetPath = GetTestDataFilePath("pointSet.mps");
}
void TestSaveEmptyData()
{
mitk::Surface::Pointer data = mitk::Surface::New();
CPPUNIT_ASSERT_THROW(mitk::IOUtil::Save(data, "/tmp/dummy"), mitk::Exception);
}
void TestTempMethods()
{
std::string tmpPath = mitk::IOUtil::GetTempPath();
CPPUNIT_ASSERT(!tmpPath.empty());
std::ofstream tmpFile;
std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile(tmpFile);
CPPUNIT_ASSERT(tmpFile && tmpFile.is_open());
CPPUNIT_ASSERT(tmpFilePath.size() > tmpPath.size());
CPPUNIT_ASSERT(tmpFilePath.substr(0, tmpPath.size()) == tmpPath);
tmpFile.close();
CPPUNIT_ASSERT(std::remove(tmpFilePath.c_str()) == 0);
std::string programPath = mitk::IOUtil::GetProgramPath();
CPPUNIT_ASSERT(!programPath.empty());
std::ofstream tmpFile2;
std::string tmpFilePath2 = mitk::IOUtil::CreateTemporaryFile(tmpFile2, "my-XXXXXX", programPath);
CPPUNIT_ASSERT(tmpFile2 && tmpFile2.is_open());
CPPUNIT_ASSERT(tmpFilePath2.size() > programPath.size());
CPPUNIT_ASSERT(tmpFilePath2.substr(0, programPath.size()) == programPath);
tmpFile2.close();
CPPUNIT_ASSERT(std::remove(tmpFilePath2.c_str()) == 0);
std::ofstream tmpFile3;
std::string tmpFilePath3 = mitk::IOUtil::CreateTemporaryFile(tmpFile3, std::ios_base::binary,
"my-XXXXXX.TXT", programPath);
CPPUNIT_ASSERT(tmpFile3 && tmpFile3.is_open());
CPPUNIT_ASSERT(tmpFilePath3.size() > programPath.size());
CPPUNIT_ASSERT(tmpFilePath3.substr(0, programPath.size()) == programPath);
CPPUNIT_ASSERT(tmpFilePath3.substr(tmpFilePath3.size() - 13, 3) == "my-");
CPPUNIT_ASSERT(tmpFilePath3.substr(tmpFilePath3.size() - 4) == ".TXT");
tmpFile3.close();
//CPPUNIT_ASSERT(std::remove(tmpFilePath3.c_str()) == 0)
std::string tmpFilePath4 = mitk::IOUtil::CreateTemporaryFile();
std::ofstream file;
file.open(tmpFilePath4.c_str());
CPPUNIT_ASSERT_MESSAGE("Testing if file exists after CreateTemporaryFile()",file.is_open());
CPPUNIT_ASSERT_THROW(mitk::IOUtil::CreateTemporaryFile(tmpFile2, "XX"), mitk::Exception);
std::string tmpDir = mitk::IOUtil::CreateTemporaryDirectory();
CPPUNIT_ASSERT(tmpDir.size() > tmpPath.size());
CPPUNIT_ASSERT(tmpDir.substr(0, tmpPath.size()) == tmpPath);
CPPUNIT_ASSERT(itksys::SystemTools::RemoveADirectory(tmpDir.c_str()));
std::string tmpDir2 = mitk::IOUtil::CreateTemporaryDirectory("my-XXXXXX", programPath);
CPPUNIT_ASSERT(tmpDir2.size() > programPath.size());
CPPUNIT_ASSERT(tmpDir2.substr(0, programPath.size()) == programPath);
CPPUNIT_ASSERT(itksys::SystemTools::RemoveADirectory(tmpDir2.c_str()));
}
void TestTempMethodsForUniqueFilenames()
{
int numberOfFiles = 100;
//create 100 empty files
std::vector<std::string> v100filenames;
for(int i=0; i<numberOfFiles; i++) {v100filenames.push_back(mitk::IOUtil::CreateTemporaryFile());}
//check if all of them are unique
for(int i=0; i<numberOfFiles; i++) for(int j=0; j<numberOfFiles; j++)
{
if(i!=j)
{
std::stringstream message;
message << "Checking if file " << i << " and file " << j << " are different, which should be the case because each of them should be unique.";
CPPUNIT_ASSERT_MESSAGE(message.str(),(v100filenames.at(i)!=v100filenames.at(j)));
}
}
//delete all the files / clean up
for(int i=0; i<numberOfFiles; i++) {std::remove(v100filenames.at(i).c_str());}
}
void TestLoadAndSaveImage()
{
mitk::Image::Pointer img1 = mitk::IOUtil::LoadImage(m_ImagePath);
CPPUNIT_ASSERT( img1.IsNotNull());
std::ofstream tmpStream;
std::string imagePath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "diffpic3d-XXXXXX.nrrd");
tmpStream.close();
std::string imagePath2 = mitk::IOUtil::CreateTemporaryFile(tmpStream, "diffpic3d-XXXXXX.nii.gz");
tmpStream.close();
// the cases where no exception should be thrown
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::Save(img1, imagePath));
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::Save(img1.GetPointer(), imagePath2));
//load data which does not exist
CPPUNIT_ASSERT_THROW(mitk::IOUtil::LoadImage("fileWhichDoesNotExist.nrrd"), mitk::Exception);
//delete the files after the test is done
std::remove(imagePath.c_str());
std::remove(imagePath2.c_str());
mitk::Image::Pointer relativImage = mitk::ImageGenerator::GenerateGradientImage<float>(4,4,4,1);
std::string imagePath3 = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX.nrrd");
tmpStream.close();
mitk::IOUtil::Save(relativImage, imagePath3);
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::LoadImage(imagePath3));
std::remove(imagePath3.c_str());
}
/**
* \brief This method calls all available load methods with a nullpointer and an empty pathand expects an exception
**/
void TestNullLoad(){
CPPUNIT_ASSERT_THROW(mitk::IOUtil::LoadImage(""), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::LoadSurface(""), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::LoadPointSet(""), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::Load(""), mitk::Exception);
}
/**
* \brief This method calls the save method (to which all other convenience save methods reference) with null parameters
**/
void TestNullSave(){
CPPUNIT_ASSERT_THROW(mitk::IOUtil::SaveImage(NULL, mitk::IOUtil::CreateTemporaryFile()), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::SaveImage(mitk::Image::New().GetPointer(), ""), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::Save(NULL, mitk::IOUtil::CreateTemporaryFile()), mitk::Exception);
CPPUNIT_ASSERT_THROW(mitk::IOUtil::Save(mitk::Image::New().GetPointer(), ""), mitk::Exception);
}
void TestLoadAndSavePointSet()
{
mitk::PointSet::Pointer pointset = mitk::IOUtil::LoadPointSet(m_PointSetPath);
CPPUNIT_ASSERT( pointset.IsNotNull());
std::ofstream tmpStream;
std::string pointSetPath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX.mps");
tmpStream.close();
std::string pointSetPathWithDefaultExtension = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX.mps");
tmpStream.close();
std::string pointSetPathWithoutDefaultExtension = mitk::IOUtil::CreateTemporaryFile(tmpStream);
tmpStream.close();
// the cases where no exception should be thrown
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::Save(pointset, pointSetPathWithDefaultExtension));
// test if defaultextension is inserted if no extension is present
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::Save(pointset, pointSetPathWithoutDefaultExtension.c_str()));
//delete the files after the test is done
std::remove(pointSetPath.c_str());
std::remove(pointSetPathWithDefaultExtension.c_str());
std::remove(pointSetPathWithoutDefaultExtension.c_str());
}
void TestLoadAndSaveSurface()
{
mitk::Surface::Pointer surface = mitk::IOUtil::LoadSurface(m_SurfacePath);
CPPUNIT_ASSERT( surface.IsNotNull());
std::ofstream tmpStream;
std::string surfacePath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "diffsurface-XXXXXX.stl");
// the cases where no exception should be thrown
CPPUNIT_ASSERT_NO_THROW(mitk::IOUtil::Save(surface, surfacePath));
// test if exception is thrown as expected on unknown extsension
CPPUNIT_ASSERT_THROW(mitk::IOUtil::Save(surface,"testSurface.xXx"), mitk::Exception);
//delete the files after the test is done
std::remove(surfacePath.c_str());
}
};
MITK_TEST_SUITE_REGISTRATION(mitkIOUtil)
diff --git a/Modules/Core/test/mitkImageEqualTest.cpp b/Modules/Core/test/mitkImageEqualTest.cpp
index 6d45c595fb..a76996bc51 100644
--- a/Modules/Core/test/mitkImageEqualTest.cpp
+++ b/Modules/Core/test/mitkImageEqualTest.cpp
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkImage.h"
#include "mitkImageGenerator.h"
#include "mitkTestingMacros.h"
#include "mitkImageSliceSelector.h"
#include "mitkTestFixture.h"
class mitkImageEqualTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageEqualTestSuite);
MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
MITK_TEST(Equal_DifferentImageGeometry_ReturnsFalse);
MITK_TEST(Equal_DifferentPixelTypes_ReturnsFalse);
MITK_TEST(Equal_DifferentDimensions_ReturnsFalse);
MITK_TEST(Equal_DifferentDimensionalities_ReturnsFalse);
MITK_TEST(Equal_DifferentPixelValues_ReturnsFalse);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::Image::Pointer m_Image;
mitk::Image::Pointer m_AnotherImage;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
//generate a gradient test image
m_Image = mitk::ImageGenerator::GenerateGradientImage<unsigned char>(3u, 3u, 1u);
m_AnotherImage = m_Image->Clone();
}
- void tearDown()
+ void tearDown() override
{
m_Image = NULL;
m_AnotherImage = NULL;
}
void Equal_CloneAndOriginal_ReturnsTrue()
{
MITK_ASSERT_EQUAL( m_Image, m_Image->Clone(), "A clone should be equal to its original.");
}
void Equal_DifferentImageGeometry_ReturnsFalse()
{
mitk::Point3D origin;
origin[0] = 0.0;
origin[1] = 0.0;
origin[2] = mitk::eps * 1.01;
m_AnotherImage->GetGeometry()->SetOrigin(origin);
MITK_ASSERT_NOT_EQUAL( m_Image, m_AnotherImage, "One origin was modified. Result should be false.");
}
void Equal_DifferentPixelTypes_ReturnsFalse()
{
m_AnotherImage = mitk::ImageGenerator::GenerateGradientImage<float>(3u, 3u, 1u);
MITK_ASSERT_NOT_EQUAL( m_Image, m_AnotherImage, "One pixel type is float, the other unsigned char. Result should be false.");
}
void Equal_DifferentDimensions_ReturnsFalse()
{
m_AnotherImage = mitk::ImageGenerator::GenerateGradientImage<unsigned char>(5u, 7u, 3u);
MITK_ASSERT_NOT_EQUAL( m_Image, m_AnotherImage, "Dimensions of first image are: (3, 3, 1). Dimensions of second image are: (5, 7, 3). Result should be false.");
}
void Equal_DifferentDimensionalities_ReturnsFalse()
{
//Select the first slice of a 2D image and compare it to the 3D original
mitk::ImageSliceSelector::Pointer sliceSelector = mitk::ImageSliceSelector::New();
sliceSelector->SetInput( m_Image );
sliceSelector->SetSliceNr( 0 );
sliceSelector->Update();
m_AnotherImage = sliceSelector->GetOutput();
MITK_ASSERT_NOT_EQUAL( m_Image, m_AnotherImage, "First image is 3D. Second image is 2D. Result should be false.");
}
void Equal_DifferentPixelValues_ReturnsFalse()
{
//todo: Replace the random images via simpler images with fixed values.
m_Image = mitk::ImageGenerator::GenerateRandomImage<unsigned char>(3u, 3u);
m_AnotherImage = mitk::ImageGenerator::GenerateRandomImage<unsigned char>(3u, 3u);
MITK_ASSERT_NOT_EQUAL( m_Image, m_AnotherImage, "We compare two random images. Result should be false.");
}
void Equal_EpsilonDifference_ReturnsTrue()
{
m_Image = mitk::ImageGenerator::GenerateRandomImage<double>(10, 10);
m_AnotherImage = m_Image->Clone();
CPPUNIT_ASSERT_MESSAGE("Epsilon = 0.0 --> double images should not be regarded as equal", !mitk::Equal(*m_Image, *m_AnotherImage, 0, true));
CPPUNIT_ASSERT_MESSAGE("Epsilon = 0.001 --> double images should be regarded as equal", mitk::Equal(*m_Image, *m_AnotherImage, 0.001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkImageEqual)
diff --git a/Modules/Core/test/mitkImageToSurfaceFilterTest.cpp b/Modules/Core/test/mitkImageToSurfaceFilterTest.cpp
index 684a137621..52535f2306 100644
--- a/Modules/Core/test/mitkImageToSurfaceFilterTest.cpp
+++ b/Modules/Core/test/mitkImageToSurfaceFilterTest.cpp
@@ -1,159 +1,159 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include "mitkImageToSurfaceFilter.h"
#include "mitkException.h"
#include "mitkTestFixture.h"
#include <mitkIOUtil.h>
bool CompareSurfacePointPositions(mitk::Surface::Pointer s1, mitk::Surface::Pointer s2)
{
vtkPoints* p1 = s1->GetVtkPolyData()->GetPoints();
vtkPoints* p2 = s2->GetVtkPolyData()->GetPoints();
if(p1->GetNumberOfPoints() != p2->GetNumberOfPoints())
return false;
for(int i = 0; i < p1->GetNumberOfPoints(); ++i)
{
if(p1->GetPoint(i)[0] != p2->GetPoint(i)[0] ||
p1->GetPoint(i)[1] != p2->GetPoint(i)[1] ||
p1->GetPoint(i)[2] != p2->GetPoint(i)[2] )
{
return true;
}
}
return false;
}
class mitkImageToSurfaceFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageToSurfaceFilterTestSuite);
MITK_TEST(testImageToSurfaceFilterInitialization);
MITK_TEST(testInput);
MITK_TEST(testSurfaceGeneration);
MITK_TEST(testDecimatePromeshDecimation);
MITK_TEST(testQuadricDecimation);
MITK_TEST(testSmoothingOfSurface);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
mitk::Image::Pointer m_BallImage;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_BallImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("BallBinary30x30x30.nrrd"));
}
- void tearDown()
+ void tearDown() override
{
}
void testImageToSurfaceFilterInitialization()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of test object", testObject.IsNotNull());
// testing initialization of member variables!
CPPUNIT_ASSERT_MESSAGE("Testing initialization of threshold member variable",testObject->GetThreshold() == 1.0f);
CPPUNIT_ASSERT_MESSAGE("Testing initialization of smooth member variable", testObject->GetSmooth() == false);
CPPUNIT_ASSERT_MESSAGE("Testing initialization of decimate member variable", testObject->GetDecimate() == mitk::ImageToSurfaceFilter::NoDecimation);
CPPUNIT_ASSERT_MESSAGE("Testing initialization of target reduction member variable", testObject->GetTargetReduction() == 0.95f);
}
void testInput()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
testObject->SetInput(m_BallImage);
CPPUNIT_ASSERT_MESSAGE("Testing set / get input!", testObject->GetInput() == m_BallImage);
}
void testSurfaceGeneration()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
testObject->SetInput(m_BallImage);
testObject->Update();
mitk::Surface::Pointer resultSurface = NULL;
resultSurface = testObject->GetOutput();
CPPUNIT_ASSERT_MESSAGE("Testing surface generation!", testObject->GetOutput() != NULL);
}
void testDecimatePromeshDecimation()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
testObject->SetInput(m_BallImage);
testObject->Update();
mitk::Surface::Pointer resultSurface = NULL;
resultSurface = testObject->GetOutput();
mitk::Surface::Pointer testSurface1 = testObject->GetOutput()->Clone();
testObject->SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro);
testObject->SetTargetReduction(0.5f);
testObject->Update();
mitk::Surface::Pointer testSurface2 = testObject->GetOutput()->Clone();
CPPUNIT_ASSERT_MESSAGE("Testing DecimatePro mesh decimation!", testSurface1->GetVtkPolyData()->GetPoints()->GetNumberOfPoints() > testSurface2->GetVtkPolyData()->GetPoints()->GetNumberOfPoints());
}
void testQuadricDecimation()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
testObject->SetInput(m_BallImage);
testObject->Update();
mitk::Surface::Pointer resultSurface = NULL;
resultSurface = testObject->GetOutput();
mitk::Surface::Pointer testSurface1 = testObject->GetOutput()->Clone();
testObject->SetDecimate(mitk::ImageToSurfaceFilter::QuadricDecimation);
testObject->SetTargetReduction(0.5f);
testObject->Update();
mitk::Surface::Pointer testSurface3 = testObject->GetOutput()->Clone();
CPPUNIT_ASSERT_MESSAGE("Testing QuadricDecimation mesh decimation!", testSurface1->GetVtkPolyData()->GetPoints()->GetNumberOfPoints() > testSurface3->GetVtkPolyData()->GetPoints()->GetNumberOfPoints());
}
void testSmoothingOfSurface()
{
mitk::ImageToSurfaceFilter::Pointer testObject = mitk::ImageToSurfaceFilter::New();
testObject->SetInput(m_BallImage);
testObject->Update();
mitk::Surface::Pointer resultSurface = NULL;
resultSurface = testObject->GetOutput();
mitk::Surface::Pointer testSurface1 = testObject->GetOutput()->Clone();
testObject->SetSmooth(true);
testObject->SetDecimate(mitk::ImageToSurfaceFilter::NoDecimation);
testObject->Update();
mitk::Surface::Pointer testSurface4 = testObject->GetOutput()->Clone();
CPPUNIT_ASSERT_MESSAGE("Testing smoothing of surface changes point data!", CompareSurfacePointPositions(testSurface1, testSurface4));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkImageToSurfaceFilter)
diff --git a/Modules/Core/test/mitkItkImageIOTest.cpp b/Modules/Core/test/mitkItkImageIOTest.cpp
index 13f2f53ce3..020f64063d 100644
--- a/Modules/Core/test/mitkItkImageIOTest.cpp
+++ b/Modules/Core/test/mitkItkImageIOTest.cpp
@@ -1,394 +1,394 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestFixture.h>
#include "mitkException.h"
#include <mitkTestingMacros.h>
#include <mitkStandardFileLocations.h>
#include <mitkExtractSliceFilter.h>
#include "mitkIOUtil.h"
#include "mitkITKImageImport.h"
#include "itksys/SystemTools.hxx"
#include <itkImageRegionIterator.h>
#include <iostream>
#include <fstream>
#ifdef WIN32
#include "process.h"
#else
#include <unistd.h>
#endif
class mitkItkImageIOTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkItkImageIOTestSuite);
MITK_TEST(TestImageWriterJpg);
MITK_TEST(TestImageWriterPng1);
MITK_TEST(TestImageWriterPng2);
MITK_TEST(TestImageWriterPng3);
MITK_TEST(TestImageWriterSimple);
MITK_TEST(TestWrite3DImageWithOnePlane);
MITK_TEST(TestWrite3DImageWithTwoPlanes);
CPPUNIT_TEST_SUITE_END();
public:
- void setUp()
+ void setUp() override
{
}
- void tearDown()
+ void tearDown() override
{
}
void TestImageWriterJpg()
{
TestImageWriter("NrrdWritingTestImage.jpg");
}
void TestImageWriterPng1()
{
TestImageWriter("Png2D-bw.png");
}
void TestImageWriterPng2()
{
TestImageWriter("RenderingTestData/rgbImage.png");
}
void TestImageWriterPng3()
{
TestImageWriter("RenderingTestData/rgbaImage.png");
}
void TestImageWriterSimple()
{
// TODO
}
std::string AppendExtension(const std::string &filename, const char *extension)
{
std::string new_filename = filename;
new_filename += extension;
return new_filename;
}
bool CompareImageMetaData( mitk::Image::Pointer image, mitk::Image::Pointer reference, bool checkPixelType = true )
{
// switch to AreIdentical() methods as soon as Bug 11925 (Basic comparison operators) is fixed
if( image->GetDimension() != reference->GetDimension() )
{
MITK_ERROR << "The image dimension differs: IN (" << image->GetDimension() << ") REF(" << reference->GetDimension() << ")";
return false;
}
// pixel type
if( checkPixelType &&
( image->GetPixelType() != reference->GetPixelType()
&& image->GetPixelType().GetBitsPerComponent() != reference->GetPixelType().GetBitsPerComponent() ) )
{
MITK_ERROR << "Pixeltype differs ( image=" << image->GetPixelType().GetPixelTypeAsString() << "[" << image->GetPixelType().GetBitsPerComponent() << "]" << " reference=" << reference->GetPixelType().GetPixelTypeAsString() << "[" << reference->GetPixelType().GetBitsPerComponent() << "]" << " )";
return false;
}
return true;
}
/*
Test writing picture formats like *.bmp, *.png, *.tiff or *.jpg
NOTE: Saving as picture format must ignore PixelType comparison - not all bits per components are supported (see specification of the format)
*/
void TestPictureWriting(mitk::Image* image, const std::string& filename, const std::string& extension)
{
const std::string fullFileName = AppendExtension(filename, extension.c_str());
mitk::Image::Pointer singleSliceImage = NULL;
if( image->GetDimension() == 3 )
{
mitk::ExtractSliceFilter::Pointer extractFilter = mitk::ExtractSliceFilter::New();
extractFilter->SetInput( image );
extractFilter->SetWorldGeometry( image->GetSlicedGeometry()->GetPlaneGeometry(0) );
extractFilter->Update();
singleSliceImage = extractFilter->GetOutput();
// test 3D writing in format supporting only 2D
mitk::IOUtil::Save(image, fullFileName);
// test images
unsigned int foundImagesCount = 0;
//if the image only contains one sinlge slice the itkImageSeriesWriter won't add a number like filename.XX.extension
if(image->GetDimension(2) == 1)
{
std::stringstream series_filenames;
series_filenames << filename << extension;
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage( series_filenames.str() );
if( compareImage.IsNotNull() )
{
foundImagesCount++;
MITK_TEST_CONDITION(CompareImageMetaData( singleSliceImage, compareImage, false ), "Image meta data unchanged after writing and loading again. "); //ignore bits per component
}
remove( series_filenames.str().c_str() );
}
else //test the whole slice stack
{
for( unsigned int i=0; i< image->GetDimension(2); i++)
{
std::stringstream series_filenames;
series_filenames << filename << "." << i+1 << extension;
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage( series_filenames.str() );
if( compareImage.IsNotNull() )
{
foundImagesCount++;
MITK_TEST_CONDITION(CompareImageMetaData( singleSliceImage, compareImage, false ), "Image meta data unchanged after writing and loading again. "); //ignore bits per component
}
remove( series_filenames.str().c_str() );
}
}
MITK_TEST_CONDITION( foundImagesCount == image->GetDimension(2), "All 2D-Slices of a 3D image were stored correctly.");
}
else if( image->GetDimension() == 2 )
{
singleSliceImage = image;
}
// test 2D writing
if( singleSliceImage.IsNotNull() )
{
try
{
mitk::IOUtil::Save(singleSliceImage, fullFileName);
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage(fullFileName.c_str());
MITK_TEST_CONDITION_REQUIRED( compareImage.IsNotNull(), "Image stored was succesfully loaded again");
MITK_TEST_CONDITION_REQUIRED( CompareImageMetaData(singleSliceImage, compareImage, false ), "Image meta data unchanged after writing and loading again. ");//ignore bits per component
remove(fullFileName.c_str());
}
catch(itk::ExceptionObject &e)
{
MITK_TEST_FAILED_MSG(<< "Exception during file writing for ." << extension << ": " << e.what() );
}
}
}
/**
* test for "ImageWriter".
*
* argc and argv are the command line parameters which were passed to
* the ADD_TEST command in the CMakeLists.txt file. For the automatic
* tests, argv is either empty for the simple tests or contains the filename
* of a test image for the image tests (see CMakeLists.txt).
*/
void TestImageWriter(std::string sourcefile)
{
sourcefile = GetTestDataFilePath(sourcefile);
// load image
CPPUNIT_ASSERT_MESSAGE("Checking whether source image exists", itksys::SystemTools::FileExists(sourcefile.c_str()));
mitk::Image::Pointer image = NULL;
try
{
image = mitk::IOUtil::LoadImage( sourcefile );
}
catch (...)
{
CPPUNIT_FAIL("Exception during file loading:");
}
CPPUNIT_ASSERT_MESSAGE("loaded image not NULL", image.IsNotNull());
// write ITK .mhd image (2D and 3D only)
if( image->GetDimension() <= 3 )
{
std::ofstream tmpStream;
std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX.mhd");
tmpStream.close();
std::string tmpFilePathWithoutExt = tmpFilePath.substr(0, tmpFilePath.size() - 4);
try
{
mitk::IOUtil::Save(image, tmpFilePath);
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage(tmpFilePath);
CPPUNIT_ASSERT_MESSAGE("Image stored in MHD format was succesfully loaded again! ", compareImage.IsNotNull());
CPPUNIT_ASSERT_MESSAGE(".mhd file exists", itksys::SystemTools::FileExists((tmpFilePathWithoutExt + ".mhd").c_str()));
CPPUNIT_ASSERT_MESSAGE(".raw or .zraw exists", itksys::SystemTools::FileExists((tmpFilePathWithoutExt + ".raw").c_str()) ||
itksys::SystemTools::FileExists((tmpFilePathWithoutExt + ".zraw").c_str()));
// delete
remove(tmpFilePath.c_str());
remove((tmpFilePathWithoutExt + ".raw").c_str());
remove((tmpFilePathWithoutExt + ".zraw").c_str());
}
catch (...)
{
CPPUNIT_FAIL("Exception during.mhd file writing");
}
}
//testing more component image writing as nrrd files
{
std::ofstream tmpStream;
std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX.nrrd");
tmpStream.close();
try
{
mitk::IOUtil::Save(image, tmpFilePath);
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage(tmpFilePath);
CPPUNIT_ASSERT_MESSAGE("Image stored in NRRD format was succesfully loaded again", compareImage.IsNotNull());
remove(tmpFilePath.c_str());
}
catch(...)
{
std::remove(tmpFilePath.c_str());
CPPUNIT_FAIL("Exception during.mhd file writing");
}
}
std::ofstream tmpStream;
std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile(tmpStream, "XXXXXX");
tmpStream.close();
TestPictureWriting(image, tmpFilePath, ".png");
TestPictureWriting(image, tmpFilePath, ".jpg");
TestPictureWriting(image, tmpFilePath, ".tiff");
TestPictureWriting(image, tmpFilePath, ".bmp");
// always end with this!
}
/**
* Try to write a 3D image with only one plane (a 2D images in disguise for all intents and purposes)
*/
void TestWrite3DImageWithOnePlane(){
typedef itk::Image<unsigned char, 3> ImageType;
ImageType::Pointer itkImage = ImageType::New();
ImageType::IndexType start;
start.Fill(0);
ImageType::SizeType size;
size[0] = 100;
size[1] = 100;
size[2] = 1;
ImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
itkImage->SetRegions(region);
itkImage->Allocate();
itkImage->FillBuffer(0);
itk::ImageRegionIterator<ImageType> imageIterator(itkImage, itkImage->GetLargestPossibleRegion());
// Make two squares
while (!imageIterator.IsAtEnd())
{
if ((imageIterator.GetIndex()[0] > 5 && imageIterator.GetIndex()[0] < 20) &&
(imageIterator.GetIndex()[1] > 5 && imageIterator.GetIndex()[1] < 20))
{
imageIterator.Set(255);
}
if ((imageIterator.GetIndex()[0] > 50 && imageIterator.GetIndex()[0] < 70) &&
(imageIterator.GetIndex()[1] > 50 && imageIterator.GetIndex()[1] < 70))
{
imageIterator.Set(60);
}
++imageIterator;
}
mitk::Image::Pointer image = mitk::ImportItkImage(itkImage);
mitk::IOUtil::SaveImage(image, mitk::IOUtil::CreateTemporaryFile("3Dto2DTestImageXXXXXX.nrrd"));
mitk::IOUtil::SaveImage(image, mitk::IOUtil::CreateTemporaryFile("3Dto2DTestImageXXXXXX.png"));
}
/**
* Try to write a 3D image with only one plane (a 2D images in disguise for all intents and purposes)
*/
void TestWrite3DImageWithTwoPlanes(){
typedef itk::Image<unsigned char, 3> ImageType;
ImageType::Pointer itkImage = ImageType::New();
ImageType::IndexType start;
start.Fill(0);
ImageType::SizeType size;
size[0] = 100;
size[1] = 100;
size[2] = 2;
ImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
itkImage->SetRegions(region);
itkImage->Allocate();
itkImage->FillBuffer(0);
itk::ImageRegionIterator<ImageType> imageIterator(itkImage, itkImage->GetLargestPossibleRegion());
// Make two squares
while (!imageIterator.IsAtEnd())
{
if ((imageIterator.GetIndex()[0] > 5 && imageIterator.GetIndex()[0] < 20) &&
(imageIterator.GetIndex()[1] > 5 && imageIterator.GetIndex()[1] < 20))
{
imageIterator.Set(255);
}
if ((imageIterator.GetIndex()[0] > 50 && imageIterator.GetIndex()[0] < 70) &&
(imageIterator.GetIndex()[1] > 50 && imageIterator.GetIndex()[1] < 70))
{
imageIterator.Set(60);
}
++imageIterator;
}
mitk::Image::Pointer image = mitk::ImportItkImage(itkImage);
mitk::IOUtil::SaveImage(image, mitk::IOUtil::CreateTemporaryFile("3Dto2DTestImageXXXXXX.nrrd"));
CPPUNIT_ASSERT_THROW(mitk::IOUtil::SaveImage(image, mitk::IOUtil::CreateTemporaryFile("3Dto2DTestImageXXXXXX.png")), mitk::Exception);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkItkImageIO)
diff --git a/Modules/Core/test/mitkLineTest.cpp b/Modules/Core/test/mitkLineTest.cpp
index d4a9f5bdc0..c299cb25ea 100644
--- a/Modules/Core/test/mitkLineTest.cpp
+++ b/Modules/Core/test/mitkLineTest.cpp
@@ -1,127 +1,127 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
#include <mitkLine.h>
class mitkLineTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLineTestSuite);
MITK_TEST(Line_Instantiation);
MITK_TEST(Line_TestPoints);
MITK_TEST(Line_TestParallel);
MITK_TEST(Test2DLine);
MITK_TEST(Test3DLine);
CPPUNIT_TEST_SUITE_END();
private:
mitk::Line<double,3> m_Line;
mitk::Line<double,2> m_2DLine;
mitk::Line<double,3> m_3DLine;
public:
- void setUp()
+ void setUp() override
{
m_Line = mitk::Line<double,3>();
//set up simple 2D Line
m_2DLine = mitk::Line<double,2>();
itk::Point<double,2> p;
p[0] = 1;
p[1] = 2;
m_2DLine.SetPoint(p);
itk::Vector<double,2> direction;
direction[0] = 0;
direction[1] = 1;
m_2DLine.SetDirection(direction);
//set up simple 3D Line
m_3DLine = mitk::Line<double,3>();
mitk::Point3D p3D;
mitk::FillVector3D(p3D,0,1,2);
m_3DLine.SetPoint(p3D);
mitk::Vector3D direction3D;
mitk::FillVector3D(direction3D,4,5,6);
m_3DLine.SetDirection(direction3D);
}
void Line_Instantiation()
{
mitk::Line<double,3> myLineDouble = mitk::Line<double,3>();
mitk::Line<float,3> myLineFloat = mitk::Line<float,3>();
CPPUNIT_ASSERT(myLineDouble.GetPoint1()[0]==0);
CPPUNIT_ASSERT(myLineFloat.GetPoint1()[0]==0);
}
void Line_TestPoints()
{
mitk::Point3D point1,point2;
mitk::FillVector3D(point1,0,1,0);
mitk::FillVector3D(point2,0,2.5,0);
m_Line.SetPoint1(point1);
m_Line.SetPoint2(point2);
CPPUNIT_ASSERT_MESSAGE("Test if point 1 was set correctly.",mitk::Equal(m_Line.GetPoint1(),point1));
CPPUNIT_ASSERT_MESSAGE("Test if point 2 was set correctly.",mitk::Equal(m_Line.GetPoint2(),point2));
}
void Line_TestParallel()
{
//first line
mitk::Point3D point1,point2;
mitk::FillVector3D(point1,0,1,0);
mitk::FillVector3D(point2,0,2.5,0);
m_Line.SetPoint1(point1);
m_Line.SetPoint2(point2);
//parallel line
mitk::Point3D point3;
mitk::Vector3D directionLine2;
mitk::FillVector3D(point1,1,1,0);
mitk::FillVector3D(directionLine2,0,1,0);
mitk::Line<double,3> parallelLine = mitk::Line<double,3>(point1,directionLine2);
CPPUNIT_ASSERT_MESSAGE("Test if lines are parallel.",m_Line.IsParallel(parallelLine));
/* Seems as this method is broken, so disabled the test for the moment, see bug 17938
MITK_INFO << "Distance: " << m_Line.Distance(point3);
CPPUNIT_ASSERT_MESSAGE("Test line distance.",m_Line.Distance(point3)==1.0);
*/
}
void Test2DLine()
{
CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (point[0])",m_2DLine.GetPoint()[0]==1);
CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (point[1])",m_2DLine.GetPoint()[1]==2);
CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (direction[0])",m_2DLine.GetDirection()[0]==0);
CPPUNIT_ASSERT_MESSAGE("Testing 2D Line (direction[1])",m_2DLine.GetDirection()[1]==1);
}
void Test3DLine()
{
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[0])",m_3DLine.GetPoint()[0]==0);
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[1])",m_3DLine.GetPoint()[1]==1);
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (point[2])",m_3DLine.GetPoint()[2]==2);
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[0])",m_3DLine.GetDirection()[0]==4);
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[1])",m_3DLine.GetDirection()[1]==5);
CPPUNIT_ASSERT_MESSAGE("Testing 3D Line (direction[2])",m_3DLine.GetDirection()[2]==6);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLine)
diff --git a/Modules/Core/test/mitkLogTest.cpp b/Modules/Core/test/mitkLogTest.cpp
index ede203ff37..cac140f300 100644
--- a/Modules/Core/test/mitkLogTest.cpp
+++ b/Modules/Core/test/mitkLogTest.cpp
@@ -1,335 +1,335 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkCommon.h"
#include "mitkTestingMacros.h"
#include <mitkLog.h>
#include <mitkNumericTypes.h>
#include <itkMultiThreader.h>
#include <itksys/SystemTools.hxx>
#include <mitkStandardFileLocations.h>
/** Documentation
*
* @brief this class provides an accessible BackendCout to determine whether this backend was
* used to process a message or not.
* It is needed for the disable / enable backend test.
*/
class TestBackendCout : public mbilog::BackendCout
{
public:
TestBackendCout()
{
m_Called = false;
mbilog::BackendCout();
}
- void ProcessMessage(const mbilog::LogMessage &l)
+ void ProcessMessage(const mbilog::LogMessage &l) override
{
m_Called = true;
mbilog::BackendCout::ProcessMessage(l);
}
bool WasCalled()
{
return m_Called;
}
private:
bool m_Called;
};
/** Documentation
*
* @brief Objects of this class can start an internal thread by calling the Start() method.
* The thread is then logging messages until the method Stop() is called. The class
* can be used to test if logging is thread-save by using multiple objects and let
* them log simuntanously.
*/
class mitkTestLoggingThread : public itk::Object
{
public:
-mitkClassMacro(mitkTestLoggingThread,itk::Object);
+mitkClassMacroItkParent(mitkTestLoggingThread,itk::Object);
mitkNewMacro1Param(mitkTestLoggingThread,itk::MultiThreader::Pointer);
int NumberOfMessages;
protected:
mitkTestLoggingThread(itk::MultiThreader::Pointer MultiThreader)
{
ThreadID = -1;
NumberOfMessages = 0;
m_MultiThreader = MultiThreader;
}
bool LoggingRunning;
int ThreadID;
itk::MultiThreader::Pointer m_MultiThreader;
void LogMessages()
{
while(LoggingRunning)
{
MITK_INFO << "Test info stream in thread" << ThreadID << "\n even with newlines";
MITK_WARN << "Test warning stream in thread " << ThreadID <<". "
<< "Even with a very long text, even without meaning or implied meaning or content, just a long sentence to see whether something has problems with long sentences or output in files or into windows or commandlines or whatever.";
MITK_DEBUG << "Test debugging stream in thread " << ThreadID;
MITK_ERROR << "Test error stream in thread " << ThreadID;
MITK_FATAL << "Test fatal stream in thread " << ThreadID;
NumberOfMessages += 5;
}
}
static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void* pInfoStruct)
{
/* extract this pointer from Thread Info structure */
struct itk::MultiThreader::ThreadInfoStruct * pInfo = (struct itk::MultiThreader::ThreadInfoStruct*)pInfoStruct;
if (pInfo == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
if (pInfo->UserData == NULL)
{
return ITK_THREAD_RETURN_VALUE;
}
mitkTestLoggingThread *thisthread = (mitkTestLoggingThread*)pInfo->UserData;
if (thisthread != NULL)
thisthread->LogMessages();
return ITK_THREAD_RETURN_VALUE;
}
public:
int Start()
{
LoggingRunning = true;
this->ThreadID = m_MultiThreader->SpawnThread(this->ThreadStartTracking, this);
return ThreadID;
}
void Stop()
{
LoggingRunning = false;
}
};
/** Documentation
*
* @brief This class holds static test methods to sturcture the test of the mitk logging mechanism.
*/
class mitkLogTestClass
{
public:
static void TestSimpleLog()
{
bool testSucceded = true;
try
{
MITK_INFO << "Test info stream.";
MITK_WARN << "Test warning stream.";
MITK_DEBUG << "Test debugging stream."; //only activated if cmake variable is on!
//so no worries if you see no output for this line
MITK_ERROR << "Test error stream.";
MITK_FATAL << "Test fatal stream.";
}
catch(mitk::Exception e)
{
testSucceded = false;
}
MITK_TEST_CONDITION_REQUIRED(testSucceded,"Test logging streams.");
}
static void TestObjectInfoLogging()
{
bool testSucceded = true;
try
{
int i = 123;
float f = .32234;
double d = 123123;
std::string testString = "testString";
std::stringstream testStringStream;
testStringStream << "test" << "String" << "Stream";
mitk::Point3D testMitkPoint;
testMitkPoint.Fill(2);
MITK_INFO << i;
MITK_INFO << f;
MITK_INFO << d;
MITK_INFO << testString;
MITK_INFO << testStringStream.str();
MITK_INFO << testMitkPoint;
}
catch(mitk::Exception e)
{
testSucceded = false;
}
MITK_TEST_CONDITION_REQUIRED(testSucceded,"Test logging of object information.");
}
static void TestThreadSaveLog(bool toFile)
{
bool testSucceded = true;
try
{
if (toFile)
{
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory() + "/testthreadlog.log";
itksys::SystemTools::RemoveFile(filename.c_str()); // remove old file, we do not want to append to large files
mitk::LoggingBackend::SetLogFile(filename.c_str());
}
unsigned int numberOfThreads = 20;
unsigned int threadRuntimeInMilliseconds = 2000;
std::vector<unsigned int> threadIDs;
std::vector<mitkTestLoggingThread::Pointer> threads;
itk::MultiThreader::Pointer multiThreader = itk::MultiThreader::New();
for (unsigned int threadIdx = 0; threadIdx < numberOfThreads; ++threadIdx)
{
//initialize threads...
mitkTestLoggingThread::Pointer newThread = mitkTestLoggingThread::New(multiThreader);
threads.push_back(newThread);
std::cout << "Created " << threadIdx << ". thread." << std::endl;
}
for (unsigned int threadIdx = 0; threadIdx < numberOfThreads; ++threadIdx)
{
//start them
std::cout << "Start " << threadIdx << ". thread." << std::endl;
threadIDs.push_back( threads[threadIdx]->Start() );
std::cout << threadIdx << ". thread has ID " << threadIDs[threadIdx] << std::endl;
}
//wait for some time (milliseconds)
itksys::SystemTools::Delay( threadRuntimeInMilliseconds );
for (unsigned int threadIdx = 0; threadIdx < numberOfThreads; ++threadIdx)
{
//stop them
std::cout << "Stop " << threadIdx << ". thread." << std::endl;
threads[threadIdx]->Stop();
}
for (unsigned int threadIdx = 0; threadIdx < numberOfThreads; ++threadIdx)
{
//Wait for all threads to end
multiThreader->TerminateThread(threadIDs[threadIdx]);
std::cout << "Terminated " << threadIdx << ". thread (" << threads[threadIdx]->NumberOfMessages << " messages)." << std::endl;
}
}
catch(std::exception e)
{
MITK_ERROR << "exception during 'TestThreadSaveLog': "<<e.what();
testSucceded = false;
}
catch(...)
{
MITK_ERROR << "unknown exception during 'TestThreadSaveLog'";
testSucceded = false;
}
//if no error occured until now, everything is ok
MITK_TEST_CONDITION_REQUIRED(testSucceded,"Test logging in different threads.");
}
static void TestLoggingToFile()
{
std::string filename = mitk::StandardFileLocations::GetInstance()->GetOptionDirectory() + "/testlog.log";
mitk::LoggingBackend::SetLogFile(filename.c_str());
MITK_INFO << "Test logging to default filename: " << mitk::LoggingBackend::GetLogFile();
MITK_TEST_CONDITION_REQUIRED(itksys::SystemTools::FileExists(filename.c_str()),"Testing if log file exists.");
//TODO delete log file?
}
static void TestAddAndRemoveBackends()
{
mbilog::BackendCout myBackend = mbilog::BackendCout();
mbilog::RegisterBackend(&myBackend);
MITK_INFO << "Test logging";
mbilog::UnregisterBackend(&myBackend);
//if no error occured until now, everything is ok
MITK_TEST_CONDITION_REQUIRED(true,"Test add/remove logging backend.");
}
static void TestDefaultBackend()
{
//not possible now, because we cannot unregister the mitk logging backend in the moment. If such a method is added to mbilog utility one may add this test.
}
static void TestEnableDisableBackends()
{
TestBackendCout myCoutBackend = TestBackendCout();
mbilog::RegisterBackend(&myCoutBackend);
mbilog::DisableBackends(mbilog::Console);
MITK_INFO << "There should be no output!";
bool success = !myCoutBackend.WasCalled();
mbilog::EnableBackends(mbilog::Console);
MITK_INFO << "Now there should be an output.";
success &= myCoutBackend.WasCalled();
mbilog::UnregisterBackend(&myCoutBackend);
MITK_TEST_CONDITION_REQUIRED(success, "Test disable / enable logging backends.")
}
};
int mitkLogTest(int /* argc */, char* /*argv*/[])
{
// always start with this!
MITK_TEST_BEGIN("Log")
MITK_TEST_OUTPUT(<<"TESTING ALL LOGGING OUTPUTS, ERROR MESSAGES ARE ALSO TESTED AND NOT MEANING AN ERROR OCCURED!")
mitkLogTestClass::TestSimpleLog();
mitkLogTestClass::TestObjectInfoLogging();
mitkLogTestClass::TestLoggingToFile();
mitkLogTestClass::TestAddAndRemoveBackends();
mitkLogTestClass::TestThreadSaveLog( false ); // false = to console
mitkLogTestClass::TestThreadSaveLog( true ); // true = to file
mitkLogTestClass::TestEnableDisableBackends();
// TODO actually test file somehow?
// always end with this!
MITK_TEST_END()
}
diff --git a/Modules/Core/test/mitkLoggingAdapterTest.cpp b/Modules/Core/test/mitkLoggingAdapterTest.cpp
index 0c4869c1dd..9877c49c50 100644
--- a/Modules/Core/test/mitkLoggingAdapterTest.cpp
+++ b/Modules/Core/test/mitkLoggingAdapterTest.cpp
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkVtkLoggingAdapter.h>
#include <mitkItkLoggingAdapter.h>
#include <mitkCommon.h>
class ItkLoggingTestClass : public itk::Object
{
public:
- mitkClassMacro( ItkLoggingTestClass , itk::Object );
+ mitkClassMacroItkParent( ItkLoggingTestClass , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void TestItkWarningMessage()
{
itkWarningMacro("Test ITK Warning message");
}
};
/** @brief This test tests all logging adapters of MITK. */
class LoggingAdapterTestClass
{
public:
static void TestVtkLoggingWithoutAdapter()
{
MITK_TEST_OUTPUT(<<"Testing vtk logging without adapter class: a separate window should open and display the logging messages.")
vtkOutputWindow::GetInstance()->DisplayText("Test VTK InfoMessage");
vtkOutputWindow::GetInstance()->DisplayDebugText("Test Vtk Debug Message");
vtkOutputWindow::GetInstance()->DisplayGenericWarningText("Test Vtk Generic Warning Message");
vtkOutputWindow::GetInstance()->DisplayWarningText("Test Vtk Warning Message");
vtkOutputWindow::GetInstance()->DisplayErrorText("Test Vtk Error Message");
MITK_TEST_CONDITION_REQUIRED(true,"Testing if Vtk logging without adapter runs without errors.");
}
static void TestVtkLoggingWithAdapter()
{
MITK_TEST_OUTPUT(<<"Testing vtk logging with adapter class: Vtk logging messages should be logged as MITK logging messages.")
mitk::VtkLoggingAdapter::Initialize();
vtkOutputWindow::GetInstance()->DisplayText("Test Vtk Info Message");
vtkOutputWindow::GetInstance()->DisplayDebugText("Test Vtk Debug Message");
vtkOutputWindow::GetInstance()->DisplayGenericWarningText("Test Vtk Generic Warning Message");
vtkOutputWindow::GetInstance()->DisplayWarningText("Test Vtk Warning Message");
vtkOutputWindow::GetInstance()->DisplayErrorText("Test Vtk Error Message");
MITK_TEST_CONDITION_REQUIRED(true,"Testing if Vtk logging with MITK logging adapter runs without errors.");
}
static void TestItkLoggingWithoutAdapter()
{
ItkLoggingTestClass::Pointer myItkLogger = ItkLoggingTestClass::New();
myItkLogger->TestItkWarningMessage();
}
static void TestItkLoggingWithAdapter()
{
mitk::ItkLoggingAdapter::Initialize();
ItkLoggingTestClass::Pointer myItkLogger = ItkLoggingTestClass::New();
myItkLogger->TestItkWarningMessage();
}
};
int mitkLoggingAdapterTest(int /*argc*/, char* /*argv*/[])
{
MITK_TEST_BEGIN("LoggingAdapters: VTK, ITK");
LoggingAdapterTestClass::TestVtkLoggingWithoutAdapter();
LoggingAdapterTestClass::TestVtkLoggingWithAdapter();
LoggingAdapterTestClass::TestItkLoggingWithoutAdapter();
LoggingAdapterTestClass::TestItkLoggingWithAdapter();
MITK_TEST_END();
}
diff --git a/Modules/Core/test/mitkMatrixTypeConversionTest.cpp b/Modules/Core/test/mitkMatrixTypeConversionTest.cpp
index f5319ef56c..e9d9902f39 100644
--- a/Modules/Core/test/mitkMatrixTypeConversionTest.cpp
+++ b/Modules/Core/test/mitkMatrixTypeConversionTest.cpp
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <string>
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include "mitkMatrix.h"
class mitkMatrixTypeConversionTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkMatrixTypeConversionTestSuite);
MITK_TEST(Mitk2Pod);
MITK_TEST(Pod2Mitk);
CPPUNIT_TEST_SUITE_END();
private:
mitk::Matrix3D mitkMatrix3D;
mitk::ScalarType podMatrix3D[3][3];
/**
* @brief Convenience method to test if one matrix has been assigned successfully to the other.
*
* More specifically, tests if m1 = m2 was performed correctly.
*
* @param m1 The matrix m1 of the assignment m1 = m2
* @param m2 The matrix m2 of the assignment m1 = m2
*/
template <typename T1, typename T2>
void TestForEquality(const T1& m1, const T2& m2)
{
for (unsigned i = 0; i < 3; i++)
{
for (unsigned j = 0; j < 3; j++)
{
std::stringstream ss;
ss << "element [" << i << "][" << j << "] equal for mitkMatrix and podMatrix";
CPPUNIT_ASSERT_EQUAL_MESSAGE(ss.str(), true,
(m1[i][j]==m2[i][j]));
}
}
}
public:
- void setUp(void)
+ void setUp(void) override
{
for (unsigned i = 0; i < 3; i++)
for (unsigned j = 0; j < 3; j++)
{
mitkMatrix3D[i][j] = i + j;
podMatrix3D[i][j] = (mitk::ScalarType) (9 - (i + j));
}
}
- void tearDown(void)
+ void tearDown(void) override
{
}
void Mitk2Pod(void)
{
mitkMatrix3D.ToArray(podMatrix3D);
TestForEquality(mitkMatrix3D, podMatrix3D);
}
void Pod2Mitk(void)
{
mitkMatrix3D.FillMatrix(podMatrix3D);
TestForEquality(podMatrix3D, mitkMatrix3D);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkMatrixTypeConversion)
diff --git a/Modules/Core/test/mitkPlaneGeometryTest.cpp b/Modules/Core/test/mitkPlaneGeometryTest.cpp
index 4ee3639731..a039f55f12 100644
--- a/Modules/Core/test/mitkPlaneGeometryTest.cpp
+++ b/Modules/Core/test/mitkPlaneGeometryTest.cpp
@@ -1,845 +1,845 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkPlaneGeometry.h"
#include "mitkRotationOperation.h"
#include "mitkInteractionConst.h"
#include "mitkLine.h"
#include "mitkGeometry3D.h"
#include "mitkThinPlateSplineCurvedGeometry.h"
#include "mitkSlicedGeometry3D.h"
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
#include <vnl/vnl_quaternion.h>
#include <vnl/vnl_quaternion.txx>
#include <fstream>
#include <iomanip>
static const mitk::ScalarType testEps = 1E-9; // the epsilon used in this test == at least float precision.
class mitkPlaneGeometryTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPlaneGeometryTestSuite);
MITK_TEST(TestInitializeStandardPlane);
MITK_TEST(TestProjectPointOntoPlane);
MITK_TEST(TestPlaneGeometryCloning);
MITK_TEST(TestInheritance);
MITK_TEST(TestSetExtendInMM);
MITK_TEST(TestRotate);
MITK_TEST(TestClone);
MITK_TEST(TestPlaneComparison);
MITK_TEST(TestAxialInitialization);
MITK_TEST(TestFrontalInitialization);
MITK_TEST(TestSaggitalInitialization);
// Currently commented out, see See bug 15990
// MITK_TEST(testPlaneGeometryInitializeOrder);
MITK_TEST(TestIntersectionPoint);
MITK_TEST(TestCase1210);
CPPUNIT_TEST_SUITE_END();
private:
// private test members that are initialized by setUp()
mitk::PlaneGeometry::Pointer planegeometry;
mitk::Point3D origin;
mitk::Vector3D right, bottom, normal;
mitk::ScalarType width, height;
mitk::ScalarType widthInMM, heightInMM, thicknessInMM;
public:
- void setUp()
+ void setUp() override
{
planegeometry = mitk::PlaneGeometry::New();
width = 100; widthInMM = width;
height = 200; heightInMM = height;
thicknessInMM = 1.0;
mitk::FillVector3D(origin, 4.5, 7.3, 11.2);
mitk::FillVector3D(right, widthInMM, 0, 0);
mitk::FillVector3D(bottom, 0, heightInMM, 0);
mitk::FillVector3D(normal, 0, 0, thicknessInMM);
planegeometry->InitializeStandardPlane(right.GetVnlVector(), bottom.GetVnlVector());
planegeometry->SetOrigin(origin);
}
- void tearDown()
+ void tearDown() override
{
}
// This test verifies inheritance behaviour, this test will fail if the behaviour changes in the future
void TestInheritance()
{
mitk::PlaneGeometry::Pointer plane = mitk::PlaneGeometry::New();
mitk::Geometry3D::Pointer g3d = dynamic_cast < mitk::Geometry3D* > ( plane.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("Planegeometry should not be castable to Geometry 3D", g3d.IsNull());
mitk::BaseGeometry::Pointer base = dynamic_cast < mitk::BaseGeometry* > ( plane.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("Planegeometry should be castable to BaseGeometry", base.IsNotNull());
base = NULL;
g3d = mitk::Geometry3D::New();
base = dynamic_cast < mitk::BaseGeometry* > ( g3d.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("Geometry3D should be castable to BaseGeometry", base.IsNotNull());
g3d=NULL;
mitk::SlicedGeometry3D::Pointer sliced = mitk::SlicedGeometry3D::New();
g3d = dynamic_cast < mitk::Geometry3D* > ( sliced.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("SlicedGeometry3D should not be castable to Geometry3D", g3d.IsNull());
plane=NULL;
mitk::ThinPlateSplineCurvedGeometry::Pointer thin = mitk::ThinPlateSplineCurvedGeometry::New();
plane = dynamic_cast < mitk::PlaneGeometry* > ( thin.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("AbstractTransformGeometry should be castable to PlaneGeometry", plane.IsNotNull());
plane = mitk::PlaneGeometry::New();
mitk::AbstractTransformGeometry::Pointer atg = dynamic_cast < mitk::AbstractTransformGeometry* > ( plane.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("PlaneGeometry should not be castable to AbstractTransofrmGeometry", atg.IsNull());
}
// See bug 1210
// Test does not use standard Parameters
void TestCase1210()
{
mitk::PlaneGeometry::Pointer planegeometry = mitk::PlaneGeometry::New();
mitk::Point3D origin;
mitk::Vector3D right, down, spacing;
mitk::FillVector3D(origin, 4.5, 7.3, 11.2);
mitk::FillVector3D(right,
1.015625, 1.015625, 1.1999969482421875
);
mitk::FillVector3D(down,
1.4012984643248170709237295832899161312802619418765e-45, 0, 0
);
mitk::FillVector3D(spacing,
0, 1.4713633875410579244699160624544119378442750389703e-43, 9.2806360452222355258639080851310540729807238879469e-32
);
std::cout << "Testing InitializeStandardPlane(rightVector, downVector, spacing = NULL): "<<std::endl;
CPPUNIT_ASSERT_NO_THROW(planegeometry->InitializeStandardPlane(right, down, &spacing));
/*
std::cout << "Testing width, height and thickness (in units): ";
if((mitk::Equal(planegeometry->GetExtent(0),width)==false) ||
(mitk::Equal(planegeometry->GetExtent(1),height)==false) ||
(mitk::Equal(planegeometry->GetExtent(2),1)==false)
)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
std::cout << "Testing width, height and thickness (in mm): ";
if((mitk::Equal(planegeometry->GetExtentInMM(0),widthInMM)==false) ||
(mitk::Equal(planegeometry->GetExtentInMM(1),heightInMM)==false) ||
(mitk::Equal(planegeometry->GetExtentInMM(2),thicknessInMM)==false)
)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
*/
}
/**
* @brief This method tests method IntersectionPoint
*
* See also bug #7151. (ref 2 this test: iggy)
* This test was written due to incorrect calculation of the intersection point
* between a given line and plane. This only occured when the pointdistance of
* the line was less than 1.
* Test Behavour:
* ==============
* we have a given line and a given plane.
* we let the line intersect the plane.
* when testing several positions on the line the resulting intersection point must be the same
* we test a position where the distance between the correspoinding points is < 0 and another position where the distance is > 0.
*
*/
// Test does not use standard Parameters
void TestIntersectionPoint()
{
//init plane with its parameter
mitk::PlaneGeometry::Pointer myPlaneGeometry = mitk::PlaneGeometry::New();
mitk::Point3D origin;
origin[0] = 0.0;
origin[1] = 2.0;
origin[2] = 0.0;
mitk::Vector3D normal;
normal[0] = 0.0;
normal[1] = 1.0;
normal[2] = 0.0;
myPlaneGeometry->InitializePlane(origin,normal);
//generate points and line for intersection testing
//point distance of given line > 1
mitk::Point3D pointP1;
pointP1[0] = 2.0;
pointP1[1] = 1.0;
pointP1[2] = 0.0;
mitk::Point3D pointP2;
pointP2[0] = 2.0;
pointP2[1] = 4.0;
pointP2[2] = 0.0;
mitk::Vector3D lineDirection;
lineDirection[0] = pointP2[0] - pointP1[0];
lineDirection[1] = pointP2[1] - pointP1[1];
lineDirection[2] = pointP2[2] - pointP1[2];
mitk::Line3D xingline( pointP1, lineDirection );
mitk::Point3D calcXingPoint;
myPlaneGeometry->IntersectionPoint(xingline, calcXingPoint);
//point distance of given line < 1
mitk::Point3D pointP3;
pointP3[0] = 2.0;
pointP3[1] = 2.2;
pointP3[2] = 0.0;
mitk::Point3D pointP4;
pointP4[0] = 2.0;
pointP4[1] = 1.7;
pointP4[2] = 0.0;
mitk::Vector3D lineDirection2;
lineDirection2[0] = pointP4[0] - pointP3[0];
lineDirection2[1] = pointP4[1] - pointP3[1];
lineDirection2[2] = pointP4[2] - pointP3[2];
mitk::Line3D xingline2( pointP3, lineDirection2 );
mitk::Point3D calcXingPoint2;
myPlaneGeometry->IntersectionPoint( xingline2, calcXingPoint2 );
//intersection points must be the same
CPPUNIT_ASSERT_MESSAGE("Failed to calculate Intersection Point", calcXingPoint == calcXingPoint2);
}
/**
* @brief This method tests method ProjectPointOntoPlane.
*
* See also bug #3409.
*/
// Test does not use standard Parameters
void TestProjectPointOntoPlane()
{
mitk::PlaneGeometry::Pointer myPlaneGeometry = mitk::PlaneGeometry::New();
//create normal
mitk::Vector3D normal;
normal[0] = 0.0;
normal[1] = 0.0;
normal[2] = 1.0;
//create origin
mitk::Point3D origin;
origin[0] = -27.582859;
origin[1] = 50;
origin[2] = 200.27742;
//initialize plane geometry
myPlaneGeometry->InitializePlane(origin,normal);
//output to descripe the test
std::cout << "Testing PlaneGeometry according to bug #3409" << std::endl;
std::cout << "Our normal is: " << normal << std::endl;
std::cout << "So ALL projected points should have exactly the same z-value!" << std::endl;
//create a number of points
mitk::Point3D myPoints[5];
myPoints[0][0] = -27.582859;
myPoints[0][1] = 50.00;
myPoints[0][2] = 200.27742;
myPoints[1][0] = -26.58662;
myPoints[1][1] = 50.00;
myPoints[1][2] = 200.19026;
myPoints[2][0] = -26.58662;
myPoints[2][1] = 50.00;
myPoints[2][2] = 200.33124;
myPoints[3][0] = 104.58662;
myPoints[3][1] = 452.12313;
myPoints[3][2] = 866.41236;
myPoints[4][0] = -207.58662;
myPoints[4][1] = 312.00;
myPoints[4][2] = -300.12346;
//project points onto plane
mitk::Point3D myProjectedPoints[5];
for ( unsigned int i = 0; i < 5; ++i )
{
myProjectedPoints[i] = myPlaneGeometry->ProjectPointOntoPlane( myPoints[i] );
}
//compare z-values with z-value of plane (should be equal)
bool allPointsOnPlane = true;
for ( unsigned int i = 0; i < 5; ++i )
{
if ( fabs(myProjectedPoints[i][2] - origin[2]) > mitk::sqrteps )
{
allPointsOnPlane = false;
}
}
CPPUNIT_ASSERT_MESSAGE("All points lie not on the same plane", allPointsOnPlane);
}
void TestPlaneGeometryCloning()
{
mitk::PlaneGeometry::Pointer geometry2D = createPlaneGeometry();
try
{
mitk::PlaneGeometry::Pointer clone = geometry2D->Clone();
itk::Matrix<mitk::ScalarType,3,3> matrix = clone->GetIndexToWorldTransform()->GetMatrix();
CPPUNIT_ASSERT_MESSAGE("Test if matrix element exists...", matrix[0][0] == 31);
double origin = geometry2D->GetOrigin()[0];
CPPUNIT_ASSERT_MESSAGE("First Point of origin as expected...", mitk::Equal(origin, 8));
double spacing = geometry2D->GetSpacing()[0];
CPPUNIT_ASSERT_MESSAGE("First Point of spacing as expected...", mitk::Equal(spacing, 31));
}
catch (...)
{
CPPUNIT_FAIL("Error during access on a member of cloned geometry");
}
// direction [row] [coloum]
MITK_TEST_OUTPUT( << "Casting a rotated 2D ITK Image to a MITK Image and check if Geometry is still same" );
}
void TestPlaneGeometryInitializeOrder()
{
mitk::Vector3D mySpacing;
mySpacing[0] = 31;
mySpacing[1] = 0.1;
mySpacing[2] = 5.4;
mitk::Point3D myOrigin;
myOrigin[0] = 8;
myOrigin[1] = 9;
myOrigin[2] = 10;
mitk::AffineTransform3D::Pointer myTransform = mitk::AffineTransform3D::New();
itk::Matrix<mitk::ScalarType, 3,3> transMatrix;
transMatrix.Fill(0);
transMatrix[0][0] = 1;
transMatrix[1][1] = 2;
transMatrix[2][2] = 4;
myTransform->SetMatrix(transMatrix);
mitk::PlaneGeometry::Pointer geometry2D1 = mitk::PlaneGeometry::New();
geometry2D1->SetIndexToWorldTransform(myTransform);
geometry2D1->SetSpacing(mySpacing);
geometry2D1->SetOrigin(myOrigin);
mitk::PlaneGeometry::Pointer geometry2D2 = mitk::PlaneGeometry::New();
geometry2D2->SetSpacing(mySpacing);
geometry2D2->SetOrigin(myOrigin);
geometry2D2->SetIndexToWorldTransform(myTransform);
mitk::PlaneGeometry::Pointer geometry2D3 = mitk::PlaneGeometry::New();
geometry2D3->SetIndexToWorldTransform(myTransform);
geometry2D3->SetSpacing(mySpacing);
geometry2D3->SetOrigin(myOrigin);
geometry2D3->SetIndexToWorldTransform(myTransform);
CPPUNIT_ASSERT_MESSAGE("Origin of Geometry 1 matches that of Geometry 2.", mitk::Equal(geometry2D1->GetOrigin(), geometry2D2->GetOrigin()));
CPPUNIT_ASSERT_MESSAGE("Origin of Geometry 1 match those of Geometry 3.", mitk::Equal(geometry2D1->GetOrigin(), geometry2D3->GetOrigin()));
CPPUNIT_ASSERT_MESSAGE("Origin of Geometry 2 match those of Geometry 3.", mitk::Equal(geometry2D2->GetOrigin(), geometry2D3->GetOrigin()));
CPPUNIT_ASSERT_MESSAGE("Spacing of Geometry 1 match those of Geometry 2.", mitk::Equal(geometry2D1->GetSpacing(), geometry2D2->GetSpacing()));
CPPUNIT_ASSERT_MESSAGE("Spacing of Geometry 1 match those of Geometry 3.", mitk::Equal(geometry2D1->GetSpacing(), geometry2D3->GetSpacing()));
CPPUNIT_ASSERT_MESSAGE("Spacing of Geometry 2 match those of Geometry 3.", mitk::Equal(geometry2D2->GetSpacing(), geometry2D3->GetSpacing()));
CPPUNIT_ASSERT_MESSAGE("Transformation of Geometry 1 match those of Geometry 2.", compareMatrix(geometry2D1->GetIndexToWorldTransform()->GetMatrix(), geometry2D2->GetIndexToWorldTransform()->GetMatrix()));
CPPUNIT_ASSERT_MESSAGE("Transformation of Geometry 1 match those of Geometry 3.", compareMatrix(geometry2D1->GetIndexToWorldTransform()->GetMatrix(), geometry2D3->GetIndexToWorldTransform()->GetMatrix()));
CPPUNIT_ASSERT_MESSAGE("Transformation of Geometry 2 match those of Geometry 3.", compareMatrix(geometry2D2->GetIndexToWorldTransform()->GetMatrix(), geometry2D3->GetIndexToWorldTransform()->GetMatrix()));
}
void TestInitializeStandardPlane()
{
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: width", mitk::Equal(planegeometry->GetExtent(0),width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: height", mitk::Equal(planegeometry->GetExtent(1),height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: depth", mitk::Equal(planegeometry->GetExtent(2),1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: width in mm", mitk::Equal(planegeometry->GetExtentInMM(0),widthInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: heght in mm", mitk::Equal(planegeometry->GetExtentInMM(1),heightInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: depth in mm", mitk::Equal(planegeometry->GetExtentInMM(2),thicknessInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: AxisVectorRight", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: AxisVectorBottom", mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with default Spacing: AxisVectorNormal", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps) );
mitk::Vector3D spacing;
thicknessInMM = 1.5;
normal.Normalize(); normal *= thicknessInMM;
mitk::FillVector3D(spacing, 1.0, 1.0, thicknessInMM);
planegeometry->InitializeStandardPlane(right.GetVnlVector(), bottom.GetVnlVector(), &spacing);
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: width", mitk::Equal(planegeometry->GetExtent(0),width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: height", mitk::Equal(planegeometry->GetExtent(1),height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: depth", mitk::Equal(planegeometry->GetExtent(2),1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: width in mm", mitk::Equal(planegeometry->GetExtentInMM(0),widthInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: height in mm", mitk::Equal(planegeometry->GetExtentInMM(1),heightInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: depth in mm", mitk::Equal(planegeometry->GetExtentInMM(2),thicknessInMM, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: AxisVectorRight", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: AxisVectorBottom", mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing correct Standard Plane initialization with custom Spacing: AxisVectorNormal", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps) );
;
}
void TestSetExtendInMM()
{
normal.Normalize();
normal *= thicknessInMM;
planegeometry->SetExtentInMM(2, thicknessInMM);
CPPUNIT_ASSERT_MESSAGE("Testing SetExtentInMM(2, ...), querying by GetExtentInMM(2): ", mitk::Equal(planegeometry->GetExtentInMM(2),thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing SetExtentInMM(2, ...), querying by GetAxisVector(2) and comparing to normal: ", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps));
planegeometry->SetOrigin(origin);
CPPUNIT_ASSERT_MESSAGE("Testing SetOrigin", mitk::Equal(planegeometry->GetOrigin(), origin, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() after SetOrigin: Right", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() after SetOrigin: Bottom", mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps) );
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() after SetOrigin: Normal", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps) );
mappingTests2D(planegeometry, width, height, widthInMM, heightInMM, origin, right, bottom);
}
void TestRotate()
{
// Changing the IndexToWorldTransform to a rotated version by SetIndexToWorldTransform() (keep origin):
mitk::AffineTransform3D::Pointer transform = mitk::AffineTransform3D::New();
mitk::AffineTransform3D::MatrixType::InternalMatrixType vnlmatrix;
vnlmatrix = planegeometry->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix();
mitk::VnlVector axis(3);
mitk::FillVector3D(axis, 1.0, 1.0, 1.0); axis.normalize();
vnl_quaternion<mitk::ScalarType> rotation(axis, 0.223);
vnlmatrix = rotation.rotation_matrix_transpose()*vnlmatrix;
mitk::Matrix3D matrix;
matrix = vnlmatrix;
transform->SetMatrix(matrix);
transform->SetOffset(planegeometry->GetIndexToWorldTransform()->GetOffset());
right.SetVnlVector( rotation.rotation_matrix_transpose()*right.GetVnlVector() );
bottom.SetVnlVector(rotation.rotation_matrix_transpose()*bottom.GetVnlVector());
normal.SetVnlVector(rotation.rotation_matrix_transpose()*normal.GetVnlVector());
planegeometry->SetIndexToWorldTransform(transform);
//The origin changed,because m_Origin=m_IndexToWorldTransform->GetOffset()+GetAxisVector(2)*0.5
//and the AxisVector changes due to the rotation. In other words: the rotation was done around
//the corner of the box, not around the planes origin. Now change it to a rotation around
//the origin, simply by re-setting the origin to the original one:
planegeometry->SetOrigin(origin);
CPPUNIT_ASSERT_MESSAGE("Testing whether SetIndexToWorldTransform kept origin: ", mitk::Equal(planegeometry->GetOrigin(), origin, testEps) );
mitk::Point2D point; point[0] = 4; point[1] = 3;
mitk::Point2D dummy;
planegeometry->WorldToIndex(point, dummy);
planegeometry->IndexToWorld(dummy, dummy);
CPPUNIT_ASSERT_MESSAGE("Testing consistancy of index and world coordinates.", dummy == point);
CPPUNIT_ASSERT_MESSAGE("Testing width of rotated version: ", mitk::Equal(planegeometry->GetExtentInMM(0),widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height of rotated version: ", mitk::Equal(planegeometry->GetExtentInMM(1),heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness of rotated version: ", mitk::Equal(planegeometry->GetExtentInMM(2),thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of rotated version: right ", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of rotated version: bottom", mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of rotated version: normal", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(0).GetNorm(),planegeometry->GetExtentInMM(0), testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(1).GetNorm(),planegeometry->GetExtentInMM(1), testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(2).GetNorm(),planegeometry->GetExtentInMM(2), testEps));
mappingTests2D(planegeometry, width, height, widthInMM, heightInMM, origin, right, bottom);
width *= 2;
height *= 3;
planegeometry->SetSizeInUnits(width, height);
CPPUNIT_ASSERT_MESSAGE("Testing SetSizeInUnits() of rotated version: ", mitk::Equal(planegeometry->GetExtent(0),width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing SetSizeInUnits() of rotated version: ", mitk::Equal(planegeometry->GetExtent(1),height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing SetSizeInUnits() of rotated version: ", mitk::Equal(planegeometry->GetExtent(2),1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width (in mm) of version with changed size in units: ", mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in mm) of version with changed size in units: ", mitk::Equal(planegeometry->GetExtentInMM(1), heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in mm) of version with changed size in units: ", mitk::Equal(planegeometry->GetExtentInMM(2), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of version with changed size in units: right ", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of version with changed size in units: bottom", mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of version with changed size in units: normal", mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(0).GetNorm(),planegeometry->GetExtentInMM(0), testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(1).GetNorm(),planegeometry->GetExtentInMM(1), testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector(direction).GetNorm() != planegeometry->GetExtentInMM(direction) of rotated version: ",
mitk::Equal(planegeometry->GetAxisVector(2).GetNorm(),planegeometry->GetExtentInMM(2), testEps));
mappingTests2D(planegeometry, width, height, widthInMM, heightInMM, origin, right, bottom);
}
void TestClone()
{
mitk::PlaneGeometry::Pointer clonedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());
// Cave: Statement below is negated!
CPPUNIT_ASSERT_MESSAGE("Testing Clone(): ", ! ((clonedplanegeometry.IsNull()) || (clonedplanegeometry->GetReferenceCount()!=1)));
CPPUNIT_ASSERT_MESSAGE("Testing origin of cloned version: ", mitk::Equal(clonedplanegeometry->GetOrigin(), origin, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width (in units) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtent(0),width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in units) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtent(1),height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing extent (in units) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtent(2),1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width (in mm) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in mm) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtentInMM(1), heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in mm) of cloned version: ", mitk::Equal(clonedplanegeometry->GetExtentInMM(2), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of cloned version: right", mitk::Equal(clonedplanegeometry->GetAxisVector(0), right, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of cloned version: bottom", mitk::Equal(clonedplanegeometry->GetAxisVector(1), bottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of cloned version: normal", mitk::Equal(clonedplanegeometry->GetAxisVector(2), normal, testEps));
mappingTests2D(clonedplanegeometry, width, height, widthInMM, heightInMM, origin, right, bottom);
}
void TestSaggitalInitialization()
{
mitk::Point3D cornerpoint0 = planegeometry->GetCornerPoint(0);
mitk::PlaneGeometry::Pointer clonedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());
// Testing InitializeStandardPlane(clonedplanegeometry, planeorientation = Sagittal, zPosition = 0, frontside=true):
planegeometry->InitializeStandardPlane(clonedplanegeometry, mitk::PlaneGeometry::Sagittal);
mitk::Vector3D newright, newbottom, newnormal;
mitk::ScalarType newthicknessInMM;
newright = bottom;
newthicknessInMM = widthInMM/width*1.0; // extent in normal direction is 1;
newnormal = right; newnormal.Normalize(); newnormal *= newthicknessInMM;
newbottom = normal; newbottom.Normalize(); newbottom *= thicknessInMM;
CPPUNIT_ASSERT_MESSAGE("Testing GetCornerPoint(0) of sagitally initialized version:", mitk::Equal(planegeometry->GetCornerPoint(0), cornerpoint0, testEps));
//ok, corner was fine, so we can dare to believe the origin is ok.
origin = planegeometry->GetOrigin();
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtent(0), height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtent(1), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(0), heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of sagitally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(2), newthicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of sagitally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(0), newright, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of sagitally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(1), newbottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of sagitally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(2), newnormal, testEps));
mappingTests2D(planegeometry, height, 1, heightInMM, thicknessInMM, origin, newright, newbottom);
// set origin back to the one of the axial slice:
origin = clonedplanegeometry->GetOrigin();
// Testing backside initialization: InitializeStandardPlane(clonedplanegeometry, planeorientation = Axial, zPosition = 0, frontside=false, rotated=true):
planegeometry->InitializeStandardPlane(clonedplanegeometry, mitk::PlaneGeometry::Axial, 0, false, true);
mitk::Point3D backsideorigin;
backsideorigin=origin+clonedplanegeometry->GetAxisVector(1);//+clonedplanegeometry->GetAxisVector(2);
CPPUNIT_ASSERT_MESSAGE("Testing origin of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetOrigin(), backsideorigin, testEps));
mitk::Point3D backsidecornerpoint0;
backsidecornerpoint0 = cornerpoint0+clonedplanegeometry->GetAxisVector(1);//+clonedplanegeometry->GetAxisVector(2);
CPPUNIT_ASSERT_MESSAGE("Testing GetCornerPoint(0) of sagitally initialized version: ", mitk::Equal(planegeometry->GetCornerPoint(0), backsidecornerpoint0, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of backsidedly, axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(0), width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of backsidedly, axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(1), height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of backsidedly, axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(1), heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(2), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetAxisVector(0), right, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetAxisVector(1), -bottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of backsidedly, axially initialized version: ", mitk::Equal(planegeometry->GetAxisVector(2), -normal, testEps));
mappingTests2D(planegeometry, width, height, widthInMM, heightInMM, backsideorigin, right, -bottom);
}
void TestFrontalInitialization()
{
mitk::Point3D cornerpoint0 = planegeometry->GetCornerPoint(0);
mitk::PlaneGeometry::Pointer clonedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());
//--------
mitk::Vector3D newright, newbottom, newnormal;
mitk::ScalarType newthicknessInMM;
// Testing InitializeStandardPlane(clonedplanegeometry, planeorientation = Frontal, zPosition = 0, frontside=true)
planegeometry->InitializeStandardPlane(clonedplanegeometry, mitk::PlaneGeometry::Frontal);
newright = right;
newbottom = normal; newbottom.Normalize(); newbottom *= thicknessInMM;
newthicknessInMM = heightInMM/height*1.0/*extent in normal direction is 1*/;
newnormal = -bottom; newnormal.Normalize(); newnormal *= newthicknessInMM;
CPPUNIT_ASSERT_MESSAGE("Testing GetCornerPoint(0) of frontally initialized version: ", mitk::Equal(planegeometry->GetCornerPoint(0), cornerpoint0, testEps));
//ok, corner was fine, so we can dare to believe the origin is ok.
origin = planegeometry->GetOrigin();
CPPUNIT_ASSERT_MESSAGE("Testing width (in units) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(0), width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in units) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(1), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in units) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width (in mm) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in mm) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in mm) of frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(2), newthicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(0), newright, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(1), newbottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(2), newnormal, testEps));
mappingTests2D(planegeometry, width, 1, widthInMM, thicknessInMM, origin, newright, newbottom);
//Changing plane to in-plane unit spacing using SetSizeInUnits:
planegeometry->SetSizeInUnits(planegeometry->GetExtentInMM(0), planegeometry->GetExtentInMM(1));
CPPUNIT_ASSERT_MESSAGE( "Testing origin of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetOrigin(), origin, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(2), newthicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(0), newright, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(1), newbottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(2), newnormal, testEps));
mappingTests2D(planegeometry, widthInMM, thicknessInMM, widthInMM, thicknessInMM, origin, newright, newbottom);
// Changing plane to unit spacing also in normal direction using SetExtentInMM(2, 1.0):
planegeometry->SetExtentInMM(2, 1.0);
newnormal.Normalize();
CPPUNIT_ASSERT_MESSAGE("Testing origin of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetOrigin(), origin, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in units) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(1), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width, height and thickness (in mm) of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetExtentInMM(2), 1.0, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(0), newright, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(1), newbottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of unit spaced, frontally initialized version: ", mitk::Equal(planegeometry->GetAxisVector(2), newnormal, testEps));
mappingTests2D(planegeometry, widthInMM, thicknessInMM, widthInMM, thicknessInMM, origin, newright, newbottom);
}
void TestAxialInitialization()
{
mitk::Point3D cornerpoint0 = planegeometry->GetCornerPoint(0);
// Clone, move, rotate and test for 'IsParallel' and 'IsOnPlane'
mitk::PlaneGeometry::Pointer clonedplanegeometry = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());
CPPUNIT_ASSERT_MESSAGE("Testing Clone(): ", ! ((clonedplanegeometry.IsNull()) || (clonedplanegeometry->GetReferenceCount()!=1)) );
std::cout << "Testing InitializeStandardPlane(clonedplanegeometry, planeorientation = Axial, zPosition = 0, frontside=true): " <<std::endl;
planegeometry->InitializeStandardPlane(clonedplanegeometry);
CPPUNIT_ASSERT_MESSAGE("Testing origin of axially initialized version: ", mitk::Equal(planegeometry->GetOrigin(), origin));
CPPUNIT_ASSERT_MESSAGE("Testing GetCornerPoint(0) of axially initialized version: ", mitk::Equal(planegeometry->GetCornerPoint(0), cornerpoint0));
CPPUNIT_ASSERT_MESSAGE("Testing width (in units) of axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(0), width, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in units) of axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(1), height, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in units) of axially initialized version (should be same as in mm due to unit spacing, except for thickness, which is always 1): ",
mitk::Equal(planegeometry->GetExtent(2), 1, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing width (in mm) of axially initialized version: ",
mitk::Equal(planegeometry->GetExtentInMM(0), widthInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing height (in mm) of axially initialized version: ",
mitk::Equal(planegeometry->GetExtentInMM(1), heightInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing thickness (in mm) of axially initialized version: ",
mitk::Equal(planegeometry->GetExtentInMM(2), thicknessInMM, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of axially initialized version: ",
mitk::Equal(planegeometry->GetAxisVector(0), right, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of axially initialized version: ",
mitk::Equal(planegeometry->GetAxisVector(1), bottom, testEps));
CPPUNIT_ASSERT_MESSAGE("Testing GetAxisVector() of axially initialized version: ",
mitk::Equal(planegeometry->GetAxisVector(2), normal, testEps));
mappingTests2D(planegeometry, width, height, widthInMM, heightInMM, origin, right, bottom);
}
void TestPlaneComparison()
{
// Clone, move, rotate and test for 'IsParallel' and 'IsOnPlane'
mitk::PlaneGeometry::Pointer clonedplanegeometry2 = dynamic_cast<mitk::PlaneGeometry*>(planegeometry->Clone().GetPointer());
CPPUNIT_ASSERT_MESSAGE("Testing Clone(): ", ! ((clonedplanegeometry2.IsNull()) || (clonedplanegeometry2->GetReferenceCount()!=1)) );
CPPUNIT_ASSERT_MESSAGE("Testing wheter original and clone are at the same position", clonedplanegeometry2->IsOnPlane(planegeometry.GetPointer()));
CPPUNIT_ASSERT_MESSAGE(" Asserting that origin is on the plane cloned plane:", clonedplanegeometry2->IsOnPlane(origin));
mitk::VnlVector newaxis(3);
mitk::FillVector3D(newaxis, 1.0, 1.0, 1.0); newaxis.normalize();
vnl_quaternion<mitk::ScalarType> rotation2(newaxis, 0.0);
mitk::Vector3D clonednormal = clonedplanegeometry2->GetNormal();
mitk::Point3D clonedorigin = clonedplanegeometry2->GetOrigin();
mitk::RotationOperation* planerot = new mitk::RotationOperation( mitk::OpROTATE, origin, clonedplanegeometry2->GetAxisVector( 0 ), 180.0 );
clonedplanegeometry2->ExecuteOperation( planerot );
CPPUNIT_ASSERT_MESSAGE(" Asserting that a flipped plane is still on the original plane: ", clonedplanegeometry2->IsOnPlane(planegeometry.GetPointer()));
clonedorigin += clonednormal;
clonedplanegeometry2->SetOrigin( clonedorigin );
CPPUNIT_ASSERT_MESSAGE("Testing if the translated (cloned, flipped) plane is parallel to its origin plane: ", clonedplanegeometry2->IsParallel(planegeometry));
delete planerot;
planerot = new mitk::RotationOperation( mitk::OpROTATE, origin, clonedplanegeometry2->GetAxisVector( 0 ), 0.5 );
clonedplanegeometry2->ExecuteOperation( planerot );
CPPUNIT_ASSERT_MESSAGE("Testing if a non-paralell plane gets recognized as not paralell [rotation +0.5 degree] : ", ! clonedplanegeometry2->IsParallel(planegeometry));
delete planerot;
planerot = new mitk::RotationOperation( mitk::OpROTATE, origin, clonedplanegeometry2->GetAxisVector( 0 ), -1.0 );
clonedplanegeometry2->ExecuteOperation( planerot );
CPPUNIT_ASSERT_MESSAGE("Testing if a non-paralell plane gets recognized as not paralell [rotation -0.5 degree] : ", ! clonedplanegeometry2->IsParallel(planegeometry));
delete planerot;
planerot = new mitk::RotationOperation( mitk::OpROTATE, origin, clonedplanegeometry2->GetAxisVector( 0 ), 360.5 );
clonedplanegeometry2->ExecuteOperation( planerot );
CPPUNIT_ASSERT_MESSAGE("Testing if a non-paralell plane gets recognized as paralell [rotation 360 degree] : ", clonedplanegeometry2->IsParallel(planegeometry));
}
private:
// helper Methods for the Tests
mitk::PlaneGeometry::Pointer createPlaneGeometry()
{
mitk::Vector3D mySpacing;
mySpacing[0] = 31;
mySpacing[1] = 0.1;
mySpacing[2] = 5.4;
mitk::Point3D myOrigin;
myOrigin[0] = 8;
myOrigin[1] = 9;
myOrigin[2] = 10;
mitk::AffineTransform3D::Pointer myTransform = mitk::AffineTransform3D::New();
itk::Matrix<mitk::ScalarType, 3,3> transMatrix;
transMatrix.Fill(0);
transMatrix[0][0] = 1;
transMatrix[1][1] = 2;
transMatrix[2][2] = 4;
myTransform->SetMatrix(transMatrix);
mitk::PlaneGeometry::Pointer geometry2D = mitk::PlaneGeometry::New();
geometry2D->SetIndexToWorldTransform(myTransform);
geometry2D->SetSpacing(mySpacing);
geometry2D->SetOrigin(myOrigin);
return geometry2D;
}
bool compareMatrix(itk::Matrix<mitk::ScalarType, 3,3> left, itk::Matrix<mitk::ScalarType, 3,3> right)
{
bool equal = true;
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
equal &= mitk::Equal(left[i][j], right[i][j]);
return equal;
}
/**
* This function tests for correct mapping and is called several times from other tests
**/
void mappingTests2D(const mitk::PlaneGeometry* planegeometry, const mitk::ScalarType& width, const mitk::ScalarType& height, const mitk::ScalarType& widthInMM, const mitk::ScalarType& heightInMM, const mitk::Point3D& origin, const mitk::Vector3D& right, const mitk::Vector3D& bottom)
{
std::cout << "Testing mapping Map(pt2d_mm(x=widthInMM/2.3,y=heightInMM/2.5), pt3d_mm) and compare with expected: ";
mitk::Point2D pt2d_mm;
mitk::Point3D pt3d_mm, expected_pt3d_mm;
pt2d_mm[0] = widthInMM/2.3; pt2d_mm[1] = heightInMM/2.5;
expected_pt3d_mm = origin+right*(pt2d_mm[0]/right.GetNorm())+bottom*(pt2d_mm[1]/bottom.GetNorm());
planegeometry->Map(pt2d_mm, pt3d_mm);
CPPUNIT_ASSERT_MESSAGE("Testing mapping Map(pt2d_mm(x=widthInMM/2.3,y=heightInMM/2.5), pt3d_mm) and compare with expected", mitk::Equal(pt3d_mm, expected_pt3d_mm, testEps));
std::cout << "Testing mapping Map(pt3d_mm, pt2d_mm) and compare with expected: ";
mitk::Point2D testpt2d_mm;
planegeometry->Map(pt3d_mm, testpt2d_mm);
std::cout << std::setprecision(12) << "Expected pt2d_mm " << pt2d_mm << std::endl;
std::cout << std::setprecision(12) << "Result testpt2d_mm " << testpt2d_mm << std::endl;
std::cout << std::setprecision(12) << "10*mitk::eps " << 10*mitk::eps << std::endl;
//This eps is temporarily set to 10*mitk::eps. See bug #15037 for details.
CPPUNIT_ASSERT_MESSAGE("Testing mapping Map(pt3d_mm, pt2d_mm) and compare with expected", mitk::Equal(pt2d_mm, testpt2d_mm, 10*mitk::eps));
std::cout << "Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ";
mitk::Point2D pt2d_units;
pt2d_units[0] = width/2.0; pt2d_units[1] = height/2.0;
pt2d_mm[0] = widthInMM/2.0; pt2d_mm[1] = heightInMM/2.0;
planegeometry->IndexToWorld(pt2d_units, testpt2d_mm);
std::cout << std::setprecision(12) << "Expected pt2d_mm " << pt2d_mm << std::endl;
std::cout << std::setprecision(12) << "Result testpt2d_mm " << testpt2d_mm << std::endl;
std::cout << std::setprecision(12) << "10*mitk::eps " << 10*mitk::eps << std::endl;
//This eps is temporarily set to 10*mitk::eps. See bug #15037 for details.
CPPUNIT_ASSERT_MESSAGE("Testing IndexToWorld(pt2d_units, pt2d_mm) and compare with expected: ", mitk::Equal(pt2d_mm, testpt2d_mm, 10*mitk::eps));
std::cout << "Testing WorldToIndex(pt2d_mm, pt2d_units) and compare with expected: ";
mitk::Point2D testpt2d_units;
planegeometry->WorldToIndex(pt2d_mm, testpt2d_units);
std::cout << std::setprecision(12) << "Expected pt2d_units " << pt2d_units << std::endl;
std::cout << std::setprecision(12) << "Result testpt2d_units " << testpt2d_units << std::endl;
std::cout << std::setprecision(12) << "10*mitk::eps " << 10*mitk::eps << std::endl;
//This eps is temporarily set to 10*mitk::eps. See bug #15037 for details.
CPPUNIT_ASSERT_MESSAGE("Testing WorldToIndex(pt2d_mm, pt2d_units) and compare with expected:", mitk::Equal(pt2d_units, testpt2d_units, 10*mitk::eps));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPlaneGeometry)
\ No newline at end of file
diff --git a/Modules/Core/test/mitkPointSetEqualTest.cpp b/Modules/Core/test/mitkPointSetEqualTest.cpp
index 660f5c80ae..1208730ee3 100644
--- a/Modules/Core/test/mitkPointSetEqualTest.cpp
+++ b/Modules/Core/test/mitkPointSetEqualTest.cpp
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkPointSet.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
/**
* @brief mitkPointSetEqualTestSuite A test class for Equal methods in mitk::PointSet.
*/
class mitkPointSetEqualTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointSetEqualTestSuite);
MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
MITK_TEST(Equal_DifferentGeometries_ReturnsFalse);
MITK_TEST(Equal_DifferentNumberOfPoints_ReturnsFalse);
MITK_TEST(Equal_DifferentPoints_ReturnsFalse);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::PointSet::Pointer m_PointSet;
mitk::PointSet::Pointer m_AnotherPointSet;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_PointSet = mitk::PointSet::New();
m_AnotherPointSet = m_PointSet->Clone();
}
- void tearDown()
+ void tearDown() override
{
m_PointSet = NULL;
m_AnotherPointSet = NULL;
}
void Equal_CloneAndOriginal_ReturnsTrue()
{
mitk::PointSet::Pointer newPointSet = mitk::PointSet::New();
MITK_ASSERT_EQUAL( newPointSet, newPointSet->Clone(), "A clone should be equal to its original.");
}
void Equal_DifferentGeometries_ReturnsFalse()
{
mitk::Point3D origin;
origin[0] = 0.0;
origin[1] = 0.0;
origin[2] = 1.0 + 2*mitk::eps;
m_AnotherPointSet->GetGeometry()->SetOrigin(origin);
MITK_ASSERT_NOT_EQUAL( m_PointSet, m_AnotherPointSet, "Origin was modified. Result should be false.");
}
void Equal_DifferentNumberOfPoints_ReturnsFalse()
{
mitk::Point3D tmpPoint;
tmpPoint[0] = 1.0;
tmpPoint[1] = 1.0;
tmpPoint[2] = 1.0;
m_PointSet->InsertPoint( 1, tmpPoint );
m_PointSet->InsertPoint( 2, tmpPoint );
m_AnotherPointSet->InsertPoint( 1, tmpPoint );
MITK_ASSERT_NOT_EQUAL( m_PointSet, m_AnotherPointSet, "One pointset has two points the other has one. Result should be false.");
}
void Equal_DifferentPoints_ReturnsFalse()
{
mitk::Point3D tmpPoint;
tmpPoint[0] = 1.0;
tmpPoint[1] = 1.0;
tmpPoint[2] = 1.0;
m_PointSet->InsertPoint( 1, tmpPoint );
tmpPoint[0] = 1.0 + 2*mitk::eps;
m_AnotherPointSet->InsertPoint( 1, tmpPoint );
MITK_ASSERT_NOT_EQUAL( m_PointSet, m_AnotherPointSet, "Two pointsets with different points. Result should be false.");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointSetEqual)
diff --git a/Modules/Core/test/mitkPointSetOnEmptyTest.cpp b/Modules/Core/test/mitkPointSetOnEmptyTest.cpp
index 4377d9544f..c24cdb6dc1 100644
--- a/Modules/Core/test/mitkPointSetOnEmptyTest.cpp
+++ b/Modules/Core/test/mitkPointSetOnEmptyTest.cpp
@@ -1,244 +1,244 @@
/*
* mitkPointSetTestOnEmpty.cpp
*
* Created on: Apr 23, 2014
* Author: wirkert
*/
/**
* TestSuite for PointSet which tests properties on an empty PointSet
*/
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <mitkPointSet.h>
#include <mitkVector.h>
#include <mitkPointOperation.h>
#include <mitkInteractionConst.h>
#include <fstream>
class mitkPointSetOnEmptyTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointSetOnEmptyTestSuite);
MITK_TEST(TestInstantiation);
MITK_TEST(TestIsEmpty);
MITK_TEST(TestGetITKPointSet);
MITK_TEST(TestGetSizeIsZero);
MITK_TEST(TestAddPointDirectly);
MITK_TEST(TestPointSetClone);
MITK_TEST(TestPointDataContainerCorrectAfterPointSetManipulation);
CPPUNIT_TEST_SUITE_END();
private:
mitk::PointSet::Pointer pointSet;
void TestPointContainerPointDataContainer(mitk::PointSet* ps)
{
mitk::PointSet::PointsContainer* pc = ps->GetPointSet()->GetPoints();
mitk::PointSet::PointDataContainer* pd = ps->GetPointSet()->GetPointData();
CPPUNIT_ASSERT_EQUAL_MESSAGE("PointContainer and PointDataContainer have same size",
true, pc->Size() == pd->Size());
mitk::PointSet::PointsContainer::ConstIterator pIt = pc->Begin();
mitk::PointSet::PointDataContainer::ConstIterator dIt = pd->Begin();
bool failed = false;
for (; pIt != pc->End(); ++pIt, ++dIt)
if (pIt->Index() != dIt->Index())
{
failed = true;
break;
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("Indices in PointContainer and PointDataContainer are equal",
false, failed);
}
public:
- void setUp()
+ void setUp() override
{
//Create PointSet
pointSet = mitk::PointSet::New();
}
- void tearDown()
+ void tearDown() override
{
pointSet = NULL;
}
void TestInstantiation()
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("Testing instantiation",
true, pointSet.IsNotNull());
}
void TestGetITKPointSet()
{
//try to get the itkPointSet
mitk::PointSet::DataType::Pointer itkdata = NULL;
itkdata = pointSet->GetPointSet();
CPPUNIT_ASSERT_EQUAL_MESSAGE("try to get the itkPointSet from a newly created PointSet",
true, itkdata.IsNotNull());
}
void TestGetSizeIsZero()
{
//fresh PointSet has to be empty!
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if the PointSet size is 0 ",
true, pointSet->GetSize() == 0);
}
void TestIsEmpty()
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if the PointSet is empty",
true, pointSet->IsEmptyTimeStep(0));
}
void TestAddPointDirectly()
{
//add a point directly
int id=0;
mitk::Point3D point;
mitk::FillVector3D(point, 1.0, 2.0, 3.0);
++id;
pointSet->GetPointSet()->GetPoints()->InsertElement(id, point);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if added points exists",
true, pointSet->GetSize()==1 ||pointSet->IndexExists(id));
mitk::Point3D tempPoint;
tempPoint.Fill(0);
tempPoint = pointSet->GetPoint(id);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if added point contains real value",
true, point == tempPoint);
}
void TestPointSetClone(void)
{
pointSet->Expand(3);
mitk::Point3D new0, new1, new2;
new0.Fill(0);
new1.Fill(1);
new2.Fill(2);
pointSet->InsertPoint(5,new0, mitk::PTCORNER,0);
pointSet->InsertPoint(112,new1,0);
pointSet->InsertPoint(2,new2,0);
pointSet->InsertPoint(2,new0,1);
pointSet->InsertPoint(1,new1,1);
pointSet->InsertPoint(0,new2,1);
pointSet->InsertPoint(0,new0,2);
pointSet->InsertPoint(2,new1,2);
pointSet->InsertPoint(1,new2,2);
MITK_TEST_OUTPUT( << "... pointset ts: " << pointSet->GetTimeSteps() )
mitk::PointSet::Pointer clonePS = pointSet->Clone();
MITK_TEST_OUTPUT( << "... clone pointset ts: " << clonePS->GetTimeSteps() )
for (unsigned int t=0; t< pointSet->GetTimeSteps(); t++)
{
MITK_TEST_OUTPUT( << "testing timestep: " << t )
CPPUNIT_ASSERT_EQUAL_MESSAGE("Clone has same size",
true, pointSet->GetSize(t) == clonePS->GetSize(t));
// test for equal point coordinates
for (mitk::PointSet::PointsConstIterator i = pointSet->Begin(), j = clonePS->Begin();
i != pointSet->End() && j != clonePS->End(); ++i, ++j)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("Cloned PS and PS have same points",
true, i.Index() == j.Index() && mitk::Equal(i.Value(),j.Value()));
}
// test for equal point data
mitk::PointSet::PointDataContainer* pointDataCont = pointSet->GetPointSet(t)->GetPointData();
mitk::PointSet::PointDataContainer* clonePointDataCont = clonePS->GetPointSet(t)->GetPointData();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Valid point data container",
true, pointDataCont && clonePointDataCont);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Cloned point data container has same size",
true, pointDataCont->Size() == clonePointDataCont->Size());
for (mitk::PointSet::PointDataConstIterator i = pointDataCont->Begin(), j = clonePointDataCont->Begin();
i != pointDataCont->End() && j != clonePointDataCont->End(); ++i, ++j)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("Cloned PS and PS have same point data",
true, i.Index() == j.Index() && i.Value() == j.Value());
}
}
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if the PointSet is not empty",
false, clonePS->IsEmptyTimeStep(0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Testing cloned point set's size!",
true, clonePS->GetPointSetSeriesSize() == pointSet->GetPointSetSeriesSize());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Testing that the clone is not the source PS!",
true, clonePS.GetPointer() != pointSet.GetPointer());
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Testing if the geometry is cloned correctly!",
true, clonePS->GetGeometry()->GetCenter() == pointSet->GetGeometry()->GetCenter());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Testing if the property list is cloned correctly!",
true, clonePS->GetPropertyList()->GetMap()->size() == pointSet->GetPropertyList()->GetMap()->size());
// Also testing, that clone is independent from original
mitk::Point3D p, p2;
p.Fill(42);
p2.Fill(84);
clonePS->InsertPoint(0,p);
pointSet->InsertPoint(0,p2);
p = clonePS->GetPoint(0);
p2 = pointSet->GetPoint(0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Testing that the clone is independent from source!",
true, p != p2);
}
void TestPointDataContainerCorrectAfterPointSetManipulation(void)
{
/* call everything that might modify PointContainer and PointDataContainer */
MITK_TEST_OUTPUT(<< "Test InsertPoint(), SetPoint() and SwapPointPosition()");
mitk::PointSet::PointType point;
mitk::FillVector3D(point, 2.2, 3.3, -4.4);
pointSet->InsertPoint(17, point);
pointSet->SetPoint(4, point);
pointSet->SetPoint(7, point);
pointSet->SetPoint(2, point);
pointSet->SwapPointPosition(7, true);
pointSet->SwapPointPosition(3, true);
pointSet->SwapPointPosition(2, false);
TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpREMOVE");
mitk::PointOperation op1(mitk::OpREMOVE, mitk::Point3D(), 2); // existing index
pointSet->ExecuteOperation(&op1);
mitk::PointOperation op1b(mitk::OpREMOVE, mitk::Point3D(), 112); // non existing index
pointSet->ExecuteOperation(&op1b);
TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpMove");
mitk::PointOperation op2(mitk::OpMOVE, mitk::Point3D(), 4); // existing index
pointSet->ExecuteOperation(&op2);
mitk::PointOperation op3(mitk::OpMOVE, mitk::Point3D(), 34); // non existing index
pointSet->ExecuteOperation(&op3);
TestPointContainerPointDataContainer(pointSet);
MITK_TEST_OUTPUT(<< "Test OpINSERT");
mitk::PointOperation op4(mitk::OpINSERT, mitk::Point3D(), 38); // non existing index
pointSet->ExecuteOperation(&op4);
mitk::PointOperation op5(mitk::OpINSERT, mitk::Point3D(), 17); // existing index
pointSet->ExecuteOperation(&op5);
TestPointContainerPointDataContainer(pointSet);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointSetOnEmpty)
diff --git a/Modules/Core/test/mitkPointSetPointOperationsTest.cpp b/Modules/Core/test/mitkPointSetPointOperationsTest.cpp
index 991fb2313e..7a33279785 100644
--- a/Modules/Core/test/mitkPointSetPointOperationsTest.cpp
+++ b/Modules/Core/test/mitkPointSetPointOperationsTest.cpp
@@ -1,287 +1,287 @@
/*
* mitkPoinSetPointOperationsTest.cpp
*
* Created on: Apr 23, 2014
* Author: wirkert
*/
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <mitkPointSet.h>
#include <mitkVector.h>
#include <mitkPointOperation.h>
#include <mitkInteractionConst.h>
#include <fstream>
/**
* TestSuite for all PointSet manipulations done by PointOperations
*/
class mitkPointSetPointOperationsTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointSetPointOperationsTestSuite);
MITK_TEST(TestCreateOperationAndAddPoint);
MITK_TEST(TestPointOperationOpMove);
MITK_TEST(TestPointOperationOpRemove);
MITK_TEST(TestPointOperationOpSelectPoint);
MITK_TEST(TestOpDeselectPoint);
MITK_TEST(TestOpMovePointUp);
MITK_TEST(TestOpMovePointDown);
MITK_TEST(TestOpMovePointUpOnFirstPoint);
CPPUNIT_TEST_SUITE_END();
private:
mitk::PointSet::Pointer pointSet;
mitk::PointOperation* doOp;
public:
- void setUp()
+ void setUp() override
{
//Create PointSet
pointSet = mitk::PointSet::New();
// add some points
mitk::Point3D point2, point3, point4;
point2.Fill(3);
point3.Fill(4);
point4.Fill(5);
pointSet->InsertPoint(2,point2);
pointSet->InsertPoint(3,point3);
pointSet->InsertPoint(4,point4);
}
- void tearDown()
+ void tearDown() override
{
pointSet = NULL;
delete doOp;
}
void TestCreateOperationAndAddPoint()
{
int id = 0;
mitk::Point3D point;
point.Fill(1);
doOp = new mitk::PointOperation(mitk::OpINSERT, point, id);
pointSet->ExecuteOperation(doOp);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if added points exists",
true, pointSet->GetSize()==4 && pointSet->IndexExists(id));
mitk::Point3D tempPoint;
tempPoint.Fill(0);
tempPoint = pointSet->GetPoint(id);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check if added point contains real value",
true, point == tempPoint);
}
void TestPointOperationOpMove()
{
//check opMOVE ExecuteOperation
int id=1;
mitk::Point3D point1;
mitk::Point3D tempPoint;
point1.Fill(2);
doOp = new mitk::PointOperation(mitk::OpMOVE, point1, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMove ",
true, tempPoint == point1);
/*
if (tempPoint != point1)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestPointOperationOpRemove()
{
//check OpREMOVE ExecuteOperation
int id=0;
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(id);
doOp = new mitk::PointOperation(mitk::OpREMOVE, point, id);
pointSet->ExecuteOperation(doOp);
tempPoint = pointSet->GetPoint(id);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpREMOVE ",
false, pointSet->IndexExists(id) );
/*
if(pointSet->IndexExists(id))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestPointOperationOpSelectPoint()
{
mitk::Point3D point3(0.);
//check OpSELECTPOINT ExecuteOperation
doOp = new mitk::PointOperation(mitk::OpSELECTPOINT, point3,3);
pointSet->ExecuteOperation(doOp);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpSELECTPOINT ",
true, pointSet->GetSelectInfo(3));
/*
if (!pointSet->GetSelectInfo(4))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestOpDeselectPoint()
{
//check OpDESELECTPOINT ExecuteOperation
mitk::Point3D point4(0.);
doOp = new mitk::PointOperation(mitk::OpDESELECTPOINT, point4,4);
pointSet->ExecuteOperation(doOp);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpDESELECTPOINT ",
false, pointSet->GetSelectInfo(4));
CPPUNIT_ASSERT_EQUAL_MESSAGE("check GetNumeberOfSelected ",
true, pointSet->GetNumberOfSelected() == 0 );
/*
if (pointSet->GetSelectInfo(4))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
if(pointSet->GetNumberOfSelected() != 0)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestOpMovePointUp()
{
//check OpMOVEPOINTUP ExecuteOperation
const int id = 4;
mitk::Point3D point = pointSet->GetPoint(id);
mitk::Point3D point4(0.);
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, point4, id);
pointSet->ExecuteOperation(doOp);
mitk::Point3D tempPoint = pointSet->GetPoint(id-1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMOVEPOINTUP ",
true, tempPoint == point);
/*
if (tempPoint != point)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestOpMovePointDown()
{
//check OpMOVEPOINTDown ExecuteOperation
const int id = 2;
mitk::Point3D point = pointSet->GetPoint(id);
mitk::Point3D point2(0.);
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTDOWN, point2, id);
pointSet->ExecuteOperation(doOp);
mitk::Point3D tempPoint = pointSet->GetPoint(id+1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMOVEPOINTDOWN ",
true, tempPoint == point);
/*
if (tempPoint != point)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestOpMovePointUpOnFirstPoint()
{
//check OpMOVEPOINTUP on first point ExecuteOperation
mitk::PointSet::PointType p1 = pointSet->GetPoint(1);
mitk::PointSet::PointType p2 = pointSet->GetPoint(2);
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p1, 1);
pointSet->ExecuteOperation(doOp);
mitk::PointSet::PointType newP1 = pointSet->GetPoint(1);
mitk::PointSet::PointType newP2 = pointSet->GetPoint(2);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMOVEPOINTUP for point id 1: ",
true, ((newP1 == p1) && (newP2 == p2)));
/*
if (((newP1 == p1) && (newP2 == p2)) == false)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointSetPointOperations)
diff --git a/Modules/Core/test/mitkPointSetTest.cpp b/Modules/Core/test/mitkPointSetTest.cpp
index f26bea3f95..c41669ec6c 100644
--- a/Modules/Core/test/mitkPointSetTest.cpp
+++ b/Modules/Core/test/mitkPointSetTest.cpp
@@ -1,359 +1,359 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <mitkPointSet.h>
#include <mitkNumericTypes.h>
#include <mitkPointOperation.h>
#include <mitkInteractionConst.h>
#include <fstream>
/**
* TestSuite for PointSet stuff not only operating on an empty PointSet
*/
class mitkPointSetTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointSetTestSuite);
MITK_TEST(TestIsNotEmpty);
MITK_TEST(TestSetSelectInfo);
MITK_TEST(TestGetNumberOfSelected);
MITK_TEST(TestSearchSelectedPoint);
MITK_TEST(TestGetPointIfExists);
MITK_TEST(TestSwapPointPositionUpwards);
MITK_TEST(TestSwapPointPositionUpwardsNotPossible);
MITK_TEST(TestSwapPointPositionDownwards);
MITK_TEST(TestSwapPointPositionDownwardsNotPossible);
MITK_TEST(TestCreateHoleInThePointIDs);
MITK_TEST(TestInsertPointWithPointSpecification);
CPPUNIT_TEST_SUITE_END();
private:
mitk::PointSet::Pointer pointSet;
static const mitk::PointSet::PointIdentifier selectedPointId = 2;
public:
- void setUp()
+ void setUp() override
{
//Create PointSet
pointSet = mitk::PointSet::New();
// add some points
mitk::Point3D point2, point3, point4;
point2.Fill(3);
point3.Fill(4);
point4.Fill(5);
pointSet->InsertPoint(2,point2);
pointSet->InsertPoint(3,point3);
pointSet->InsertPoint(4,point4);
mitk::Point3D point1;
mitk::FillVector3D(point1, 1.0, 2.0, 3.0);
pointSet->InsertPoint(1, point1);
mitk::Point3D point0;
point0.Fill(1);
pointSet->InsertPoint(0, point0);
// select point with id 2
pointSet->SetSelectInfo(2, true);
}
- void tearDown()
+ void tearDown() override
{
pointSet = NULL;
}
void TestIsNotEmpty()
{
//PointSet can not be empty!
CPPUNIT_ASSERT_EQUAL_MESSAGE( "check if the PointSet is not empty ",
true, !pointSet->IsEmptyTimeStep(0) );
/*
std::cout << "check if the PointSet is not empty ";
if (pointSet->IsEmpty(0))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSetSelectInfo()
{
//check SetSelectInfo
pointSet->SetSelectInfo(4, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SetSelectInfo",
true, pointSet->GetSelectInfo(4));
/*
if (!pointSet->GetSelectInfo(2))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSearchSelectedPoint()
{
// check SearchSelectedPoint
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SearchSelectedPoint ",
true, pointSet->SearchSelectedPoint() == (int) selectedPointId);
/*
if( pointSet->SearchSelectedPoint() != 4)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestGetNumberOfSelected()
{
// check GetNumeberOfSelected
CPPUNIT_ASSERT_EQUAL_MESSAGE("check GetNumeberOfSelected ",
true, pointSet->GetNumberOfSelected() == 1);
/*
if(pointSet->GetNumberOfSelected() != 1)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestGetPointIfExists()
{
//check GetPointIfExists
mitk::Point3D point4;
mitk::Point3D tempPoint;
point4.Fill(5);
mitk::PointSet::PointType tmpPoint;
pointSet->GetPointIfExists(4, &tmpPoint);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check GetPointIfExists: ",
true, tmpPoint == point4);
/*
if (tmpPoint != point5)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSwapPointPositionUpwards()
{
//Check SwapPointPosition upwards
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(1);
pointSet->SwapPointPosition(1, true);
tempPoint = pointSet->GetPoint(0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SwapPointPosition upwards",
true, point == tempPoint);
/*
if(point != tempPoint)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSwapPointPositionUpwardsNotPossible()
{
//Check SwapPointPosition upwards not possible
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SwapPointPosition upwards not possible",
false, pointSet->SwapPointPosition(0, true));
/*
if(pointSet->SwapPointPosition(0, true))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSwapPointPositionDownwards()
{
//Check SwapPointPosition downwards
mitk::Point3D point;
mitk::Point3D tempPoint;
point = pointSet->GetPoint(0);
pointSet->SwapPointPosition(0, false);
tempPoint = pointSet->GetPoint(1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SwapPointPosition down",
true, point == tempPoint);
/*
if(point != tempPoint)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestSwapPointPositionDownwardsNotPossible()
{
mitk::PointSet::Pointer pointSet2 = mitk::PointSet::New();
int id = 0;
mitk::Point3D point;
point.Fill(1);
pointSet2->SetPoint(id, point);
//Check SwapPointPosition downwards not possible
CPPUNIT_ASSERT_EQUAL_MESSAGE("check SwapPointPosition downwards not possible",
false, pointSet2->SwapPointPosition(id, false));
/*
if(pointSet->SwapPointPosition(1, false))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
void TestCreateHoleInThePointIDs()
{
// create a hole in the point IDs
mitk::Point3D point(0.);
mitk::PointSet::PointType p10, p11, p12;
p10.Fill(10.0);
p11.Fill(11.0);
p12.Fill(12.0);
pointSet->InsertPoint(10, p10);
pointSet->InsertPoint(11, p11);
pointSet->InsertPoint(12, p12);
CPPUNIT_ASSERT_EQUAL_MESSAGE("add points with id 10, 11, 12: ",
true, (pointSet->IndexExists(10) == true) || (pointSet->IndexExists(11) == true) || (pointSet->IndexExists(12) == true));
//check OpREMOVE ExecuteOperation
int id = 11;
mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpREMOVE, point, id);
pointSet->ExecuteOperation(doOp);
CPPUNIT_ASSERT_EQUAL_MESSAGE( "remove point id 11: ",
false, pointSet->IndexExists(id));
/*
if(pointSet->IndexExists(id))
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
delete doOp;
std::cout<<"[PASSED]"<<std::endl;
*/
//mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p12, 12);
//pointSet->ExecuteOperation(doOp);
delete doOp;
//check OpMOVEPOINTUP ExecuteOperation
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP, p12, 12);
pointSet->ExecuteOperation(doOp);
delete doOp;
mitk::PointSet::PointType newP10 = pointSet->GetPoint(10);
mitk::PointSet::PointType newP12 = pointSet->GetPoint(12);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMOVEPOINTUP for point id 12:",
true, ((newP10 == p12) && (newP12 == p10)));
//check OpMOVEPOINTDOWN ExecuteOperation
doOp = new mitk::PointOperation(mitk::OpMOVEPOINTDOWN, p10, 10);
pointSet->ExecuteOperation(doOp);
delete doOp;
newP10 = pointSet->GetPoint(10);
newP12 = pointSet->GetPoint(12);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check PointOperation OpMOVEPOINTDOWN for point id 10: ",
true, ((newP10 == p10) && (newP12 == p12)));
}
void TestInsertPointWithPointSpecification()
{
//check InsertPoint with PointSpecification
mitk::Point3D point5;
mitk::Point3D tempPoint;
point5.Fill(7);
pointSet->SetPoint(5, point5, mitk::PTEDGE );
tempPoint = pointSet->GetPoint(5);
CPPUNIT_ASSERT_EQUAL_MESSAGE("check InsertPoint with PointSpecification" ,
true, tempPoint == point5);
/*
if (tempPoint != point5)
{
std::cout<<"[FAILED]"<<std::endl;
return EXIT_FAILURE;
}
std::cout<<"[PASSED]"<<std::endl;
*/
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointSet)
diff --git a/Modules/Core/test/mitkPointTypeConversionTest.cpp b/Modules/Core/test/mitkPointTypeConversionTest.cpp
index 797b983e95..b6e69fd31e 100644
--- a/Modules/Core/test/mitkPointTypeConversionTest.cpp
+++ b/Modules/Core/test/mitkPointTypeConversionTest.cpp
@@ -1,165 +1,165 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestFixture.h"
#include "mitkTestingMacros.h"
#include "mitkNumericConstants.h"
#include "mitkNumericTypes.h" // for Equal method
#include "mitkPoint.h"
#include "itkPoint.h"
#include "vtkPoints.h"
#include "vtkSmartPointer.h"
#include <iostream>
using namespace mitk;
class mitkPointTypeConversionTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointTypeConversionTestSuite);
MITK_TEST(Vector2Point);
MITK_TEST(Mitk2Itk_PointCompatibility);
MITK_TEST(Itk2Mitk_PointCompatibility);
MITK_TEST(Vtk2Mitk_PointCompatibility);
MITK_TEST(Mitk2Pod_PointCompatibility);
MITK_TEST(Pod2Mitk_PointCompatibility);
CPPUNIT_TEST_SUITE_END();
private:
vtkSmartPointer<vtkPoints> a_vtkPoints;
ScalarType originalValues[3];
ScalarType valuesToCopy[3];
/**
* @brief Convenience method to test if one vector has been assigned successfully to the other.
*
* More specifically, tests if v1 = v2 was performed correctly.
*
* @param v1 The vector v1 of the assignment v1 = v2
* @param v2 The vector v2 of the assignment v1 = v2
* @param v1Name The type name of v1 (e.g.: mitk::Vector3D). Necessary for the correct test output.
* @param v2Name The type name of v2 (e.g.: mitk::Vector3D). Necessary for the correct test output.
* @param eps defines the allowed tolerance when testing for equality.
*/
template <typename T1, typename T2>
void TestForEquality(T1 v1, T2 v2, std::string v1Name, std::string v2Name, ScalarType eps = mitk::eps)
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("\nAssigning " + v2Name + " to " + v1Name + ":\n both are equal", true, EqualArray(v1, v2, 3, eps));
}
public:
- void setUp(void)
+ void setUp(void) override
{
FillVector3D(originalValues, 1.0, 2.0, 3.0);
FillVector3D(valuesToCopy, 4.0, 5.0, 6.0);
a_vtkPoints = vtkSmartPointer<vtkPoints>::New();
a_vtkPoints->Initialize();
}
- void tearDown(void)
+ void tearDown(void) override
{
// a_vtkPoints = NULL;
}
void Mitk2Itk_PointCompatibility()
{
itk::Point<ScalarType, 3> itkPoint3D = originalValues;
mitk::Point3D point3D = valuesToCopy;
itkPoint3D = point3D;
TestForEquality(itkPoint3D, point3D, "itk::Point", "mitk:Point");
}
void Itk2Mitk_PointCompatibility()
{
mitk::Point3D point3D = originalValues;
itk::Point<ScalarType, 3> itkPoint3D = valuesToCopy;
point3D = itkPoint3D;
TestForEquality(point3D, itkPoint3D, "mitk:Point", "itk::Point");
}
void Vtk2Mitk_PointCompatibility()
{
mitk::Point3D point3D = originalValues;
a_vtkPoints->InsertNextPoint(valuesToCopy);
double vtkPoint[3];
a_vtkPoints->GetPoint(0, vtkPoint);
point3D = vtkPoint;
TestForEquality(point3D, vtkPoint, "mitk:Point", "vtkPoint");
}
void Mitk2Pod_PointCompatibility()
{
ScalarType podPoint[] = {1.0, 2.0, 3.0};
mitk::Point3D point3D = valuesToCopy;
point3D.ToArray(podPoint);
TestForEquality(podPoint, point3D, "POD point", "mitk::Point");
}
void Pod2Mitk_PointCompatibility()
{
itk::Point<double, 3> point3D = originalValues;
ScalarType podPoint[] = {4.0, 5.0, 6.0};
point3D = podPoint;
TestForEquality(point3D, podPoint, "mitk::Point3D", "POD point");
}
void Vector2Point()
{
itk::Point<double, 3> point3D = valuesToCopy;
itk::Vector<double, 3> vector3D = originalValues;
point3D = vector3D;
TestForEquality(point3D, vector3D, "mitk::Point", "mitk::Vector");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointTypeConversion)
diff --git a/Modules/Core/test/mitkProportionalTimeGeometryTest.cpp b/Modules/Core/test/mitkProportionalTimeGeometryTest.cpp
index 97a2805040..04b81d9b6d 100644
--- a/Modules/Core/test/mitkProportionalTimeGeometryTest.cpp
+++ b/Modules/Core/test/mitkProportionalTimeGeometryTest.cpp
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkProportionalTimeGeometry.h"
#include "mitkGeometry3D.h"
#include "mitkThinPlateSplineCurvedGeometry.h"
#include "mitkSlicedGeometry3D.h"
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
class mitkProportionalTimeGeometryTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkProportionalTimeGeometryTestSuite);
MITK_TEST(TestInheritance);
MITK_TEST(TestProportionalTimeGeometryCloning);
CPPUNIT_TEST_SUITE_END();
public:
- void setUp()
+ void setUp() override
{
}
- void tearDown()
+ void tearDown() override
{
}
// This test is supposed to verify inheritance behaviour, this test will fail if the behaviour changes in the future
void TestInheritance()
{
mitk::ProportionalTimeGeometry::Pointer ptGeom = mitk::ProportionalTimeGeometry::New();
mitk::Geometry3D::Pointer g3d = dynamic_cast < mitk::Geometry3D* > ( ptGeom.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("ProportionalTimeGeometry should not be castable to Geometry3D", g3d.IsNull());
mitk::TimeGeometry::Pointer base = dynamic_cast < mitk::TimeGeometry* > ( ptGeom.GetPointer() );
CPPUNIT_ASSERT_MESSAGE("ProportionalTimeGeometry should be castable to TimeGeometry", base.IsNotNull());
}
void TestProportionalTimeGeometryCloning()
{
mitk::ProportionalTimeGeometry::Pointer geom = CreateProportionalTimeGeometry();
mitk::ProportionalTimeGeometry::Pointer clone = geom->Clone();
CPPUNIT_ASSERT_MESSAGE("First time point of clone matches original",
clone->GetFirstTimePoint() == 1.1);
CPPUNIT_ASSERT_MESSAGE("Step duration of clone matches original",
clone->GetStepDuration() == 2.2);
mitk::PlaneGeometry *planeGeom = dynamic_cast<mitk::PlaneGeometry*>(clone->GetGeometryForTimeStep(0).GetPointer());
itk::Matrix<mitk::ScalarType,3,3> matrix = planeGeom->GetIndexToWorldTransform()->GetMatrix();
CPPUNIT_ASSERT_MESSAGE("Matrix element [0][0] of clone matches original", matrix[0][0] == 31);
double origin = planeGeom->GetOrigin()[0];
CPPUNIT_ASSERT_MESSAGE("First Point of origin of clone matches original", mitk::Equal(origin, 8));
double spacing = planeGeom->GetSpacing()[0];
CPPUNIT_ASSERT_MESSAGE("First Point of spacing of clone matches original", mitk::Equal(spacing, 31));
}
private:
// helper Methods for the Tests
mitk::ProportionalTimeGeometry::Pointer CreateProportionalTimeGeometry()
{
mitk::Vector3D mySpacing;
mySpacing[0] = 31;
mySpacing[1] = 0.1;
mySpacing[2] = 5.4;
mitk::Point3D myOrigin;
myOrigin[0] = 8;
myOrigin[1] = 9;
myOrigin[2] = 10;
mitk::AffineTransform3D::Pointer myTransform = mitk::AffineTransform3D::New();
itk::Matrix<mitk::ScalarType, 3,3> transMatrix;
transMatrix.Fill(0);
transMatrix[0][0] = 1;
transMatrix[1][1] = 2;
transMatrix[2][2] = 4;
myTransform->SetMatrix(transMatrix);
mitk::PlaneGeometry::Pointer geom2D = mitk::PlaneGeometry::New();
geom2D->SetIndexToWorldTransform(myTransform);
geom2D->SetSpacing(mySpacing);
geom2D->SetOrigin(myOrigin);
mitk::ProportionalTimeGeometry::Pointer geom = mitk::ProportionalTimeGeometry::New();
geom->SetFirstTimePoint(1.1);
geom->SetStepDuration(2.2);
geom->SetTimeStepGeometry(geom2D, 0);
return geom;
}
};
MITK_TEST_SUITE_REGISTRATION(mitkProportionalTimeGeometry)
diff --git a/Modules/Core/test/mitkRawImageFileReaderTest.cpp b/Modules/Core/test/mitkRawImageFileReaderTest.cpp
index b1c5eefa2f..5a6d299f2b 100644
--- a/Modules/Core/test/mitkRawImageFileReaderTest.cpp
+++ b/Modules/Core/test/mitkRawImageFileReaderTest.cpp
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include "mitkIOUtil.h"
#include "mitkIOConstants.h"
class mitkRawImageFileReaderTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkRawImageFileReaderTestSuite);
MITK_TEST(testReadFile);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
std::string m_ImagePath;
std::string m_ImagePathNrrdRef; //corresponding mhd path for comparision
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_ImagePath = GetTestDataFilePath("brain.raw");
m_ImagePathNrrdRef = GetTestDataFilePath("brainHalfSize.nrrd"); //we need half size because the brain file has spacing 2 and this reader doesn't support spacing
}
- void tearDown()
+ void tearDown() override
{
}
void testReadFile()
{
mitk::IFileReader::Options options;
options[mitk::IOConstants::DIMENSION()] = 3;
options[mitk::IOConstants::PIXEL_TYPE()] = mitk::IOConstants::PIXEL_TYPE_FLOAT();
options[mitk::IOConstants::SIZE_X()] = 91;
options[mitk::IOConstants::SIZE_Y()] = 109;
options[mitk::IOConstants::SIZE_Z()] = 91;
options[mitk::IOConstants::ENDIANNESS()] = mitk::IOConstants::ENDIANNESS_LITTLE();
mitk::Image::Pointer readFile = dynamic_cast<mitk::Image*>(mitk::IOUtil::Load(m_ImagePath, options).front().GetPointer());
CPPUNIT_ASSERT_MESSAGE("Testing reading a raw file.",readFile.IsNotNull());
//compare with the reference image
mitk::Image::Pointer compareImage = mitk::IOUtil::LoadImage(m_ImagePathNrrdRef);
MITK_ASSERT_EQUAL(compareImage, readFile, "Testing if image is equal to the same image as reference file loaded with mitk");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkRawImageFileReader)
diff --git a/Modules/Core/test/mitkSTLFileReaderTest.cpp b/Modules/Core/test/mitkSTLFileReaderTest.cpp
index 3190525e42..79fd208f7f 100644
--- a/Modules/Core/test/mitkSTLFileReaderTest.cpp
+++ b/Modules/Core/test/mitkSTLFileReaderTest.cpp
@@ -1,79 +1,79 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkImage.h"
#include "mitkSlicedGeometry3D.h"
#include "mitkSurface.h"
#include "mitkIOUtil.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <vtkSTLReader.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <fstream>
class mitkSTLFileReaderTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkSTLFileReaderTestSuite);
MITK_TEST(testReadFile);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
std::string m_SurfacePath;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_SurfacePath = GetTestDataFilePath("ball.stl");
}
- void tearDown()
+ void tearDown() override
{
}
void testReadFile()
{
//Read STL-Image from file
mitk::Surface::Pointer surface = mitk::IOUtil::LoadSurface(m_SurfacePath);
//check some basic stuff
CPPUNIT_ASSERT_MESSAGE("Reader output not NULL",surface.IsNotNull());
CPPUNIT_ASSERT_MESSAGE("IsInitialized()",surface->IsInitialized());
CPPUNIT_ASSERT_MESSAGE("mitk::Surface::SetVtkPolyData()",(surface->GetVtkPolyData()!=NULL));
CPPUNIT_ASSERT_MESSAGE("Availability of geometry",(surface->GetGeometry()!=NULL));
//use vtk stl reader for reference
vtkSmartPointer<vtkSTLReader> myVtkSTLReader = vtkSmartPointer<vtkSTLReader>::New();
myVtkSTLReader->SetFileName( m_SurfacePath.c_str() );
myVtkSTLReader->Update();
vtkSmartPointer<vtkPolyData> myVtkPolyData = myVtkSTLReader->GetOutput();
//vtkPolyData from vtkSTLReader directly
int n = myVtkPolyData->GetNumberOfPoints();
//vtkPolyData from mitkSTLFileReader
int m = surface->GetVtkPolyData()->GetNumberOfPoints();
CPPUNIT_ASSERT_MESSAGE("Number of Points in VtkPolyData",(n == m));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkSTLFileReader)
diff --git a/Modules/Core/test/mitkSurfaceEqualTest.cpp b/Modules/Core/test/mitkSurfaceEqualTest.cpp
index 2691ec2a09..77016ec7ef 100644
--- a/Modules/Core/test/mitkSurfaceEqualTest.cpp
+++ b/Modules/Core/test/mitkSurfaceEqualTest.cpp
@@ -1,182 +1,182 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkSurface.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkPolygon.h>
#include <vtkPolyLine.h>
#include <vtkCellArray.h>
/**
* @brief mitkPointSetEqualTestSuite A test class for Equal methods in mitk::PointSet.
*/
class mitkSurfaceEqualTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkSurfaceEqualTestSuite);
MITK_TEST(Equal_CloneAndOriginalOneTimestep_ReturnsTrue);
MITK_TEST(Equal_CloneAndOriginalTwoTimesteps_ReturnsTrue);
MITK_TEST(Equal_OneTimeStepVSTwoTimeStep_ReturnsFalse);
MITK_TEST(Equal_TwoTimeStepsDifferentPoints_ReturnsFalse);
MITK_TEST(Equal_DifferentPoints_ReturnsFalse);
MITK_TEST(Equal_SurfaceWithPolygonSurfaceWithPolyLine_ReturnsFalse);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::Surface::Pointer m_Surface3D;
mitk::Surface::Pointer m_Surface3DTwoTimeSteps;
vtkSmartPointer<vtkPoints> m_PointsOne;
vtkSmartPointer<vtkPoints> m_PointsTwo;
vtkSmartPointer<vtkCellArray> m_PolygonArrayTwo;
vtkSmartPointer<vtkPolyData> m_PolyDataOne;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
//generate two sets of points
m_PointsOne = vtkSmartPointer<vtkPoints>::New();
m_PointsOne->InsertNextPoint( 0.0, 0.0, 0.0 );
m_PointsOne->InsertNextPoint( 1.0, 0.0, 0.0 );
m_PointsOne->InsertNextPoint( 0.0, 1.0, 0.0 );
m_PointsOne->InsertNextPoint( 1.0, 1.0, 0.0 );
m_PointsTwo = vtkSmartPointer<vtkPoints>::New();
m_PointsTwo->InsertNextPoint( 0.0, 0.0, 0.0 );
m_PointsTwo->InsertNextPoint( 0.0, 0.0, 2.0 );
m_PointsTwo->InsertNextPoint( 0.0, 1.0, 0.0 );
m_PointsTwo->InsertNextPoint( 0.0, 1.0, 2.0 );
//generate two polygons
vtkSmartPointer<vtkPolygon> polygonOne = vtkSmartPointer<vtkPolygon>::New();
polygonOne->GetPointIds()->SetNumberOfIds(4);
polygonOne->GetPointIds()->SetId(0,0);
polygonOne->GetPointIds()->SetId(1,1);
polygonOne->GetPointIds()->SetId(2,2);
polygonOne->GetPointIds()->SetId(3,3);
vtkSmartPointer<vtkPolygon> polygonTwo = vtkSmartPointer<vtkPolygon>::New();
polygonTwo->GetPointIds()->SetNumberOfIds(4);
polygonTwo->GetPointIds()->SetId(0,3);
polygonTwo->GetPointIds()->SetId(1,2);
polygonTwo->GetPointIds()->SetId(2,0);
polygonTwo->GetPointIds()->SetId(3,1);
//generate polydatas
vtkSmartPointer<vtkCellArray> polygonArrayOne = vtkSmartPointer<vtkCellArray>::New();
polygonArrayOne->InsertNextCell(polygonOne);
m_PolyDataOne = vtkSmartPointer<vtkPolyData>::New();
m_PolyDataOne->SetPoints(m_PointsOne);
m_PolyDataOne->SetPolys(polygonArrayOne);
m_PolygonArrayTwo = vtkSmartPointer<vtkCellArray>::New();
m_PolygonArrayTwo->InsertNextCell(polygonTwo);
vtkSmartPointer<vtkPolyData> polyDataTwo = vtkSmartPointer<vtkPolyData>::New();
polyDataTwo->SetPoints(m_PointsOne);
polyDataTwo->SetPolys(m_PolygonArrayTwo);
//generate surfaces
m_Surface3D = mitk::Surface::New();
m_Surface3D->SetVtkPolyData( m_PolyDataOne );
m_Surface3DTwoTimeSteps = mitk::Surface::New();
m_Surface3DTwoTimeSteps->SetVtkPolyData( m_PolyDataOne, 0 );
m_Surface3DTwoTimeSteps->SetVtkPolyData( polyDataTwo, 1 );
}
- void tearDown()
+ void tearDown() override
{
m_Surface3D = NULL;
m_Surface3DTwoTimeSteps = NULL;
m_PolyDataOne = NULL;
m_PolygonArrayTwo = NULL;
m_PointsOne = NULL;
m_PointsTwo = NULL;
}
void Equal_CloneAndOriginalOneTimestep_ReturnsTrue()
{
MITK_ASSERT_EQUAL( m_Surface3D, m_Surface3D->Clone(), "A one timestep clone should be equal to its original.");
}
void Equal_CloneAndOriginalTwoTimesteps_ReturnsTrue()
{
MITK_ASSERT_EQUAL( m_Surface3DTwoTimeSteps, m_Surface3DTwoTimeSteps->Clone(), "A two timestep clone should be equal to its original.");
}
void Equal_OneTimeStepVSTwoTimeStep_ReturnsFalse()
{
MITK_ASSERT_NOT_EQUAL( m_Surface3D, m_Surface3DTwoTimeSteps, "A one timestep and two timestep surface should not be equal.");
}
void Equal_TwoTimeStepsDifferentPoints_ReturnsFalse()
{
vtkSmartPointer<vtkPolyData> polyDataDifferentPoints = vtkSmartPointer<vtkPolyData>::New();
polyDataDifferentPoints->SetPoints(m_PointsTwo);
polyDataDifferentPoints->SetPolys(m_PolygonArrayTwo);
mitk::Surface::Pointer surface3DTwoTimeStepsDifferentPoints = mitk::Surface::New();
surface3DTwoTimeStepsDifferentPoints->SetVtkPolyData( m_PolyDataOne, 0 );
surface3DTwoTimeStepsDifferentPoints->SetVtkPolyData( polyDataDifferentPoints, 1 );
//The geometry also changes, because the second pointset has a different geometry/extent.
MITK_ASSERT_NOT_EQUAL( surface3DTwoTimeStepsDifferentPoints, m_Surface3DTwoTimeSteps, "A surface with the same timesteps and different points should not be equal.");
}
void Equal_SurfaceWithPolygonSurfaceWithPolyLine_ReturnsFalse()
{
//generate a line
vtkSmartPointer<vtkPolyLine> polyLineOne = vtkSmartPointer<vtkPolyLine>::New();
polyLineOne->GetPointIds()->SetNumberOfIds(2);
polyLineOne->GetPointIds()->SetId(0,0);
polyLineOne->GetPointIds()->SetId(1,1);
vtkSmartPointer<vtkCellArray> polyLineArrayOne = vtkSmartPointer<vtkCellArray>::New();
polyLineArrayOne->InsertNextCell(polyLineOne);
vtkSmartPointer<vtkPolyData> polyDataLine = vtkSmartPointer<vtkPolyData>::New();
polyDataLine->SetPoints(m_PointsOne);
polyDataLine->SetLines(polyLineArrayOne);
mitk::Surface::Pointer surface3DLine = mitk::Surface::New();
surface3DLine->SetVtkPolyData( polyDataLine );
MITK_ASSERT_NOT_EQUAL( m_Surface3D, surface3DLine, "A surface with the same timesteps and points and the same number of cells, but different types of cells should not be equal.");
}
void Equal_DifferentPoints_ReturnsFalse()
{
mitk::Surface::Pointer surfaceWithADifferentPoint = m_Surface3D->Clone();
//modify points. m_Surface3D contains m_PointsOne
surfaceWithADifferentPoint->GetVtkPolyData()->SetPoints( m_PointsTwo );
MITK_ASSERT_NOT_EQUAL( m_Surface3D, surfaceWithADifferentPoint, "A surface with a single timestep and different points should not be equal.");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkSurfaceEqual)
diff --git a/Modules/Core/test/mitkSurfaceToImageFilterTest.cpp b/Modules/Core/test/mitkSurfaceToImageFilterTest.cpp
index 2904794cfb..1e406743e8 100644
--- a/Modules/Core/test/mitkSurfaceToImageFilterTest.cpp
+++ b/Modules/Core/test/mitkSurfaceToImageFilterTest.cpp
@@ -1,172 +1,172 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkIOUtil.h>
#include <mitkImagePixelReadAccessor.h>
#include <mitkImageWriteAccessor.h>
#include "mitkSurfaceToImageFilter.h"
#include <vtkPolyData.h>
#include "mitkTestFixture.h"
class mitkSurfaceToImageFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkSurfaceToImageFilterTestSuite);
MITK_TEST(test3DSurfaceValidOutput);
MITK_TEST(test3DSurfaceCorrect);
MITK_TEST(test3DSurfaceIn4DImage);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
mitk::Surface::Pointer m_Surface;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_Surface = mitk::IOUtil::LoadSurface(GetTestDataFilePath("ball.stl"));
}
- void tearDown()
+ void tearDown() override
{
}
void test3DSurfaceValidOutput()
{
mitk::SurfaceToImageFilter::Pointer surfaceToImageFilter = mitk::SurfaceToImageFilter::New();
mitk::Image::Pointer additionalInputImage = mitk::Image::New();
additionalInputImage->Initialize( mitk::MakeScalarPixelType<unsigned int>(), *m_Surface->GetTimeGeometry());
//Arrange the filter
surfaceToImageFilter->MakeOutputBinaryOn();
surfaceToImageFilter->SetInput(m_Surface);
surfaceToImageFilter->SetImage(additionalInputImage);
surfaceToImageFilter->Update();
CPPUNIT_ASSERT_MESSAGE("SurfaceToImageFilter_AnyInputImageAndModeSetToBinary_ResultIsImageWithUCHARPixelType", surfaceToImageFilter->GetOutput()->GetPixelType().GetComponentType() == itk::ImageIOBase::UCHAR);
}
void test3DSurfaceCorrect()
{
mitk::SurfaceToImageFilter::Pointer surfaceToImageFilter = mitk::SurfaceToImageFilter::New();
//todo I don't know if this image is always needed. There is no documentation of the filter. Use git blame and ask the author.
mitk::Image::Pointer additionalInputImage = mitk::Image::New();
unsigned int* dims = new unsigned int[3];
dims[0] = 32;
dims[1] = 32;
dims[2] = 32;
additionalInputImage->Initialize( mitk::MakeScalarPixelType<unsigned int>(),3,dims);
additionalInputImage->SetOrigin(m_Surface->GetGeometry()->GetOrigin());
additionalInputImage->GetGeometry()->SetIndexToWorldTransform(m_Surface->GetGeometry()->GetIndexToWorldTransform());
//Arrange the filter
//The docu does not really tell if this is always needed. Could we skip SetImage in any case?
surfaceToImageFilter->MakeOutputBinaryOn();
surfaceToImageFilter->SetInput(m_Surface);
surfaceToImageFilter->SetImage(additionalInputImage);
surfaceToImageFilter->Update();
mitk::ImagePixelReadAccessor<unsigned char,3> outputReader(surfaceToImageFilter->GetOutput());
itk::Index<3> idx;
bool valuesCorrect = true;
//Values outside the ball should be 0
idx[0] = 0; idx[1] = 0, idx[2] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 0; idx[1] = 15, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 15, idx[2] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 0, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 5; idx[1] = 9, idx[2] = 23; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
//Values inside the ball should be 1
idx[0] = 15; idx[1] = 15, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 31; idx[1] = 15, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 2; idx[1] = 15, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 15; idx[1] = 15, idx[2] = 2; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 15; idx[1] = 2, idx[2] = 15; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 6; idx[1] = 9, idx[2] = 23; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
CPPUNIT_ASSERT_MESSAGE("SurfaceToImageFilter_BallSurfaceAsInput_OutputCorrect", valuesCorrect == true);
}
void test3DSurfaceIn4DImage()
{
mitk::SurfaceToImageFilter::Pointer surfaceToImageFilter = mitk::SurfaceToImageFilter::New();
mitk::Image::Pointer additionalInputImage = mitk::Image::New();
unsigned int* dims = new unsigned int[4];
dims[0] = 32;
dims[1] = 32;
dims[2] = 32;
dims[3] = 2;
additionalInputImage->Initialize( mitk::MakeScalarPixelType<unsigned int>(),4,dims);
additionalInputImage->SetOrigin(m_Surface->GetGeometry()->GetOrigin());
additionalInputImage->GetGeometry()->SetIndexToWorldTransform(m_Surface->GetGeometry()->GetIndexToWorldTransform());
mitk::Image::Pointer secondStep = additionalInputImage->Clone();
unsigned int size = sizeof(unsigned char);
for (unsigned int i = 0; i < secondStep->GetDimension(); ++i)
size *= secondStep->GetDimension(i);
mitk::ImageWriteAccessor accessor( secondStep );
memset( accessor.GetData(), 1, size );
additionalInputImage->GetTimeGeometry()->Expand(2);
additionalInputImage->GetGeometry(1)->SetSpacing(secondStep->GetGeometry()->GetSpacing());
additionalInputImage->GetGeometry(1)->SetOrigin(secondStep->GetGeometry()->GetOrigin());
additionalInputImage->GetGeometry(1)->SetIndexToWorldTransform(secondStep->GetGeometry()->GetIndexToWorldTransform());
additionalInputImage->SetImportVolume(secondStep->GetData(),0);
additionalInputImage->SetImportVolume(secondStep->GetData(),1);
//Arrange the filter
surfaceToImageFilter->MakeOutputBinaryOn();
surfaceToImageFilter->SetInput(m_Surface);
surfaceToImageFilter->SetImage(additionalInputImage);
surfaceToImageFilter->Update();
mitk::ImagePixelReadAccessor<unsigned char,4> outputReader(surfaceToImageFilter->GetOutput());
itk::Index<4> idx;
bool valuesCorrect = true;
//Values outside the ball should be 0
idx[0] = 0; idx[1] = 0, idx[2] = 0; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 0; idx[1] = 15, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 15, idx[2] = 0; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 0, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 5; idx[1] = 9, idx[2] = 23; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
//Values inside the ball should be 1 hould be 1
idx[0] = 15; idx[1] = 15, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 31; idx[1] = 15, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 2; idx[1] = 15, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 15; idx[1] = 15, idx[2] = 2; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 15; idx[1] = 2, idx[2] = 15; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
idx[0] = 6; idx[1] = 9, idx[2] = 23; idx[3] = 0; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 1);
//Values inside the ball but in the second timestep hould be 0
idx[0] = 15; idx[1] = 15, idx[2] = 15; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 31; idx[1] = 15, idx[2] = 15; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 2; idx[1] = 15, idx[2] = 15; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 15, idx[2] = 2; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 15; idx[1] = 2, idx[2] = 15; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
idx[0] = 6; idx[1] = 9, idx[2] = 23; idx[3] = 1; valuesCorrect = valuesCorrect && (outputReader.GetPixelByIndex(idx) == 0);
CPPUNIT_ASSERT_MESSAGE("SurfaceToImageFilter_BallSurfaceAsInput_Output4DCorrect", valuesCorrect == true);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkSurfaceToImageFilter)
diff --git a/Modules/Core/test/mitkVectorTypeConversionTest.cpp b/Modules/Core/test/mitkVectorTypeConversionTest.cpp
index 6d02c7300a..5bf2504381 100644
--- a/Modules/Core/test/mitkVectorTypeConversionTest.cpp
+++ b/Modules/Core/test/mitkVectorTypeConversionTest.cpp
@@ -1,264 +1,264 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <iostream>
#include "itkVector.h"
#include "mitkTestFixture.h"
#include "mitkTestingMacros.h"
#include <vnl/vnl_vector_fixed_ref.h>
#include "vnl/vnl_math.h"
#include "mitkNumericConstants.h"
#include "mitkVector.h"
#include "mitkPoint.h"
using namespace mitk;
class mitkVectorTypeConversionTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkVectorTypeConversionTestSuite);
MITK_TEST(Point2Vector);
MITK_TEST(Pod2Mitk);
MITK_TEST(Mitk2Pod);
MITK_TEST(OneElement2Mitk);
MITK_TEST(Itk2Mitk);
MITK_TEST(Mitk2Itk);
MITK_TEST(Vnlfixed2Mitk);
MITK_TEST(Mitk2Vnlfixed);
MITK_TEST(Vnl2Mitk);
MITK_TEST(Mitk2Vnl);
MITK_TEST(Vnl2Mitk_WrongVnlVectorSize);
MITK_TEST(ToArray_DifferentType);
MITK_TEST(Fill_DifferentType);
CPPUNIT_TEST_SUITE_END();
private:
/**
* these variables are used in the test functions
*
* The variable which should be copied into is set to its original value.
* The value which should be copied is set to valuesToCopy.
*
* Then the copying takes place. The test is successful, if the variable which
* should be copied into holds the valuesToCopy afterwards and is equal to the
* vector which should be copied.
*/
ScalarType originalValues[3];
ScalarType valuesToCopy[3];
float epsDouble2Float;
/**
* @brief Convenience method to test if one vector has been assigned successfully to the other.
*
* More specifically, tests if v1 = v2 was performed correctly.
*
* @param v1 The vector v1 of the assignment v1 = v2
* @param v2 The vector v2 of the assignment v1 = v2
* @param v1Name The type name of v1 (e.g.: mitk::Vector3D). Necessary for the correct test output.
* @param v2Name The type name of v2 (e.g.: mitk::Vector3D). Necessary for the correct test output.
* @param eps defines the allowed tolerance when testing for equality.
*/
template <typename T1, typename T2>
void TestForEquality(const T1& v1, const T2& v2, const std::string& v1Name, const std::string& v2Name, const ScalarType& eps = mitk::eps) const
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("\nAssigning " + v2Name + " to " + v1Name + ":\n both are equal", true,
EqualArray(v1, v2, 3, eps));
}
public:
- void setUp(void)
+ void setUp(void) override
{
FillVector3D(originalValues, 1.123456789987, 2.789456321456, 3.123654789987456);
FillVector3D(valuesToCopy, 4.654789123321, 5.987456789321, 6.321654987789546);
epsDouble2Float = vnl_math::float_eps * 10.0;
}
- void tearDown(void)
+ void tearDown(void) override
{
}
void Pod2Mitk(void)
{
mitk::Vector3D vector3D = valuesToCopy;
TestForEquality(vector3D, valuesToCopy, "mitk::Vector3D", "double POD");
}
void Mitk2Pod(void)
{
ScalarType podArray[3];
mitk::Vector3D vector3D = valuesToCopy;
vector3D.ToArray(podArray);
TestForEquality(podArray, vector3D, "double POD", "mitk::Vector3D");
}
void OneElement2Mitk(void)
{
double twos[] = {2.0, 2.0, 2.0};
mitk::Vector<double, 3> vector3D(2.0);
CPPUNIT_ASSERT_ASSERTION_PASS_MESSAGE( "\n one values initializes all elements to this value", EqualArray(vector3D, twos, 3));
}
void Itk2Mitk(void)
{
Vector3D vector3D = originalValues;
itk::Vector<ScalarType, 3> itkVector = valuesToCopy;
vector3D = itkVector;
TestForEquality(vector3D, itkVector, "mitk::Vector3D", "itk::Vector");
}
void Mitk2Itk(void)
{
Vector3D vector3D = valuesToCopy;
itk::Vector<ScalarType, 3> itkVector = originalValues;
itkVector = vector3D;
TestForEquality(itkVector, vector3D, "itk::Vector", "mitk::Vector3D");
}
void Vnlfixed2Mitk(void)
{
mitk::Vector3D vector3D = originalValues;
vnl_vector_fixed<ScalarType, 3> vnlVectorFixed(valuesToCopy);
vector3D = vnlVectorFixed;
TestForEquality(vector3D, vnlVectorFixed, "mitk::Vector3D", "vnl_vector_fixed<ScalarType>");
}
void Mitk2Vnlfixed(void)
{
vnl_vector_fixed<ScalarType, 3> vnlVectorFixed(originalValues);
mitk::Vector3D vector3D = valuesToCopy;
vnlVectorFixed = vector3D;
TestForEquality(vnlVectorFixed, vector3D, "vnl_vector_fixed<ScalarType>", "mitk::Vector3D");
}
void Vnl2Mitk(void)
{
mitk::Vector3D vector3D = originalValues;
vnl_vector<ScalarType> vnlVector(3);
vnlVector.set(valuesToCopy);
vector3D = vnlVector;
TestForEquality(vector3D, vnlVector, "mitk::Vector3D", "vnl_vector<ScalarType>");
}
void Mitk2Vnl(void)
{
vnl_vector<ScalarType> vnlVector(3);
vnlVector.set(originalValues);
mitk::Vector3D vector3D = valuesToCopy;
vnlVector = vector3D;
TestForEquality(vnlVector, vector3D, "vnl_vector<ScalarType>", "mitk::Vector3D");
}
/**
* @brief Tests if an exception is thrown when constructing an mitk::Vector form a vnl_vector of not suited size.
*/
void Vnl2Mitk_WrongVnlVectorSize()
{
ScalarType largerValuesToCopy[] = {4.12345678910, 5.10987654321, 6.123456789132456, 7.123456987789456};
mitk::Vector3D vector3D = originalValues;
vnl_vector<ScalarType> vnlVector(4);
vnlVector.set(largerValuesToCopy);
CPPUNIT_ASSERT_THROW(vector3D = vnlVector, mitk::Exception);
}
void ToArray_DifferentType(void)
{
float podArray[3];
for (int var = 0; var < 3; ++var) {
podArray[var] = originalValues[var];
}
mitk::Vector3D vector3D = valuesToCopy;
vector3D.ToArray(podArray);
TestForEquality(podArray, vector3D, "float POD", "mitk::Vector3D", epsDouble2Float);
}
void Fill_DifferentType(void)
{
mitk::Vector3D vector3D = originalValues;
float podArray[3];
for (int var = 0; var < 3; ++var) {
podArray[var] = valuesToCopy[var];
}
vector3D.FillVector(podArray);
TestForEquality(vector3D, podArray, "mitk::Vector3D", "float POD", epsDouble2Float);
}
void Point2Vector()
{
mitk::Point3D point3D = originalValues;
mitk::Vector3D vector3D = valuesToCopy;
vector3D = point3D.GetVectorFromOrigin();
TestForEquality(point3D, vector3D, "mitk::Point3D", "mitk::Vector3D");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkVectorTypeConversion)
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-activator/main.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-activator/main.cpp
index 8b9feebd56..a5ee9aebfb 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-activator/main.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-activator/main.cpp
@@ -1,27 +1,27 @@
#include <usModuleActivator.h>
US_USE_NAMESPACE
//! [0]
class MyActivator : public ModuleActivator
{
public:
- void Load(ModuleContext* /*context*/)
+ void Load(ModuleContext* /*context*/) override
{ /* register stuff */ }
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{ /* cleanup */ }
};
US_EXPORT_MODULE_ACTIVATOR(MyActivator)
//![0]
int main(int /*argc*/, char* /*argv*/[])
{
MyActivator ma;
return 0;
}
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-registration/main.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-registration/main.cpp
index 511791e1ac..d3ba6e4446 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-registration/main.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-registration/main.cpp
@@ -1,115 +1,115 @@
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usServiceFactory.h>
#include <usServiceInterface.h>
US_USE_NAMESPACE
struct InterfaceA { virtual ~InterfaceA() {} };
struct InterfaceB { virtual ~InterfaceB() {} };
struct InterfaceC { virtual ~InterfaceC() {} };
//! [1-1]
class MyService : public InterfaceA
{};
//! [1-1]
//! [2-1]
class MyService2 : public InterfaceA, public InterfaceB
{};
//! [2-1]
class MyActivator : public ModuleActivator
{
public:
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
Register1(context);
Register2(context);
RegisterFactory1(context);
RegisterFactory2(context);
}
void Register1(ModuleContext* context)
{
//! [1-2]
MyService* myService = new MyService;
context->RegisterService<InterfaceA>(myService);
//! [1-2]
}
void Register2(ModuleContext* context)
{
//! [2-2]
MyService2* myService = new MyService2;
context->RegisterService<InterfaceA, InterfaceB>(myService);
//! [2-2]
}
void RegisterFactory1(ModuleContext* context)
{
//! [f1]
class MyServiceFactory : public ServiceFactory
{
- virtual InterfaceMap GetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/)
+ virtual InterfaceMap GetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/) override
{
MyService* myService = new MyService;
return MakeInterfaceMap<InterfaceA>(myService);
}
virtual void UngetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/,
- const InterfaceMap& service)
+ const InterfaceMap& service) override
{
delete ExtractInterface<InterfaceA>(service);
}
};
MyServiceFactory* myServiceFactory = new MyServiceFactory;
context->RegisterService<InterfaceA>(myServiceFactory);
//! [f1]
}
void RegisterFactory2(ModuleContext* context)
{
//! [f2]
class MyServiceFactory : public ServiceFactory
{
- virtual InterfaceMap GetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/)
+ virtual InterfaceMap GetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/) override
{
MyService2* myService = new MyService2;
return MakeInterfaceMap<InterfaceA,InterfaceB>(myService);
}
virtual void UngetService(Module* /*module*/, const ServiceRegistrationBase& /*registration*/,
- const InterfaceMap& service)
+ const InterfaceMap& service) override
{
delete ExtractInterface<InterfaceA>(service);
}
};
MyServiceFactory* myServiceFactory = new MyServiceFactory;
context->RegisterService<InterfaceA,InterfaceB>(static_cast<ServiceFactory*>(myServiceFactory));
//! [f2]
// In the RegisterService call above, we could remove the static_cast because local types
// are not considered in template argument type deduction and hence the compiler choose
// the correct RegisterService<I1,I2>(ServiceFactory*) overload. However, local types are
// usually the exception and using a non-local type for the service factory would make the
// compiler choose RegisterService<I1,I2,Impl>(Impl*) instead, unless we use the static_cast.
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{ /* cleanup */ }
};
US_EXPORT_MODULE_ACTIVATOR(MyActivator)
int main(int /*argc*/, char* /*argv*/[])
{
MyActivator ma;
return 0;
}
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-servicelistenerhook/main.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-servicelistenerhook/main.cpp
index b8e64fb7c7..e9486d7631 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-servicelistenerhook/main.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-servicelistenerhook/main.cpp
@@ -1,51 +1,51 @@
#include <usServiceListenerHook.h>
#include <map>
US_USE_NAMESPACE
//! [1]
class MyServiceListenerHook : public ServiceListenerHook
{
private:
class Tracked
{
// Do some work during construction and destruction
};
US_UNORDERED_MAP_TYPE<ListenerInfo, Tracked> tracked;
public:
- void Added(const std::vector<ListenerInfo>& listeners)
+ void Added(const std::vector<ListenerInfo>& listeners) override
{
for (std::vector<ListenerInfo>::const_iterator iter = listeners.begin(),
endIter = listeners.end(); iter != endIter; ++iter)
{
// Lock the tracked object for thread-safe access
if (iter->IsRemoved()) return;
tracked.insert(std::make_pair(*iter, Tracked()));
}
}
- void Removed(const std::vector<ListenerInfo>& listeners)
+ void Removed(const std::vector<ListenerInfo>& listeners) override
{
for (std::vector<ListenerInfo>::const_iterator iter = listeners.begin(),
endIter = listeners.end(); iter != endIter; ++iter)
{
// Lock the tracked object for thread-safe access
// If we got a corresponding "Added" event before, the Tracked
// destructor will do some cleanup...
tracked.erase(*iter);
}
}
};
//! [1]
int main(int /*argc*/, char* /*argv*/[])
{
return 0;
}
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-servicetracker/main.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-servicetracker/main.cpp
index 4cbf68249b..db66194a84 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-servicetracker/main.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-servicetracker/main.cpp
@@ -1,113 +1,113 @@
#include <usServiceTracker.h>
#include <usGetModuleContext.h>
US_USE_NAMESPACE
struct IFooService {};
///! [tt]
struct MyTrackedClass { /* ... */ };
//! [tt]
//! [ttt]
struct MyTrackedClassTraits : public TrackedTypeTraitsBase<MyTrackedClass, MyTrackedClassTraits>
{
static bool IsValid(const TrackedType&)
{
// Dummy implementation
return true;
}
static void Dispose(TrackedType&)
{}
static TrackedType DefaultValue()
{
return TrackedType();
}
};
//! [ttt]
//! [customizer]
struct MyTrackingCustomizer : public ServiceTrackerCustomizer<IFooService, MyTrackedClass>
{
- virtual MyTrackedClass AddingService(const ServiceReferenceType&)
+ virtual MyTrackedClass AddingService(const ServiceReferenceType&) override
{
return MyTrackedClass();
}
- virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass)
+ virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass) override
{
}
- virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass)
+ virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass) override
{
}
};
//! [customizer]
struct MyTrackingPointerCustomizer : public ServiceTrackerCustomizer<IFooService, MyTrackedClass*>
{
- virtual MyTrackedClass* AddingService(const ServiceReferenceType&)
+ virtual MyTrackedClass* AddingService(const ServiceReferenceType&) override
{
return new MyTrackedClass();
}
- virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass*)
+ virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass*) override
{
}
- virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass*)
+ virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass*) override
{
}
};
// For compilation test purposes only
struct MyTrackingCustomizerVoid : public ServiceTrackerCustomizer<void, MyTrackedClass>
{
- virtual MyTrackedClass AddingService(const ServiceReferenceType&)
+ virtual MyTrackedClass AddingService(const ServiceReferenceType&) override
{
return MyTrackedClass();
}
- virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass)
+ virtual void ModifiedService(const ServiceReferenceType&, MyTrackedClass) override
{
}
- virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass)
+ virtual void RemovedService(const ServiceReferenceType&, MyTrackedClass) override
{
}
};
int main(int /*argc*/, char* /*argv*/[])
{
{
//! [tracker]
MyTrackingCustomizer myCustomizer;
ServiceTracker<IFooService, MyTrackedClassTraits> tracker(GetModuleContext(), &myCustomizer);
//! [tracker]
}
{
//! [tracker2]
MyTrackingPointerCustomizer myCustomizer;
ServiceTracker<IFooService, TrackedTypeTraits<IFooService,MyTrackedClass*> > tracker(GetModuleContext(), &myCustomizer);
//! [tracker2]
}
// For compilation test purposes only
MyTrackingCustomizerVoid myCustomizer2;
try
{
ServiceTracker<void, MyTrackedClassTraits> tracker2(GetModuleContext(), &myCustomizer2);
ServiceTracker<void, TrackedTypeTraits<void,MyTrackedClass*> > tracker3(GetModuleContext());
}
catch (const us::ServiceException&)
{}
return 0;
}
#include <usModuleInitialization.h>
US_INITIALIZE_MODULE
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-singleton/main.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-singleton/main.cpp
index 63ec571af4..a822cf65b4 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-singleton/main.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-singleton/main.cpp
@@ -1,73 +1,73 @@
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include "SingletonOne.h"
#include "SingletonTwo.h"
US_USE_NAMESPACE
class MyActivator : public ModuleActivator
{
public:
MyActivator()
: m_SingletonOne(NULL)
, m_SingletonTwo(NULL)
{}
//![0]
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
// The Load() method of the module activator is called during static
// initialization time of the shared library.
// First create and register a SingletonTwoService instance.
m_SingletonTwo = new SingletonTwoService;
m_SingletonTwoReg = context->RegisterService<SingletonTwoService>(m_SingletonTwo);
// Now the SingletonOneService constructor will get a valid
// SingletonTwoService instance.
m_SingletonOne = new SingletonOneService;
m_SingletonOneReg = context->RegisterService<SingletonOneService>(m_SingletonOne);
}
//![0]
//![1]
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
// Services are automatically unregistered during unloading of
// the shared library after the call to Unload(ModuleContext*)
// has returned.
// Since SingletonOneService needs a non-null SingletonTwoService
// instance in its destructor, we explicitly unregister and delete the
// SingletonOneService instance here. This way, the SingletonOneService
// destructor will still get a valid SingletonTwoService instance.
m_SingletonOneReg.Unregister();
delete m_SingletonOne;
// For singletonTwoService, we could rely on the automatic unregistering
// by the service registry and on automatic deletion if you used
// smart pointer reference counting. You must not delete service instances
// in this method without unregistering them first.
m_SingletonTwoReg.Unregister();
delete m_SingletonTwo;
}
//![1]
private:
SingletonOneService* m_SingletonOne;
SingletonTwoService* m_SingletonTwo;
ServiceRegistration<SingletonOneService> m_SingletonOneReg;
ServiceRegistration<SingletonTwoService> m_SingletonTwoReg;
};
US_EXPORT_MODULE_ACTIVATOR(MyActivator)
int main()
{
}
diff --git a/Modules/CppMicroServices/core/doc/snippets/uServices-staticmodules/MyStaticModule.cpp b/Modules/CppMicroServices/core/doc/snippets/uServices-staticmodules/MyStaticModule.cpp
index f61e009f6e..ddbef8d773 100644
--- a/Modules/CppMicroServices/core/doc/snippets/uServices-staticmodules/MyStaticModule.cpp
+++ b/Modules/CppMicroServices/core/doc/snippets/uServices-staticmodules/MyStaticModule.cpp
@@ -1,39 +1,39 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModuleActivator.h>
#include <usModuleInitialization.h>
US_USE_NAMESPACE
struct MyStaticModuleActivator : public ModuleActivator
{
- void Load(ModuleContext* /*context*/)
+ void Load(ModuleContext* /*context*/) override
{
std::cout << "Hello from a static module." << std::endl;
}
- void Unload(ModuleContext* /*context*/) {}
+ void Unload(ModuleContext* /*context*/) override {}
};
US_EXPORT_MODULE_ACTIVATOR(MyStaticModuleActivator)
US_INITIALIZE_MODULE
diff --git a/Modules/CppMicroServices/core/include/usAny.h b/Modules/CppMicroServices/core/include/usAny.h
index bfa2250d35..38d933e742 100644
--- a/Modules/CppMicroServices/core/include/usAny.h
+++ b/Modules/CppMicroServices/core/include/usAny.h
@@ -1,577 +1,577 @@
/*=============================================================================
Library: CppMicroServices
Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
Extracted from Boost 1.46.1 and adapted for CppMicroServices.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
=========================================================================*/
#ifndef US_ANY_H
#define US_ANY_H
#include <algorithm>
#include <typeinfo>
#include <sstream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <usCoreConfig.h>
US_BEGIN_NAMESPACE
class Any;
US_Core_EXPORT std::string any_value_to_string(const Any& any);
US_Core_EXPORT std::string any_value_to_json(const Any& val);
US_Core_EXPORT std::string any_value_to_json(const std::string& val);
US_Core_EXPORT std::string any_value_to_json(bool val);
template<class T>
std::string any_value_to_string(const T& val)
{
std::stringstream ss;
ss << val;
return ss.str();
}
template<class T>
std::string any_value_to_json(const T& val)
{
return any_value_to_string(val);
}
/**
* \internal
*/
template<typename Iterator>
std::string container_to_string(Iterator i1, Iterator i2)
{
std::stringstream ss;
ss << "[";
const Iterator begin = i1;
for ( ; i1 != i2; ++i1)
{
if (i1 == begin) ss << any_value_to_string(*i1);
else ss << "," << any_value_to_string(*i1);
}
ss << "]";
return ss.str();
}
/**
* \internal
*/
template<typename Iterator>
std::string container_to_json(Iterator i1, Iterator i2)
{
std::stringstream ss;
ss << "[";
const Iterator begin = i1;
for ( ; i1 != i2; ++i1)
{
if (i1 == begin) ss << any_value_to_json(*i1);
else ss << "," << any_value_to_json(*i1);
}
ss << "]";
return ss.str();
}
template<class E>
std::string any_value_to_string(const std::vector<E>& vec)
{
return container_to_string(vec.begin(), vec.end());
}
template<class E>
std::string any_value_to_json(const std::vector<E>& vec)
{
return container_to_json(vec.begin(), vec.end());
}
template<class E>
std::string any_value_to_string(const std::list<E>& l)
{
return container_to_string(l.begin(), l.end());
}
template<class E>
std::string any_value_to_json(const std::list<E>& l)
{
return container_to_json(l.begin(), l.end());
}
template<class E>
std::string any_value_to_string(const std::set<E>& s)
{
return container_to_string(s.begin(), s.end());
}
template<class E>
std::string any_value_to_json(const std::set<E>& s)
{
return container_to_json(s.begin(), s.end());
}
template<class M>
std::string any_value_to_string(const std::map<M, Any>& m);
template<class K, class V>
std::string any_value_to_string(const std::map<K, V>& m);
template<class M>
std::string any_value_to_json(const std::map<M, Any>& m);
template<class K, class V>
std::string any_value_to_json(const std::map<K, V>& m);
/**
* \ingroup MicroServicesUtils
*
* An Any class represents a general type and is capable of storing any type, supporting type-safe extraction
* of the internally stored data.
*
* Code taken from the Boost 1.46.1 library. Original copyright by Kevlin Henney. Modified for CppMicroServices.
*/
class Any
{
public:
/**
* Creates an empty any type.
*/
Any(): _content(0)
{ }
/**
* Creates an Any which stores the init parameter inside.
*
* \param value The content of the Any
*
* Example:
* \code
* Any a(13);
* Any a(string("12345"));
* \endcode
*/
template <typename ValueType>
Any(const ValueType& value)
: _content(new Holder<ValueType>(value))
{ }
/**
* Copy constructor, works with empty Anys and initialized Any values.
*
* \param other The Any to copy
*/
Any(const Any& other)
: _content(other._content ? other._content->Clone() : 0)
{ }
~Any()
{
delete _content;
}
/**
* Swaps the content of the two Anys.
*
* \param rhs The Any to swap this Any with.
*/
Any& Swap(Any& rhs)
{
std::swap(_content, rhs._content);
return *this;
}
/**
* Assignment operator for all types != Any.
*
* \param rhs The value which should be assigned to this Any.
*
* Example:
* \code
* Any a = 13;
* Any a = string("12345");
* \endcode
*/
template <typename ValueType>
Any& operator = (const ValueType& rhs)
{
Any(rhs).Swap(*this);
return *this;
}
/**
* Assignment operator for Any.
*
* \param rhs The Any which should be assigned to this Any.
*/
Any& operator = (const Any& rhs)
{
Any(rhs).Swap(*this);
return *this;
}
/**
* returns true if the Any is empty
*/
bool Empty() const
{
return !_content;
}
/**
* Returns a string representation for the content.
*
* Custom types should either provide a <code>std::ostream& operator<<(std::ostream& os, const CustomType& ct)</code>
* function or specialize the any_value_to_string template function for meaningful output.
*/
std::string ToString() const
{
return _content->ToString();
}
/**
* Returns a JSON representation for the content.
*
* Custom types should specialize the any_value_to_json template function for meaningful output.
*/
std::string ToJSON() const
{
return Empty() ? "null" : _content->ToJSON();
}
/**
* Returns the type information of the stored content.
* If the Any is empty typeid(void) is returned.
* It is suggested to always query an Any for its type info before trying to extract
* data via an any_cast/ref_any_cast.
*/
const std::type_info& Type() const
{
return _content ? _content->Type() : typeid(void);
}
private:
class Placeholder
{
public:
virtual ~Placeholder()
{ }
virtual std::string ToString() const = 0;
virtual std::string ToJSON() const = 0;
virtual const std::type_info& Type() const = 0;
virtual Placeholder* Clone() const = 0;
};
template <typename ValueType>
class Holder: public Placeholder
{
public:
Holder(const ValueType& value)
: _held(value)
{ }
- virtual std::string ToString() const
+ virtual std::string ToString() const override
{
return any_value_to_string(_held);
}
- virtual std::string ToJSON() const
+ virtual std::string ToJSON() const override
{
return any_value_to_json(_held);
}
- virtual const std::type_info& Type() const
+ virtual const std::type_info& Type() const override
{
return typeid(ValueType);
}
- virtual Placeholder* Clone() const
+ virtual Placeholder* Clone() const override
{
return new Holder(_held);
}
ValueType _held;
private: // intentionally left unimplemented
Holder& operator=(const Holder &);
};
private:
template <typename ValueType>
friend ValueType* any_cast(Any*);
template <typename ValueType>
friend ValueType* unsafe_any_cast(Any*);
Placeholder* _content;
};
class BadAnyCastException : public std::bad_cast
{
public:
BadAnyCastException(const std::string& msg = "")
: std::bad_cast(), _msg(msg)
{}
~BadAnyCastException() throw() {}
- virtual const char * what() const throw()
+ virtual const char * what() const throw() override
{
if (_msg.empty())
return "US_PREPEND_NAMESPACE(BadAnyCastException): "
"failed conversion using US_PREPEND_NAMESPACE(any_cast)";
else
return _msg.c_str();
}
private:
std::string _msg;
};
/**
* any_cast operator used to extract the ValueType from an Any*. Will return a pointer
* to the stored value.
*
* Example Usage:
* \code
* MyType* pTmp = any_cast<MyType*>(pAny)
* \endcode
* Will return NULL if the cast fails, i.e. types don't match.
*/
template <typename ValueType>
ValueType* any_cast(Any* operand)
{
return operand && operand->Type() == typeid(ValueType)
? &static_cast<Any::Holder<ValueType>*>(operand->_content)->_held
: 0;
}
/**
* any_cast operator used to extract a const ValueType pointer from an const Any*. Will return a const pointer
* to the stored value.
*
* Example Usage:
* \code
* const MyType* pTmp = any_cast<MyType*>(pAny)
* \endcode
* Will return NULL if the cast fails, i.e. types don't match.
*/
template <typename ValueType>
const ValueType* any_cast(const Any* operand)
{
return any_cast<ValueType>(const_cast<Any*>(operand));
}
/**
* any_cast operator used to extract a copy of the ValueType from an const Any&.
*
* Example Usage:
* \code
* MyType tmp = any_cast<MyType>(anAny)
* \endcode
* Will throw a BadCastException if the cast fails.
* Dont use an any_cast in combination with references, i.e. MyType& tmp = ... or const MyType& = ...
* Some compilers will accept this code although a copy is returned. Use the ref_any_cast in
* these cases.
*/
template <typename ValueType>
ValueType any_cast(const Any& operand)
{
ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
if (!result) throw BadAnyCastException("Failed to convert between const Any types");
return *result;
}
/**
* any_cast operator used to extract a copy of the ValueType from an Any&.
*
* Example Usage:
* \code
* MyType tmp = any_cast<MyType>(anAny)
* \endcode
* Will throw a BadCastException if the cast fails.
* Dont use an any_cast in combination with references, i.e. MyType& tmp = ... or const MyType& tmp = ...
* Some compilers will accept this code although a copy is returned. Use the ref_any_cast in
* these cases.
*/
template <typename ValueType>
ValueType any_cast(Any& operand)
{
ValueType* result = any_cast<ValueType>(&operand);
if (!result) throw BadAnyCastException("Failed to convert between Any types");
return *result;
}
/**
* ref_any_cast operator used to return a const reference to the internal data.
*
* Example Usage:
* \code
* const MyType& tmp = ref_any_cast<MyType>(anAny);
* \endcode
*/
template <typename ValueType>
const ValueType& ref_any_cast(const Any & operand)
{
ValueType* result = any_cast<ValueType>(const_cast<Any*>(&operand));
if (!result) throw BadAnyCastException("RefAnyCast: Failed to convert between const Any types");
return *result;
}
/**
* ref_any_cast operator used to return a reference to the internal data.
*
* Example Usage:
* \code
* MyType& tmp = ref_any_cast<MyType>(anAny);
* \endcode
*/
template <typename ValueType>
ValueType& ref_any_cast(Any& operand)
{
ValueType* result = any_cast<ValueType>(&operand);
if (!result) throw BadAnyCastException("RefAnyCast: Failed to convert between Any types");
return *result;
}
/**
* \internal
*
* The "unsafe" versions of any_cast are not part of the
* public interface and may be removed at any time. They are
* required where we know what type is stored in the any and can't
* use typeid() comparison, e.g., when our types may travel across
* different shared libraries.
*/
template <typename ValueType>
ValueType* unsafe_any_cast(Any* operand)
{
return &static_cast<Any::Holder<ValueType>*>(operand->_content)->_held;
}
/**
* \internal
*
* The "unsafe" versions of any_cast are not part of the
* public interface and may be removed at any time. They are
* required where we know what type is stored in the any and can't
* use typeid() comparison, e.g., when our types may travel across
* different shared libraries.
*/
template <typename ValueType>
const ValueType* unsafe_any_cast(const Any* operand)
{
return any_cast<ValueType>(const_cast<Any*>(operand));
}
template<class K>
std::string any_value_to_string(const std::map<K, Any>& m)
{
std::stringstream ss;
ss << "{";
typedef typename std::map<K, Any>::const_iterator Iterator;
Iterator i1 = m.begin();
const Iterator begin = i1;
const Iterator end = m.end();
for ( ; i1 != end; ++i1)
{
if (i1 == begin) ss << i1->first << " : " << i1->second.ToString();
else ss << ", " << i1->first << " : " << i1->second.ToString();
}
ss << "}";
return ss.str();
}
template<class K, class V>
std::string any_value_to_string(const std::map<K, V>& m)
{
std::stringstream ss;
ss << "{";
typedef typename std::map<K, V>::const_iterator Iterator;
Iterator i1 = m.begin();
const Iterator begin = i1;
const Iterator end = m.end();
for ( ; i1 != end; ++i1)
{
if (i1 == begin) ss << i1->first << " : " << i1->second;
else ss << ", " << i1->first << " : " << i1->second;
}
ss << "}";
return ss.str();
}
template<class K>
std::string any_value_to_json(const std::map<K, Any>& m)
{
std::stringstream ss;
ss << "{";
typedef typename std::map<K, Any>::const_iterator Iterator;
Iterator i1 = m.begin();
const Iterator begin = i1;
const Iterator end = m.end();
for ( ; i1 != end; ++i1)
{
if (i1 == begin) ss << "\"" << i1->first << "\" : " << i1->second.ToJSON();
else ss << ", " << "\"" << i1->first << "\" : " << i1->second.ToJSON();
}
ss << "}";
return ss.str();
}
template<class K, class V>
std::string any_value_to_json(const std::map<K, V>& m)
{
std::stringstream ss;
ss << "{";
typedef typename std::map<K, V>::const_iterator Iterator;
Iterator i1 = m.begin();
const Iterator begin = i1;
const Iterator end = m.end();
for ( ; i1 != end; ++i1)
{
if (i1 == begin) ss << "\"" << i1->first << "\" : " << i1->second;
else ss << ", " << "\"" << i1->first << "\" : " << i1->second;
}
ss << "}";
return ss.str();
}
US_END_NAMESPACE
#endif // US_ANY_H
diff --git a/Modules/CppMicroServices/core/src/module/usCoreModuleActivator.cpp b/Modules/CppMicroServices/core/src/module/usCoreModuleActivator.cpp
index cf49fd7966..87d028c852 100644
--- a/Modules/CppMicroServices/core/src/module/usCoreModuleActivator.cpp
+++ b/Modules/CppMicroServices/core/src/module/usCoreModuleActivator.cpp
@@ -1,47 +1,47 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usModuleActivator.h"
#include "usModule.h"
#include "usModulePrivate.h"
#include "usCoreModuleContext_p.h"
US_BEGIN_NAMESPACE
class CoreModuleActivator : public ModuleActivator
{
- void Load(ModuleContext* mc)
+ void Load(ModuleContext* mc) override
{
mc->GetModule()->d->coreCtx->Init();
}
- void Unload(ModuleContext* /*mc*/)
+ void Unload(ModuleContext* /*mc*/) override
{
//mc->GetModule()->d->coreCtx->Uninit();
}
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(CoreModuleActivator))
diff --git a/Modules/CppMicroServices/core/src/module/usModuleResourceBuffer_p.h b/Modules/CppMicroServices/core/src/module/usModuleResourceBuffer_p.h
index f98614f8ae..b7138b1774 100644
--- a/Modules/CppMicroServices/core/src/module/usModuleResourceBuffer_p.h
+++ b/Modules/CppMicroServices/core/src/module/usModuleResourceBuffer_p.h
@@ -1,68 +1,68 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USMODULERESOURCEBUFFER_P_H
#define USMODULERESOURCEBUFFER_P_H
#include <usCoreExport.h>
#include <streambuf>
US_BEGIN_NAMESPACE
class ModuleResourceBufferPrivate;
class US_Core_EXPORT ModuleResourceBuffer: public std::streambuf
{
public:
explicit ModuleResourceBuffer(void* data, std::size_t size,
std::ios_base::openmode mode);
~ModuleResourceBuffer();
private:
- int_type underflow();
+ int_type underflow() override;
- int_type uflow();
+ int_type uflow() override;
- int_type pbackfail(int_type ch);
+ int_type pbackfail(int_type ch) override;
- std::streamsize showmanyc();
+ std::streamsize showmanyc() override;
- pos_type seekoff (off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
- pos_type seekpos (pos_type sp, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out);
+ pos_type seekoff (off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
+ pos_type seekpos (pos_type sp, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override;
// purposely not implemented
ModuleResourceBuffer(const ModuleResourceBuffer&);
ModuleResourceBuffer& operator=(const ModuleResourceBuffer&);
private:
ModuleResourceBufferPrivate* d;
};
US_END_NAMESPACE
#endif // USMODULERESOURCEBUFFER_P_H
diff --git a/Modules/CppMicroServices/core/src/service/usServiceHooks_p.h b/Modules/CppMicroServices/core/src/service/usServiceHooks_p.h
index ea7e003c78..ec047fb29c 100644
--- a/Modules/CppMicroServices/core/src/service/usServiceHooks_p.h
+++ b/Modules/CppMicroServices/core/src/service/usServiceHooks_p.h
@@ -1,73 +1,73 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USSERVICEHOOKS_P_H
#define USSERVICEHOOKS_P_H
#include "usServiceTracker.h"
#include "usServiceListeners_p.h"
US_BEGIN_NAMESPACE
struct ServiceListenerHook;
class ServiceHooks : private MultiThreaded<>, private ServiceTrackerCustomizer<ServiceListenerHook>
{
private:
CoreModuleContext* coreCtx;
ServiceTracker<ServiceListenerHook>* listenerHookTracker;
bool bOpen;
- virtual TrackedType AddingService(const ServiceReferenceType& reference);
- virtual void ModifiedService(const ServiceReferenceType& reference, TrackedType service);
- virtual void RemovedService(const ServiceReferenceType& reference, TrackedType service);
+ virtual TrackedType AddingService(const ServiceReferenceType& reference) override;
+ virtual void ModifiedService(const ServiceReferenceType& reference, TrackedType service) override;
+ virtual void RemovedService(const ServiceReferenceType& reference, TrackedType service) override;
public:
ServiceHooks(CoreModuleContext* coreCtx);
~ServiceHooks();
void Open();
void Close();
bool IsOpen() const;
void FilterServiceReferences(ModuleContext* mc, const std::string& service,
const std::string& filter, std::vector<ServiceReferenceBase>& refs);
void FilterServiceEventReceivers(const ServiceEvent& evt,
ServiceListeners::ServiceListenerEntries& receivers);
void HandleServiceListenerReg(const ServiceListenerEntry& sle);
void HandleServiceListenerUnreg(const ServiceListenerEntry& sle);
void HandleServiceListenerUnreg(const std::vector<ServiceListenerEntry>& set);
};
US_END_NAMESPACE
#endif // USSERVICEHOOKS_P_H
diff --git a/Modules/CppMicroServices/core/test/modules/libA/usTestModuleA.cpp b/Modules/CppMicroServices/core/test/modules/libA/usTestModuleA.cpp
index ce8c625065..8ef066de4c 100644
--- a/Modules/CppMicroServices/core/test/modules/libA/usTestModuleA.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libA/usTestModuleA.cpp
@@ -1,77 +1,77 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usTestModuleAService.h"
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usGlobalConfig.h>
US_BEGIN_NAMESPACE
struct TestModuleA : public TestModuleAService
{
TestModuleA(ModuleContext* mc)
{
US_INFO << "Registering TestModuleAService";
sr = mc->RegisterService<TestModuleAService>(this);
}
void Unregister()
{
if (sr)
{
sr.Unregister();
sr = 0;
}
}
private:
ServiceRegistration<TestModuleAService> sr;
};
class TestModuleAActivator : public ModuleActivator
{
public:
TestModuleAActivator() : s(0) {}
~TestModuleAActivator() { delete s; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
s = new TestModuleA(context);
}
- void Unload(ModuleContext*)
+ void Unload(ModuleContext*) override
{
}
private:
TestModuleA* s;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleAActivator))
diff --git a/Modules/CppMicroServices/core/test/modules/libA2/usTestModuleA2.cpp b/Modules/CppMicroServices/core/test/modules/libA2/usTestModuleA2.cpp
index dbc67185bb..a8b1088361 100644
--- a/Modules/CppMicroServices/core/test/modules/libA2/usTestModuleA2.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libA2/usTestModuleA2.cpp
@@ -1,76 +1,76 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usTestModuleA2Service.h"
#include <usModuleActivator.h>
#include <usModuleContext.h>
US_BEGIN_NAMESPACE
struct TestModuleA2 : public TestModuleA2Service
{
TestModuleA2(ModuleContext* mc)
{
US_INFO << "Registering TestModuleA2Service";
sr = mc->RegisterService<TestModuleA2Service>(this);
}
void Unregister()
{
if (sr)
{
sr.Unregister();
}
}
private:
ServiceRegistration<TestModuleA2Service> sr;
};
class TestModuleA2Activator : public ModuleActivator
{
public:
TestModuleA2Activator() : s(0) {}
~TestModuleA2Activator() { delete s; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
s = new TestModuleA2(context);
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
s->Unregister();
}
private:
TestModuleA2* s;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleA2Activator))
diff --git a/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleB.cpp b/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleB.cpp
index 70b5befedf..c1f571ec40 100644
--- a/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleB.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleB.cpp
@@ -1,66 +1,66 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usTestModuleBService.h"
#include <usModuleImport.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
US_BEGIN_NAMESPACE
struct TestModuleB : public TestModuleBService
{
TestModuleB(ModuleContext* mc)
{
US_INFO << "Registering TestModuleBService";
mc->RegisterService<TestModuleBService>(this);
}
};
class TestModuleBActivator : public ModuleActivator
{
public:
TestModuleBActivator() : s(0) {}
~TestModuleBActivator() { delete s; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
s = new TestModuleB(context);
}
- void Unload(ModuleContext*)
+ void Unload(ModuleContext*) override
{
}
private:
TestModuleB* s;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleBActivator))
US_IMPORT_MODULE(TestModuleImportedByB)
diff --git a/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleImportedByB.cpp b/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleImportedByB.cpp
index b4a446fe03..0e67a4a3fb 100644
--- a/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleImportedByB.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libBWithStatic/usTestModuleImportedByB.cpp
@@ -1,64 +1,64 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usTestModuleBService.h"
#include <usModuleActivator.h>
#include <usModuleContext.h>
US_BEGIN_NAMESPACE
struct TestModuleImportedByB : public TestModuleBService
{
TestModuleImportedByB(ModuleContext* mc)
{
US_INFO << "Registering TestModuleImportedByB";
mc->RegisterService<TestModuleBService>(this);
}
};
class TestModuleImportedByBActivator : public ModuleActivator
{
public:
TestModuleImportedByBActivator() : s(0) {}
~TestModuleImportedByBActivator() { delete s; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
s = new TestModuleImportedByB(context);
}
- void Unload(ModuleContext*)
+ void Unload(ModuleContext*) override
{
}
private:
TestModuleImportedByB* s;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleImportedByBActivator))
diff --git a/Modules/CppMicroServices/core/test/modules/libH/usTestModuleH.cpp b/Modules/CppMicroServices/core/test/modules/libH/usTestModuleH.cpp
index 497b9b0025..31fbe99097 100644
--- a/Modules/CppMicroServices/core/test/modules/libH/usTestModuleH.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libH/usTestModuleH.cpp
@@ -1,140 +1,140 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usServiceInterface.h>
#include <usModuleActivator.h>
#include <usServiceFactory.h>
#include <usPrototypeServiceFactory.h>
#include <usModule.h>
#include <usModuleContext.h>
#include <iostream>
US_BEGIN_NAMESPACE
struct TestModuleH
{
virtual ~TestModuleH() {}
};
struct TestModuleH2
{
virtual ~TestModuleH2() {}
};
class TestProduct : public TestModuleH
{
// Module* caller;
public:
TestProduct(Module* /*caller*/)
//: caller(caller)
{}
};
class TestProduct2 : public TestProduct, public TestModuleH2
{
public:
TestProduct2(Module* caller)
: TestProduct(caller)
{}
};
class TestModuleHPrototypeServiceFactory : public PrototypeServiceFactory
{
std::map<long, std::list<TestProduct2*> > fcbind; // Map calling module with implementation
public:
- InterfaceMap GetService(Module* caller, const ServiceRegistrationBase& /*sReg*/)
+ InterfaceMap GetService(Module* caller, const ServiceRegistrationBase& /*sReg*/) override
{
std::cout << "GetService (prototype) in H" << std::endl;
TestProduct2* product = new TestProduct2(caller);
fcbind[caller->GetModuleId()].push_back(product);
return MakeInterfaceMap<TestModuleH,TestModuleH2>(product);
}
- void UngetService(Module* caller, const ServiceRegistrationBase& /*sReg*/, const InterfaceMap& service)
+ void UngetService(Module* caller, const ServiceRegistrationBase& /*sReg*/, const InterfaceMap& service) override
{
TestProduct2* product = dynamic_cast<TestProduct2*>(ExtractInterface<TestModuleH>(service));
delete product;
fcbind[caller->GetModuleId()].remove(product);
}
};
class TestModuleHActivator : public ModuleActivator, public ServiceFactory
{
std::string thisServiceName;
ServiceRegistration<TestModuleH> factoryService;
ServiceRegistration<TestModuleH,TestModuleH2> prototypeFactoryService;
ModuleContext* mc;
std::map<long, TestProduct*> fcbind; // Map calling module with implementation
TestModuleHPrototypeServiceFactory prototypeFactory;
public:
TestModuleHActivator()
: thisServiceName(us_service_interface_iid<TestModuleH>())
, mc(NULL)
{}
- void Load(ModuleContext* mc)
+ void Load(ModuleContext* mc) override
{
std::cout << "start in H" << std::endl;
this->mc = mc;
factoryService = mc->RegisterService<TestModuleH>(this);
prototypeFactoryService = mc->RegisterService<TestModuleH,TestModuleH2>(static_cast<ServiceFactory*>(&prototypeFactory));
}
- void Unload(ModuleContext* /*mc*/)
+ void Unload(ModuleContext* /*mc*/) override
{
factoryService.Unregister();
}
- InterfaceMap GetService(Module* caller, const ServiceRegistrationBase& /*sReg*/)
+ InterfaceMap GetService(Module* caller, const ServiceRegistrationBase& /*sReg*/) override
{
std::cout << "GetService in H" << std::endl;
TestProduct* product = new TestProduct(caller);
fcbind.insert(std::make_pair(caller->GetModuleId(), product));
return MakeInterfaceMap<TestModuleH>(product);
}
- void UngetService(Module* caller, const ServiceRegistrationBase& /*sReg*/, const InterfaceMap& service)
+ void UngetService(Module* caller, const ServiceRegistrationBase& /*sReg*/, const InterfaceMap& service) override
{
TestModuleH* product = ExtractInterface<TestModuleH>(service);
delete product;
fcbind.erase(caller->GetModuleId());
}
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(us::TestModuleHActivator)
diff --git a/Modules/CppMicroServices/core/test/modules/libM/usTestModuleM.cpp b/Modules/CppMicroServices/core/test/modules/libM/usTestModuleM.cpp
index 1a89029c2a..ceec0d89f2 100644
--- a/Modules/CppMicroServices/core/test/modules/libM/usTestModuleM.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libM/usTestModuleM.cpp
@@ -1,43 +1,43 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModuleActivator.h>
US_BEGIN_NAMESPACE
class TestModuleMActivator : public ModuleActivator
{
public:
- void Load(ModuleContext*)
+ void Load(ModuleContext*) override
{
}
- void Unload(ModuleContext*)
+ void Unload(ModuleContext*) override
{
}
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleMActivator))
diff --git a/Modules/CppMicroServices/core/test/modules/libS/usTestModuleS.cpp b/Modules/CppMicroServices/core/test/modules/libS/usTestModuleS.cpp
index 75cf59331c..e8fae0a999 100644
--- a/Modules/CppMicroServices/core/test/modules/libS/usTestModuleS.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libS/usTestModuleS.cpp
@@ -1,142 +1,142 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "../../usServiceControlInterface.h"
#include "usTestModuleSService0.h"
#include "usTestModuleSService1.h"
#include "usTestModuleSService2.h"
#include "usTestModuleSService3.h"
#include <usServiceRegistration.h>
#include <usModuleContext.h>
#include <usModuleActivator.h>
US_BEGIN_NAMESPACE
class TestModuleS : public ServiceControlInterface,
public TestModuleSService0,
public TestModuleSService1,
public TestModuleSService2,
public TestModuleSService3
{
public:
TestModuleS(ModuleContext* mc)
: mc(mc)
{
for(int i = 0; i <= 3; ++i)
{
servregs.push_back(ServiceRegistrationU());
}
sreg = mc->RegisterService<TestModuleSService0>(this);
sciReg = mc->RegisterService<ServiceControlInterface>(this);
}
virtual const char* GetNameOfClass() const
{
return "TestModuleS";
}
- void ServiceControl(int offset, const std::string& operation, int ranking)
+ void ServiceControl(int offset, const std::string& operation, int ranking) override
{
if (0 <= offset && offset <= 3)
{
if (operation == "register")
{
if (!servregs[offset])
{
std::stringstream servicename;
servicename << SERVICE << offset;
InterfaceMap ifm;
ifm.insert(std::make_pair(servicename.str(), static_cast<void*>(this)));
ServiceProperties props;
props.insert(std::make_pair(ServiceConstants::SERVICE_RANKING(), Any(ranking)));
servregs[offset] = mc->RegisterService(ifm, props);
}
}
if (operation == "unregister")
{
if (servregs[offset])
{
ServiceRegistrationU sr1 = servregs[offset];
sr1.Unregister();
servregs[offset] = 0;
}
}
}
}
void Unregister()
{
if (sreg)
{
sreg.Unregister();
}
if (sciReg)
{
sciReg.Unregister();
}
}
private:
static const std::string SERVICE; // = "us::TestModuleSService"
ModuleContext* mc;
std::vector<ServiceRegistrationU> servregs;
ServiceRegistration<TestModuleSService0> sreg;
ServiceRegistration<ServiceControlInterface> sciReg;
};
const std::string TestModuleS::SERVICE = "us::TestModuleSService";
class TestModuleSActivator : public ModuleActivator
{
public:
TestModuleSActivator() : s(0) {}
~TestModuleSActivator() { delete s; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
s = new TestModuleS(context);
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
#ifndef US_BUILD_SHARED_LIBS
s->Unregister();
#endif
}
private:
TestModuleS* s;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(TestModuleSActivator))
diff --git a/Modules/CppMicroServices/core/test/modules/libSL1/usActivatorSL1.cpp b/Modules/CppMicroServices/core/test/modules/libSL1/usActivatorSL1.cpp
index 7c1419babe..96f23afd6e 100644
--- a/Modules/CppMicroServices/core/test/modules/libSL1/usActivatorSL1.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libSL1/usActivatorSL1.cpp
@@ -1,106 +1,106 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModuleActivator.h>
#include <usModulePropsInterface.h>
#include <usServiceTracker.h>
#include <usServiceTrackerCustomizer.h>
#include "usFooService.h"
US_BEGIN_NAMESPACE
class ActivatorSL1 :
public ModuleActivator, public ModulePropsInterface,
public ServiceTrackerCustomizer<FooService>
{
public:
ActivatorSL1()
: tracker(0), context(0)
{
}
~ActivatorSL1()
{
delete tracker;
}
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
this->context = context;
InterfaceMap im = MakeInterfaceMap<ModulePropsInterface>(this);
im.insert(std::make_pair(std::string("ActivatorSL1"), this));
sr = context->RegisterService(im);
delete tracker;
tracker = new FooTracker(context, this);
tracker->Open();
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
tracker->Close();
}
- const Properties& GetProperties() const
+ const Properties& GetProperties() const override
{
return props;
}
- FooService* AddingService(const ServiceReferenceType& reference)
+ FooService* AddingService(const ServiceReferenceType& reference) override
{
props["serviceAdded"] = true;
FooService* fooService = context->GetService<FooService>(reference);
fooService->foo();
return fooService;
}
- void ModifiedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/)
+ void ModifiedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/) override
{}
- void RemovedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/)
+ void RemovedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/) override
{
props["serviceRemoved"] = true;
}
private:
ModulePropsInterface::Properties props;
ServiceRegistrationU sr;
typedef ServiceTracker<FooService> FooTracker;
FooTracker* tracker;
ModuleContext* context;
}; // ActivatorSL1
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(ActivatorSL1))
diff --git a/Modules/CppMicroServices/core/test/modules/libSL3/usActivatorSL3.cpp b/Modules/CppMicroServices/core/test/modules/libSL3/usActivatorSL3.cpp
index 17cb010005..a6b609d322 100644
--- a/Modules/CppMicroServices/core/test/modules/libSL3/usActivatorSL3.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libSL3/usActivatorSL3.cpp
@@ -1,99 +1,99 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModuleActivator.h>
#include <usModulePropsInterface.h>
#include <usServiceTracker.h>
#include <usServiceTrackerCustomizer.h>
#include <usFooService.h>
US_BEGIN_NAMESPACE
class ActivatorSL3 :
public ModuleActivator, public ModulePropsInterface,
public ServiceTrackerCustomizer<FooService>
{
public:
ActivatorSL3() : tracker(0), context(0) {}
~ActivatorSL3()
{ delete tracker; }
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
this->context = context;
InterfaceMap im = MakeInterfaceMap<ModulePropsInterface>(this);
im.insert(std::make_pair(std::string("ActivatorSL3"), this));
sr = context->RegisterService(im);
delete tracker;
tracker = new FooTracker(context, this);
tracker->Open();
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
tracker->Close();
}
- const ModulePropsInterface::Properties& GetProperties() const
+ const ModulePropsInterface::Properties& GetProperties() const override
{
return props;
}
- FooService* AddingService(const ServiceReferenceType& reference)
+ FooService* AddingService(const ServiceReferenceType& reference) override
{
props["serviceAdded"] = true;
US_INFO << "SL3: Adding reference =" << reference;
FooService* fooService = context->GetService(reference);
fooService->foo();
return fooService;
}
- void ModifiedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/)
+ void ModifiedService(const ServiceReferenceType& /*reference*/, FooService* /*service*/) override
{
}
- void RemovedService(const ServiceReferenceType& reference, FooService* /*service*/)
+ void RemovedService(const ServiceReferenceType& reference, FooService* /*service*/) override
{
props["serviceRemoved"] = true;
US_INFO << "SL3: Removing reference =" << reference;
}
private:
typedef ServiceTracker<FooService> FooTracker;
FooTracker* tracker;
ModuleContext* context;
ServiceRegistrationU sr;
ModulePropsInterface::Properties props;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(ActivatorSL3))
diff --git a/Modules/CppMicroServices/core/test/modules/libSL4/usActivatorSL4.cpp b/Modules/CppMicroServices/core/test/modules/libSL4/usActivatorSL4.cpp
index 70d3952b7b..fdfd4a3061 100644
--- a/Modules/CppMicroServices/core/test/modules/libSL4/usActivatorSL4.cpp
+++ b/Modules/CppMicroServices/core/test/modules/libSL4/usActivatorSL4.cpp
@@ -1,64 +1,64 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usServiceRegistration.h>
#include <usFooService.h>
US_BEGIN_NAMESPACE
class ActivatorSL4 :
public ModuleActivator, public FooService
{
public:
~ActivatorSL4()
{
}
- void foo()
+ void foo() override
{
US_INFO << "TestModuleSL4: Doing foo";
}
- void Load(ModuleContext* context)
+ void Load(ModuleContext* context) override
{
sr = context->RegisterService<FooService>(this);
US_INFO << "TestModuleSL4: Registered " << sr;
}
- void Unload(ModuleContext* /*context*/)
+ void Unload(ModuleContext* /*context*/) override
{
}
private:
ServiceRegistration<FooService> sr;
};
US_END_NAMESPACE
US_EXPORT_MODULE_ACTIVATOR(US_PREPEND_NAMESPACE(ActivatorSL4))
diff --git a/Modules/CppMicroServices/core/test/usModuleHooksTest.cpp b/Modules/CppMicroServices/core/test/usModuleHooksTest.cpp
index b9c68bdf56..094fa44df3 100644
--- a/Modules/CppMicroServices/core/test/usModuleHooksTest.cpp
+++ b/Modules/CppMicroServices/core/test/usModuleHooksTest.cpp
@@ -1,194 +1,194 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModule.h>
#include <usModuleEvent.h>
#include <usModuleFindHook.h>
#include <usModuleEventHook.h>
#include <usModuleContext.h>
#include <usGetModuleContext.h>
#include <usSharedLibrary.h>
#include "usTestingMacros.h"
#include "usTestingConfig.h"
US_USE_NAMESPACE
namespace {
#ifdef US_PLATFORM_WINDOWS
static const std::string LIB_PATH = US_RUNTIME_OUTPUT_DIRECTORY;
#else
static const std::string LIB_PATH = US_LIBRARY_OUTPUT_DIRECTORY;
#endif
class TestModuleListener
{
public:
void ModuleChanged(const ModuleEvent moduleEvent)
{
this->events.push_back(moduleEvent);
}
std::vector<ModuleEvent> events;
};
class TestModuleFindHook : public ModuleFindHook
{
public:
- void Find(const ModuleContext* /*context*/, ShrinkableVector<Module*>& modules)
+ void Find(const ModuleContext* /*context*/, ShrinkableVector<Module*>& modules) override
{
for (ShrinkableVector<Module*>::iterator i = modules.begin();
i != modules.end();)
{
if ((*i)->GetName() == "TestModuleA")
{
i = modules.erase(i);
}
else
{
++i;
}
}
}
};
class TestModuleEventHook : public ModuleEventHook
{
public:
- void Event(const ModuleEvent& event, ShrinkableVector<ModuleContext*>& contexts)
+ void Event(const ModuleEvent& event, ShrinkableVector<ModuleContext*>& contexts) override
{
if (event.GetType() == ModuleEvent::LOADING || event.GetType() == ModuleEvent::UNLOADING)
{
contexts.erase(std::remove(contexts.begin(), contexts.end(), GetModuleContext()), contexts.end());
}
}
};
void TestFindHook()
{
SharedLibrary libA(LIB_PATH, "TestModuleA");
#ifdef US_BUILD_SHARED_LIBS
try
{
libA.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG(<< "Load module exception: " << e.what())
}
#endif
Module* moduleA = GetModuleContext()->GetModule("TestModuleA");
US_TEST_CONDITION_REQUIRED(moduleA != 0, "Test for existing module TestModuleA")
US_TEST_CONDITION(moduleA->GetName() == "TestModuleA", "Test module name")
US_TEST_CONDITION(moduleA->IsLoaded() == true, "Test if loaded correctly");
long moduleAId = moduleA->GetModuleId();
US_TEST_CONDITION_REQUIRED(moduleAId > 0, "Test for valid module id")
US_TEST_CONDITION_REQUIRED(GetModuleContext()->GetModule(moduleAId) != NULL, "Test for non-filtered GetModule(long) result")
TestModuleFindHook findHook;
ServiceRegistration<ModuleFindHook> findHookReg = GetModuleContext()->RegisterService<ModuleFindHook>(&findHook);
US_TEST_CONDITION_REQUIRED(GetModuleContext()->GetModule(moduleAId) == NULL, "Test for filtered GetModule(long) result")
std::vector<Module*> modules = GetModuleContext()->GetModules();
for (std::vector<Module*>::iterator i = modules.begin();
i != modules.end(); ++i)
{
if((*i)->GetName() == "TestModuleA")
{
US_TEST_FAILED_MSG(<< "TestModuleA not filtered from GetModules()")
}
}
findHookReg.Unregister();
libA.Unload();
}
#ifdef US_BUILD_SHARED_LIBS
void TestEventHook()
{
TestModuleListener moduleListener;
GetModuleContext()->AddModuleListener(&moduleListener, &TestModuleListener::ModuleChanged);
SharedLibrary libA(LIB_PATH, "TestModuleA");
try
{
libA.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG(<< "Load module exception: " << e.what())
}
US_TEST_CONDITION_REQUIRED(moduleListener.events.size() == 2, "Test for received load module events")
libA.Unload();
US_TEST_CONDITION_REQUIRED(moduleListener.events.size() == 4, "Test for received unload module events")
TestModuleEventHook eventHook;
ServiceRegistration<ModuleEventHook> eventHookReg = GetModuleContext()->RegisterService<ModuleEventHook>(&eventHook);
moduleListener.events.clear();
try
{
libA.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG(<< "Load module exception: " << e.what())
}
US_TEST_CONDITION_REQUIRED(moduleListener.events.size() == 1, "Test for filtered load module events")
US_TEST_CONDITION_REQUIRED(moduleListener.events[0].GetType() == ModuleEvent::LOADED, "Test for LOADED event")
libA.Unload();
US_TEST_CONDITION_REQUIRED(moduleListener.events.size() == 2, "Test for filtered unload module events")
US_TEST_CONDITION_REQUIRED(moduleListener.events[1].GetType() == ModuleEvent::UNLOADED, "Test for UNLOADED event")
eventHookReg.Unregister();
GetModuleContext()->RemoveModuleListener(&moduleListener, &TestModuleListener::ModuleChanged);
}
#endif
} // end unnamed namespace
int usModuleHooksTest(int /*argc*/, char* /*argv*/[])
{
US_TEST_BEGIN("ModuleHooksTest");
TestFindHook();
#ifdef US_BUILD_SHARED_LIBS
TestEventHook();
#endif
US_TEST_END()
}
diff --git a/Modules/CppMicroServices/core/test/usServiceHooksTest.cpp b/Modules/CppMicroServices/core/test/usServiceHooksTest.cpp
index be44b68a4c..cdbc44c496 100644
--- a/Modules/CppMicroServices/core/test/usServiceHooksTest.cpp
+++ b/Modules/CppMicroServices/core/test/usServiceHooksTest.cpp
@@ -1,414 +1,414 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usModule.h>
#include <usModuleEvent.h>
#include <usModuleContext.h>
#include <usGetModuleContext.h>
#include <usLDAPProp.h>
#include <usServiceFindHook.h>
#include <usServiceEventListenerHook.h>
#include <usServiceListenerHook.h>
#include <usSharedLibrary.h>
#include "usTestingMacros.h"
#include "usTestingConfig.h"
US_USE_NAMESPACE
namespace {
#ifdef US_PLATFORM_WINDOWS
static const std::string LIB_PATH = US_RUNTIME_OUTPUT_DIRECTORY;
#else
static const std::string LIB_PATH = US_LIBRARY_OUTPUT_DIRECTORY;
#endif
class TestServiceListener
{
public:
void ServiceChanged(const ServiceEvent serviceEvent)
{
this->events.push_back(serviceEvent);
}
std::vector<ServiceEvent> events;
};
class TestServiceEventListenerHook : public ServiceEventListenerHook
{
private:
int id;
public:
TestServiceEventListenerHook(int id)
: id(id)
{
}
typedef ShrinkableMap<ModuleContext*, ShrinkableVector<ServiceListenerHook::ListenerInfo> > MapType;
- void Event(const ServiceEvent& /*event*/, MapType& listeners)
+ void Event(const ServiceEvent& /*event*/, MapType& listeners) override
{
US_TEST_CONDITION_REQUIRED(listeners.size() > 0 && listeners.find(GetModuleContext()) != listeners.end(), "Check listener content");
ShrinkableVector<ServiceListenerHook::ListenerInfo>& listenerInfos = listeners[GetModuleContext()];
// listener count should be 2 because the event listener hooks are called with
// the list of listeners before filtering them according to ther LDAP filter
if (id == 1)
{
#ifdef US_BUILD_SHARED_LIBS
US_TEST_CONDITION(listenerInfos.size() == 2, "2 service listeners expected");
#else
US_TEST_CONDITION(listenerInfos.size() >= 2, "2 service listeners expected");
#endif
US_TEST_CONDITION(listenerInfos[0].IsRemoved() == false, "Listener is not removed");
US_TEST_CONDITION(listenerInfos[1].IsRemoved() == false, "Listener is not removed");
US_TEST_CONDITION(!(listenerInfos[0] == listenerInfos[1]), "listener info inequality");
}
else
{
// there is already one listener filtered out
#ifdef US_BUILD_SHARED_LIBS
US_TEST_CONDITION(listenerInfos.size() == 1, "1 service listener expected");
#else
US_TEST_CONDITION(listenerInfos.size() >= 1, "1 service listener expected");
#endif
US_TEST_CONDITION(listenerInfos[0].IsRemoved() == false, "Listener is not removed");
}
if (listenerInfo.IsNull())
{
listenerInfo = listenerInfos[0];
}
else
{
US_TEST_CONDITION(listenerInfo == listenerInfos[0], "Equal listener info objects");
}
// Remove the listener without a filter from the list
for(ShrinkableVector<ServiceListenerHook::ListenerInfo>::iterator infoIter = listenerInfos.begin();
infoIter != listenerInfos.end();)
{
if (infoIter->GetFilter().empty())
{
infoIter = listenerInfos.erase(infoIter);
}
else
{
++infoIter;
}
}
#ifdef US_BUILD_SHARED_LIBS
US_TEST_CONDITION(listenerInfos.size() == 1, "One listener with LDAP filter should remain");
#else
US_TEST_CONDITION(listenerInfos.size() >= 1, "One listener with LDAP filter should remain");
#endif
ordering.push_back(id);
}
ServiceListenerHook::ListenerInfo listenerInfo;
static std::vector<int> ordering;
};
std::vector<int> TestServiceEventListenerHook::ordering;
class TestServiceFindHook : public ServiceFindHook
{
private:
int id;
public:
TestServiceFindHook(int id)
: id(id)
{
}
void Find(const ModuleContext* context, const std::string& /*name*/,
- const std::string& /*filter*/, ShrinkableVector<ServiceReferenceBase>& references)
+ const std::string& /*filter*/, ShrinkableVector<ServiceReferenceBase>& references) override
{
US_TEST_CONDITION(context == GetModuleContext(), "Module context");
references.clear();
ordering.push_back(id);
}
static std::vector<int> ordering;
};
std::vector<int> TestServiceFindHook::ordering;
class TestServiceListenerHook : public ServiceListenerHook
{
private:
int id;
public:
TestServiceListenerHook(int id)
: id(id)
{
}
- void Added(const std::vector<ListenerInfo>& listeners)
+ void Added(const std::vector<ListenerInfo>& listeners) override
{
for (std::vector<ListenerInfo>::const_iterator iter = listeners.begin();
iter != listeners.end(); ++iter)
{
if (iter->IsRemoved() || iter->GetModuleContext() != GetModuleContext()) continue;
listenerInfos.insert(*iter);
lastAdded = listeners.back();
ordering.push_back(id);
}
}
- void Removed(const std::vector<ListenerInfo>& listeners)
+ void Removed(const std::vector<ListenerInfo>& listeners) override
{
for (std::vector<ListenerInfo>::const_iterator iter = listeners.begin();
iter != listeners.end(); ++iter)
{
listenerInfos.erase(*iter);
ordering.push_back(id*10);
}
lastRemoved = listeners.back();
}
static std::vector<int> ordering;
US_UNORDERED_SET_TYPE<ListenerInfo> listenerInfos;
ListenerInfo lastAdded;
ListenerInfo lastRemoved;
};
std::vector<int> TestServiceListenerHook::ordering;
void TestEventListenerHook()
{
ModuleContext* context = GetModuleContext();
TestServiceListener serviceListener1;
TestServiceListener serviceListener2;
context->AddServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged);
context->AddServiceListener(&serviceListener2, &TestServiceListener::ServiceChanged, LDAPProp(ServiceConstants::OBJECTCLASS()) == "bla");
TestServiceEventListenerHook serviceEventListenerHook1(1);
ServiceProperties hookProps1;
hookProps1[ServiceConstants::SERVICE_RANKING()] = 10;
ServiceRegistration<ServiceEventListenerHook> eventListenerHookReg1 =
context->RegisterService<ServiceEventListenerHook>(&serviceEventListenerHook1, hookProps1);
TestServiceEventListenerHook serviceEventListenerHook2(2);
ServiceProperties hookProps2;
hookProps2[ServiceConstants::SERVICE_RANKING()] = 0;
ServiceRegistration<ServiceEventListenerHook> eventListenerHookReg2 =
context->RegisterService<ServiceEventListenerHook>(&serviceEventListenerHook2, hookProps2);
std::vector<int> expectedOrdering;
expectedOrdering.push_back(1);
expectedOrdering.push_back(1);
expectedOrdering.push_back(2);
US_TEST_CONDITION(serviceEventListenerHook1.ordering == expectedOrdering, "Event listener hook call order");
US_TEST_CONDITION(serviceListener1.events.empty(), "service event of service event listener hook");
US_TEST_CONDITION(serviceListener2.events.empty(), "no service event for filtered listener");
#ifdef US_BUILD_SHARED_LIBS
SharedLibrary libA(LIB_PATH, "TestModuleA");
try
{
libA.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG(<< "Load module exception: " << e.what())
}
expectedOrdering.push_back(1);
expectedOrdering.push_back(2);
US_TEST_CONDITION(serviceEventListenerHook1.ordering == expectedOrdering, "Event listener hook call order");
libA.Unload();
#endif
US_TEST_CONDITION(serviceListener1.events.empty(), "no service event due to service event listener hook");
US_TEST_CONDITION(serviceListener2.events.empty(), "no service event for filtered listener due to service event listener hook");
eventListenerHookReg2.Unregister();
eventListenerHookReg1.Unregister();
context->RemoveServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged);
context->RemoveServiceListener(&serviceListener2, &TestServiceListener::ServiceChanged);
}
void TestListenerHook()
{
ModuleContext* context = GetModuleContext();
TestServiceListener serviceListener1;
TestServiceListener serviceListener2;
context->AddServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged);
context->AddServiceListener(&serviceListener2, &TestServiceListener::ServiceChanged, LDAPProp(ServiceConstants::OBJECTCLASS()) == "bla");
TestServiceListenerHook serviceListenerHook1(1);
ServiceProperties hookProps1;
hookProps1[ServiceConstants::SERVICE_RANKING()] = 0;
ServiceRegistration<ServiceListenerHook> listenerHookReg1 =
context->RegisterService<ServiceListenerHook>(&serviceListenerHook1, hookProps1);
TestServiceListenerHook serviceListenerHook2(2);
ServiceProperties hookProps2;
hookProps2[ServiceConstants::SERVICE_RANKING()] = 10;
ServiceRegistration<ServiceListenerHook> listenerHookReg2 =
context->RegisterService<ServiceListenerHook>(&serviceListenerHook2, hookProps2);
#ifdef US_BUILD_SHARED_LIBS
// check if hooks got notified about the existing listeners
US_TEST_CONDITION_REQUIRED(serviceListenerHook1.listenerInfos.size() == 2, "Notification about existing listeners")
#endif
const std::size_t listenerInfoSizeOld = serviceListenerHook1.listenerInfos.size() - 2;
context->AddServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged);
ServiceListenerHook::ListenerInfo lastAdded = serviceListenerHook1.lastAdded;
#ifdef US_BUILD_SHARED_LIBS
std::vector<int> expectedOrdering;
expectedOrdering.push_back(1);
expectedOrdering.push_back(1);
expectedOrdering.push_back(2);
expectedOrdering.push_back(2);
expectedOrdering.push_back(20);
expectedOrdering.push_back(10);
expectedOrdering.push_back(2);
expectedOrdering.push_back(1);
US_TEST_CONDITION(serviceListenerHook1.ordering == expectedOrdering, "Listener hook call order");
#endif
context->AddServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged, LDAPProp(ServiceConstants::OBJECTCLASS()) == "blub");
US_TEST_CONDITION(lastAdded == serviceListenerHook1.lastRemoved, "Same ListenerInfo object)");
US_TEST_CONDITION(!(lastAdded == serviceListenerHook1.lastAdded), "New ListenerInfo object)");
#ifdef US_BUILD_SHARED_LIBS
expectedOrdering.push_back(20);
expectedOrdering.push_back(10);
expectedOrdering.push_back(2);
expectedOrdering.push_back(1);
US_TEST_CONDITION(serviceListenerHook1.ordering == expectedOrdering, "Listener hook call order");
#endif
context->RemoveServiceListener(&serviceListener1, &TestServiceListener::ServiceChanged);
context->RemoveServiceListener(&serviceListener2, &TestServiceListener::ServiceChanged);
#ifdef US_BUILD_SHARED_LIBS
expectedOrdering.push_back(20);
expectedOrdering.push_back(10);
expectedOrdering.push_back(20);
expectedOrdering.push_back(10);
US_TEST_CONDITION(serviceListenerHook1.ordering == expectedOrdering, "Listener hook call order");
#endif
US_TEST_CONDITION_REQUIRED(serviceListenerHook1.listenerInfos.size() == listenerInfoSizeOld, "Removed listener infos")
listenerHookReg2.Unregister();
listenerHookReg1.Unregister();
}
void TestFindHook()
{
ModuleContext* context = GetModuleContext();
TestServiceFindHook serviceFindHook1(1);
ServiceProperties hookProps1;
hookProps1[ServiceConstants::SERVICE_RANKING()] = 0;
ServiceRegistration<ServiceFindHook> findHookReg1 =
context->RegisterService<ServiceFindHook>(&serviceFindHook1, hookProps1);
TestServiceFindHook serviceFindHook2(2);
ServiceProperties hookProps2;
hookProps2[ServiceConstants::SERVICE_RANKING()] = 10;
ServiceRegistration<ServiceFindHook> findHookReg2 =
context->RegisterService<ServiceFindHook>(&serviceFindHook2, hookProps2);
std::vector<int> expectedOrdering;
US_TEST_CONDITION(serviceFindHook1.ordering == expectedOrdering, "Find hook call order");
TestServiceListener serviceListener;
context->AddServiceListener(&serviceListener, &TestServiceListener::ServiceChanged);
#ifdef US_BUILD_SHARED_LIBS
SharedLibrary libA(LIB_PATH, "TestModuleA");
try
{
libA.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG(<< "Load module exception: " << e.what())
}
US_TEST_CONDITION(serviceListener.events.size() == 1, "Service registered");
#endif
std::vector<ServiceReferenceU> refs = context->GetServiceReferences("us::TestModuleAService");
US_TEST_CONDITION(refs.empty(), "Empty references");
ServiceReferenceU ref = context->GetServiceReference("us::TestModuleAService");
US_TEST_CONDITION(!ref, "Invalid reference (filtered out)");
expectedOrdering.push_back(2);
expectedOrdering.push_back(1);
expectedOrdering.push_back(2);
expectedOrdering.push_back(1);
US_TEST_CONDITION(serviceFindHook1.ordering == expectedOrdering, "Find hook call order");
findHookReg2.Unregister();
findHookReg1.Unregister();
refs = context->GetServiceReferences("us::TestModuleAService");
US_TEST_CONDITION(!refs.empty(), "Non-empty references");
ref = context->GetServiceReference("us::TestModuleAService");
US_TEST_CONDITION(ref, "Valid reference");
#ifdef US_BUILD_SHARED_LIBS
libA.Unload();
#endif
context->RemoveServiceListener(&serviceListener, &TestServiceListener::ServiceChanged);
}
} // end unnamed namespace
int usServiceHooksTest(int /*argc*/, char* /*argv*/[])
{
US_TEST_BEGIN("ServiceHooksTest");
TestListenerHook();
TestFindHook();
TestEventListenerHook();
US_TEST_END()
}
diff --git a/Modules/CppMicroServices/core/test/usServiceTemplateTest.cpp b/Modules/CppMicroServices/core/test/usServiceTemplateTest.cpp
index b91dae1bd5..153defe7b8 100644
--- a/Modules/CppMicroServices/core/test/usServiceTemplateTest.cpp
+++ b/Modules/CppMicroServices/core/test/usServiceTemplateTest.cpp
@@ -1,208 +1,208 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usGetModuleContext.h>
#include <usModuleContext.h>
#include <usModule.h>
#include <usServiceFactory.h>
#include "usTestingMacros.h"
struct Interface1 {};
struct Interface2 {};
struct Interface3 {};
struct MyService1 : public Interface1
{};
struct MyService2 : public Interface1, public Interface2
{};
struct MyService3 : public Interface1, public Interface2, public Interface3
{};
struct MyFactory1 : public us::ServiceFactory
{
std::map<long, MyService1*> m_idToServiceMap;
- virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/)
+ virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/) override
{
MyService1* s = new MyService1;
m_idToServiceMap.insert(std::make_pair(module->GetModuleId(), s));
return us::MakeInterfaceMap<Interface1>(s);
}
virtual void UngetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/,
- const us::InterfaceMap& service)
+ const us::InterfaceMap& service) override
{
std::map<long, MyService1*>::iterator iter = m_idToServiceMap.find(module->GetModuleId());
if (iter != m_idToServiceMap.end())
{
US_TEST_CONDITION(static_cast<Interface1*>(iter->second) == us::ExtractInterface<Interface1>(service), "Compare service pointer")
delete iter->second;
m_idToServiceMap.erase(iter);
}
}
};
struct MyFactory2 : public us::ServiceFactory
{
std::map<long, MyService2*> m_idToServiceMap;
- virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/)
+ virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/) override
{
MyService2* s = new MyService2;
m_idToServiceMap.insert(std::make_pair(module->GetModuleId(), s));
return us::MakeInterfaceMap<Interface1,Interface2>(s);
}
virtual void UngetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/,
- const us::InterfaceMap& service)
+ const us::InterfaceMap& service) override
{
std::map<long, MyService2*>::iterator iter = m_idToServiceMap.find(module->GetModuleId());
if (iter != m_idToServiceMap.end())
{
US_TEST_CONDITION(static_cast<Interface2*>(iter->second) == us::ExtractInterface<Interface2>(service), "Compare service pointer")
delete iter->second;
m_idToServiceMap.erase(iter);
}
}
};
struct MyFactory3 : public us::ServiceFactory
{
std::map<long, MyService3*> m_idToServiceMap;
- virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/)
+ virtual us::InterfaceMap GetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/) override
{
MyService3* s = new MyService3;
m_idToServiceMap.insert(std::make_pair(module->GetModuleId(), s));
return us::MakeInterfaceMap<Interface1,Interface2,Interface3>(s);
}
virtual void UngetService(us::Module* module, const us::ServiceRegistrationBase& /*registration*/,
- const us::InterfaceMap& service)
+ const us::InterfaceMap& service) override
{
std::map<long, MyService3*>::iterator iter = m_idToServiceMap.find(module->GetModuleId());
if (iter != m_idToServiceMap.end())
{
US_TEST_CONDITION(static_cast<Interface3*>(iter->second) == us::ExtractInterface<Interface3>(service), "Compare service pointer")
delete iter->second;
m_idToServiceMap.erase(iter);
}
}
};
US_USE_NAMESPACE
int usServiceTemplateTest(int /*argc*/, char* /*argv*/[])
{
US_TEST_BEGIN("ServiceTemplateTest");
ModuleContext* mc = GetModuleContext();
// Register compile tests
MyService1 s1;
MyService2 s2;
MyService3 s3;
us::ServiceRegistration<Interface1> sr1 = mc->RegisterService<Interface1>(&s1);
us::ServiceRegistration<Interface1,Interface2> sr2 = mc->RegisterService<Interface1,Interface2>(&s2);
us::ServiceRegistration<Interface1,Interface2,Interface3> sr3 = mc->RegisterService<Interface1,Interface2,Interface3>(&s3);
MyFactory1 f1;
us::ServiceRegistration<Interface1> sfr1 = mc->RegisterService<Interface1>(&f1);
MyFactory2 f2;
us::ServiceRegistration<Interface1,Interface2> sfr2 = mc->RegisterService<Interface1,Interface2>(static_cast<ServiceFactory*>(&f2));
MyFactory3 f3;
us::ServiceRegistration<Interface1,Interface2,Interface3> sfr3 = mc->RegisterService<Interface1,Interface2,Interface3>(static_cast<ServiceFactory*>(&f3));
#ifdef US_BUILD_SHARED_LIBS
US_TEST_CONDITION(mc->GetModule()->GetRegisteredServices().size() == 6, "# of reg services")
#endif
std::vector<us::ServiceReference<Interface1> > s1refs = mc->GetServiceReferences<Interface1>();
US_TEST_CONDITION(s1refs.size() == 6, "# of interface1 regs")
std::vector<us::ServiceReference<Interface2> > s2refs = mc->GetServiceReferences<Interface2>();
US_TEST_CONDITION(s2refs.size() == 4, "# of interface2 regs")
std::vector<us::ServiceReference<Interface3> > s3refs = mc->GetServiceReferences<Interface3>();
US_TEST_CONDITION(s3refs.size() == 2, "# of interface3 regs")
Interface1* i1 = mc->GetService(sr1.GetReference());
US_TEST_CONDITION(i1 == static_cast<Interface1*>(&s1), "interface1 ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sr1.GetReference()), "unget interface1 ptr")
i1 = mc->GetService(sfr1.GetReference());
US_TEST_CONDITION(i1 == static_cast<Interface1*>(f1.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface1 factory ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr1.GetReference()), "unget interface1 factory ptr")
i1 = mc->GetService(sr2.GetReference(InterfaceType<Interface1>()));
US_TEST_CONDITION(i1 == static_cast<Interface1*>(&s2), "interface1 ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sr2.GetReference(InterfaceType<Interface1>())), "unget interface1 ptr")
i1 = mc->GetService(sfr2.GetReference(InterfaceType<Interface1>()));
US_TEST_CONDITION(i1 == static_cast<Interface1*>(f2.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface1 factory ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr2.GetReference(InterfaceType<Interface1>())), "unget interface1 factory ptr")
Interface2* i2 = mc->GetService(sr2.GetReference(InterfaceType<Interface2>()));
US_TEST_CONDITION(i2 == static_cast<Interface2*>(&s2), "interface2 ptr")
i2 = NULL;
US_TEST_CONDITION(mc->UngetService(sr2.GetReference(InterfaceType<Interface2>())), "unget interface2 ptr")
i2 = mc->GetService(sfr2.GetReference(InterfaceType<Interface2>()));
US_TEST_CONDITION(i2 == static_cast<Interface2*>(f2.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface2 factory ptr")
i2 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr2.GetReference(InterfaceType<Interface2>())), "unget interface2 factory ptr")
i1 = mc->GetService(sr3.GetReference(InterfaceType<Interface1>()));
US_TEST_CONDITION(i1 == static_cast<Interface1*>(&s3), "interface1 ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sr3.GetReference(InterfaceType<Interface1>())), "unget interface1 ptr")
i1 = mc->GetService(sfr3.GetReference(InterfaceType<Interface1>()));
US_TEST_CONDITION(i1 == static_cast<Interface1*>(f3.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface1 factory ptr")
i1 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr3.GetReference(InterfaceType<Interface1>())), "unget interface1 factory ptr")
i2 = mc->GetService(sr3.GetReference(InterfaceType<Interface2>()));
US_TEST_CONDITION(i2 == static_cast<Interface2*>(&s3), "interface2 ptr")
i2 = NULL;
US_TEST_CONDITION(mc->UngetService(sr3.GetReference(InterfaceType<Interface2>())), "unget interface2 ptr")
i2 = mc->GetService(sfr3.GetReference(InterfaceType<Interface2>()));
US_TEST_CONDITION(i2 == static_cast<Interface2*>(f3.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface2 factory ptr")
i2 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr3.GetReference(InterfaceType<Interface2>())), "unget interface2 factory ptr")
Interface3* i3 = mc->GetService(sr3.GetReference(InterfaceType<Interface3>()));
US_TEST_CONDITION(i3 == static_cast<Interface3*>(&s3), "interface3 ptr")
i3 = NULL;
US_TEST_CONDITION(mc->UngetService(sr3.GetReference(InterfaceType<Interface3>())), "unget interface3 ptr")
i3 = mc->GetService(sfr3.GetReference(InterfaceType<Interface3>()));
US_TEST_CONDITION(i3 == static_cast<Interface3*>(f3.m_idToServiceMap[mc->GetModule()->GetModuleId()]), "interface3 factory ptr")
i3 = NULL;
US_TEST_CONDITION(mc->UngetService(sfr3.GetReference(InterfaceType<Interface3>())), "unget interface3 factory ptr")
sr1.Unregister();
sr2.Unregister();
sr3.Unregister();
US_TEST_END()
}
diff --git a/Modules/CppMicroServices/core/test/usServiceTrackerTest.cpp b/Modules/CppMicroServices/core/test/usServiceTrackerTest.cpp
index 7883d1cd42..9e9cd71af2 100644
--- a/Modules/CppMicroServices/core/test/usServiceTrackerTest.cpp
+++ b/Modules/CppMicroServices/core/test/usServiceTrackerTest.cpp
@@ -1,287 +1,287 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include <usTestingMacros.h>
#include <usTestingConfig.h>
#include <usModule.h>
#include <usModuleContext.h>
#include <usGetModuleContext.h>
#include <usServiceInterface.h>
#include <usServiceTracker.h>
#include <usSharedLibrary.h>
#include "usServiceControlInterface.h"
#include <memory>
US_USE_NAMESPACE
bool CheckConvertibility(const std::vector<ServiceReferenceU>& refs,
std::vector<std::string>::const_iterator idBegin,
std::vector<std::string>::const_iterator idEnd)
{
std::vector<std::string> ids;
ids.assign(idBegin, idEnd);
for (std::vector<ServiceReferenceU>::const_iterator sri = refs.begin();
sri != refs.end(); ++sri)
{
for (std::vector<std::string>::iterator idIter = ids.begin();
idIter != ids.end(); ++idIter)
{
if (sri->IsConvertibleTo(*idIter))
{
ids.erase(idIter);
break;
}
}
}
return ids.empty();
}
struct MyInterfaceOne {
virtual ~MyInterfaceOne() {}
};
struct MyInterfaceTwo {
virtual ~MyInterfaceTwo() {}
};
class MyCustomizer : public us::ServiceTrackerCustomizer<MyInterfaceOne>
{
public:
MyCustomizer(us::ModuleContext* context)
: m_context(context)
{}
- virtual MyInterfaceOne* AddingService(const ServiceReferenceType& reference)
+ virtual MyInterfaceOne* AddingService(const ServiceReferenceType& reference) override
{
US_TEST_CONDITION_REQUIRED(reference, "AddingService() valid reference")
return m_context->GetService(reference);
}
- virtual void ModifiedService(const ServiceReferenceType& reference, MyInterfaceOne* service)
+ virtual void ModifiedService(const ServiceReferenceType& reference, MyInterfaceOne* service) override
{
US_TEST_CONDITION(reference, "ModifiedService() valid reference")
US_TEST_CONDITION(service, "ModifiedService() valid service")
}
- virtual void RemovedService(const ServiceReferenceType& reference, MyInterfaceOne* service)
+ virtual void RemovedService(const ServiceReferenceType& reference, MyInterfaceOne* service) override
{
US_TEST_CONDITION(reference, "RemovedService() valid reference")
US_TEST_CONDITION(service, "RemovedService() valid service")
}
private:
us::ModuleContext* m_context;
};
void TestFilterString()
{
us::ModuleContext* context = us::GetModuleContext();
MyCustomizer customizer(context);
us::LDAPFilter filter("(" + us::ServiceConstants::SERVICE_ID() + ">=0)");
us::ServiceTracker<MyInterfaceOne> tracker(context, filter, &customizer);
tracker.Open();
struct MyServiceOne : public MyInterfaceOne {};
struct MyServiceTwo : public MyInterfaceTwo {};
MyServiceOne serviceOne;
MyServiceTwo serviceTwo;
ServiceRegistration<MyInterfaceOne> reg1 = context->RegisterService<MyInterfaceOne>(&serviceOne);
ServiceRegistration<MyInterfaceTwo> reg2 = context->RegisterService<MyInterfaceTwo>(&serviceTwo);
US_TEST_CONDITION(tracker.GetServiceReferences().size() == 1, "tracking count")
reg1.Unregister();
reg2.Unregister();
}
void TestServiceTracker()
{
#ifdef US_PLATFORM_WINDOWS
const std::string LIB_PATH = US_RUNTIME_OUTPUT_DIRECTORY;
#else
const std::string LIB_PATH = US_LIBRARY_OUTPUT_DIRECTORY;
#endif
ModuleContext* mc = GetModuleContext();
SharedLibrary libS(LIB_PATH, "TestModuleS");
#ifdef US_BUILD_SHARED_LIBS
// Start the test target to get a service published.
try
{
libS.Load();
}
catch (const std::exception& e)
{
US_TEST_FAILED_MSG( << "Failed to load module, got exception: " << e.what() );
}
#endif
// 1. Create a ServiceTracker with ServiceTrackerCustomizer == null
std::string s1("us::TestModuleSService");
ServiceReferenceU servref = mc->GetServiceReference(s1 + "0");
US_TEST_CONDITION_REQUIRED(servref != 0, "Test if registered service of id us::TestModuleSService0");
ServiceReference<ServiceControlInterface> servCtrlRef = mc->GetServiceReference<ServiceControlInterface>();
US_TEST_CONDITION_REQUIRED(servCtrlRef != 0, "Test if constrol service was registered");
ServiceControlInterface* serviceController = mc->GetService(servCtrlRef);
US_TEST_CONDITION_REQUIRED(serviceController != 0, "Test valid service controller");
std::auto_ptr<ServiceTracker<void> > st1(new ServiceTracker<void>(mc, servref));
// 2. Check the size method with an unopened service tracker
US_TEST_CONDITION_REQUIRED(st1->Size() == 0, "Test if size == 0");
// 3. Open the service tracker and see what it finds,
// expect to find one instance of the implementation,
// "org.cppmicroservices.TestModuleSService0"
st1->Open();
std::vector<ServiceReferenceU> sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 1, "Checking ServiceTracker size");
US_TEST_CONDITION_REQUIRED(s1 + "0" == sa2[0].GetInterfaceId(), "Checking service implementation name");
// 5. Close this service tracker
st1->Close();
// 6. Check the size method, now when the servicetracker is closed
US_TEST_CONDITION_REQUIRED(st1->Size() == 0, "Checking ServiceTracker size");
// 7. Check if we still track anything , we should get null
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.empty(), "Checking ServiceTracker size");
// 8. A new Servicetracker, this time with a filter for the object
std::string fs = std::string("(") + ServiceConstants::OBJECTCLASS() + "=" + s1 + "*" + ")";
LDAPFilter f1(fs);
st1.reset(new ServiceTracker<void>(mc, f1));
// add a service
serviceController->ServiceControl(1, "register", 7);
// 9. Open the service tracker and see what it finds,
// expect to find two instances of references to
// "org.cppmicroservices.TestModuleSService*"
// i.e. they refer to the same piece of code
std::vector<std::string> ids;
ids.push_back((s1 + "0"));
ids.push_back((s1 + "1"));
ids.push_back((s1 + "2"));
ids.push_back((s1 + "3"));
st1->Open();
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 2, "Checking service reference count");
US_TEST_CONDITION_REQUIRED(CheckConvertibility(sa2, ids.begin(), ids.begin()+2), "Check for expected interface id [0]");
US_TEST_CONDITION_REQUIRED(sa2[1].IsConvertibleTo(s1 + "1"), "Check for expected interface id [1]");
// 10. Get libTestModuleS to register one more service and see if it appears
serviceController->ServiceControl(2, "register", 1);
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 3, "Checking service reference count");
US_TEST_CONDITION_REQUIRED(CheckConvertibility(sa2, ids.begin(), ids.begin()+3), "Check for expected interface id [2]");
// 11. Get libTestModuleS to register one more service and see if it appears
serviceController->ServiceControl(3, "register", 2);
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 4, "Checking service reference count");
US_TEST_CONDITION_REQUIRED(CheckConvertibility(sa2, ids.begin(), ids.end()), "Check for expected interface id [3]");
// 12. Get libTestModuleS to unregister one service and see if it disappears
serviceController->ServiceControl(3, "unregister", 0);
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 3, "Checking service reference count");
// 13. Get the highest ranking service reference, it should have ranking 7
ServiceReferenceU h1 = st1->GetServiceReference();
int rank = any_cast<int>(h1.GetProperty(ServiceConstants::SERVICE_RANKING()));
US_TEST_CONDITION_REQUIRED(rank == 7, "Check service rank");
// 14. Get the service of the highest ranked service reference
InterfaceMap o1 = st1->GetService(h1);
US_TEST_CONDITION_REQUIRED(!o1.empty(), "Check for non-null service");
// 14a Get the highest ranked service, directly this time
InterfaceMap o3 = st1->GetService();
US_TEST_CONDITION_REQUIRED(!o3.empty(), "Check for non-null service");
US_TEST_CONDITION_REQUIRED(o1 == o3, "Check for equal service instances");
// 15. Now release the tracking of that service and then try to get it
// from the servicetracker, which should yield a null object
serviceController->ServiceControl(1, "unregister", 7);
InterfaceMap o2 = st1->GetService(h1);
US_TEST_CONDITION_REQUIRED(o2.empty(), "Checkt that service is null");
// 16. Get all service objects this tracker tracks, it should be 2
std::vector<InterfaceMap> ts1 = st1->GetServices();
US_TEST_CONDITION_REQUIRED(ts1.size() == 2, "Check service count");
// 17. Test the remove method.
// First register another service, then remove it being tracked
serviceController->ServiceControl(1, "register", 7);
h1 = st1->GetServiceReference();
std::vector<ServiceReferenceU> sa3 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa3.size() == 3, "Check service reference count");
US_TEST_CONDITION_REQUIRED(CheckConvertibility(sa3, ids.begin(), ids.begin()+3), "Check for expected interface id [0]");
st1->Remove(h1); // remove tracking on one servref
sa2 = st1->GetServiceReferences();
US_TEST_CONDITION_REQUIRED(sa2.size() == 2, "Check service reference count");
// 18. Test the addingService method,add a service reference
// 19. Test the removedService method, remove a service reference
// 20. Test the waitForService method
InterfaceMap o9 = st1->WaitForService(50);
US_TEST_CONDITION_REQUIRED(!o9.empty(), "Checking WaitForService method");
}
int usServiceTrackerTest(int /*argc*/, char* /*argv*/[])
{
US_TEST_BEGIN("ServiceTrackerTest")
TestFilterString();
TestServiceTracker();
US_TEST_END()
}
diff --git a/Modules/CppMicroServices/core/test/usTestDriverActivator.h b/Modules/CppMicroServices/core/test/usTestDriverActivator.h
index 30a6cc2f4e..5ef86f56c8 100644
--- a/Modules/CppMicroServices/core/test/usTestDriverActivator.h
+++ b/Modules/CppMicroServices/core/test/usTestDriverActivator.h
@@ -1,49 +1,49 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USTESTDRIVERACTIVATOR_H
#define USTESTDRIVERACTIVATOR_H
#include <usModuleActivator.h>
US_BEGIN_NAMESPACE
class TestDriverActivator : public ModuleActivator
{
public:
TestDriverActivator();
static bool LoadCalled();
- void Load(ModuleContext*);
+ void Load(ModuleContext*) override;
- void Unload(ModuleContext* );
+ void Unload(ModuleContext* ) override;
private:
static TestDriverActivator* m_Instance;
bool m_LoadCalled;
};
US_END_NAMESPACE
#endif // USTESTDRIVERACTIVATOR_H
diff --git a/Modules/CppMicroServices/third_party/jsoncpp.h b/Modules/CppMicroServices/third_party/jsoncpp.h
index 0ab8e50d88..a5c1438e95 100644
--- a/Modules/CppMicroServices/third_party/jsoncpp.h
+++ b/Modules/CppMicroServices/third_party/jsoncpp.h
@@ -1,1855 +1,1855 @@
/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).
/// It is intented to be used with #include <json/json.h>
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: LICENSE
// //////////////////////////////////////////////////////////////////////
/*
The JsonCpp library's source code, including accompanying documentation,
tests and demonstration applications, are licensed under the following
conditions...
The author (Baptiste Lepilleur) explicitly disclaims copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
this software is released into the Public Domain.
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
released under the terms of the MIT License (see below).
In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
Public Domain/MIT License conditions described here, as they choose.
The MIT License is about as close to Public Domain as a license can get, and is
described in clear, concise terms at:
http://en.wikipedia.org/wiki/MIT_License
The full text of the MIT License follows:
========================================================================
Copyright (c) 2007-2010 Baptiste Lepilleur
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
(END LICENSE TEXT)
The MIT license is compatible with both the GPL and commercial
software, affording one all of the rights of Public Domain with the
minor nuisance of being required to keep the above copyright notice
and license text in the source code. Note also that by accepting the
Public Domain "license" you can re-license your copy using whatever
license you like.
*/
// //////////////////////////////////////////////////////////////////////
// End of content of file: LICENSE
// //////////////////////////////////////////////////////////////////////
#ifndef JSON_AMALGATED_H_INCLUDED
# define JSON_AMALGATED_H_INCLUDED
/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
#define JSON_IS_AMALGATED
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/config.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef JSON_CONFIG_H_INCLUDED
# define JSON_CONFIG_H_INCLUDED
/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1
/// If defined, indicates that json may leverage CppTL library
//# define JSON_USE_CPPTL 1
/// If defined, indicates that cpptl vector based map should be used instead of std::map
/// as Value container.
//# define JSON_USE_CPPTL_SMALLMAP 1
/// If defined, indicates that Json specific container should be used
/// (hash table & simple deque container with customizable allocator).
/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
//# define JSON_VALUE_USE_INTERNAL_MAP 1
/// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
/// The memory pools allocator used optimization (initializing Value and ValueInternalLink
/// as if it was a POD) that may cause some validation tool to report errors.
/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
/// If defined, indicates that Json use exception to report invalid type manipulation
/// instead of C assert macro.
# define JSON_USE_EXCEPTION 1
/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
/// Remarks: it is automatically defined in the generated amalgated header.
#define JSON_IS_AMALGAMATION
# ifdef JSON_IN_CPPTL
# include <cpptl/config.h>
# ifndef JSON_USE_CPPTL
# define JSON_USE_CPPTL 1
# endif
# endif
# ifdef JSON_IN_CPPTL
# define JSON_API CPPTL_API
# elif defined(JSON_DLL_BUILD)
# define JSON_API __declspec(dllexport)
# elif defined(JSON_DLL)
# define JSON_API __declspec(dllimport)
# else
# define JSON_API
# endif
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer
// Storages, and 64 bits integer support is disabled.
// #define JSON_NO_INT64 1
#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
// Microsoft Visual Studio 6 only support conversion from __int64 to double
// (no conversion from unsigned __int64).
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
/// Indicates that the following function is deprecated.
# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
#endif
#if !defined(JSONCPP_DEPRECATED)
# define JSONCPP_DEPRECATED(message)
#endif // if !defined(JSONCPP_DEPRECATED)
namespace Json {
typedef int Int;
typedef unsigned int UInt;
# if defined(JSON_NO_INT64)
typedef int LargestInt;
typedef unsigned int LargestUInt;
# undef JSON_HAS_INT64
# else // if defined(JSON_NO_INT64)
// For Microsoft Visual use specific types as long long is not supported
# if defined(_MSC_VER) // Microsoft Visual Studio
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
# else // if defined(_MSC_VER) // Other platforms, use long long
typedef long long int Int64;
typedef unsigned long long int UInt64;
# endif // if defined(_MSC_VER)
typedef Int64 LargestInt;
typedef UInt64 LargestUInt;
# define JSON_HAS_INT64
# endif // if defined(JSON_NO_INT64)
} // end namespace Json
#endif // JSON_CONFIG_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/config.h
// //////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef JSON_FORWARDS_H_INCLUDED
# define JSON_FORWARDS_H_INCLUDED
#if !defined(JSON_IS_AMALGAMATION)
# include "config.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
namespace Json {
// writer.h
class FastWriter;
class StyledWriter;
// reader.h
class Reader;
// features.h
class Features;
// value.h
typedef unsigned int ArrayIndex;
class StaticString;
class Path;
class PathArgument;
class Value;
class ValueIteratorBase;
class ValueIterator;
class ValueConstIterator;
#ifdef JSON_VALUE_USE_INTERNAL_MAP
class ValueMapAllocator;
class ValueInternalLink;
class ValueInternalArray;
class ValueInternalMap;
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
} // namespace Json
#endif // JSON_FORWARDS_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/features.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
# define CPPTL_JSON_FEATURES_H_INCLUDED
#if !defined(JSON_IS_AMALGAMATION)
# include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
namespace Json {
/** \brief Configuration passed to reader and writer.
* This configuration object can be used to force the Reader or Writer
* to behave in a standard conforming way.
*/
class JSON_API Features
{
public:
/** \brief A configuration that allows all features and assumes all strings are UTF-8.
* - C & C++ comments are allowed
* - Root object can be any JSON value
* - Assumes Value strings are encoded in UTF-8
*/
static Features all();
/** \brief A configuration that is strictly compatible with the JSON specification.
* - Comments are forbidden.
* - Root object must be either an array or an object value.
* - Assumes Value strings are encoded in UTF-8
*/
static Features strictMode();
/** \brief Initialize the configuration like JsonConfig::allFeatures;
*/
Features();
/// \c true if comments are allowed. Default: \c true.
bool allowComments_;
/// \c true if root must be either an array or an object value. Default: \c false.
bool strictRoot_;
};
} // namespace Json
#endif // CPPTL_JSON_FEATURES_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/features.h
// //////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/value.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef CPPTL_JSON_H_INCLUDED
# define CPPTL_JSON_H_INCLUDED
#if !defined(JSON_IS_AMALGAMATION)
# include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
# include <string>
# include <vector>
# ifndef JSON_USE_CPPTL_SMALLMAP
# include <map>
# else
# include <cpptl/smallmap.h>
# endif
# ifdef JSON_USE_CPPTL
# include <cpptl/forwards.h>
# endif
/** \brief JSON (JavaScript Object Notation).
*/
namespace Json {
/** \brief Type of the value held by a Value object.
*/
enum ValueType
{
nullValue = 0, ///< 'null' value
intValue, ///< signed integer value
uintValue, ///< unsigned integer value
realValue, ///< double value
stringValue, ///< UTF-8 string value
booleanValue, ///< bool value
arrayValue, ///< array value (ordered list)
objectValue ///< object value (collection of name/value pairs).
};
enum CommentPlacement
{
commentBefore = 0, ///< a comment placed on the line before a value
commentAfterOnSameLine, ///< a comment just after a value on the same line
commentAfter, ///< a comment on the line after a value (only make sense for root value)
numberOfCommentPlacement
};
//# ifdef JSON_USE_CPPTL
// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
//# endif
/** \brief Lightweight wrapper to tag static string.
*
* Value constructor and objectValue member assignement takes advantage of the
* StaticString and avoid the cost of string duplication when storing the
* string or the member name.
*
* Example of usage:
* \code
* Json::Value aValue( StaticString("some text") );
* Json::Value object;
* static const StaticString code("code");
* object[code] = 1234;
* \endcode
*/
class JSON_API StaticString
{
public:
explicit StaticString( const char *czstring )
: str_( czstring )
{
}
operator const char *() const
{
return str_;
}
const char *c_str() const
{
return str_;
}
private:
const char *str_;
};
/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
*
* This class is a discriminated union wrapper that can represents a:
* - signed integer [range: Value::minInt - Value::maxInt]
* - unsigned integer (range: 0 - Value::maxUInt)
* - double
* - UTF-8 string
* - boolean
* - 'null'
* - an ordered list of Value
* - collection of name/value pairs (javascript object)
*
* The type of the held value is represented by a #ValueType and
* can be obtained using type().
*
* values of an #objectValue or #arrayValue can be accessed using operator[]() methods.
* Non const methods will automatically create the a #nullValue element
* if it does not exist.
* The sequence of an #arrayValue will be automatically resize and initialized
* with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
*
* The get() methods can be used to obtanis default value in the case the required element
* does not exist.
*
* It is possible to iterate over the list of a #objectValue values using
* the getMemberNames() method.
*/
class JSON_API Value
{
friend class ValueIteratorBase;
# ifdef JSON_VALUE_USE_INTERNAL_MAP
friend class ValueInternalLink;
friend class ValueInternalMap;
# endif
public:
typedef std::vector<std::string> Members;
typedef ValueIterator iterator;
typedef ValueConstIterator const_iterator;
typedef Json::UInt UInt;
typedef Json::Int Int;
# if defined(JSON_HAS_INT64)
typedef Json::UInt64 UInt64;
typedef Json::Int64 Int64;
#endif // defined(JSON_HAS_INT64)
typedef Json::LargestInt LargestInt;
typedef Json::LargestUInt LargestUInt;
typedef Json::ArrayIndex ArrayIndex;
static const Value null;
/// Minimum signed integer value that can be stored in a Json::Value.
static const LargestInt minLargestInt;
/// Maximum signed integer value that can be stored in a Json::Value.
static const LargestInt maxLargestInt;
/// Maximum unsigned integer value that can be stored in a Json::Value.
static const LargestUInt maxLargestUInt;
/// Minimum signed int value that can be stored in a Json::Value.
static const Int minInt;
/// Maximum signed int value that can be stored in a Json::Value.
static const Int maxInt;
/// Maximum unsigned int value that can be stored in a Json::Value.
static const UInt maxUInt;
/// Minimum signed 64 bits int value that can be stored in a Json::Value.
static const Int64 minInt64;
/// Maximum signed 64 bits int value that can be stored in a Json::Value.
static const Int64 maxInt64;
/// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
static const UInt64 maxUInt64;
private:
#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
# ifndef JSON_VALUE_USE_INTERNAL_MAP
class CZString
{
public:
enum DuplicationPolicy
{
noDuplication = 0,
duplicate,
duplicateOnCopy
};
CZString( ArrayIndex index );
CZString( const char *cstr, DuplicationPolicy allocate );
CZString( const CZString &other );
~CZString();
CZString &operator =( const CZString &other );
bool operator<( const CZString &other ) const;
bool operator==( const CZString &other ) const;
ArrayIndex index() const;
const char *c_str() const;
bool isStaticString() const;
private:
void swap( CZString &other );
const char *cstr_;
ArrayIndex index_;
};
public:
# ifndef JSON_USE_CPPTL_SMALLMAP
typedef std::map<CZString, Value> ObjectValues;
# else
typedef CppTL::SmallMap<CZString, Value> ObjectValues;
# endif // ifndef JSON_USE_CPPTL_SMALLMAP
# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
public:
/** \brief Create a default Value of the given type.
This is a very useful constructor.
To create an empty array, pass arrayValue.
To create an empty object, pass objectValue.
Another Value can then be set to this one by assignment.
This is useful since clear() and resize() will not alter types.
Examples:
\code
Json::Value null_value; // null
Json::Value arr_value(Json::arrayValue); // []
Json::Value obj_value(Json::objectValue); // {}
\endcode
*/
Value( ValueType type = nullValue );
Value( Int value );
Value( UInt value );
#if defined(JSON_HAS_INT64)
Value( Int64 value );
Value( UInt64 value );
#endif // if defined(JSON_HAS_INT64)
Value( double value );
Value( const char *value );
Value( const char *beginValue, const char *endValue );
/** \brief Constructs a value from a static string.
* Like other value string constructor but do not duplicate the string for
* internal storage. The given string must remain alive after the call to this
* constructor.
* Example of usage:
* \code
* Json::Value aValue( StaticString("some text") );
* \endcode
*/
Value( const StaticString &value );
Value( const std::string &value );
# ifdef JSON_USE_CPPTL
Value( const CppTL::ConstString &value );
# endif
Value( bool value );
Value( const Value &other );
~Value();
Value &operator=( const Value &other );
/// Swap values.
/// \note Currently, comments are intentionally not swapped, for
/// both logic and efficiency.
void swap( Value &other );
ValueType type() const;
bool operator <( const Value &other ) const;
bool operator <=( const Value &other ) const;
bool operator >=( const Value &other ) const;
bool operator >( const Value &other ) const;
bool operator ==( const Value &other ) const;
bool operator !=( const Value &other ) const;
int compare( const Value &other ) const;
const char *asCString() const;
std::string asString() const;
# ifdef JSON_USE_CPPTL
CppTL::ConstString asConstString() const;
# endif
Int asInt() const;
UInt asUInt() const;
Int64 asInt64() const;
UInt64 asUInt64() const;
LargestInt asLargestInt() const;
LargestUInt asLargestUInt() const;
float asFloat() const;
double asDouble() const;
bool asBool() const;
bool isNull() const;
bool isBool() const;
bool isInt() const;
bool isUInt() const;
bool isIntegral() const;
bool isDouble() const;
bool isNumeric() const;
bool isString() const;
bool isArray() const;
bool isObject() const;
bool isConvertibleTo( ValueType other ) const;
/// Number of values in array or object
ArrayIndex size() const;
/// \brief Return true if empty array, empty object, or null;
/// otherwise, false.
bool empty() const;
/// Return isNull()
bool operator!() const;
/// Remove all object members and array elements.
/// \pre type() is arrayValue, objectValue, or nullValue
/// \post type() is unchanged
void clear();
/// Resize the array to size elements.
/// New elements are initialized to null.
/// May only be called on nullValue or arrayValue.
/// \pre type() is arrayValue or nullValue
/// \post type() is arrayValue
void resize( ArrayIndex size );
/// Access an array element (zero based index ).
/// If the array contains less than index element, then null value are inserted
/// in the array so that its size is index+1.
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
Value &operator[]( ArrayIndex index );
/// Access an array element (zero based index ).
/// If the array contains less than index element, then null value are inserted
/// in the array so that its size is index+1.
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
Value &operator[]( int index );
/// Access an array element (zero based index )
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
const Value &operator[]( ArrayIndex index ) const;
/// Access an array element (zero based index )
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
const Value &operator[]( int index ) const;
/// If the array contains at least index+1 elements, returns the element value,
/// otherwise returns defaultValue.
Value get( ArrayIndex index,
const Value &defaultValue ) const;
/// Return true if index < size().
bool isValidIndex( ArrayIndex index ) const;
/// \brief Append value to array at the end.
///
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
Value &append( const Value &value );
/// Access an object value by name, create a null member if it does not exist.
Value &operator[]( const char *key );
/// Access an object value by name, returns null if there is no member with that name.
const Value &operator[]( const char *key ) const;
/// Access an object value by name, create a null member if it does not exist.
Value &operator[]( const std::string &key );
/// Access an object value by name, returns null if there is no member with that name.
const Value &operator[]( const std::string &key ) const;
/** \brief Access an object value by name, create a null member if it does not exist.
* If the object as no entry for that name, then the member name used to store
* the new entry is not duplicated.
* Example of use:
* \code
* Json::Value object;
* static const StaticString code("code");
* object[code] = 1234;
* \endcode
*/
Value &operator[]( const StaticString &key );
# ifdef JSON_USE_CPPTL
/// Access an object value by name, create a null member if it does not exist.
Value &operator[]( const CppTL::ConstString &key );
/// Access an object value by name, returns null if there is no member with that name.
const Value &operator[]( const CppTL::ConstString &key ) const;
# endif
/// Return the member named key if it exist, defaultValue otherwise.
Value get( const char *key,
const Value &defaultValue ) const;
/// Return the member named key if it exist, defaultValue otherwise.
Value get( const std::string &key,
const Value &defaultValue ) const;
# ifdef JSON_USE_CPPTL
/// Return the member named key if it exist, defaultValue otherwise.
Value get( const CppTL::ConstString &key,
const Value &defaultValue ) const;
# endif
/// \brief Remove and return the named member.
///
/// Do nothing if it did not exist.
/// \return the removed Value, or null.
/// \pre type() is objectValue or nullValue
/// \post type() is unchanged
Value removeMember( const char* key );
/// Same as removeMember(const char*)
Value removeMember( const std::string &key );
/// Return true if the object has a member named key.
bool isMember( const char *key ) const;
/// Return true if the object has a member named key.
bool isMember( const std::string &key ) const;
# ifdef JSON_USE_CPPTL
/// Return true if the object has a member named key.
bool isMember( const CppTL::ConstString &key ) const;
# endif
/// \brief Return a list of the member names.
///
/// If null, return an empty list.
/// \pre type() is objectValue or nullValue
/// \post if type() was nullValue, it remains nullValue
Members getMemberNames() const;
//# ifdef JSON_USE_CPPTL
// EnumMemberNames enumMemberNames() const;
// EnumValues enumValues() const;
//# endif
/// Comments must be //... or /* ... */
void setComment( const char *comment,
CommentPlacement placement );
/// Comments must be //... or /* ... */
void setComment( const std::string &comment,
CommentPlacement placement );
bool hasComment( CommentPlacement placement ) const;
/// Include delimiters and embedded newlines.
std::string getComment( CommentPlacement placement ) const;
std::string toStyledString() const;
const_iterator begin() const;
const_iterator end() const;
iterator begin();
iterator end();
private:
Value &resolveReference( const char *key,
bool isStatic );
# ifdef JSON_VALUE_USE_INTERNAL_MAP
inline bool isItemAvailable() const
{
return itemIsUsed_ == 0;
}
inline void setItemUsed( bool isUsed = true )
{
itemIsUsed_ = isUsed ? 1 : 0;
}
inline bool isMemberNameStatic() const
{
return memberNameIsStatic_ == 0;
}
inline void setMemberNameIsStatic( bool isStatic )
{
memberNameIsStatic_ = isStatic ? 1 : 0;
}
# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP
private:
struct CommentInfo
{
CommentInfo();
~CommentInfo();
void setComment( const char *text );
char *comment_;
};
//struct MemberNamesTransform
//{
// typedef const char *result_type;
// const char *operator()( const CZString &name ) const
// {
// return name.c_str();
// }
//};
union ValueHolder
{
LargestInt int_;
LargestUInt uint_;
double real_;
bool bool_;
char *string_;
# ifdef JSON_VALUE_USE_INTERNAL_MAP
ValueInternalArray *array_;
ValueInternalMap *map_;
#else
ObjectValues *map_;
# endif
} value_;
ValueType type_ : 8;
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
# ifdef JSON_VALUE_USE_INTERNAL_MAP
unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
# endif
CommentInfo *comments_;
};
/** \brief Experimental and untested: represents an element of the "path" to access a node.
*/
class PathArgument
{
public:
friend class Path;
PathArgument();
PathArgument( ArrayIndex index );
PathArgument( const char *key );
PathArgument( const std::string &key );
private:
enum Kind
{
kindNone = 0,
kindIndex,
kindKey
};
std::string key_;
ArrayIndex index_;
Kind kind_;
};
/** \brief Experimental and untested: represents a "path" to access a node.
*
* Syntax:
* - "." => root node
* - ".[n]" => elements at index 'n' of root node (an array value)
* - ".name" => member named 'name' of root node (an object value)
* - ".name1.name2.name3"
* - ".[0][1][2].name1[3]"
* - ".%" => member name is provided as parameter
* - ".[%]" => index is provied as parameter
*/
class Path
{
public:
Path( const std::string &path,
const PathArgument &a1 = PathArgument(),
const PathArgument &a2 = PathArgument(),
const PathArgument &a3 = PathArgument(),
const PathArgument &a4 = PathArgument(),
const PathArgument &a5 = PathArgument() );
const Value &resolve( const Value &root ) const;
Value resolve( const Value &root,
const Value &defaultValue ) const;
/// Creates the "path" to access the specified node and returns a reference on the node.
Value &make( Value &root ) const;
private:
typedef std::vector<const PathArgument *> InArgs;
typedef std::vector<PathArgument> Args;
void makePath( const std::string &path,
const InArgs &in );
void addPathInArg( const std::string &path,
const InArgs &in,
InArgs::const_iterator &itInArg,
PathArgument::Kind kind );
void invalidPath( const std::string &path,
int location );
Args args_;
};
#ifdef JSON_VALUE_USE_INTERNAL_MAP
/** \brief Allocator to customize Value internal map.
* Below is an example of a simple implementation (default implementation actually
* use memory pool for speed).
* \code
class DefaultValueMapAllocator : public ValueMapAllocator
{
public: // overridden from ValueMapAllocator
virtual ValueInternalMap *newMap()
{
return new ValueInternalMap();
}
virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
{
return new ValueInternalMap( other );
}
virtual void destructMap( ValueInternalMap *map )
{
delete map;
}
virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
{
return new ValueInternalLink[size];
}
virtual void releaseMapBuckets( ValueInternalLink *links )
{
delete [] links;
}
virtual ValueInternalLink *allocateMapLink()
{
return new ValueInternalLink();
}
virtual void releaseMapLink( ValueInternalLink *link )
{
delete link;
}
};
* \endcode
*/
class JSON_API ValueMapAllocator
{
public:
virtual ~ValueMapAllocator();
virtual ValueInternalMap *newMap() = 0;
virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
virtual void destructMap( ValueInternalMap *map ) = 0;
virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
virtual ValueInternalLink *allocateMapLink() = 0;
virtual void releaseMapLink( ValueInternalLink *link ) = 0;
};
/** \brief ValueInternalMap hash-map bucket chain link (for internal use only).
* \internal previous_ & next_ allows for bidirectional traversal.
*/
class JSON_API ValueInternalLink
{
public:
enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
enum InternalFlags {
flagAvailable = 0,
flagUsed = 1
};
ValueInternalLink();
~ValueInternalLink();
Value items_[itemPerLink];
char *keys_[itemPerLink];
ValueInternalLink *previous_;
ValueInternalLink *next_;
};
/** \brief A linked page based hash-table implementation used internally by Value.
* \internal ValueInternalMap is a tradional bucket based hash-table, with a linked
* list in each bucket to handle collision. There is an addional twist in that
* each node of the collision linked list is a page containing a fixed amount of
* value. This provides a better compromise between memory usage and speed.
*
* Each bucket is made up of a chained list of ValueInternalLink. The last
* link of a given bucket can be found in the 'previous_' field of the following bucket.
* The last link of the last bucket is stored in tailLink_ as it has no following bucket.
* Only the last link of a bucket may contains 'available' item. The last link always
* contains at least one element unless is it the bucket one very first link.
*/
class JSON_API ValueInternalMap
{
friend class ValueIteratorBase;
friend class Value;
public:
typedef unsigned int HashKey;
typedef unsigned int BucketIndex;
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
struct IteratorState
{
IteratorState()
: map_(0)
, link_(0)
, itemIndex_(0)
, bucketIndex_(0)
{
}
ValueInternalMap *map_;
ValueInternalLink *link_;
BucketIndex itemIndex_;
BucketIndex bucketIndex_;
};
# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
ValueInternalMap();
ValueInternalMap( const ValueInternalMap &other );
ValueInternalMap &operator =( const ValueInternalMap &other );
~ValueInternalMap();
void swap( ValueInternalMap &other );
BucketIndex size() const;
void clear();
bool reserveDelta( BucketIndex growth );
bool reserve( BucketIndex newItemCount );
const Value *find( const char *key ) const;
Value *find( const char *key );
Value &resolveReference( const char *key,
bool isStatic );
void remove( const char *key );
void doActualRemove( ValueInternalLink *link,
BucketIndex index,
BucketIndex bucketIndex );
ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
Value &setNewItem( const char *key,
bool isStatic,
ValueInternalLink *link,
BucketIndex index );
Value &unsafeAdd( const char *key,
bool isStatic,
HashKey hashedKey );
HashKey hash( const char *key ) const;
int compare( const ValueInternalMap &other ) const;
private:
void makeBeginIterator( IteratorState &it ) const;
void makeEndIterator( IteratorState &it ) const;
static bool equals( const IteratorState &x, const IteratorState &other );
static void increment( IteratorState &iterator );
static void incrementBucket( IteratorState &iterator );
static void decrement( IteratorState &iterator );
static const char *key( const IteratorState &iterator );
static const char *key( const IteratorState &iterator, bool &isStatic );
static Value &value( const IteratorState &iterator );
static int distance( const IteratorState &x, const IteratorState &y );
private:
ValueInternalLink *buckets_;
ValueInternalLink *tailLink_;
BucketIndex bucketsSize_;
BucketIndex itemCount_;
};
/** \brief A simplified deque implementation used internally by Value.
* \internal
* It is based on a list of fixed "page", each page contains a fixed number of items.
* Instead of using a linked-list, a array of pointer is used for fast item look-up.
* Look-up for an element is as follow:
* - compute page index: pageIndex = itemIndex / itemsPerPage
* - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage]
*
* Insertion is amortized constant time (only the array containing the index of pointers
* need to be reallocated when items are appended).
*/
class JSON_API ValueInternalArray
{
friend class Value;
friend class ValueIteratorBase;
public:
enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
typedef Value::ArrayIndex ArrayIndex;
typedef unsigned int PageIndex;
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
struct IteratorState // Must be a POD
{
IteratorState()
: array_(0)
, currentPageIndex_(0)
, currentItemIndex_(0)
{
}
ValueInternalArray *array_;
Value **currentPageIndex_;
unsigned int currentItemIndex_;
};
# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
ValueInternalArray();
ValueInternalArray( const ValueInternalArray &other );
ValueInternalArray &operator =( const ValueInternalArray &other );
~ValueInternalArray();
void swap( ValueInternalArray &other );
void clear();
void resize( ArrayIndex newSize );
Value &resolveReference( ArrayIndex index );
Value *find( ArrayIndex index ) const;
ArrayIndex size() const;
int compare( const ValueInternalArray &other ) const;
private:
static bool equals( const IteratorState &x, const IteratorState &other );
static void increment( IteratorState &iterator );
static void decrement( IteratorState &iterator );
static Value &dereference( const IteratorState &iterator );
static Value &unsafeDereference( const IteratorState &iterator );
static int distance( const IteratorState &x, const IteratorState &y );
static ArrayIndex indexOf( const IteratorState &iterator );
void makeBeginIterator( IteratorState &it ) const;
void makeEndIterator( IteratorState &it ) const;
void makeIterator( IteratorState &it, ArrayIndex index ) const;
void makeIndexValid( ArrayIndex index );
Value **pages_;
ArrayIndex size_;
PageIndex pageCount_;
};
/** \brief Experimental: do not use. Allocator to customize Value internal array.
* Below is an example of a simple implementation (actual implementation use
* memory pool).
\code
class DefaultValueArrayAllocator : public ValueArrayAllocator
{
public: // overridden from ValueArrayAllocator
virtual ~DefaultValueArrayAllocator()
{
}
virtual ValueInternalArray *newArray()
{
return new ValueInternalArray();
}
virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
{
return new ValueInternalArray( other );
}
virtual void destruct( ValueInternalArray *array )
{
delete array;
}
virtual void reallocateArrayPageIndex( Value **&indexes,
ValueInternalArray::PageIndex &indexCount,
ValueInternalArray::PageIndex minNewIndexCount )
{
ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
if ( minNewIndexCount > newIndexCount )
newIndexCount = minNewIndexCount;
void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
if ( !newIndexes )
throw std::bad_alloc();
indexCount = newIndexCount;
indexes = static_cast<Value **>( newIndexes );
}
virtual void releaseArrayPageIndex( Value **indexes,
ValueInternalArray::PageIndex indexCount )
{
if ( indexes )
free( indexes );
}
virtual Value *allocateArrayPage()
{
return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
}
virtual void releaseArrayPage( Value *value )
{
if ( value )
free( value );
}
};
\endcode
*/
class JSON_API ValueArrayAllocator
{
public:
virtual ~ValueArrayAllocator();
virtual ValueInternalArray *newArray() = 0;
virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
virtual void destructArray( ValueInternalArray *array ) = 0;
/** \brief Reallocate array page index.
* Reallocates an array of pointer on each page.
* \param indexes [input] pointer on the current index. May be \c NULL.
* [output] pointer on the new index of at least
* \a minNewIndexCount pages.
* \param indexCount [input] current number of pages in the index.
* [output] number of page the reallocated index can handle.
* \b MUST be >= \a minNewIndexCount.
* \param minNewIndexCount Minimum number of page the new index must be able to
* handle.
*/
virtual void reallocateArrayPageIndex( Value **&indexes,
ValueInternalArray::PageIndex &indexCount,
ValueInternalArray::PageIndex minNewIndexCount ) = 0;
virtual void releaseArrayPageIndex( Value **indexes,
ValueInternalArray::PageIndex indexCount ) = 0;
virtual Value *allocateArrayPage() = 0;
virtual void releaseArrayPage( Value *value ) = 0;
};
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
/** \brief base class for Value iterators.
*
*/
class ValueIteratorBase
{
public:
typedef unsigned int size_t;
typedef int difference_type;
typedef ValueIteratorBase SelfType;
ValueIteratorBase();
#ifndef JSON_VALUE_USE_INTERNAL_MAP
explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
#else
ValueIteratorBase( const ValueInternalArray::IteratorState &state );
ValueIteratorBase( const ValueInternalMap::IteratorState &state );
#endif
bool operator ==( const SelfType &other ) const
{
return isEqual( other );
}
bool operator !=( const SelfType &other ) const
{
return !isEqual( other );
}
difference_type operator -( const SelfType &other ) const
{
return computeDistance( other );
}
/// Return either the index or the member name of the referenced value as a Value.
Value key() const;
/// Return the index of the referenced Value. -1 if it is not an arrayValue.
UInt index() const;
/// Return the member name of the referenced Value. "" if it is not an objectValue.
const char *memberName() const;
protected:
Value &deref() const;
void increment();
void decrement();
difference_type computeDistance( const SelfType &other ) const;
bool isEqual( const SelfType &other ) const;
void copy( const SelfType &other );
private:
#ifndef JSON_VALUE_USE_INTERNAL_MAP
Value::ObjectValues::iterator current_;
// Indicates that iterator is for a null value.
bool isNull_;
#else
union
{
ValueInternalArray::IteratorState array_;
ValueInternalMap::IteratorState map_;
} iterator_;
bool isArray_;
#endif
};
/** \brief const iterator for object and array value.
*
*/
class ValueConstIterator : public ValueIteratorBase
{
friend class Value;
public:
typedef unsigned int size_t;
typedef int difference_type;
typedef const Value &reference;
typedef const Value *pointer;
typedef ValueConstIterator SelfType;
ValueConstIterator();
private:
/*! \internal Use by Value to create an iterator.
*/
#ifndef JSON_VALUE_USE_INTERNAL_MAP
explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
#else
ValueConstIterator( const ValueInternalArray::IteratorState &state );
ValueConstIterator( const ValueInternalMap::IteratorState &state );
#endif
public:
SelfType &operator =( const ValueIteratorBase &other );
SelfType operator++( int )
{
SelfType temp( *this );
++*this;
return temp;
}
SelfType operator--( int )
{
SelfType temp( *this );
--*this;
return temp;
}
SelfType &operator--()
{
decrement();
return *this;
}
SelfType &operator++()
{
increment();
return *this;
}
reference operator *() const
{
return deref();
}
};
/** \brief Iterator for object and array value.
*/
class ValueIterator : public ValueIteratorBase
{
friend class Value;
public:
typedef unsigned int size_t;
typedef int difference_type;
typedef Value &reference;
typedef Value *pointer;
typedef ValueIterator SelfType;
ValueIterator();
ValueIterator( const ValueConstIterator &other );
ValueIterator( const ValueIterator &other );
private:
/*! \internal Use by Value to create an iterator.
*/
#ifndef JSON_VALUE_USE_INTERNAL_MAP
explicit ValueIterator( const Value::ObjectValues::iterator &current );
#else
ValueIterator( const ValueInternalArray::IteratorState &state );
ValueIterator( const ValueInternalMap::IteratorState &state );
#endif
public:
SelfType &operator =( const SelfType &other );
SelfType operator++( int )
{
SelfType temp( *this );
++*this;
return temp;
}
SelfType operator--( int )
{
SelfType temp( *this );
--*this;
return temp;
}
SelfType &operator--()
{
decrement();
return *this;
}
SelfType &operator++()
{
increment();
return *this;
}
reference operator *() const
{
return deref();
}
};
} // namespace Json
#endif // CPPTL_JSON_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/value.h
// //////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/reader.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef CPPTL_JSON_READER_H_INCLUDED
# define CPPTL_JSON_READER_H_INCLUDED
#if !defined(JSON_IS_AMALGAMATION)
# include "features.h"
# include "value.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
# include <deque>
# include <stack>
# include <string>
# include <iostream>
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
*
*/
class JSON_API Reader
{
public:
typedef char Char;
typedef const Char *Location;
/** \brief Constructs a Reader allowing all features
* for parsing.
*/
Reader();
/** \brief Constructs a Reader allowing the specified feature set
* for parsing.
*/
Reader( const Features &features );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param document UTF-8 encoded string containing the document to read.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const std::string &document,
Value &root,
bool collectComments = true );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read.
* \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read.
\ Must be >= beginDoc.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const char *beginDoc, const char *endDoc,
Value &root,
bool collectComments = true );
/// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&).
bool parse( std::istream &is,
Value &root,
bool collectComments = true );
/** \brief Returns a user friendly string that list errors in the parsed document.
* \return Formatted error message with the list of errors with their location in
* the parsed document. An empty string is returned if no error occurred
* during parsing.
* \deprecated Use getFormattedErrorMessages() instead (typo fix).
*/
JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
std::string getFormatedErrorMessages() const;
/** \brief Returns a user friendly string that list errors in the parsed document.
* \return Formatted error message with the list of errors with their location in
* the parsed document. An empty string is returned if no error occurred
* during parsing.
*/
std::string getFormattedErrorMessages() const;
private:
enum TokenType
{
tokenEndOfStream = 0,
tokenObjectBegin,
tokenObjectEnd,
tokenArrayBegin,
tokenArrayEnd,
tokenString,
tokenNumber,
tokenTrue,
tokenFalse,
tokenNull,
tokenArraySeparator,
tokenMemberSeparator,
tokenComment,
tokenError
};
class Token
{
public:
TokenType type_;
Location start_;
Location end_;
};
class ErrorInfo
{
public:
Token token_;
std::string message_;
Location extra_;
};
typedef std::deque<ErrorInfo> Errors;
bool expectToken( TokenType type, Token &token, const char *message );
bool readToken( Token &token );
void skipSpaces();
bool match( Location pattern,
int patternLength );
bool readComment();
bool readCStyleComment();
bool readCppStyleComment();
bool readString();
void readNumber();
bool readValue();
bool readObject( Token &token );
bool readArray( Token &token );
bool decodeNumber( Token &token );
bool decodeString( Token &token );
bool decodeString( Token &token, std::string &decoded );
bool decodeDouble( Token &token );
bool decodeUnicodeCodePoint( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool decodeUnicodeEscapeSequence( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool addError( const std::string &message,
Token &token,
Location extra = 0 );
bool recoverFromError( TokenType skipUntilToken );
bool addErrorAndRecover( const std::string &message,
Token &token,
TokenType skipUntilToken );
void skipUntilSpace();
Value &currentValue();
Char getNextChar();
void getLocationLineAndColumn( Location location,
int &line,
int &column ) const;
std::string getLocationLineAndColumn( Location location ) const;
void addComment( Location begin,
Location end,
CommentPlacement placement );
void skipCommentTokens( Token &token );
typedef std::stack<Value *> Nodes;
Nodes nodes_;
Errors errors_;
std::string document_;
Location begin_;
Location end_;
Location current_;
Location lastValueEnd_;
Value *lastValue_;
std::string commentsBefore_;
Features features_;
bool collectComments_;
};
/** \brief Read from 'sin' into 'root'.
Always keep comments from the input JSON.
This can be used to read a file into a particular sub-object.
For example:
\code
Json::Value root;
cin >> root["dir"]["file"];
cout << root;
\endcode
Result:
\verbatim
{
"dir": {
"file": {
// The input stream JSON would be nested here.
}
}
}
\endverbatim
\throw std::exception on parse error.
\see Json::operator<<()
*/
std::istream& operator>>( std::istream&, Value& );
} // namespace Json
#endif // CPPTL_JSON_READER_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/reader.h
// //////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/writer.h
// //////////////////////////////////////////////////////////////////////
// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
#ifndef JSON_WRITER_H_INCLUDED
# define JSON_WRITER_H_INCLUDED
#if !defined(JSON_IS_AMALGAMATION)
# include "value.h"
#endif // if !defined(JSON_IS_AMALGAMATION)
# include <vector>
# include <string>
# include <iostream>
namespace Json {
class Value;
/** \brief Abstract class for writers.
*/
class JSON_API Writer
{
public:
virtual ~Writer();
virtual std::string write( const Value &root ) = 0;
};
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
*
* The JSON document is written in a single line. It is not intended for 'human' consumption,
* but may be usefull to support feature such as RPC where bandwith is limited.
* \sa Reader, Value
*/
class JSON_API FastWriter : public Writer
{
public:
FastWriter();
virtual ~FastWriter(){}
void enableYAMLCompatibility();
public: // overridden from Writer
- virtual std::string write( const Value &root );
+ virtual std::string write( const Value &root ) override;
private:
void writeValue( const Value &value );
std::string document_;
bool yamlCompatiblityEnabled_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledWriter: public Writer
{
public:
StyledWriter();
virtual ~StyledWriter(){}
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize.
* \return String containing the JSON document that represents the root value.
*/
- virtual std::string write( const Value &root );
+ virtual std::string write( const Value &root ) override;
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::string document_;
std::string indentString_;
int rightMargin_;
int indentSize_;
bool addChildValues_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
to a stream rather than to a string.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \param indentation Each level will be indented by this amount extra.
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledStreamWriter
{
public:
StyledStreamWriter( std::string indentation="\t" );
~StyledStreamWriter(){}
public:
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param out Stream to write to. (Can be ostringstream, e.g.)
* \param root Value to serialize.
* \note There is no point in deriving from Writer, since write() should not return a value.
*/
void write( std::ostream &out, const Value &root );
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::ostream* document_;
std::string indentString_;
int rightMargin_;
std::string indentation_;
bool addChildValues_;
};
# if defined(JSON_HAS_INT64)
std::string JSON_API valueToString( Int value );
std::string JSON_API valueToString( UInt value );
# endif // if defined(JSON_HAS_INT64)
std::string JSON_API valueToString( LargestInt value );
std::string JSON_API valueToString( LargestUInt value );
std::string JSON_API valueToString( double value );
std::string JSON_API valueToString( bool value );
std::string JSON_API valueToQuotedString( const char *value );
/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
std::ostream& operator<<( std::ostream&, const Value &root );
} // namespace Json
#endif // JSON_WRITER_H_INCLUDED
// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/writer.h
// //////////////////////////////////////////////////////////////////////
#endif //ifndef JSON_AMALGATED_H_INCLUDED
diff --git a/Modules/DICOMReader/include/mitkClassicDICOMSeriesReader.h b/Modules/DICOMReader/include/mitkClassicDICOMSeriesReader.h
index 185e524932..18c1f95341 100644
--- a/Modules/DICOMReader/include/mitkClassicDICOMSeriesReader.h
+++ b/Modules/DICOMReader/include/mitkClassicDICOMSeriesReader.h
@@ -1,83 +1,83 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkClassicDICOMSeriesReader_h
#define mitkClassicDICOMSeriesReader_h
#include "mitkThreeDnTDICOMSeriesReader.h"
#include "MitkDICOMReaderExports.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Sorting and grouping like mitk::DicomSeriesReader until 2013.
This class implements the same functionality as the legacy class DicomSeriesReader,
except that is is 75 lines instead of 2500 lines.
\warning Since the old class is known to have problems with some series,
it is advised to use a good configuration of DICOMITKSeriesGDCMReader,
which can be obtained by using DICOMFileReaderSelector.
The following text documents the actual sorting logic of this reader.
The class groups datasets that have different values in any of the following tags:
- (0028,0010) Number of Rows
- (0028,0011) Number of Columns
- (0028,0030) Pixel Spacing
- (0018,1164) Imager Pixel Spacing
- (0020,0037) %Image Orientation (Patient)
- (0018,0050) Slice Thickness
- (0028,0008) Number of Frames
- (0020,000e) Series Instance UID
Within each of the groups, datasets are sorted by the value of the following tags (primary sorting first):
- (0020,0032) %Image Position (Patient) (distance from zero along normal of (0020,0037) %Image Orientation (Patient))
- (0020,0012) Aqcuisition Number
- (0008,0032) Aqcuisition Time
- (0018,1060) Trigger Time
- (0008,0018) SOP Instance UID (last resort, not really meaningful but decides clearly)
If the series was acquired using a tilted gantry, this will be "fixed" by applying a shear transformation.
If multiple images occupy the same position in space, it is assumed that this indicated a 3D+t image.
*/
class MITKDICOMREADER_EXPORT ClassicDICOMSeriesReader : public ThreeDnTDICOMSeriesReader
{
public:
mitkClassMacro( ClassicDICOMSeriesReader, DICOMITKSeriesGDCMReader );
mitkCloneMacro( ClassicDICOMSeriesReader );
itkNewMacro( ClassicDICOMSeriesReader );
- virtual bool operator==(const DICOMFileReader& other) const;
+ virtual bool operator==(const DICOMFileReader& other) const override;
protected:
ClassicDICOMSeriesReader();
virtual ~ClassicDICOMSeriesReader();
ClassicDICOMSeriesReader(const ClassicDICOMSeriesReader& other);
ClassicDICOMSeriesReader& operator=(const ClassicDICOMSeriesReader& other);
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMDatasetSorter.h b/Modules/DICOMReader/include/mitkDICOMDatasetSorter.h
index f687c96cae..9179f544c9 100644
--- a/Modules/DICOMReader/include/mitkDICOMDatasetSorter.h
+++ b/Modules/DICOMReader/include/mitkDICOMDatasetSorter.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMDatasetSorter_h
#define mitkDICOMDatasetSorter_h
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkDICOMDatasetAccess.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief The sorting/splitting building-block of DICOMITKSeriesGDCMReader.
This class describes the interface of the sorting/splitting process
described as part of DICOMITKSeriesGDCMReader::AnalyzeInputFiles()
(see \ref DICOMITKSeriesGDCMReader_LoadingStrategy).
The prodecure is simple:
- take a list of input datasets (DICOMDatasetAccess)
- sort them (to be defined by sub-classes, based on specific tags)
- return the sorting result as outputs (the single input might be distributed into multiple outputs)
The simplest and most generic form of sorting is implemented in
sub-class DICOMTagBasedSorter.
*/
class MITKDICOMREADER_EXPORT DICOMDatasetSorter : public itk::LightObject
{
public:
- mitkClassMacro( DICOMDatasetSorter, itk::LightObject )
+ mitkClassMacroItkParent( DICOMDatasetSorter, itk::LightObject )
/**
\brief Return the tags of interest (to facilitate scanning)
*/
virtual DICOMTagList GetTagsOfInterest() = 0;
/// \brief Input for sorting
void SetInput(DICOMDatasetList filenames);
/// \brief Input for sorting
const DICOMDatasetList& GetInput() const;
/// \brief Sort input datasets into one or multiple outputs.
virtual void Sort() = 0;
/// \brief Output of the sorting process.
unsigned int GetNumberOfOutputs() const;
/// \brief Output of the sorting process.
const DICOMDatasetList& GetOutput(unsigned int index) const;
/// \brief Output of the sorting process.
DICOMDatasetList& GetOutput(unsigned int index);
/// \brief Print configuration details into stream.
virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const = 0;
virtual bool operator==(const DICOMDatasetSorter& other) const = 0;
protected:
DICOMDatasetSorter();
virtual ~DICOMDatasetSorter();
DICOMDatasetSorter(const DICOMDatasetSorter& other);
DICOMDatasetSorter& operator=(const DICOMDatasetSorter& other);
void ClearOutputs();
void SetNumberOfOutputs(unsigned int numberOfOutputs);
void SetOutput(unsigned int index, const DICOMDatasetList& output);
private:
DICOMDatasetList m_Input;
std::vector< DICOMDatasetList > m_Outputs;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMFileReader.h b/Modules/DICOMReader/include/mitkDICOMFileReader.h
index b7b0ac62c3..aa8e89e7fa 100644
--- a/Modules/DICOMReader/include/mitkDICOMFileReader.h
+++ b/Modules/DICOMReader/include/mitkDICOMFileReader.h
@@ -1,135 +1,135 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMFileReader_h
#define mitkDICOMFileReader_h
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "MitkDICOMReaderExports.h"
#include "mitkDICOMTagCache.h"
#include "mitkDICOMImageBlockDescriptor.h"
namespace mitk
{
// TODO Philips3D!
// TODO http://bugs.mitk.org/show_bug.cgi?id=11572 ?
/**
\ingroup DICOMReaderModule
\brief Interface for DICOM readers that produce mitk::Images.
As described in \ref DICOMReaderModule, this class structures
the reader's part in the process of analyzing a set of DICOM files
and selecting the most appropriate reader.
The overall loading process is as follows:
- <b>Define input files</b>: a list of absolute filenames
- <b>Analyze the potential output</b>: see what can be made of the input files, describe with DICOMImageBlockDescriptor%s
- <b>Load pixel data</b>: an application will usually analyze files using multiple readers and only load with a single reader
Sub-classes are required to implement a number of methods that
reflect above structure. See mitk::DICOMITKSeriesGDCMReader for
an example.
To help applications in describing different readers to the user, each reader
brings a number of methods that describe its configuration/specifics by
means of a short label and a (longer) description.
*/
class MITKDICOMREADER_EXPORT DICOMFileReader : public itk::Object
{
public:
- mitkClassMacro( DICOMFileReader, itk::Object );
+ mitkClassMacroItkParent( DICOMFileReader, itk::Object );
/// Test whether a file is DICOM at all
static bool IsDICOM(const std::string& filename);
/// Indicate whether this reader can handle given file
virtual bool CanHandleFile(const std::string& filename) = 0;
/// This input files
void SetInputFiles(StringList filenames);
/// This input files
const StringList& GetInputFiles() const;
/// Analyze input files
virtual void AnalyzeInputFiles() = 0;
/// Number of outputs, only meaningful after calling AnalyzeInputFiles()
unsigned int GetNumberOfOutputs() const;
/// Individual outputs, only meaningful after calling AnalyzeInputFiles(). \throws std::invalid_argument
const DICOMImageBlockDescriptor& GetOutput(unsigned int index) const;
// void AllocateOutputImages(); TODO for later implementation of slice-by-slice loading
/// Load the mitk::Image%s in our outputs, the DICOMImageBlockDescriptor. To be called only after AnalyzeInputFiles(). Take care of potential exceptions!
virtual bool LoadImages() = 0;
virtual DICOMTagList GetTagsOfInterest() const = 0;
/// A way to provide external knowledge about files and tag values is appreciated.
virtual void SetTagCache(DICOMTagCache::Pointer) = 0;
/// Short label/name to describe this reader
void SetConfigurationLabel(const std::string&);
/// Short label/name to describe this reader
std::string GetConfigurationLabel() const;
/// One-sentence description of the reader's loading "strategy"
void SetConfigurationDescription(const std::string&);
/// One-sentence description of the reader's loading "strategy"
std::string GetConfigurationDescription() const;
/// Print configuration description to given stream, for human reader
void PrintConfiguration(std::ostream& os) const;
/// Print output description to given stream, for human reader
void PrintOutputs(std::ostream& os, bool filenameDetails = false) const;
virtual bool operator==(const DICOMFileReader& other) const = 0;
protected:
DICOMFileReader();
virtual ~DICOMFileReader();
DICOMFileReader(const DICOMFileReader& other);
DICOMFileReader& operator=(const DICOMFileReader& other);
void ClearOutputs();
void SetNumberOfOutputs(unsigned int numberOfOutputs);
void SetOutput(unsigned int index, const DICOMImageBlockDescriptor& output);
/// non-const access to the DICOMImageBlockDescriptor
DICOMImageBlockDescriptor& InternalGetOutput(unsigned int index);
/// Configuration description for human reader, to be implemented by sub-classes
virtual void InternalPrintConfiguration(std::ostream& os) const = 0;
private:
StringList m_InputFilenames;
std::vector< DICOMImageBlockDescriptor > m_Outputs;
std::string m_ConfigLabel;
std::string m_ConfigDescription;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMFileReaderSelector.h b/Modules/DICOMReader/include/mitkDICOMFileReaderSelector.h
index 87742d94f5..de06a05006 100644
--- a/Modules/DICOMReader/include/mitkDICOMFileReaderSelector.h
+++ b/Modules/DICOMReader/include/mitkDICOMFileReaderSelector.h
@@ -1,104 +1,104 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMFileReaderSelector_h
#define mitkDICOMFileReaderSelector_h
#include "mitkDICOMFileReader.h"
#include <usModuleResource.h>
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Simple best-reader selection.
This class implements a process of comparing different DICOMFileReader%s and selecting
the reader with the minimal number of mitk::Image%s in its output.
The code found in this class can
- just be used to select a reader using this simple strategy
- be taken as an example of how to use DICOMFileReader%s
To create a selection of potential readers, the class makes use
of mitk::DICOMReaderConfigurator, i.e. DICOMFileReaderSelector
also expects the configuration files/strings to be in the format
expected by mitk::DICOMReaderConfigurator.
Two convenience methods load "default" configurations from
compiled-in resources: LoadBuiltIn3DConfigs() and LoadBuiltIn3DnTConfigs().
*/
class MITKDICOMREADER_EXPORT DICOMFileReaderSelector : public itk::LightObject
{
public:
typedef std::list<DICOMFileReader::Pointer> ReaderList;
- mitkClassMacro( DICOMFileReaderSelector, itk::LightObject )
+ mitkClassMacroItkParent( DICOMFileReaderSelector, itk::LightObject )
itkNewMacro( DICOMFileReaderSelector )
/// \brief Add a configuration as expected by DICOMReaderConfigurator.
/// Configs can only be reset by instantiating a new DICOMFileReaderSelector.
void AddConfig(const std::string& xmlDescription);
/// \brief Add a configuration as expected by DICOMReaderConfigurator.
/// Configs can only be reset by instantiating a new DICOMFileReaderSelector.
void AddConfigFile(const std::string& filename);
/// \brief Add a whole pre-configured reader to the selection process.
void AddFileReaderCanditate(DICOMFileReader::Pointer reader);
/// \brief Load 3D image creating configurations from the MITK module system (see \ref mitk::Module::FindResources).
/// For a default set of configurations, look into the directory Resources of the DICOMReader module.
void LoadBuiltIn3DConfigs();
/// \brief Load 3D+t image creating configurations from the MITK module system (see \ref mitk::Module::FindResources).
/// For a default set of configurations, look into the directory Resources of the DICOMReader module.
void LoadBuiltIn3DnTConfigs();
/// \brief Return all the DICOMFileReader%s that are currently used for selection by this class.
/// The readers returned by this method depend on what config files have been added earlier
/// (or which of the built-in readers have been loaded)
ReaderList GetAllConfiguredReaders() const;
/// Input files
void SetInputFiles(StringList filenames);
/// Input files
const StringList& GetInputFiles() const;
/// Execute the analysis and selection process. The first reader with a minimal number of outputs will be returned.
DICOMFileReader::Pointer GetFirstReaderWithMinimumNumberOfOutputImages();
protected:
DICOMFileReaderSelector();
virtual ~DICOMFileReaderSelector();
void AddConfigsFromResources(const std::string& path);
void AddConfigFromResource(const std::string& resourcename);
void AddConfigFromResource(us::ModuleResource& resource);
private:
StringList m_PossibleConfigurations;
StringList m_InputFilenames;
ReaderList m_Readers;
};
} // namespace
#endif // mitkDICOMFileReaderSelector_h
diff --git a/Modules/DICOMReader/include/mitkDICOMGDCMImageFrameInfo.h b/Modules/DICOMReader/include/mitkDICOMGDCMImageFrameInfo.h
index ee0f708f9a..07d21bd2ea 100644
--- a/Modules/DICOMReader/include/mitkDICOMGDCMImageFrameInfo.h
+++ b/Modules/DICOMReader/include/mitkDICOMGDCMImageFrameInfo.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMGDCMImageFrameInfo_h
#define mitkDICOMGDCMImageFrameInfo_h
#include "mitkDICOMImageFrameInfo.h"
#include "mitkDICOMDatasetAccess.h"
#include "gdcmScanner.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief The dataset access implementation for DICOMITKSeriesGDCMReader, based on GDCM.
This class combines a DICOMImageFrameInfo object with the scanning results
from gdcm::Scanner. The scanning results will be used to implement the tag
access methods of DICOMDatasetAccess.
*/
class MITKDICOMREADER_EXPORT DICOMGDCMImageFrameInfo : public itk::LightObject, public DICOMDatasetAccess
{
public:
- mitkClassMacro(DICOMGDCMImageFrameInfo, itk::LightObject);
+ mitkClassMacroItkParent(DICOMGDCMImageFrameInfo, itk::LightObject);
itkNewMacro( DICOMGDCMImageFrameInfo );
mitkNewMacro1Param( DICOMGDCMImageFrameInfo, const std::string&);
mitkNewMacro2Param( DICOMGDCMImageFrameInfo, const std::string&, unsigned int );
mitkNewMacro1Param( DICOMGDCMImageFrameInfo, DICOMImageFrameInfo::Pointer);
mitkNewMacro2Param( DICOMGDCMImageFrameInfo, DICOMImageFrameInfo::Pointer, gdcm::Scanner::TagToValue const&);
virtual ~DICOMGDCMImageFrameInfo();
- virtual std::string GetTagValueAsString(const DICOMTag&) const;
+ virtual std::string GetTagValueAsString(const DICOMTag&) const override;
- std::string GetFilenameIfAvailable() const;
+ std::string GetFilenameIfAvailable() const override;
/// The frame that this objects refers to
DICOMImageFrameInfo::Pointer GetFrameInfo() const;
/// The frame that this objects refers to
void SetFrameInfo(DICOMImageFrameInfo::Pointer frameinfo);
protected:
DICOMImageFrameInfo::Pointer m_FrameInfo;
DICOMGDCMImageFrameInfo(DICOMImageFrameInfo::Pointer frameinfo);
DICOMGDCMImageFrameInfo(DICOMImageFrameInfo::Pointer frameinfo, gdcm::Scanner::TagToValue const& tagToValueMapping);
DICOMGDCMImageFrameInfo(const std::string& filename = "", unsigned int frameNo = 0);
const gdcm::Scanner::TagToValue m_TagForValue;
};
typedef std::vector<DICOMGDCMImageFrameInfo::Pointer> DICOMGDCMImageFrameList;
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMGDCMTagScanner.h b/Modules/DICOMReader/include/mitkDICOMGDCMTagScanner.h
index 9a0d73a2a3..e5d7df8819 100644
--- a/Modules/DICOMReader/include/mitkDICOMGDCMTagScanner.h
+++ b/Modules/DICOMReader/include/mitkDICOMGDCMTagScanner.h
@@ -1,106 +1,106 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMGDCMTagScanner_h
#define mitkDICOMGDCMTagScanner_h
#include "mitkDICOMTagCache.h"
#include "mitkDICOMEnums.h"
#include "mitkDICOMGDCMImageFrameInfo.h"
#include <gdcmScanner.h>
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Encapsulates the tag scanning process for a set of DICOM files.
Formerly integrated as a part of DICOMITKSeriesGDCMReader, the tag
scanning part has been factored out into this DICOMGDCMTagScanner class
in order to allow a single scan for multiple reader alternatives. This
helps much in the selection process of e.g. DICOMFileReaderSelector.
The class works similar to gdcm::Scanner, just with the MITK set of classes:
- add a number of DICOM tags that should be read
- set a list of files that should be scanned for named tags
- call Scan()
- retrieve the scan results
- via GetFrameInfoList() or
- via GetTagValue()
When used in a process where multiple classes will access the scan
results, care should be taken that all the tags and files of interst
are communicated to DICOMGDCMTagScanner before requesting the results!
*/
class MITKDICOMREADER_EXPORT DICOMGDCMTagScanner : public DICOMTagCache
{
public:
mitkClassMacro( DICOMGDCMTagScanner, DICOMTagCache );
itkNewMacro( DICOMGDCMTagScanner );
/**
\brief Add this tag to the scanning process.
*/
virtual void AddTag(const DICOMTag& tag);
/**
\brief Add a list of tags to the scanning process.
*/
virtual void AddTags(const DICOMTagList& tags);
/**
\brief Define the list of files to scan.
This does not ADD to an internal list, but it replaces the
whole list of files.
*/
virtual void SetInputFiles(const StringList& filenames);
/**
\brief Start the scanning process.
Calling Scan() will invalidate previous scans, forgetting
all about files and tags from files that have been scanned
previously.
*/
virtual void Scan();
/**
\brief Retrieve a result list for file-by-file tag access.
*/
virtual DICOMGDCMImageFrameList GetFrameInfoList() const;
/**
\brief Directly retrieve the tag value for a given frame and tag.
*/
- virtual std::string GetTagValue(DICOMImageFrameInfo* frame, const DICOMTag& tag) const;
+ virtual std::string GetTagValue(DICOMImageFrameInfo* frame, const DICOMTag& tag) const override;
protected:
DICOMGDCMTagScanner();
DICOMGDCMTagScanner(const DICOMGDCMTagScanner&);
virtual ~DICOMGDCMTagScanner();
std::set<DICOMTag> m_ScannedTags;
gdcm::Scanner m_GDCMScanner;
StringList m_InputFilenames;
DICOMGDCMImageFrameList m_ScanResult;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMITKSeriesGDCMReader.h b/Modules/DICOMReader/include/mitkDICOMITKSeriesGDCMReader.h
index 1e81995e72..582608cbdd 100644
--- a/Modules/DICOMReader/include/mitkDICOMITKSeriesGDCMReader.h
+++ b/Modules/DICOMReader/include/mitkDICOMITKSeriesGDCMReader.h
@@ -1,356 +1,356 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMITKSeriesGDCMReader_h
#define mitkDICOMITKSeriesGDCMReader_h
#include "mitkDICOMFileReader.h"
#include "mitkDICOMDatasetSorter.h"
#include "mitkDICOMGDCMImageFrameInfo.h"
#include "mitkEquiDistantBlocksSorter.h"
#include "mitkNormalDirectionConsistencySorter.h"
#include "mitkITKDICOMSeriesReaderHelper.h"
#include "MitkDICOMReaderExports.h"
#include <stack>
namespace itk
{
class TimeProbesCollectorBase;
}
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT, MR, PET, CR, etc.
Implements the loading processed as structured by DICOMFileReader offers configuration
of its loading strategy.
Documentation sections:
- \ref DICOMITKSeriesGDCMReader_LoadingStrategy
- \ref DICOMITKSeriesGDCMReader_ForcedConfiguration
- \ref DICOMITKSeriesGDCMReader_UserConfiguration
- \ref DICOMITKSeriesGDCMReader_GantryTilt
- \ref DICOMITKSeriesGDCMReader_Testing
- \ref DICOMITKSeriesGDCMReader_Internals
- \ref DICOMITKSeriesGDCMReader_RelatedClasses
- \ref DICOMITKSeriesGDCMReader_TiltInternals
- \ref DICOMITKSeriesGDCMReader_Condensing
\section DICOMITKSeriesGDCMReader_LoadingStrategy Loading strategy
The set of input files is processed by a number of DICOMDatasetSorter objects which may do two sort of things:
1. split a list of input frames into multiple lists, based on DICOM tags such as "Rows", "Columns", which cannot be mixed within a single mitk::Image
2. sort the frames within the input lists, based on the values of DICOM tags such as "Image Position Patient"
When the DICOMITKSeriesGDCMReader is configured with DICOMDatasetSorter%s, the list of input files is processed
as follows:
1. build an initial set of output groups, simply by grouping all input files.
2. for each configured DICOMDatasetSorter, process:
- for each output group:
1. set this group's files as input to the sorter
2. let the sorter sort (and split)
3. integrate the sorter's output groups with our own output groups
\section DICOMITKSeriesGDCMReader_ForcedConfiguration Forced Configuration
In all cases, the reader will add two DICOMDatasetSorter objects that are required to load
mitk::Images properly via itk::ImageSeriesReader:
1. As a \b first step, the input files will be split into groups that are not compatible because they differ in essential aspects:
- (0028,0010) Number of Rows
- (0028,0011) Number of Columns
- (0028,0030) Pixel Spacing
- (0018,1164) Imager Pixel Spacing
- (0020,0037) %Image Orientation (Patient)
- (0018,0050) Slice Thickness
- (0028,0008) Number of Frames
2. As are two forced \b last steps:
1. There will always be an instance of EquiDistantBlocksSorter,
which ensures that there is an equal distance between all the frames of an Image.
This is required to achieve correct geometrical positions in the mitk::Image,
i.e. it is essential to be able to make measurements in images.
- whether or not the distance is required to be orthogonal to the image planes is configured by SetFixTiltByShearing().
- during this check, we need to tolerate some minor errors in documented vs. calculated image origins.
The amount of tolerance can be adjusted by SetToleratedOriginOffset() and SetToleratedOriginOffsetToAdaptive().
Please see EquiDistantBlocksSorter for more details. The default should be good for most cases.
2. There is always an instance of NormalDirectionConsistencySorter,
which makes the order of images go along the image normals (see NormalDirectionConsistencySorter)
\section DICOMITKSeriesGDCMReader_UserConfiguration User Configuration
The user of this class can add more sorting steps (similar to the one described in above section) by calling AddSortingElement().
Usually, an application will add sorting by "Image Position Patient", by "Instance Number", and by other relevant tags here.
\section DICOMITKSeriesGDCMReader_GantryTilt Gantry tilt handling
When CT gantry tilt is used, the gantry plane (= X-Ray source and detector ring) and the vertical plane do not align
anymore. This scanner feature is used for example to reduce metal artifacs (e.g. <i>Lee C , Evaluation of Using CT
Gantry Tilt Scan on Head and Neck Cancer Patients with Dental Structure: Scans Show Less Metal Artifacts. Presented
at: Radiological Society of North America 2011 Scientific Assembly and Annual Meeting; November 27- December 2,
2011 Chicago IL.</i>).
The acquired planes of such CT series do not match the expectations of a orthogonal geometry in mitk::Image: if you
stack the slices, they show a small shift along the Y axis:
\verbatim
without tilt with tilt
|||||| //////
|||||| //////
-- |||||| --------- ////// -------- table orientation
|||||| //////
|||||| //////
Stacked slices:
without tilt with tilt
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
\endverbatim
As such gemetries do not "work" in conjunction with mitk::Image, DICOMITKSeriesGDCMReader is able to perform a correction for such series.
Whether or not such correction should be attempted is controlled by SetFixTiltByShearing(), the default being correction.
For details, see "Internals" below.
\section DICOMITKSeriesGDCMReader_Testing Testing
A number of tests is implemented in module DICOMTesting, which is documented at \ref DICOMTesting.
\section DICOMITKSeriesGDCMReader_Internals Class internals
Internally, the class is based on GDCM and it depends heavily on the gdcm::Scanner class.
Since the sorting elements (see DICOMDatasetSorter and DICOMSortCriterion) can access tags only via the DICOMDatasetAccess interface,
BUT DICOMITKSeriesGDCMReader holds a list of more specific classes DICOMGDCMImageFrameInfo, we must convert between the two
types sometimes. This explains the methods ToDICOMDatasetList(), FromDICOMDatasetList().
The intermediate result of all the sorting efforts is held in m_SortingResultInProgress,
which is modified through InternalExecuteSortingStep().
\subsection DICOMITKSeriesGDCMReader_RelatedClasses Overview of related classes
The following diagram gives an overview of the related classes:
\image html implementeditkseriesgdcmreader.jpg
\subsection DICOMITKSeriesGDCMReader_TiltInternals Details about the tilt correction
The gantry tilt "correction" algorithm fixes two errors introduced by ITK's ImageSeriesReader:
- the plane shift that is ignored by ITK's reader is recreated by applying a shearing transformation using itk::ResampleFilter.
- the spacing is corrected (it is calculated by ITK's reader from the distance between two origins, which is NOT the slice distance in this special case)
Both errors are introduced in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
For the correction, we examine two consecutive slices of a series, both described as a pair (origin/orientation):
- we calculate if the first origin is on a line along the normal of the second slice
- if this is not the case, the geometry will not fit a normal mitk::Image/mitk::Geometry3D
- we then project the second origin into the first slice's coordinate system to quantify the shift
- both is done in class GantryTiltInformation with quite some comments.
The geometry of image stacks with tilted geometries is illustrated below:
- green: the DICOM images as described by their tags: origin as a point with the line indicating the orientation
- red: the output of ITK ImageSeriesReader: wrong, larger spacing, no tilt
- blue: how much a shear must correct
\image html tilt-correction.jpg
\subsection DICOMITKSeriesGDCMReader_Condensing Sub-classes can condense multiple blocks into a single larger block
The sorting/splitting process described above is helpful for at least two more DICOM readers, which either try to load 3D+t images or which load diffusion data.
In both cases, a single pixel of the mitk::Image is made up of multiple values, in one case values over time, in the other case multiple measurements of a single point.
The specialized readers for these cases (e.g. ThreeDnTDICOMSeriesReader) can reuse most of the methods in DICOMITKSeriesGDCMReader,
except that they need an extra step after the usual sorting, in which they can merge already grouped 3D blocks. What blocks are merged
depends on the specialized reader's understanding of these images. To allow for such merging, a method Condense3DBlocks() is called
as an absolute last step of AnalyzeInputFiles(). Given this, a sub-class could implement only LoadImages() and Condense3DBlocks() instead
repeating most of AnalyzeInputFiles().
*/
class MITKDICOMREADER_EXPORT DICOMITKSeriesGDCMReader : public DICOMFileReader
{
public:
mitkClassMacro( DICOMITKSeriesGDCMReader, DICOMFileReader );
mitkCloneMacro( DICOMITKSeriesGDCMReader );
itkNewMacro( DICOMITKSeriesGDCMReader );
mitkNewMacro1Param( DICOMITKSeriesGDCMReader, unsigned int );
/**
\brief Runs the sorting / splitting process described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy.
Method required by DICOMFileReader.
*/
- virtual void AnalyzeInputFiles();
+ virtual void AnalyzeInputFiles() override;
// void AllocateOutputImages();
/**
\brief Loads images using itk::ImageSeriesReader, potentially applies shearing to correct gantry tilt.
*/
- virtual bool LoadImages();
+ virtual bool LoadImages() override;
// re-implemented from super-class
- virtual bool CanHandleFile(const std::string& filename);
+ virtual bool CanHandleFile(const std::string& filename) override;
/**
\brief Add an element to the sorting procedure described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy.
*/
virtual void AddSortingElement(DICOMDatasetSorter* sorter, bool atFront = false);
typedef const std::list<DICOMDatasetSorter::ConstPointer> ConstSorterList;
ConstSorterList GetFreelyConfiguredSortingElements() const;
/**
\brief Controls whether to "fix" tilted acquisitions by shearing the output (see \ref DICOMITKSeriesGDCMReader_GantryTilt).
*/
void SetFixTiltByShearing(bool on);
bool GetFixTiltByShearing() const;
/**
\brief Controls whether groups of only two images are accepted when ensuring consecutive slices via EquiDistantBlocksSorter.
*/
void SetAcceptTwoSlicesGroups(bool accept);
bool GetAcceptTwoSlicesGroups() const;
/**
\brief See \ref DICOMITKSeriesGDCMReader_ForcedConfiguration.
*/
void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct = 0.3);
/**
\brief See \ref DICOMITKSeriesGDCMReader_ForcedConfiguration.
*/
void SetToleratedOriginOffset(double millimeters = 0.005);
double GetToleratedOriginError() const;
bool IsToleratedOriginOffsetAbsolute() const;
double GetDecimalPlacesForOrientation() const;
- virtual bool operator==(const DICOMFileReader& other) const;
+ virtual bool operator==(const DICOMFileReader& other) const override;
- virtual DICOMTagList GetTagsOfInterest() const;
+ virtual DICOMTagList GetTagsOfInterest() const override;
protected:
- virtual void InternalPrintConfiguration(std::ostream& os) const;
+ virtual void InternalPrintConfiguration(std::ostream& os) const override;
/// \brief Return active C locale
std::string GetActiveLocale() const;
/**
\brief Remember current locale on stack, activate "C" locale.
"C" locale is required for correct parsing of numbers by itk::ImageSeriesReader
*/
void PushLocale() const;
/**
\brief Activate last remembered locale from locale stack
"C" locale is required for correct parsing of numbers by itk::ImageSeriesReader
*/
void PopLocale() const;
DICOMITKSeriesGDCMReader(unsigned int decimalPlacesForOrientation = 5);
virtual ~DICOMITKSeriesGDCMReader();
DICOMITKSeriesGDCMReader(const DICOMITKSeriesGDCMReader& other);
DICOMITKSeriesGDCMReader& operator=(const DICOMITKSeriesGDCMReader& other);
/// \brief See \ref DICOMITKSeriesGDCMReader_Internals
DICOMDatasetList ToDICOMDatasetList(const DICOMGDCMImageFrameList& input);
/// \brief See \ref DICOMITKSeriesGDCMReader_Internals
DICOMGDCMImageFrameList FromDICOMDatasetList(const DICOMDatasetList& input);
/// \brief See \ref DICOMITKSeriesGDCMReader_Internals
DICOMImageFrameList ToDICOMImageFrameList(const DICOMGDCMImageFrameList& input);
typedef std::list<DICOMGDCMImageFrameList> SortingBlockList;
/**
\brief "Hook" for sub-classes, see \ref DICOMITKSeriesGDCMReader_Condensing
\return REMAINING blocks
*/
virtual SortingBlockList Condense3DBlocks(SortingBlockList& resultOf3DGrouping);
virtual DICOMTagCache::Pointer GetTagCache() const;
- void SetTagCache(DICOMTagCache::Pointer);
+ void SetTagCache(DICOMTagCache::Pointer) override;
/// \brief Sorting step as described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy
SortingBlockList InternalExecuteSortingStep(
unsigned int sortingStepIndex,
DICOMDatasetSorter::Pointer sorter,
const SortingBlockList& input);
/// \brief Loads the mitk::Image by means of an itk::ImageSeriesReader
virtual bool LoadMitkImageForOutput(unsigned int o);
virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const;
/**
\brief Shear the loaded mitk::Image to "correct" a spatial error introduced by itk::ImageSeriesReader
See \ref DICOMITKSeriesGDCMReader_GantryTilt for details.
*/
Image::Pointer FixupSpacing(Image* mitkImage, const DICOMImageBlockDescriptor& block) const;
/// \brief Describe this reader's confidence for given SOP class UID
ReaderImplementationLevel GetReaderImplementationLevel(const std::string sopClassUID) const;
private:
/// \brief Creates the required sorting steps described in \ref DICOMITKSeriesGDCMReader_ForcedConfiguration
void EnsureMandatorySortersArePresent(unsigned int decimalPlacesForOrientation);
protected:
// NOT nice, made available to ThreeDnTDICOMSeriesReader due to lack of time
bool m_FixTiltByShearing; // could be removed by ITKDICOMSeriesReader NOT flagging tilt unless requested to fix it!
private:
SortingBlockList m_SortingResultInProgress;
typedef std::list<DICOMDatasetSorter::Pointer> SorterList;
SorterList m_Sorter;
protected:
// NOT nice, made available to ThreeDnTDICOMSeriesReader and ClassicDICOMSeriesReader due to lack of time
mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter;
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter;
private:
mutable std::stack<std::string> m_ReplacedCLocales;
mutable std::stack<std::locale> m_ReplacedCinLocales;
double m_DecimalPlacesForOrientation;
DICOMTagCache::Pointer m_TagCache;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMImageFrameInfo.h b/Modules/DICOMReader/include/mitkDICOMImageFrameInfo.h
index 2e38057930..a6898f1773 100644
--- a/Modules/DICOMReader/include/mitkDICOMImageFrameInfo.h
+++ b/Modules/DICOMReader/include/mitkDICOMImageFrameInfo.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMImageFrameInfo_h
#define mitkDICOMImageFrameInfo_h
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "MitkDICOMReaderExports.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Describes a frame within a DICOM file.
This is a minimal data structure to describe a single frame
(think of DICOM multi-frame classes) within a DICOM file.
To be used by DICOMFileReader%s and as part of DICOMImageBlockDescriptor.
*/
class MITKDICOMREADER_EXPORT DICOMImageFrameInfo : public itk::LightObject
{
public:
/// absolute filename
std::string Filename;
/// frame number, starting with 0
unsigned int FrameNo;
- mitkClassMacro( DICOMImageFrameInfo, itk::LightObject )
+ mitkClassMacroItkParent( DICOMImageFrameInfo, itk::LightObject )
itkNewMacro( DICOMImageFrameInfo );
mitkNewMacro1Param( DICOMImageFrameInfo, const std::string&);
mitkNewMacro2Param( DICOMImageFrameInfo, const std::string&, unsigned int );
bool operator==(const DICOMImageFrameInfo& other) const;
protected:
DICOMImageFrameInfo(const std::string& filename = "", unsigned int frameNo = 0);
};
typedef std::vector<DICOMImageFrameInfo::Pointer> DICOMImageFrameList;
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMReaderConfigurator.h b/Modules/DICOMReader/include/mitkDICOMReaderConfigurator.h
index 8219445281..9c88d6bd31 100644
--- a/Modules/DICOMReader/include/mitkDICOMReaderConfigurator.h
+++ b/Modules/DICOMReader/include/mitkDICOMReaderConfigurator.h
@@ -1,143 +1,143 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMReaderConfigurator_h
#define mitkDICOMReaderConfigurator_h
#include "mitkClassicDICOMSeriesReader.h"
#include "mitkDICOMTagBasedSorter.h"
// to put into private implementation
#include "tinyxml.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Too-simple factory to create DICOMFileReader%s.
This class is able to instantiate and configure (where possible) DICOMFileReader%s from XML descriptions.
\note This is a bad factory example, because the factory is not extensible and needs to know all the specific readers. A flexible implementation should be provided in a future version.
In its current version, the XML input is meant to be structured like
\verbatim
<?xml version="1.0" standalone=no>
<DICOMFileReader
label="Example Reader"
description="Sort images by example tags"
class="DICOMITKSeriesGDCMReader"
fixTiltByShearing="true">
<Distinguishing>
<Tag name="SeriesInstanceUID" group="0020" element="000e"/>
<Tag name="SeriesNumber" group="0020" element="0011"/>
</Distinguishing>
<Sorting>
<ImagePositionPatient/>
<Tag name="SOPInstanceUID" group="0x0008" element="0x0018"/>
</Sorting>
</DICOMFileReader>
\endverbatim
The root-tag \i <DICOMFileReader> names the class to be instantiated, currently this can be one of
- DICOMITKSeriesGDCMReader
- ThreeDnTDICOMSeriesReader
Both classes bring simple configuration flags with them and a description of how images are sorted prior to loading.
Flag for DICOMITKSeriesGDCMReader:
<pre>fixTiltByShearing="true|false"</pre>
Determines whether a potential gantry tilt should be "fixed" by shearing the output image.
Flag for ThreeDnTDICOMSeriesReader:
<pre>group3DnT="true|false"</pre>
Determines whether images at the same spatial position should be interpreted as 3D+t images.
The tags <Distinguishing> and <Sorting> describe the basic loading strategy of both
reader mentioned above: first images are divided into incompatible groups (<Distinguishing>),
and afterwards the images within each group are sorted by means of DICOMSortCriterion, which
most commonly mentions a tag.
Tag element and group are interpreted as the exadecimal numbers
found all around the DICOM standard. The numbers can be prepended by a "0x" if this is preferred
by the programmer (but they are taken as hexadecimal in all cases).
\section DICOMReaderConfigurator_AboutTheFuture About the future evolution of this class
This first version is hard coded for the current state of the implementation.
If things should evolve in a way that needs us to splitt off readers for "old" versions,
time should be taken to refactor this class.
Basically, a serializer class should accompany each of the configurable classes. Such
serializer classes should be registered and discovered via micro-services (to support extensions).
A serializer should offer both methods to serialize a class and to desirialize it again.
A "version" attribute at the top-level tag should be used to distinguish versions.
Usually it should be enough to keep DE-serializers for all versions. Writers for the most
recent version should be enough.
*/
class MITKDICOMREADER_EXPORT DICOMReaderConfigurator : public itk::LightObject
{
public:
- mitkClassMacro( DICOMReaderConfigurator, itk::LightObject )
+ mitkClassMacroItkParent( DICOMReaderConfigurator, itk::LightObject )
itkNewMacro( DICOMReaderConfigurator )
DICOMFileReader::Pointer CreateFromConfigFile(const std::string& filename) const;
DICOMFileReader::Pointer CreateFromUTF8ConfigString(const std::string& xmlContents) const;
std::string CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const;
protected:
DICOMReaderConfigurator();
virtual ~DICOMReaderConfigurator();
private:
DICOMFileReader::Pointer CreateFromTiXmlDocument(TiXmlDocument& doc) const;
DICOMTag tagFromXMLElement(TiXmlElement*) const;
std::string requiredStringAttribute(TiXmlElement* xmlElement, const std::string& key) const;
unsigned int hexStringToUInt(const std::string& s) const;
ThreeDnTDICOMSeriesReader::Pointer ConfigureThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, TiXmlElement*) const;
DICOMITKSeriesGDCMReader::Pointer ConfigureDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, TiXmlElement*) const;
void ConfigureCommonPropertiesOfDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, TiXmlElement* element) const;
void ConfigureCommonPropertiesOfThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, TiXmlElement* element) const;
DICOMSortCriterion::Pointer CreateDICOMSortByTag(TiXmlElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
DICOMSortCriterion::Pointer CreateSortByImagePositionPatient(TiXmlElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
mitk::DICOMTagBasedSorter::Pointer CreateDICOMTagBasedSorter(TiXmlElement* element) const;
TiXmlElement* CreateConfigStringFromReader(const DICOMITKSeriesGDCMReader* reader) const;
TiXmlElement* CreateConfigStringFromReader(const ThreeDnTDICOMSeriesReader* reader) const;
TiXmlElement* CreateConfigStringFromReader(const ClassicDICOMSeriesReader* reader) const;
TiXmlElement* CreateConfigStringFromDICOMDatasetSorter(const DICOMTagBasedSorter* sorter) const;
TiXmlElement* CreateConfigStringFromDICOMTag(const DICOMTag& tag) const;
TiXmlElement* CreateDICOMFileReaderTag(const DICOMFileReader* reader) const;
const char* toString(bool) const;
std::string toHexString(unsigned int i) const;
};
} // namespace
#endif // mitkDICOMReaderConfigurator_h
diff --git a/Modules/DICOMReader/include/mitkDICOMSortByTag.h b/Modules/DICOMReader/include/mitkDICOMSortByTag.h
index c2d91c3f19..7e9f3b8199 100644
--- a/Modules/DICOMReader/include/mitkDICOMSortByTag.h
+++ b/Modules/DICOMReader/include/mitkDICOMSortByTag.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMSortByTag_h
#define mitkDICOMSortByTag_h
#include "mitkDICOMSortCriterion.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Compare two datasets by the value of a single tag (for use in DICOMTagBasedSorter).
The class will compare the tag values by
1. numerical value if possible (i.e. both datasets have a value that is numerical)
2. alphabetical order otherwise
If the comparison results in equalness, it is refered to the secondary criterion, see
DICOMSortByTag::NextLevelIsLeftBeforeRight().
*/
class MITKDICOMREADER_EXPORT DICOMSortByTag : public DICOMSortCriterion
{
public:
mitkClassMacro( DICOMSortByTag, DICOMSortCriterion );
mitkNewMacro1Param( DICOMSortByTag, const DICOMTag& );
mitkNewMacro2Param( DICOMSortByTag, const DICOMTag&, DICOMSortCriterion::Pointer );
- virtual DICOMTagList GetTagsOfInterest() const;
- virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const;
+ virtual DICOMTagList GetTagsOfInterest() const override;
+ virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const override;
- virtual double NumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to) const;
+ virtual double NumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to) const override;
- virtual void Print(std::ostream& os) const;
+ virtual void Print(std::ostream& os) const override;
- virtual bool operator==(const DICOMSortCriterion& other) const;
+ virtual bool operator==(const DICOMSortCriterion& other) const override;
protected:
DICOMSortByTag( const DICOMTag& tag, DICOMSortCriterion::Pointer secondaryCriterion = NULL );
virtual ~DICOMSortByTag();
DICOMSortByTag(const DICOMSortByTag& other);
DICOMSortByTag& operator=(const DICOMSortByTag& other);
bool StringCompare(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right, const DICOMTag& tag) const;
bool NumericCompare(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right, const DICOMTag& tag) const;
private:
DICOMTag m_Tag;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMSortCriterion.h b/Modules/DICOMReader/include/mitkDICOMSortCriterion.h
index 2b812d0529..7ee590beb3 100644
--- a/Modules/DICOMReader/include/mitkDICOMSortCriterion.h
+++ b/Modules/DICOMReader/include/mitkDICOMSortCriterion.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMSortCriterion_h
#define mitkDICOMSortCriterion_h
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkDICOMDatasetAccess.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief A tag based sorting criterion for use in DICOMTagBasedSorter.
This class is used within std::sort (see DICOMTagBasedSorter::Sort())
and has to answer a simple question by implementing IsLeftBeforeRight().
Each time IsLeftBeforeRight() is called, the method should return whether
the left dataset should be sorted before the right dataset.
Because there are identical tags values quite oftenly, a DICOMSortCriterion
will always hold a secondary DICOMSortCriterion. In cases of equal tag
values, the decision is refered to the secondary criterion.
*/
class MITKDICOMREADER_EXPORT DICOMSortCriterion : public itk::LightObject
{
public:
- mitkClassMacro( DICOMSortCriterion, itk::LightObject );
+ mitkClassMacroItkParent( DICOMSortCriterion, itk::LightObject );
/// \brief Tags used for comparison (includes seconary criteria).
DICOMTagList GetAllTagsOfInterest() const;
/// \brief Tags used for comparison.
virtual DICOMTagList GetTagsOfInterest() const = 0;
/// \brief Answer the sorting question.
virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const = 0;
/// \brief Calculate a distance between two datasets.
/// This ansers the question of consecutive datasets.
virtual double NumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to) const = 0;
/// \brief The fallback criterion.
DICOMSortCriterion::ConstPointer GetSecondaryCriterion() const;
/// brief describe this class in given stream.
virtual void Print(std::ostream& os) const = 0;
virtual bool operator==(const DICOMSortCriterion& other) const = 0;
protected:
DICOMSortCriterion( DICOMSortCriterion::Pointer secondaryCriterion );
virtual ~DICOMSortCriterion();
bool NextLevelIsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const;
DICOMSortCriterion(const DICOMSortCriterion& other);
DICOMSortCriterion& operator=(const DICOMSortCriterion& other);
DICOMSortCriterion::Pointer m_SecondaryCriterion;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMTagBasedSorter.h b/Modules/DICOMReader/include/mitkDICOMTagBasedSorter.h
index d4e32dc559..36d8f1b31c 100644
--- a/Modules/DICOMReader/include/mitkDICOMTagBasedSorter.h
+++ b/Modules/DICOMReader/include/mitkDICOMTagBasedSorter.h
@@ -1,191 +1,191 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMTagBasedSorter_h
#define mitkDICOMTagBasedSorter_h
#include "mitkDICOMDatasetSorter.h"
#include "mitkDICOMSortCriterion.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Sort DICOM datasets based on configurable tags.
This class implements sorting of input DICOM datasets into multiple outputs
as described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy.
The logic of sorting and splitting is most simple and most generic:
1. Datasets will be put into different groups, if they differ in their value of specific tags (defined by AddDistinguishingTag())
- there might be multiple distinguishing tags defined
- tag values might be processed before comparison by means of TagValueProcessor (e.g. round to a number of decimal places)
2. Each of the groups will be sorted by comparing their tag values using multiple DICOMSortCriterion
- DICOMSortCriterion might evaluate a single tag (e.g. Instance Number) or multiple values (as in SortByImagePositionPatient)
- only a single DICOMSortCriterion is defined for DICOMTagBasedSorter, because each DICOMSortCriterion holds a "secondary sort criterion", i.e. an application can define multiple tags for sorting by chaining \link DICOMSortCriterion DICOMSortCriteria \endlink
- applications should make sure that sorting is always defined (to avoid problems with standard containers), e.g. by adding a comparison of filenames or instance UIDs as a last sorting fallback.
*/
class MITKDICOMREADER_EXPORT DICOMTagBasedSorter : public DICOMDatasetSorter
{
public:
/**
\brief Processes tag values before they are compared.
These classes could do some kind of normalization such as rounding, lower case formatting, etc.
*/
class MITKDICOMREADER_EXPORT TagValueProcessor
{
public:
/// \brief Implements the "processing".
virtual std::string operator()(const std::string&) const = 0;
virtual TagValueProcessor* Clone() const = 0;
};
/**
\brief Cuts a number after configured number of decimal places.
An instance of this class can be used to avoid errors when comparing minimally different image orientations.
*/
class MITKDICOMREADER_EXPORT CutDecimalPlaces : public TagValueProcessor
{
public:
CutDecimalPlaces(unsigned int precision);
CutDecimalPlaces(const CutDecimalPlaces& other);
unsigned int GetPrecision() const;
- virtual std::string operator()(const std::string&) const;
- virtual TagValueProcessor* Clone() const;
+ virtual std::string operator()(const std::string&) const override;
+ virtual TagValueProcessor* Clone() const override;
private:
unsigned int m_Precision;
};
mitkClassMacro( DICOMTagBasedSorter, DICOMDatasetSorter )
itkNewMacro( DICOMTagBasedSorter )
/**
\brief Datasets that differ in given tag's value will be sorted into separate outputs.
*/
void AddDistinguishingTag( const DICOMTag&, TagValueProcessor* tagValueProcessor = NULL );
DICOMTagList GetDistinguishingTags() const;
const TagValueProcessor* GetTagValueProcessorForDistinguishingTag(const DICOMTag&) const;
/**
\brief Define the sorting criterion (which holds seconardy criteria)
*/
void SetSortCriterion( DICOMSortCriterion::ConstPointer criterion );
DICOMSortCriterion::ConstPointer GetSortCriterion() const;
/**
\brief A list of all the tags needed for processing (facilitates scanning).
*/
- virtual DICOMTagList GetTagsOfInterest();
+ virtual DICOMTagList GetTagsOfInterest() override;
/**
\brief Whether or not groups should be checked for consecutive tag values.
When this flag is set (default in constructor=off), the sorter will
not only sort in a way that the values of a configured tag are ascending
BUT in addition the sorter will enforce a constant numerical distance
between values.
Having this flag is useful for handling of series with missing slices,
e.g. Instance Numbers 1 2 3 5 6 7 8. With the flag set to true, the sorter
would split this group into two, because the initial distance of 1 is
not kept between Instance Numbers 3 and 5.
A special case of this behavior can be configured by SetExpectDistanceOne().
When this additional flag is set to true, the sorter will expect distance
1 exactly. This can help if the second slice is missing already. Without
this additional flag, we would "learn" about a wrong distance of 2 (or similar)
and then sort completely wrong.
*/
void SetStrictSorting(bool strict);
bool GetStrictSorting() const;
/**
\brief Flag for a special case in "strict sorting".
Please see documentation of SetStrictSorting().
\sa SetStrictSorting
*/
void SetExpectDistanceOne(bool strict);
bool GetExpectDistanceOne() const;
/**
\brief Actually sort as described in the Detailed Description.
*/
- virtual void Sort();
+ virtual void Sort() override;
/**
\brief Print configuration details into given stream.
*/
- virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const;
+ virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
- virtual bool operator==(const DICOMDatasetSorter& other) const;
+ virtual bool operator==(const DICOMDatasetSorter& other) const override;
protected:
/**
\brief Helper struct to feed into std::sort, configured via DICOMSortCriterion.
*/
struct ParameterizedDatasetSort
{
ParameterizedDatasetSort(DICOMSortCriterion::ConstPointer);
bool operator() (const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right);
DICOMSortCriterion::ConstPointer m_SortCriterion;
};
DICOMTagBasedSorter();
virtual ~DICOMTagBasedSorter();
DICOMTagBasedSorter(const DICOMTagBasedSorter& other);
DICOMTagBasedSorter& operator=(const DICOMTagBasedSorter& other);
/**
\brief Helper for SplitInputGroups().
*/
std::string BuildGroupID( DICOMDatasetAccess* dataset );
typedef std::map<std::string, DICOMDatasetList> GroupIDToListType;
/**
\brief Implements the "distiguishing tags".
To sort datasets into different groups, a long string will be built for each dataset. The string concatenates all tags and their respective values.
Datasets that match in all values will end up with the same string.
*/
GroupIDToListType SplitInputGroups();
/**
\brief Implements the sorting step.
Relatively simple implementation thanks to std::sort and a parameterization via DICOMSortCriterion.
*/
GroupIDToListType& SortGroups(GroupIDToListType& groups);
DICOMTagList m_DistinguishingTags;
typedef std::map<const DICOMTag, TagValueProcessor*> TagValueProcessorMap;
TagValueProcessorMap m_TagValueProcessor;
DICOMSortCriterion::ConstPointer m_SortCriterion;
bool m_StrictSorting;
bool m_ExpectDistanceOne;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkDICOMTagCache.h b/Modules/DICOMReader/include/mitkDICOMTagCache.h
index a0b381f3b0..1684ac3a06 100644
--- a/Modules/DICOMReader/include/mitkDICOMTagCache.h
+++ b/Modules/DICOMReader/include/mitkDICOMTagCache.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMTagCache_h
#define mitkDICOMTagCache_h
#include "itkObjectFactory.h"
#include "mitkCommon.h"
#include "mitkDICOMTag.h"
#include "MitkDICOMReaderExports.h"
namespace mitk
{
class DICOMImageFrameInfo;
/**
\ingroup DICOMReaderModule
\brief ...
*/
class MITKDICOMREADER_EXPORT DICOMTagCache : public itk::Object
{
public:
- mitkClassMacro( DICOMTagCache, itk::Object );
+ mitkClassMacroItkParent( DICOMTagCache, itk::Object );
virtual std::string GetTagValue(DICOMImageFrameInfo* frame, const DICOMTag& tag) const = 0;
protected:
DICOMTagCache();
DICOMTagCache(const DICOMTagCache&);
virtual ~DICOMTagCache();
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkEquiDistantBlocksSorter.h b/Modules/DICOMReader/include/mitkEquiDistantBlocksSorter.h
index 4534f766b0..4e9590ef92 100644
--- a/Modules/DICOMReader/include/mitkEquiDistantBlocksSorter.h
+++ b/Modules/DICOMReader/include/mitkEquiDistantBlocksSorter.h
@@ -1,214 +1,214 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkEquiDistantBlocksSorter_h
#define mitkEquiDistantBlocksSorter_h
#include "mitkDICOMDatasetSorter.h"
#include "mitkDICOMSortCriterion.h"
#include "mitkGantryTiltInformation.h"
#include "mitkVector.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Split inputs into blocks of equidistant slices (for use in DICOMITKSeriesGDCMReader).
Since inter-slice distance is not recorded in DICOM tags, we must ensure that blocks are made up of
slices that have equal distances between neighboring slices. This is especially necessary because itk::ImageSeriesReader
is later used for the actual loading, and this class expects (and does nocht verify) equal inter-slice distance (see \ref DICOMITKSeriesGDCMReader_ForcedConfiguration).
To achieve such grouping, the inter-slice distance is calculated from the first two different slice positions of a block.
Following slices are added to a block as long as they can be added by adding the calculated inter-slice distance to the
last slice of the block. Slices that do not fit into the expected distance pattern, are set aside for further analysis.
This grouping is done until each file has been assigned to a group.
Slices that share a position in space are also sorted into separate blocks during this step.
So the result of this step is a set of blocks that contain only slices with equal z spacing
and uniqe slices at each position.
During sorting, the origins (documented in tag image position patient) are compared
against expected origins (from former origin plus moving direction). As there will
be minor differences in numbers (from both calculations and unprecise tag values),
we must be a bit tolerant here. The default behavior is to expect that an origin is
not further away from the expected position than 30% of the inter-slice distance.
To support a legacy behavior of a former loader (DicomSeriesReader), this default can
be restricted to a constant number of millimeters by calling SetToleratedOriginOffset(mm).
Detailed implementation in AnalyzeFileForITKImageSeriesReaderSpacingAssumption().
*/
class MITKDICOMREADER_EXPORT EquiDistantBlocksSorter : public DICOMDatasetSorter
{
public:
mitkClassMacro( EquiDistantBlocksSorter, DICOMDatasetSorter )
itkNewMacro( EquiDistantBlocksSorter )
- virtual DICOMTagList GetTagsOfInterest();
+ virtual DICOMTagList GetTagsOfInterest() override;
/**
\brief Delegates work to AnalyzeFileForITKImageSeriesReaderSpacingAssumption().
AnalyzeFileForITKImageSeriesReaderSpacingAssumption() is called until it does not
create multiple blocks anymore.
*/
- virtual void Sort();
+ virtual void Sort() override;
/**
\brief Whether or not to accept images from a tilted acquisition in a single output group.
*/
void SetAcceptTilt(bool accept);
bool GetAcceptTilt() const;
/**
\brief See class description and SetToleratedOriginOffset().
*/
void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct = 0.3);
/**
\brief See class description and SetToleratedOriginOffsetToAdaptive().
Default value of 0.005 is calculated so that we get a maximum of 1/10mm
error when having a measurement crosses 20 slices in z direction (too strict? we don't know better..).
*/
void SetToleratedOriginOffset(double millimeters = 0.005);
double GetToleratedOriginOffset() const;
bool IsToleratedOriginOffsetAbsolute() const;
void SetAcceptTwoSlicesGroups(bool accept);
bool GetAcceptTwoSlicesGroups() const;
- virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const;
+ virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
- virtual bool operator==(const DICOMDatasetSorter& other) const;
+ virtual bool operator==(const DICOMDatasetSorter& other) const override;
protected:
/**
\brief Return type of AnalyzeFileForITKImageSeriesReaderSpacingAssumption().
Class contains the grouping result of method AnalyzeFileForITKImageSeriesReaderSpacingAssumption(),
which takes as input a number of images, which are all equally oriented and spatially sorted along their normal direction.
The result contains of two blocks: a first one is the grouping result, all of those images can be loaded
into one image block because they have an equal origin-to-origin distance without any gaps in-between.
*/
class SliceGroupingAnalysisResult
{
public:
SliceGroupingAnalysisResult();
/**
\brief Grouping result, all same origin-to-origin distance w/o gaps.
*/
DICOMDatasetList GetBlockDatasets();
void SetFirstFilenameOfBlock(const std::string& filename);
std::string GetFirstFilenameOfBlock() const;
void SetLastFilenameOfBlock(const std::string& filename);
std::string GetLastFilenameOfBlock() const;
/**
\brief Remaining files, which could not be grouped.
*/
DICOMDatasetList GetUnsortedDatasets();
/**
\brief Wheter or not the grouped result contain a gantry tilt.
*/
bool ContainsGantryTilt();
/**
\brief Detailed description of gantry tilt.
*/
const GantryTiltInformation& GetTiltInfo() const;
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToSortedBlock(DICOMDatasetAccess* dataset);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToUnsortedBlock(DICOMDatasetAccess* dataset);
void AddFilesToUnsortedBlock(const DICOMDatasetList& datasets);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
\todo Could make sense to enhance this with an instance of GantryTiltInformation to store the whole result!
*/
void FlagGantryTilt(const GantryTiltInformation& tiltInfo);
/**
\brief Only meaningful for use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
*/
void UndoPrematureGrouping();
protected:
DICOMDatasetList m_GroupedFiles;
DICOMDatasetList m_UnsortedFiles;
GantryTiltInformation m_TiltInfo;
std::string m_FirstFilenameOfBlock;
std::string m_LastFilenameOfBlock;
};
/**
\brief Ensure an equal z-spacing for a group of files.
Takes as input a number of images, which are all equally oriented and spatially sorted along their normal direction.
Internally used by GetSeries. Returns two lists: the first one contins slices of equal inter-slice spacing.
The second list contains remaining files, which need to be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
*/
SliceGroupingAnalysisResult
AnalyzeFileForITKImageSeriesReaderSpacingAssumption(const DICOMDatasetList& files, bool groupsOfSimilarImages);
/**
\brief Safely convert const char* to std::string.
*/
std::string
ConstCharStarToString(const char* s);
EquiDistantBlocksSorter();
virtual ~EquiDistantBlocksSorter();
EquiDistantBlocksSorter(const EquiDistantBlocksSorter& other);
EquiDistantBlocksSorter& operator=(const EquiDistantBlocksSorter& other);
bool m_AcceptTilt;
typedef std::vector<SliceGroupingAnalysisResult> ResultsList;
ResultsList m_SliceGroupingResults;
double m_ToleratedOriginOffset;
bool m_ToleratedOriginOffsetIsAbsolute;
bool m_AcceptTwoSlicesGroups;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkNormalDirectionConsistencySorter.h b/Modules/DICOMReader/include/mitkNormalDirectionConsistencySorter.h
index 8867d10125..9d5c52d905 100644
--- a/Modules/DICOMReader/include/mitkNormalDirectionConsistencySorter.h
+++ b/Modules/DICOMReader/include/mitkNormalDirectionConsistencySorter.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkNormalDirectionConsistencySorter_h
#define mitkNormalDirectionConsistencySorter_h
#include "mitkDICOMDatasetSorter.h"
#include "mitkGantryTiltInformation.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Makes sure that the order of files is along the image plane normals.
When loading with ImageSeriesReader and initializing an mitk::Image with the result
we need to make sure that the order of inputs for the ImageSeriesReader is along the
normal of the images. I.e. The direction of the normal needs to be the same direction
as the vector from the first to the last image origin.
Since this class is used as a last sorting step before loading, it will also
calculate (and return) an updated GantryTiltInformation object.
\note This class might be a workaround for another bug in MITK, but until this issue
is completely understood, the workaround fixes the problem of images that
appear upside-down.
*/
class MITKDICOMREADER_EXPORT NormalDirectionConsistencySorter : public DICOMDatasetSorter
{
public:
mitkClassMacro( NormalDirectionConsistencySorter, DICOMDatasetSorter )
itkNewMacro( NormalDirectionConsistencySorter )
- virtual DICOMTagList GetTagsOfInterest();
+ virtual DICOMTagList GetTagsOfInterest() override;
/// See class description.
- virtual void Sort();
+ virtual void Sort() override;
/// See class description and DICOMITKSeriesGDCMReader.
GantryTiltInformation GetTiltInformation() const;
- virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const;
+ virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
- virtual bool operator==(const DICOMDatasetSorter& other) const;
+ virtual bool operator==(const DICOMDatasetSorter& other) const override;
protected:
NormalDirectionConsistencySorter();
virtual ~NormalDirectionConsistencySorter();
NormalDirectionConsistencySorter(const NormalDirectionConsistencySorter& other);
NormalDirectionConsistencySorter& operator=(const NormalDirectionConsistencySorter& other);
GantryTiltInformation m_TiltInfo;
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkSortByImagePositionPatient.h b/Modules/DICOMReader/include/mitkSortByImagePositionPatient.h
index b4e958f89d..2fde2f5da6 100644
--- a/Modules/DICOMReader/include/mitkSortByImagePositionPatient.h
+++ b/Modules/DICOMReader/include/mitkSortByImagePositionPatient.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSortByImagePositionPatient_h
#define mitkSortByImagePositionPatient_h
#include "mitkDICOMSortCriterion.h"
#include "mitkVector.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief Sort by distance of image origin along image normal (for use in DICOMTagBasedSorter).
To compare two datasets, their distance to the world origin is calculated.
This distance is calculated along the image normals because we do not know
the image orientation in advance, to any of the three coordinates could be identical for all datasets.
\note This class assumes that the datasets have identical orientations!
*/
class MITKDICOMREADER_EXPORT SortByImagePositionPatient : public DICOMSortCriterion
{
public:
mitkClassMacro( SortByImagePositionPatient, DICOMSortCriterion );
mitkNewMacro1Param( SortByImagePositionPatient, DICOMSortCriterion::Pointer );
- virtual DICOMTagList GetTagsOfInterest() const;
- virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const;
+ virtual DICOMTagList GetTagsOfInterest() const override;
+ virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right) const override;
- virtual double NumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to) const;
+ virtual double NumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to) const override;
- virtual void Print(std::ostream& os) const;
+ virtual void Print(std::ostream& os) const override;
- virtual bool operator==(const DICOMSortCriterion& other) const;
+ virtual bool operator==(const DICOMSortCriterion& other) const override;
protected:
SortByImagePositionPatient( DICOMSortCriterion::Pointer secondaryCriterion = NULL );
virtual ~SortByImagePositionPatient();
SortByImagePositionPatient(const SortByImagePositionPatient& other);
SortByImagePositionPatient& operator=(const SortByImagePositionPatient& other);
double InternalNumericDistance(const mitk::DICOMDatasetAccess* from, const mitk::DICOMDatasetAccess* to, bool& possible) const;
private:
};
}
#endif
diff --git a/Modules/DICOMReader/include/mitkThreeDnTDICOMSeriesReader.h b/Modules/DICOMReader/include/mitkThreeDnTDICOMSeriesReader.h
index eb92daed09..2f9611e394 100644
--- a/Modules/DICOMReader/include/mitkThreeDnTDICOMSeriesReader.h
+++ b/Modules/DICOMReader/include/mitkThreeDnTDICOMSeriesReader.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkThreeDnTDICOMSeriesReader_h
#define mitkThreeDnTDICOMSeriesReader_h
#include "mitkDICOMITKSeriesGDCMReader.h"
#include "MitkDICOMReaderExports.h"
namespace mitk
{
/**
\ingroup DICOMReader
\brief Extends DICOMITKSeriesGDCMReader by sorting/grouping into 3D+t image blocks.
This class reuses the DICOMITKSeriesGDCMReader class and adds the option of
grouping 3D blocks at the same spatial position into a single block, which
is loaded as a 3D+t mitk::Image (compare to \ref DICOMITKSeriesGDCMReader_Condensing).
To group two output blocks into a single 3D+t block, this class tests a number
of requirements that the two blocks must fulfill:
- the <b>origin of the first slice</b> must be identical
- the <b>origin of the last slice</b> must be identical
- the <b>number of slices</b> must be identical
The output blocks described by DICOMImageBlockDescriptor will contains the following properties:
- \b "3D+t": true if the image is 3D+t
- \b "timesteps": number of timesteps of an image (only defined if "3D+t" is true)
*/
class MITKDICOMREADER_EXPORT ThreeDnTDICOMSeriesReader : public DICOMITKSeriesGDCMReader
{
public:
mitkClassMacro( ThreeDnTDICOMSeriesReader, DICOMITKSeriesGDCMReader );
mitkCloneMacro( ThreeDnTDICOMSeriesReader );
itkNewMacro( ThreeDnTDICOMSeriesReader );
mitkNewMacro1Param( ThreeDnTDICOMSeriesReader, unsigned int );
/// \brief Control whether 3D+t grouping shall actually be attempted.
void SetGroup3DandT(bool on);
bool GetGroup3DandT() const;
// void AllocateOutputImages();
/// \brief Load via multiple calls to itk::ImageSeriesReader.
- virtual bool LoadImages();
+ virtual bool LoadImages() override;
- virtual bool operator==(const DICOMFileReader& other) const;
+ virtual bool operator==(const DICOMFileReader& other) const override;
protected:
ThreeDnTDICOMSeriesReader(unsigned int decimalPlacesForOrientation = 5);
virtual ~ThreeDnTDICOMSeriesReader();
ThreeDnTDICOMSeriesReader(const ThreeDnTDICOMSeriesReader& other);
ThreeDnTDICOMSeriesReader& operator=(const ThreeDnTDICOMSeriesReader& other);
/**
\brief Analyze the groups produced by DICOMITKSeriesGDCMReader for 3D+t properties.
This method tests whether some blocks are at the same spatial position and groups
them into single blocks.
*/
- virtual SortingBlockList Condense3DBlocks(SortingBlockList&);
+ virtual SortingBlockList Condense3DBlocks(SortingBlockList&) override;
- bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const;
+ bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const override;
bool m_Group3DandT;
};
}
#endif
diff --git a/Modules/DICOMReader/test/mitkDICOMFilenameSorter.h b/Modules/DICOMReader/test/mitkDICOMFilenameSorter.h
index 0d1ba8e694..c0ff6a2257 100644
--- a/Modules/DICOMReader/test/mitkDICOMFilenameSorter.h
+++ b/Modules/DICOMReader/test/mitkDICOMFilenameSorter.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMFilenameSorter_h
#define mitkDICOMFilenameSorter_h
#include "mitkDICOMDatasetSorter.h"
namespace mitk
{
/**
\ingroup DICOMReaderModule
\brief sort files based on filename (last resort).
*/
class DICOMFilenameSorter : public DICOMDatasetSorter
{
public:
mitkClassMacro( DICOMFilenameSorter, DICOMDatasetSorter )
itkNewMacro( DICOMFilenameSorter )
- virtual DICOMTagList GetTagsOfInterest();
+ virtual DICOMTagList GetTagsOfInterest() override;
- virtual void Sort();
+ virtual void Sort() override;
- virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const;
+ virtual void PrintConfiguration(std::ostream& os, const std::string& indent = "") const override;
- virtual bool operator==(const DICOMDatasetSorter& other) const;
+ virtual bool operator==(const DICOMDatasetSorter& other) const override;
protected:
struct FilenameSort
{
bool operator() (const mitk::DICOMDatasetAccess* left, const mitk::DICOMDatasetAccess* right);
};
DICOMFilenameSorter();
virtual ~DICOMFilenameSorter();
DICOMFilenameSorter(const DICOMFilenameSorter& other);
DICOMFilenameSorter& operator=(const DICOMFilenameSorter& other);
};
}
#endif
diff --git a/Modules/DICOMReader/test/mitkDICOMNullFileReader.h b/Modules/DICOMReader/test/mitkDICOMNullFileReader.h
index e276813bf1..e594481655 100644
--- a/Modules/DICOMReader/test/mitkDICOMNullFileReader.h
+++ b/Modules/DICOMReader/test/mitkDICOMNullFileReader.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDICOMNullFileReader_h
#define mitkDICOMNullFileReader_h
#include "mitkDICOMFileReader.h"
namespace mitk
{
class DICOMNullFileReader : public DICOMFileReader
{
public:
mitkClassMacro( DICOMNullFileReader, DICOMFileReader );
mitkCloneMacro( DICOMNullFileReader );
itkNewMacro( DICOMNullFileReader );
- virtual void AnalyzeInputFiles();
+ virtual void AnalyzeInputFiles() override;
// void AllocateOutputImages();
- virtual bool LoadImages();
+ virtual bool LoadImages() override;
- virtual bool CanHandleFile(const std::string& filename);
+ virtual bool CanHandleFile(const std::string& filename) override;
- bool operator==(const DICOMFileReader& other) const;
+ bool operator==(const DICOMFileReader& other) const override;
- virtual DICOMTagList GetTagsOfInterest() const { return DICOMTagList(); }
- virtual void SetTagCache( DICOMTagCache::Pointer ) {}
+ virtual DICOMTagList GetTagsOfInterest() const override { return DICOMTagList(); }
+ virtual void SetTagCache( DICOMTagCache::Pointer ) override {}
protected:
DICOMNullFileReader();
virtual ~DICOMNullFileReader();
DICOMNullFileReader(const DICOMNullFileReader& other);
DICOMNullFileReader& operator=(const DICOMNullFileReader& other);
- void InternalPrintConfiguration(std::ostream& os) const;
+ void InternalPrintConfiguration(std::ostream& os) const override;
private:
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkAffineDataInteractor3D.h b/Modules/DataTypesExt/include/mitkAffineDataInteractor3D.h
index 81d328bae5..d76786f9bb 100644
--- a/Modules/DataTypesExt/include/mitkAffineDataInteractor3D.h
+++ b/Modules/DataTypesExt/include/mitkAffineDataInteractor3D.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAffineDataInteractor3D_h_
#define mitkAffineDataInteractor3D_h_
#include <mitkDataInteractor.h>
#include <mitkGeometry3D.h>
#include "MitkDataTypesExtExports.h"
namespace mitk
{
/**
* \brief Affine interaction with objects in 3D windows.
*
* \ingroup Interaction
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKDATATYPESEXT_EXPORT AffineDataInteractor3D: public DataInteractor
{
public:
mitkClassMacro(AffineDataInteractor3D, DataInteractor);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual void SetDataNode(NodeType node);
void TranslateGeometry(mitk::Vector3D translate, mitk::BaseGeometry* geometry);
void RotateGeometry(mitk::ScalarType angle, int rotationaxis, mitk::BaseGeometry* geometry);
void ScaleGeometry(mitk::Point3D newScale, mitk::BaseGeometry* geometry);
mitk::BaseGeometry *GetUpdatedTimeGeometry(mitk::InteractionEvent *interactionEvent);
protected:
AffineDataInteractor3D();
virtual ~AffineDataInteractor3D();
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
*/
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
/**
* Initializes the movement, stores starting position.
*/
virtual bool CheckOverObject (const InteractionEvent*);
virtual bool SelectObject (StateMachineAction*, InteractionEvent*);
virtual bool DeselectObject (StateMachineAction*, InteractionEvent*);
virtual bool InitTranslate (StateMachineAction*, InteractionEvent*);
virtual bool InitRotate (StateMachineAction*, InteractionEvent*);
virtual bool TranslateObject (StateMachineAction*, InteractionEvent*);
virtual bool RotateObject (StateMachineAction*, InteractionEvent*);
virtual bool TranslateUpKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool TranslateDownKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool TranslateLeftKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool TranslateRightKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool TranslateUpModifierKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool TranslateDownModifierKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateUpKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateDownKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateLeftKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateRightKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateUpModifierKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool RotateDownModifierKey(StateMachineAction*, InteractionEvent* interactionEvent);
virtual bool ScaleDownKey(mitk::StateMachineAction *, mitk::InteractionEvent* interactionEvent);
virtual bool ScaleUpKey(mitk::StateMachineAction *, mitk::InteractionEvent* interactionEvent);
virtual void RestoreNodeProperties();
private:
Point3D m_InitialPickedWorldPoint;
Point2D m_InitialPickedDisplayPoint;
Geometry3D::Pointer m_OriginalGeometry;
Vector3D m_ObjectNormal;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkBoundingObjectGroup.h b/Modules/DataTypesExt/include/mitkBoundingObjectGroup.h
index 80ef6106f9..22284040c8 100644
--- a/Modules/DataTypesExt/include/mitkBoundingObjectGroup.h
+++ b/Modules/DataTypesExt/include/mitkBoundingObjectGroup.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef BOUNDINGOBJECTGROUP_H_HEADER_INCLUDED
#define BOUNDINGOBJECTGROUP_H_HEADER_INCLUDED
#include <mitkBoundingObject.h>
#include "MitkDataTypesExtExports.h"
#include <deque>
namespace mitk {
//##Documentation
//## @brief group object, that contains several mitk::BoundingObjects
//##
//## Calculates a bounding box that contains all sub-bounding boxes.
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT BoundingObjectGroup : public mitk::BoundingObject
{
public:
enum CSGMode
{
Union,
Intersection,
Difference
};
mitkClassMacro(BoundingObjectGroup, mitk::BoundingObject);// itk::VectorContainer<unsigned int ,mitk::BoundingObject::Pointer>);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void UpdateOutputInformation();
- virtual bool IsInside(const mitk::Point3D& p) const;
+ virtual void UpdateOutputInformation() override;
+ virtual bool IsInside(const mitk::Point3D& p) const override;
void SetBoundingObjects(const std::deque<mitk::BoundingObject::Pointer> boundingObjects);
std::deque<mitk::BoundingObject::Pointer> GetBoundingObjects();
itkSetMacro(CSGMode, mitk::BoundingObjectGroup::CSGMode);
itkGetMacro(CSGMode, mitk::BoundingObjectGroup::CSGMode);
void AddBoundingObject(mitk::BoundingObject::Pointer boundingObject);
void RemoveBoundingObject(mitk::BoundingObject::Pointer boundingObject);
unsigned int GetCount() const;
mitk::BaseGeometry * GetGeometry (int t=0) const;
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
protected:
BoundingObjectGroup();
virtual ~BoundingObjectGroup();
std::deque<mitk::BoundingObject::Pointer> m_BoundingObjects;
unsigned int m_Counter;
CSGMode m_CSGMode;
};
}
#endif /* BOUNDINGOBJECTGROUP_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkClippingPlaneInteractor3D.h b/Modules/DataTypesExt/include/mitkClippingPlaneInteractor3D.h
index 2feef8fb32..5de8ad7662 100644
--- a/Modules/DataTypesExt/include/mitkClippingPlaneInteractor3D.h
+++ b/Modules/DataTypesExt/include/mitkClippingPlaneInteractor3D.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkClippingPlaneInteractor3D_h
#define mitkClippingPlaneInteractor3D_h
#include <mitkBaseRenderer.h>
#include <mitkDataInteractor.h>
#include <mitkGeometry3D.h>
#include "MitkDataTypesExtExports.h"
namespace mitk
{
/**
* \brief Specialized interactor for clipping planes.
*
* \ingroup Interaction
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKDATATYPESEXT_EXPORT ClippingPlaneInteractor3D: public DataInteractor
{
public:
mitkClassMacro(ClippingPlaneInteractor3D, DataInteractor);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
ClippingPlaneInteractor3D();
virtual ~ClippingPlaneInteractor3D();
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
*/
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
/**
* Initializes the movement, stores starting position.
*/
virtual bool CheckOverObject (const InteractionEvent *);
virtual bool SelectObject (StateMachineAction*, InteractionEvent*);
virtual bool DeselectObject (StateMachineAction*, InteractionEvent*);
virtual bool InitTranslate (StateMachineAction*, InteractionEvent*);
virtual bool InitRotate (StateMachineAction*, InteractionEvent*);
virtual bool TranslateObject (StateMachineAction*, InteractionEvent*);
virtual bool RotateObject (StateMachineAction*, InteractionEvent*);
private:
bool ColorizeSurface(BaseRenderer::Pointer renderer, double scalar = 0.0);
double m_InitialPickedWorldPoint[4];
Point2D m_InitialPickedDisplayPoint;
Geometry3D::Pointer m_OriginalGeometry;
Vector3D m_ObjectNormal;
};
}
#endif //mitkClippingPlaneInteractor3D_h
diff --git a/Modules/DataTypesExt/include/mitkColorSequenceCycleH.h b/Modules/DataTypesExt/include/mitkColorSequenceCycleH.h
index 44d092cf52..90182b4678 100644
--- a/Modules/DataTypesExt/include/mitkColorSequenceCycleH.h
+++ b/Modules/DataTypesExt/include/mitkColorSequenceCycleH.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOLORSEQUENCE_H_DEFG2390JKD
#define MITKCOLORSEQUENCE_H_DEFG2390JKD
#include <mitkColorSequence.h>
#include "MitkDataTypesExtExports.h"
namespace mitk
{
/*!
\brief Creates a list of around 36 different colors, where one is easily distinguished from the preceding one.
The list of colors starts with a fully saturated, full valued red (Hue = 0 = 360).
After that the sequence is generated like this:
- first cycle through fully saturated colors (increase hue by 60)
- then cycle through colors with halfed saturation (increase hue by 60)
- then cycle through colors with halfed value (increase hue by 60)
Finally repeat colors.
*/
class MITKDATATYPESEXT_EXPORT ColorSequenceCycleH : public ColorSequence
{
public:
ColorSequenceCycleH();
virtual ~ColorSequenceCycleH();
/*!
\brief Return another color
*/
- virtual Color GetNextColor();
+ virtual Color GetNextColor() override;
/*!
\brief Rewind to first color
*/
- virtual void GoToBegin();
+ virtual void GoToBegin() override;
/*!
\brief Increase the used Hue value.
This can be done by steps ( = steps * 60 increase of Hue )
or absolute ( 0.0 < Hue < 360.0).
Can also be used to decrease the Hue; Values < 0 are cropped to 0.
Note: This does not change the other values, i.e. the color cycle.
Therefor, the method can just be used to skip steps (i.e. colors) in a cycle.
Use SetColorCycle if you want to change other values.
*/
virtual void ChangeHueValueByCycleSteps( int steps );
virtual void ChangeHueValueByAbsoluteNumber( float number );
/*!
\brief Set the color cycle.
The color cycle has to be an integer value between 0 and 5
(see class description for an explanation). Use this in combination with
the hue value cahnge to generate your dream colors...
*/
virtual void SetColorCycle( unsigned short cycle );
protected:
float color_h; // current hue (0 .. 360)
float color_s; // current saturation (0 .. 1)
float color_v; // current value (0 .. 1)
unsigned short color_cycle;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkColorSequenceRainbow.h b/Modules/DataTypesExt/include/mitkColorSequenceRainbow.h
index f7134dc2b7..cd4201d220 100644
--- a/Modules/DataTypesExt/include/mitkColorSequenceRainbow.h
+++ b/Modules/DataTypesExt/include/mitkColorSequenceRainbow.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCOLORSEQUENCERAINBOW_H_URTESEINDEUTIGEKENNUNG_02
#define MITKCOLORSEQUENCERAINBOW_H_URTESEINDEUTIGEKENNUNG_02
#include "mitkColorSequence.h"
#include "MitkDataTypesExtExports.h"
namespace mitk
{
class MITKDATATYPESEXT_EXPORT ColorSequenceRainbow : public ColorSequence
{
public:
ColorSequenceRainbow();
virtual ~ColorSequenceRainbow();
/*!
\brief method to return another color
*/
- virtual Color GetNextColor();
+ virtual Color GetNextColor() override;
/*!
\brief method to set the color-index to begin again
*/
- virtual void GoToBegin();
+ virtual void GoToBegin() override;
private:
/*!
\brief method that fills the pre-defnied colors
*/
void InitColorList();
/*!
\brief global color-object that holds the actual color and changes to the next one
*/
mitk::Color m_Color;
/*!
\brief color-index to iterate through the colors
*/
unsigned int m_ColorIndex;
/*!
\brief vector-List with all pre-defined colors
*/
std::vector<Color> m_ColorList;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkCompressedImageContainer.h b/Modules/DataTypesExt/include/mitkCompressedImageContainer.h
index 8eec7c066b..42c960c061 100644
--- a/Modules/DataTypesExt/include/mitkCompressedImageContainer.h
+++ b/Modules/DataTypesExt/include/mitkCompressedImageContainer.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCompressedImageContainer_h_Included
#define mitkCompressedImageContainer_h_Included
#include "mitkCommon.h"
#include "MitkDataTypesExtExports.h"
#include "mitkImage.h"
#include "mitkGeometry3D.h"
#include "mitkImageDataItem.h"
#include <itkObject.h>
#include <vector>
namespace mitk
{
/**
\brief Holds one (compressed) mitk::Image
Uses zlib to compress the data of an mitk::Image.
$Author$
*/
class MITKDATATYPESEXT_EXPORT CompressedImageContainer : public itk::Object
{
public:
- mitkClassMacro(CompressedImageContainer, Object);
+ mitkClassMacroItkParent(CompressedImageContainer, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Creates a compressed version of the image.
*
* Will not hold any further SmartPointers to the image.
*
*/
void SetImage( Image* );
/**
* \brief Creates a full mitk::Image from its compressed version.
*
* This Method hold no buffer, so the uncompression algorithm will be
* executed every time you call this method. Don't overdo it.
*
*/
Image::Pointer GetImage();
protected:
CompressedImageContainer(); // purposely hidden
virtual ~CompressedImageContainer();
PixelType *m_PixelType;
unsigned int m_ImageDimension;
std::vector<unsigned int> m_ImageDimensions;
unsigned long m_OneTimeStepImageSizeInBytes;
unsigned int m_NumberOfTimeSteps;
/// one for each timestep. first = pointer to compressed data; second = size of buffer in bytes
std::vector< std::pair<unsigned char*, unsigned long> > m_ByteBuffers;
BaseGeometry::Pointer m_ImageGeometry;
};
} // namespace
#endif
diff --git a/Modules/DataTypesExt/include/mitkCone.h b/Modules/DataTypesExt/include/mitkCone.h
index 26b8cced86..d83d6e0f03 100644
--- a/Modules/DataTypesExt/include/mitkCone.h
+++ b/Modules/DataTypesExt/include/mitkCone.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCONE_H_HEADER_INCLUDED
#define MITKCONE_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include "MitkDataTypesExtExports.h"
namespace mitk {
//##Documentation
//## @brief Data class containing an cylinder
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT Cone : public BoundingObject
{
public:
mitkClassMacro(Cone, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
//virtual void UpdateOutputInformation();
protected:
Cone();
virtual ~Cone();
};
}
#endif /* MITKCONE_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkCuboid.h b/Modules/DataTypesExt/include/mitkCuboid.h
index 26c9344212..1634482d10 100644
--- a/Modules/DataTypesExt/include/mitkCuboid.h
+++ b/Modules/DataTypesExt/include/mitkCuboid.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITCUBOID_H_HEADER_INCLUDED
#define MITCUBOID_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include "MitkDataTypesExtExports.h"
namespace mitk {
//##Documentation
//## @brief Data class containing an cuboid
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT Cuboid : public BoundingObject
{
public:
mitkClassMacro(Cuboid, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
protected:
Cuboid();
virtual ~Cuboid();
};
}
#endif /* MITCUBOID_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkCylinder.h b/Modules/DataTypesExt/include/mitkCylinder.h
index 31364be52e..96c5daf12e 100644
--- a/Modules/DataTypesExt/include/mitkCylinder.h
+++ b/Modules/DataTypesExt/include/mitkCylinder.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCYLINDER_H_HEADER_INCLUDED
#define MITKCYLINDER_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include "MitkDataTypesExtExports.h"
namespace mitk {
//##Documentation
//## @brief Data class containing an cylinder
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT Cylinder : public BoundingObject
{
public:
mitkClassMacro(Cylinder, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
protected:
Cylinder();
virtual ~Cylinder();
};
}
#endif /* MITKCYLINDER_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkDataStorageSelection.h b/Modules/DataTypesExt/include/mitkDataStorageSelection.h
index 8e5a38e084..dfe53faac4 100644
--- a/Modules/DataTypesExt/include/mitkDataStorageSelection.h
+++ b/Modules/DataTypesExt/include/mitkDataStorageSelection.h
@@ -1,191 +1,191 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDataStorageSelection_h
#define mitkDataStorageSelection_h
#include "MitkDataTypesExtExports.h"
#include <mitkDataStorage.h>
#include <mitkNodePredicateBase.h>
#include <mitkCommon.h>
#include <set>
namespace mitk
{
class BaseProperty;
class PropertyList;
class MITKDATATYPESEXT_EXPORT DataStorageSelection: public itk::Object
{
public:
typedef std::vector<mitk::DataNode*> Nodes;
typedef Message1<const mitk::DataNode*> DataNodeEvent;
DataNodeEvent NodeChanged;
DataNodeEvent NodeAdded;
DataNodeEvent NodeRemoved;
Message2<const mitk::DataNode*, const mitk::BaseProperty*> PropertyChanged;
- mitkClassMacro(DataStorageSelection, itk::Object);
+ mitkClassMacroItkParent(DataStorageSelection, itk::Object);
mitkNewMacro2Param(DataStorageSelection, DataStorage*, bool);
mitkNewMacro3Param(DataStorageSelection, DataStorage*, NodePredicateBase*, bool);
protected:
DataStorageSelection(mitk::DataStorage* _DataStorage, bool _AutoAddNodes);
DataStorageSelection(mitk::DataStorage* _DataStorage
, mitk::NodePredicateBase* _Predicate, bool _AutoAddNodes);
public:
virtual ~DataStorageSelection();
///
/// Get the DataStorage.
///
mitk::DataStorage::Pointer GetDataStorage() const;
///
/// Get the predicate.
///
mitk::NodePredicateBase::Pointer GetPredicate() const;
///
/// Returns the size of this selection
///
unsigned int GetSize() const;
///
/// Get node at a specific model index.
///
mitk::DataNode::Pointer GetNode(unsigned int index) const;
///
/// Returns the first node, same as calling GetNode(0)
///
mitk::DataNode::Pointer GetNode() const;
///
/// Returns a copy of the node-vector
///
std::vector<mitk::DataNode*> GetNodes() const;
///
/// \see m_AutoAddNodes
///
bool DoesAutoAddNodes() const;
public:
///
/// Removes all nodes, sets node as new first element
///
DataStorageSelection& operator=(mitk::DataNode* node);
///
/// Removes all nodes, sets node as new first element
///
DataStorageSelection& operator=(mitk::DataNode::Pointer node);
///
/// Sets the DataStorage.
///
virtual void SetDataStorage(mitk::DataStorage* _DataStorage);
///
/// Sets the predicate. <b>QmitkDataStorageTableModel is owner of the predicate!</b>
///
virtual void SetPredicate(mitk::NodePredicateBase* _Predicate);
///
/// Add a node (if not already there)
///
virtual void AddNode(const mitk::DataNode* node);
///
/// Removes a node
///
virtual void RemoveNode(const mitk::DataNode* node);
///
/// Removes a node
///
virtual void RemoveAllNodes();
///
/// Called whenever an itk Object this class holds gets deleted or modified
///
virtual void ObjectChanged(const itk::Object *caller, const itk::EventObject &event);
protected:
///
/// Find a node in the list by the given prop
///
mitk::DataNode::Pointer FindNode(const mitk::BaseProperty* prop) const;
///
/// Find a node in the list by the given proplist
///
mitk::DataNode::Pointer FindNode(const mitk::PropertyList* propList) const;
///
/// Removes all nodes and fill the vector again
///
void Reset();
///
/// If a node is already in this list, all listeners will be removed
///
void RemoveListener(mitk::DataNode* node);
///
/// Adds listeners for modified/delete event, for the propertylists
/// modified/delete and for the modified/delete event of each property
/// and stores listener tags
///
void AddListener(mitk::DataNode* node);
protected:
///
/// Pointer to the DataStorage from which the nodes are selected
///
mitk::DataStorage* m_DataStorage;
///
/// DeleteTag for the DataStorage
///
unsigned int m_DataStorageDeletedTag;
///
/// 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<mitk::DataNode*> m_Nodes;
///
/// \brief Maps a node to a modified observer tag.
///
std::map<mitk::DataNode*, unsigned long> m_NodeModifiedObserverTags;
///
/// \brief Maps a propertylist to a modified observer tag.
///
std::map<mitk::PropertyList*, unsigned long> m_PropertyListModifiedObserverTags;
///
/// \brief Maps a propertylist to a delete observer tag.
///
std::map<mitk::PropertyList*, unsigned long> m_PropertyListDeletedObserverTags;
///
/// \brief Maps a property to a modified observer tag.
///
std::map<mitk::BaseProperty*, unsigned long> m_PropertyModifiedObserverTags;
///
/// \brief Maps a property to a delete observer tag.
///
std::map<mitk::BaseProperty*, unsigned long> m_PropertyDeletedObserverTags;
///
/// If set to true no event processing will be performed
///
bool m_SelfCall;
///
/// Saves if new nodes are automatically added to this selection
///
bool m_AutoAddNodes;
};
}
#endif // mitkDataStorageSelection_h
diff --git a/Modules/DataTypesExt/include/mitkEllipsoid.h b/Modules/DataTypesExt/include/mitkEllipsoid.h
index d417f13f23..136591b054 100644
--- a/Modules/DataTypesExt/include/mitkEllipsoid.h
+++ b/Modules/DataTypesExt/include/mitkEllipsoid.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKELLIPSEDATA_H_HEADER_INCLUDED
#define MITKELLIPSEDATA_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include "MitkDataTypesExtExports.h"
namespace mitk {
//##Documentation
//## @brief Data class containing an ellipsoid
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT Ellipsoid : public BoundingObject
{
public:
mitkClassMacro(Ellipsoid, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
protected:
Ellipsoid();
virtual ~Ellipsoid();
};
}
#endif /* MITKELLIPSEDATA_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkGridRepresentationProperty.h b/Modules/DataTypesExt/include/mitkGridRepresentationProperty.h
index 2336c0d1e7..3fa1a551b5 100644
--- a/Modules/DataTypesExt/include/mitkGridRepresentationProperty.h
+++ b/Modules/DataTypesExt/include/mitkGridRepresentationProperty.h
@@ -1,113 +1,113 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_GRID_REPRESENTATION_PROPERTY__H_
#define _MITK_GRID_REPRESENTATION_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include "MitkDataTypesExtExports.h"
namespace mitk
{
/**
* Extends the enumeration prop mitkEnumerationPropery. Adds the value
* (constant / Id / string representation):
* <ul>
* <li>POINTS / 0 / Points</li>
* <li>WIREFRAME / 1 / Wireframe</li>
* <li>SURFACE / 2 / Surface</li>
* <li>WIREFRAME_SURFACE / 3 / WireframeSurface</li>
* </ul>
* Default is the Wireframe representation
*/
class MITKDATATYPESEXT_EXPORT GridRepresentationProperty : public EnumerationProperty
{
public:
enum RepresentationType {POINTS = 0, WIREFRAME = 1, SURFACE = 2}; //, WIREFRAME_SURFACE = 3};
mitkClassMacro( GridRepresentationProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(GridRepresentationProperty, const IdType& );
mitkNewMacro1Param(GridRepresentationProperty, const std::string& );
/**
* Sets the representation type to POINTS.
*/
virtual void SetRepresentationToPoints();
/**
* Sets the representation type to WIREFRAME.
*/
virtual void SetRepresentationToWireframe();
/**
* Sets the representation type to SURFACE.
*/
virtual void SetRepresentationToSurface();
/**
* Sets the representation type to WIREFRAME_SURFACE.
*/
virtual void SetRepresentationToWireframeSurface();
protected:
/**
* Constructor. Sets the representation to a default value of Wireframe(1)
*/
GridRepresentationProperty( );
GridRepresentationProperty(const GridRepresentationProperty& other);
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Wireframe(1)
* @param value the integer representation of the representation
*/
GridRepresentationProperty( const IdType& value );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Wireframe(1)
* @param value the string representation of the representation
*/
GridRepresentationProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid representation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRepresentationTypes();
private:
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
} // end of namespace mitk
#endif // _MITK_GRID_REPRESENTATION_PROPERTY__H_
diff --git a/Modules/DataTypesExt/include/mitkGridVolumeMapperProperty.h b/Modules/DataTypesExt/include/mitkGridVolumeMapperProperty.h
index 61876e3ba6..43a6c18857 100644
--- a/Modules/DataTypesExt/include/mitkGridVolumeMapperProperty.h
+++ b/Modules/DataTypesExt/include/mitkGridVolumeMapperProperty.h
@@ -1,106 +1,106 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_GRID_VOLUME_MAPPER_PROPERTY__H_
#define _MITK_GRID_VOLUME_MAPPER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include "MitkDataTypesExtExports.h"
namespace mitk
{
/**
* Extends the enumeration prop mitkEnumerationPropery. Adds the value
* (constant/Id/string representation):
* PT/0/Projected Tetrahedra, ZSWEEP/1/ZSweep, RAYCAST/2/Ray Cast
* Default is the Wireframe representation
*/
class MITKDATATYPESEXT_EXPORT GridVolumeMapperProperty : public EnumerationProperty
{
public:
enum MapperType {
RAYCAST = 0,
PT = 1,
ZSWEEP = 2
};
mitkClassMacro( GridVolumeMapperProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(GridVolumeMapperProperty, const IdType&);
mitkNewMacro1Param(GridVolumeMapperProperty, const std::string&);
/**
* Sets the mapper to projected tetrahedra.
*/
virtual void SetVolumeMapperToPT();
/**
* Sets the mapper to zsweep.
*/
virtual void SetVolumeMapperToZSweep();
/**
* Sets the mapper to ray casting.
*/
virtual void SetVolumeMapperToRayCast();
protected:
/**
* Constructor. Sets the representation to a default value of Wireframe(1)
*/
GridVolumeMapperProperty( );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Wireframe(1)
* @param value the integer representation of the representation
*/
GridVolumeMapperProperty( const IdType& value );
/**
* Constructor. Sets the representation to the given value. If it is not
* valid, the representation is set to Wireframe(1)
* @param value the string representation of the representation
*/
GridVolumeMapperProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid representation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRepresentationTypes();
private:
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
} // end of namespace mitk
#endif // _MITK_GRID_VOLUME_MAPPER_PROPERTY__H_
diff --git a/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h b/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
index e8458b2799..f5ff0b2ef2 100644
--- a/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
+++ b/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
@@ -1,120 +1,120 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMITKLABELEDIMAGELOOKUPTABLE_H
#define MITKMITKLABELEDIMAGELOOKUPTABLE_H
#include "mitkLookupTable.h"
#include "MitkDataTypesExtExports.h"
#include "mitkLevelWindow.h"
#include <iostream>
#include <string>
namespace mitk
{
/**
* A lookup table for 2D mapping of labeled images. The lookup table supports
* images with up to 256 unsigned labels. Negative labels are not supported.
* Please use the level/window settings as given by the GetLevelWindow() method
* to make sure, that the colors are rendered correctly.
* The colors are initialized with random colors as default. As background
* the label 0 is assumed. The color for the background is set to fully transparent
* as default.
*/
class MITKDATATYPESEXT_EXPORT LabeledImageLookupTable : public LookupTable
{
public:
/**
* Standard mitk typedefs are generated by the mitkClassMacro
*/
mitkClassMacro(LabeledImageLookupTable, LookupTable);
/**
* Make this object constructable by the ::New() Method.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* The data type for a label. Currently only images with labels
* in the range [0,255] are supported.
*/
typedef unsigned char LabelType;
- LabeledImageLookupTable& operator=(const LookupTable& other);
+ LabeledImageLookupTable& operator=(const LookupTable& other) override;
/**
* Sets the color for a given label
* @param label The pixel value used as a label in the image
* @param r The red component of the rgba color value. Values sould be given in the range [0,1]
* @param g The green component of the rgba color value. Values sould be given in the range [0,1]
* @param b The blue component of the rgba color value. Values sould be given in the range [0,1]
* @param a The alpha component of the rgba color value. Values sould be given in the range [0,1]. Default is 1.
*/
virtual void SetColorForLabel( const LabelType& label, const double& r, const double& g, const double& b, const double a = 1.0 );
/**
* Determines the color which will be used for coloring a given label.
* @param label the label for which the color should be returned
* @returns an rgba array containing the color information for the given label.
* Color components are expressed as [0,1] double values.
*/
virtual double* GetColorForLabel(const LabelType& label);
/**
* Provides access to level window settings, which should be used
* in combination with the LUTs generated by this filter (at lease for
* 2D visualization. If you use other level/window settings, it is not
* guaranteed, that scalar values are mapped to the correct colors.
*/
mitk::LevelWindow GetLevelWindow(){return m_LevelWindow;}
protected:
/**
* Default constructor. Protected to prevent "normal" creation
*/
LabeledImageLookupTable();
LabeledImageLookupTable(const LabeledImageLookupTable& other);
/**
* Virtual destructor
*/
virtual ~LabeledImageLookupTable();
/**
* Generates a random rgb color value. Values for rgb are in the range
* [0,1]
*/
virtual void GenerateRandomColor( double& r, double& g, double& b);
/**
* Generates a radnom number drawn from a uniform
* distribution in the range [0,1].
*/
virtual double GenerateRandomNumber();
mitk::LevelWindow m_LevelWindow;
private:
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkLabeledImageVolumeCalculator.h b/Modules/DataTypesExt/include/mitkLabeledImageVolumeCalculator.h
index 4ff1472fb8..76c2bcc82b 100644
--- a/Modules/DataTypesExt/include/mitkLabeledImageVolumeCalculator.h
+++ b/Modules/DataTypesExt/include/mitkLabeledImageVolumeCalculator.h
@@ -1,97 +1,97 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_LABELEDIMAGEVOLUMECALCULATOR_H
#define _MITK_LABELEDIMAGEVOLUMECALCULATOR_H
#include <itkObject.h>
#include "MitkDataTypesExtExports.h"
#include "mitkImage.h"
#include "mitkImageTimeSelector.h"
#include <itkImage.h>
namespace mitk
{
/**
* \brief Class for calculating the volume (or area) for each label in a
* labeled image.
*
* Labels are expected to be of an unsigned integer type.
*
* TODO: Extend class for time resolved images
*/
class MITKDATATYPESEXT_EXPORT LabeledImageVolumeCalculator : public itk::Object
{
public:
typedef std::vector< double > VolumeVector;
typedef std::vector< Point3D > PointVector;
- mitkClassMacro( LabeledImageVolumeCalculator, itk::Object );
+ mitkClassMacroItkParent( LabeledImageVolumeCalculator, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetConstObjectMacro( Image, mitk::Image );
virtual void Calculate();
double GetVolume( unsigned int label ) const;
const Point3D &GetCentroid( unsigned int label ) const;
const VolumeVector &GetVolumes() const;
const PointVector &GetCentroids() const;
protected:
LabeledImageVolumeCalculator();
virtual ~LabeledImageVolumeCalculator();
template < typename TPixel, unsigned int VImageDimension >
void _InternalCalculateVolumes(
itk::Image< TPixel, VImageDimension > *image,
LabeledImageVolumeCalculator *volumeCalculator,
BaseGeometry *geometry );
ImageTimeSelector::Pointer m_InputTimeSelector;
Image::ConstPointer m_Image;
VolumeVector m_VolumeVector;
PointVector m_CentroidVector;
Point3D m_DummyPoint;
};
}
#endif // #define _MITK_LABELEDIMAGEVOLUMECALCULATOR_H
diff --git a/Modules/DataTypesExt/include/mitkLookupTableSource.h b/Modules/DataTypesExt/include/mitkLookupTableSource.h
index 03cc7e0cd5..7bd2e8dcac 100644
--- a/Modules/DataTypesExt/include/mitkLookupTableSource.h
+++ b/Modules/DataTypesExt/include/mitkLookupTableSource.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLOOKUPTABLESOURCE_H_HEADER_INCLUDED
#define MITKLOOKUPTABLESOURCE_H_HEADER_INCLUDED
#include "mitkLookupTable.h"
#include "MitkDataTypesExtExports.h"
#include "mitkCommon.h"
#include "itkProcessObject.h"
namespace mitk
{
/**
* @brief Base class for all objects which have an object of type
* mitkLookupTable as output
*
* Base class for all objects which have an object of type mitkLookupTable
* as output. It is assumed, that mitkLookupTableSources do not provide support
* for streaming, that is, that the requested region is always the largest
* possible region.
* @ingroup Process
*/
class MITKDATATYPESEXT_EXPORT LookupTableSource : public itk::ProcessObject
{
public:
- mitkClassMacro( LookupTableSource, itk::ProcessObject )
+ mitkClassMacroItkParent( LookupTableSource, itk::ProcessObject )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::LookupTable OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef itk::DataObject::Pointer DataObjectPointer;
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
/**
* Generates the input requested region simply by calling the equivalent
* method of the superclass.
*/
- void GenerateInputRequestedRegion();
+ void GenerateInputRequestedRegion() override;
/**
* Replacement of the SetOutput method. I think it is not yet correcly
* implemented, so you should better not use it.
* @todo provide a more usefule implementation
* @param output the intended output of the lookup table source.
*/
virtual void GraftOutput( OutputType* output );
virtual OutputType* GetOutput();
virtual const OutputType* GetOutput() const;
virtual OutputType* GetOutput(DataObjectPointerArraySizeType idx);
virtual const OutputType* GetOutput(DataObjectPointerArraySizeType idx) const;
protected:
LookupTableSource();
virtual ~LookupTableSource();
};
} // namespace mitk
#endif
diff --git a/Modules/DataTypesExt/include/mitkMesh.h b/Modules/DataTypesExt/include/mitkMesh.h
index 9d634a6e24..15b406fd6b 100644
--- a/Modules/DataTypesExt/include/mitkMesh.h
+++ b/Modules/DataTypesExt/include/mitkMesh.h
@@ -1,138 +1,138 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMESH_H_HEADER_INCLUDED
#define MITKMESH_H_HEADER_INCLUDED
#include "mitkPointSet.h"
#include "MitkDataTypesExtExports.h"
#include <vtkCellArray.h>
#include <vtkFloatArray.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <itkPolygonCell.h>
#include <vtkSystemIncludes.h>
#include <vtkPoints.h>
namespace mitk {
/**
* \brief DataStructure which stores a set of points (incl. pointdata) where
* each point can be associated to an element of a cell.
*
* A mesh contains several cells that can be of different celltypes
* (Line, Triangle, Polygone...). A cell is always closed. If a linestrip is
* to be created, then declare several cells, each containing one line.
*
* The operations take care of the coherence. If a line is added to an
* existing LineCell, then a TriangleCell is built with the old and the new
* parameter (and so on). Deletion is done the opposite way.
*
* Example for inserting a line into a TriangleCell:
* existing PIds ind the cell: 1, 2, 4;
* inserting (2, 3) so that new PIds in Cell: 1, 2, 3, 4
*
* The cell is now of type QuadrilateralCell
*
* \ingroup Data
*/
class MITKDATATYPESEXT_EXPORT Mesh : public PointSet
{
public:
mitkClassMacro(Mesh, PointSet);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef Superclass::DataType::CellType CellType;
typedef CellType::CellAutoPointer CellAutoPointer;
typedef Superclass::MeshTraits::CellTraits CellTraits;
typedef CellTraits::PointIdConstIterator PointIdConstIterator;
typedef CellTraits::PointIdIterator PointIdIterator;
typedef DataType::CellDataContainer CellDataContainer;
typedef DataType::CellDataContainerIterator CellDataIterator;
typedef Superclass::DataType::CellsContainer::Iterator CellIterator;
typedef Superclass::DataType::CellsContainer::ConstIterator ConstCellIterator;
typedef itk::PolygonCell< CellType > PolygonType;
typedef MeshType::CellType::MultiVisitor MeshMultiVisitor;
/** \brief returns the current number of cells in the mesh */
virtual unsigned long GetNumberOfCells( int t = 0 );
/** \brief returns the mesh */
virtual const DataType *GetMesh( int t = 0 ) const;
/** \brief returns the mesh */
virtual DataType *GetMesh( int t = 0 );
void SetMesh( DataType *mesh, int t = 0 );
/** \brief checks if the given point is in a cell and returns that cellId.
* Basicaly it searches lines and points that are hit.
*/
virtual bool EvaluatePosition( Point3D point, unsigned long &cellId,
float precision, int t = 0 );
/** \brief searches for the next new cellId and returns that id */
unsigned long GetNewCellId( int t = 0 );
/** \brief returns the first cell that includes the given pointId */
virtual int SearchFirstCell( unsigned long pointId, int t = 0 );
/** \brief searches for a line, that is hit by the given point.
* Then returns the lineId and the cellId
*/
virtual bool SearchLine( Point3D point, float distance,
unsigned long &lineId, unsigned long &cellId, int t = 0 );
/** \brief searches a line according to the cellId and lineId and returns
* the PointIds, that assign the line; if successful, then return
* param = true;
*/
virtual bool GetPointIds( unsigned long cellId, unsigned long lineId,
int &idA, int &idB, int t = 0 );
/** \brief searches a selected cell and returns the id of that cell. If no
* cell is found, then -1 is returned
*/
virtual int SearchSelectedCell( int t = 0 );
/** \brief creates a BoundingBox and computes it with the given points of
* the cell.
*
* Returns the BoundingBox != IsNull() if successful.
*/
virtual DataType::BoundingBoxPointer GetBoundingBoxFromCell(
unsigned long cellId, int t = 0 );
/** \brief executes the given Operation */
- virtual void ExecuteOperation(Operation* operation);
+ virtual void ExecuteOperation(Operation* operation) override;
protected:
Mesh();
virtual ~Mesh();
};
} // namespace mitk
#endif /* MITKMESH_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkMultiStepper.h b/Modules/DataTypesExt/include/mitkMultiStepper.h
index a66749c94b..19b504813b 100644
--- a/Modules/DataTypesExt/include/mitkMultiStepper.h
+++ b/Modules/DataTypesExt/include/mitkMultiStepper.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MULTISTEPPER_H_HEADER_INCLUDED
#define MULTISTEPPER_H_HEADER_INCLUDED
#include <set>
#include "MitkDataTypesExtExports.h"
#include "mitkCommon.h"
#include "mitkVector.h"
#include "mitkStepper.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk {
//##Documentation
//## @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.
//## @ingroup NavigationControl
class MITKDATATYPESEXT_EXPORT MultiStepper : public Stepper
{
public:
mitkClassMacro(MultiStepper, Stepper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void AddStepper(Stepper::Pointer stepper,unsigned int repeat = 1);
void RemoveStepper(Stepper::Pointer stepper,unsigned int repeat = 1);
/*void Next();
void Previous();
void First();
void Last(); */
// unsigned int GetPos();
- void SetPos(unsigned int pos);
- void SetSteps(const unsigned int steps);
+ void SetPos(unsigned int pos) override;
+ void SetSteps(const unsigned int steps) override;
protected:
MultiStepper();
virtual ~MultiStepper();
typedef std::set<Stepper::Pointer> StepperSet;
typedef std::map<Stepper::Pointer,unsigned int> ScaleFactorMap;
StepperSet m_SubSteppers;
ScaleFactorMap m_ScaleFactors;
Stepper::Pointer m_LargestRangeStepper;
void UpdateStepCount();
};
} // namespace mitk
#endif /* MULTISTEPPER_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkOrganTypeProperty.h b/Modules/DataTypesExt/include/mitkOrganTypeProperty.h
index 2415cd251c..bddf742020 100644
--- a/Modules/DataTypesExt/include/mitkOrganTypeProperty.h
+++ b/Modules/DataTypesExt/include/mitkOrganTypeProperty.h
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkOrganTypeProperty_h_Included
#define mitkOrganTypeProperty_h_Included
#include "mitkCommon.h"
#include "MitkDataTypesExtExports.h"
#include "mitkEnumerationProperty.h"
#include <itkObjectFactory.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
\brief Enumerates all known organs :-)
\sa QmitkInteractiveSegmentation
\ingroup ToolManagerEtAl
\ingroup DataManagement
Last contributor $Author$
*/
class MITKDATATYPESEXT_EXPORT OrganTypeProperty : public EnumerationProperty
{
public:
mitkClassMacro(OrganTypeProperty, EnumerationProperty);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(OrganTypeProperty, const IdType&);
mitkNewMacro1Param(OrganTypeProperty, const std::string&);
using BaseProperty::operator=;
protected:
OrganTypeProperty();
OrganTypeProperty( const IdType& value );
OrganTypeProperty( const std::string& value );
virtual ~OrganTypeProperty();
virtual void AddEnumerationTypes();
private:
// purposely not implemented
OrganTypeProperty& operator=(const OrganTypeProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace
#endif
diff --git a/Modules/DataTypesExt/include/mitkPlane.h b/Modules/DataTypesExt/include/mitkPlane.h
index 174cb3e580..b236187fc3 100644
--- a/Modules/DataTypesExt/include/mitkPlane.h
+++ b/Modules/DataTypesExt/include/mitkPlane.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPLANE_H_HEADER_INCLUDED
#define MITKPLANE_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include "MitkDataTypesExtExports.h"
class vtkPlaneSource;
class vtkDoubleArray;
namespace mitk {
/**
* \brief Plane surface representation
*
* Encapsulates vtkPlaneSource.
*
* \ingroup Data
*/
class MITKDATATYPESEXT_EXPORT Plane : public BoundingObject
{
public:
mitkClassMacro(Plane, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetExtent( const double x, const double y );
void GetExtent( double &x, double &y ) const;
void SetResolution( const int xR, const int yR );
void GetResolution( int &xR, int &yR ) const;
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
protected:
Plane();
virtual ~Plane();
vtkPlaneSource *m_PlaneSource;
vtkPolyData *m_Plane;
vtkDoubleArray *m_PlaneNormal;
};
}
#endif /* MITKPLANE_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkSurfaceDeformationDataInteractor3D.h b/Modules/DataTypesExt/include/mitkSurfaceDeformationDataInteractor3D.h
index 819cb387df..c4099826f7 100644
--- a/Modules/DataTypesExt/include/mitkSurfaceDeformationDataInteractor3D.h
+++ b/Modules/DataTypesExt/include/mitkSurfaceDeformationDataInteractor3D.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurfaceDeformationDataInteractor3D_h_
#define mitkSurfaceDeformationDataInteractor3D_h_
#include "mitkDataInteractor.h"
#include "MitkDataTypesExtExports.h"
#include "mitkSurface.h"
namespace mitk
{
/**
* \brief SurfaceDeformation interaction with objects in 3D windows.
*
* \ingroup Interaction
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKDATATYPESEXT_EXPORT SurfaceDeformationDataInteractor3D: public DataInteractor
{
public:
mitkClassMacro(SurfaceDeformationDataInteractor3D, DataInteractor);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
SurfaceDeformationDataInteractor3D();
virtual ~SurfaceDeformationDataInteractor3D();
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
*/
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
/**
* Initializes the movement, stores starting position.
*/
virtual bool CheckOverObject (const InteractionEvent*);
virtual bool SelectObject (StateMachineAction*, InteractionEvent*);
virtual bool DeselectObject (StateMachineAction*, InteractionEvent*);
virtual bool InitDeformation (StateMachineAction*, InteractionEvent*);
virtual bool DeformObject (StateMachineAction*, InteractionEvent*);
virtual bool ScaleRadius (StateMachineAction*, InteractionEvent*);
enum
{
COLORIZATION_GAUSS,
COLORIZATION_CONSTANT
};
private:
bool ColorizeSurface(vtkPolyData* polyData, int timeStep, const Point3D& pickedPoint, int mode, double scalar = 0.0);
double m_InitialPickedWorldPoint[4];
Point3D m_InitialPickedPoint;
Point3D m_SurfaceColorizationCenter;
Surface* m_Surface;
vtkPolyData* m_OriginalPolyData;
double m_GaussSigma;
Vector3D m_ObjectNormal;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkUnstructuredGrid.h b/Modules/DataTypesExt/include/mitkUnstructuredGrid.h
index ef83710d82..6a2108b4ac 100644
--- a/Modules/DataTypesExt/include/mitkUnstructuredGrid.h
+++ b/Modules/DataTypesExt/include/mitkUnstructuredGrid.h
@@ -1,114 +1,114 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_H_
#define _MITK_UNSTRUCTURED_GRID_H_
#include "mitkBaseData.h"
#include "MitkDataTypesExtExports.h"
#include "itkImageRegion.h"
class vtkUnstructuredGrid;
namespace mitk {
//##Documentation
//## @brief Class for storing unstructured grids (vtkUnstructuredGrid)
//## @ingroup Data
class MITKDATATYPESEXT_EXPORT UnstructuredGrid : public BaseData
{
public:
// not yet the best choice of a region-type for surfaces, but it works for the time being
typedef itk::ImageRegion< 5 > RegionType;
mitkClassMacro(UnstructuredGrid, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual void SetVtkUnstructuredGrid(vtkUnstructuredGrid* grid, unsigned int t = 0);
virtual vtkUnstructuredGrid* GetVtkUnstructuredGrid(unsigned int t = 0);
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
virtual void SetRequestedRegion(UnstructuredGrid::RegionType *region);
- virtual void Graft(const DataObject* data);
+ virtual void Graft(const DataObject* data) override;
- virtual void CopyInformation(const itk::DataObject *data);
+ virtual void CopyInformation(const itk::DataObject *data) override;
- virtual void Update();
+ virtual void Update() override;
// Initialize should not be called manually;
// The polydata vector is initialized automatically when enlarged;
- virtual void Expand( unsigned int timeSteps = 1 );
+ virtual void Expand( unsigned int timeSteps = 1 ) override;
const RegionType& GetLargestPossibleRegion() const
{
m_LargestPossibleRegion.SetIndex(3, 0);
m_LargestPossibleRegion.SetSize(3, GetTimeGeometry()->CountTimeSteps());
return m_LargestPossibleRegion;
}
//##Documentation
//## Get the region object that defines the size and starting index
//## for the region of the image requested (i.e., the region of the
//## image to be operated on by a filter).
virtual const RegionType& GetRequestedRegion() const
{
return m_RequestedRegion;
}
void CalculateBoundingBox();
protected:
mitkCloneMacro(Self);
typedef std::vector< vtkUnstructuredGrid* > VTKUnstructuredGridSeries;
UnstructuredGrid();
UnstructuredGrid(const mitk::UnstructuredGrid & other);
virtual ~UnstructuredGrid();
- virtual void ClearData();
+ virtual void ClearData() override;
- virtual void InitializeEmpty();
+ virtual void InitializeEmpty() override;
VTKUnstructuredGridSeries m_GridSeries;
mutable RegionType m_LargestPossibleRegion;
RegionType m_RequestedRegion;
bool m_CalculateBoundingBox;
};
} // namespace mitk
#endif /* _MITK_UNSTRUCTURED_GRID_H_ */
diff --git a/Modules/DataTypesExt/include/mitkUnstructuredGridSource.h b/Modules/DataTypesExt/include/mitkUnstructuredGridSource.h
index 3b8d352fe6..d80898c8c9 100644
--- a/Modules/DataTypesExt/include/mitkUnstructuredGridSource.h
+++ b/Modules/DataTypesExt/include/mitkUnstructuredGridSource.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_DATA_SOURCE_H_HEADER_
#define _MITK_UNSTRUCTURED_GRID_DATA_SOURCE_H_HEADER_
#include "mitkBaseDataSource.h"
#include "MitkDataTypesExtExports.h"
namespace mitk {
class UnstructuredGrid;
//##Documentation
//## @brief Superclass of all classes generating unstructured grids (instances of class
//## UnstructuredGrid) 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::UnstructuredGridSource.
//## @ingroup Process
class MITKDATATYPESEXT_EXPORT UnstructuredGridSource : public BaseDataSource
{
public:
mitkClassMacro(UnstructuredGridSource, BaseDataSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::UnstructuredGrid OutputType;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
UnstructuredGridSource();
virtual ~UnstructuredGridSource();
};
} // namespace mitk
#endif /* _MITK_UNSTRUCTURED_GRID_DATA_SOURCE_H_HEADER_ */
diff --git a/Modules/DataTypesExt/include/mitkVideoSource.h b/Modules/DataTypesExt/include/mitkVideoSource.h
index 40f84ed038..ab8c804ad1 100644
--- a/Modules/DataTypesExt/include/mitkVideoSource.h
+++ b/Modules/DataTypesExt/include/mitkVideoSource.h
@@ -1,141 +1,141 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitk_Video_Source_h_
#define _mitk_Video_Source_h_
#include "mitkCommon.h"
#include "MitkDataTypesExtExports.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <mitkMessage.h>
namespace mitk
{
///
/// Simple base class for acquiring video data.
///
class MITKDATATYPESEXT_EXPORT VideoSource: virtual public itk::Object
{
public:
///
/// Smart pointer defs
///
- mitkClassMacro( VideoSource, itk::Object );
+ mitkClassMacroItkParent( VideoSource, itk::Object );
///
/// assigns the grabbing devices for acquiring the next frame.
/// in this base implementation it does nothing except incrementing
/// m_FrameCount
///
virtual void FetchFrame();
///
/// \return a pointer to the image data array for opengl rendering.
///
virtual unsigned char * GetVideoTexture() = 0;
///
/// advices this class to start the video capturing.
/// in this base implementation: toggles m_CapturingInProcess, resets m_FrameCount
/// *ATTENTION*: this should be also done in subclasses overwriting this method
///
virtual void StartCapturing();
///
/// advices this class to stop the video capturing.
/// in this base implementation: toggles m_CapturingInProcess, resets m_FrameCount
/// *ATTENTION*: this should be also done in subclasses overwriting this method
///
virtual void StopCapturing();
///
/// \return true if video capturing is active.
/// \see m_CapturingInProcess
///
virtual bool IsCapturingEnabled() const;
///
/// \return the current frame width (might be 0 if unknown)
///
virtual int GetImageWidth();
///
/// \return the current frame height (might be 0 if unknown)
///
virtual int GetImageHeight();
///
/// \return the current frame count
///
virtual unsigned long GetFrameCount() const;
///
/// \return true, if capturing is currently paused, false otherwise
///
virtual bool GetCapturePaused() const;
///
/// toggles m_CapturePaused
/// In Subclasses this function can be overwritten to take
/// measurs to provide a pause image, *BUT DO NOT FORGET TO
/// TOGGLE m_CapturePaused*
///
virtual void PauseCapturing();
protected:
///
/// init member
///
VideoSource();
///
/// deletes m_CurrentVideoTexture (if not 0)
///
virtual ~VideoSource();
protected:
///
/// finally this is what the video source must create: a video texture pointer
/// default: 0
///
unsigned char * m_CurrentVideoTexture;
///
/// should be filled when the first frame is available
/// default: 0
///
int m_CaptureWidth;
///
/// should be filled when the first frame is available
/// default: 0
///
int m_CaptureHeight;
///
/// saves if capturing is in procress
/// default: false
///
bool m_CapturingInProcess;
///
/// Saves the current frame count. Incremented in FetchFrame().
/// Resetted to 0 when StartCapturing() or StopCapturing() is called.
/// default: 0
///
unsigned long m_FrameCount;
///
/// Saves if the capturing is currently paused, i.e. this
/// will not fetch any further frames but provide the current
/// frame as long as m_CapturePaused is true
/// default: false
///
bool m_CapturePaused;
};
}
#endif // Header
diff --git a/Modules/DeformableRegistration/itkBSplineDeformableTransformInitializer.h b/Modules/DeformableRegistration/itkBSplineDeformableTransformInitializer.h
index 5b73c33ce6..549064afb5 100644
--- a/Modules/DeformableRegistration/itkBSplineDeformableTransformInitializer.h
+++ b/Modules/DeformableRegistration/itkBSplineDeformableTransformInitializer.h
@@ -1,129 +1,129 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __itkBSplineDeformableTransformInitializer_h
#define __itkBSplineDeformableTransformInitializer_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include <iostream>
namespace itk
{
/** \class BSplineDeformableTransformInitializer
* \brief BSplineDeformableTransformInitializer is a helper class intended to
* initialize the grid parameters of a BSplineDeformableTransform based on the
* parameters of an image.
*
* In the context of image registration, the image to be used are reference will
* be the fixed image. The BSpline grid will use the fixed image as a base for
* computing the grid spacing, orientation and origin, among other things.
*
*
* \ingroup Transforms
*/
template < class TTransform, class TImage >
class ITK_EXPORT BSplineDeformableTransformInitializer : public Object
{
public:
/** Standard class typedefs. */
typedef BSplineDeformableTransformInitializer Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** New macro for creation of through a Smart Pointer. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Run-time type information (and related methods). */
itkTypeMacro( BSplineDeformableTransformInitializer, Object );
/** Type of the transform to initialize */
typedef TTransform TransformType;
/** Types defined from transform traits */
typedef typename TransformType::Pointer TransformPointer;
typedef typename TransformType::RegionType TransformRegionType;
typedef typename TransformRegionType::SizeType TransformSizeType;
/** Dimension of parameters. */
itkStaticConstMacro(SpaceDimension, unsigned int,
TransformType::InputSpaceDimension);
/** Image Types to use in the initialization of the transform */
typedef TImage ImageType;
typedef typename ImageType::ConstPointer ImagePointer;
/** Set the transform to be initialized */
itkSetObjectMacro( Transform, TransformType );
/** Set the fixed image used in the registration process */
itkSetConstObjectMacro( Image, ImageType );
/** Set the number of grid nodes that we want to place inside the image. This
* method will override the settings of any previous call to
* SetNumberOfGridNodesInsideTheImage().*/
itkSetMacro( GridSizeInsideTheImage, TransformSizeType );
/** Set the number of grid nodes that we want to place inside the image. This
* number of node is used along one dimension of the image. Therefore, if
* you pass the number 5 as argument of this method, in a 3D space, then the
* total number of grid nodes inside the image will be \$ 5 x 5 x 5 \$ .
* This method will override the settings of any previous call to
* SetGridSizeInsideTheImage().*/
void SetNumberOfGridNodesInsideTheImage( unsigned int numberOfNodes )
{
this->m_GridSizeInsideTheImage.Fill( numberOfNodes );
this->Modified();
}
/** Initialize the transform using data from the images */
virtual void InitializeTransform() const;
protected:
BSplineDeformableTransformInitializer();
~BSplineDeformableTransformInitializer(){};
- void PrintSelf(std::ostream &os, Indent indent) const;
+ void PrintSelf(std::ostream &os, Indent indent) const override;
private:
BSplineDeformableTransformInitializer(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
TransformPointer m_Transform;
ImagePointer m_Image;
TransformSizeType m_GridSizeInsideTheImage;
unsigned int m_NumberOfGridNodesInsideTheImage;
}; //class BSplineDeformableTransformInitializer
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkBSplineDeformableTransformInitializer.txx"
#endif
#endif /* __itkBSplineDeformableTransformInitializer_h */
diff --git a/Modules/DeformableRegistration/mitkBSplineRegistration.h b/Modules/DeformableRegistration/mitkBSplineRegistration.h
index 5398e8144c..e85a63e23e 100644
--- a/Modules/DeformableRegistration/mitkBSplineRegistration.h
+++ b/Modules/DeformableRegistration/mitkBSplineRegistration.h
@@ -1,154 +1,154 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKBSPLINEREGISTRATION_H
#define MITKBSPLINEREGISTRATION_H
#include "mitkRegistrationBase.h"
#include "MitkDeformableRegistrationExports.h"
#include "mitkImageAccessByItk.h"
#include <mitkOptimizerParameters.h>
//#include <mitkMetricParameters.h>
#include "mitkRigidRegistrationObserver.h"
namespace mitk
{
/*!
\brief This class performes a b-spline registration between two images.
\ingroup DeformableRegistration
\author Thomas van Bruggen
*/
class MITKDEFORMABLEREGISTRATION_EXPORT BSplineRegistration : public RegistrationBase
{
public:
mitkClassMacro(BSplineRegistration, RegistrationBase);
/*!
* \brief Method for creation through the object factory.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*!
* \brief Sets the number of iterations which will be performed during the registration process.
*/
void SetNumberOfIterations(int iterations);
/*!
* \brief Sets whether the result should be saved or not.
*/
void SetSaveResult(bool saveResult);
/*!
* \brief Sets the filename for the resulting deformed image.
*/
void SetResultFileName(const char* resultName);
/*!
* \brief Starts the B-Spline registration.
*/
- virtual void GenerateData()
+ virtual void GenerateData() override
{
if (this->GetInput())
{
AccessByItk(this->GetInput(), GenerateData2);
}
}
/*!
\brief Set the optimizer parameters
*/
void SetOptimizerParameters(mitk::OptimizerParameters::Pointer optimizerParameters)
{
m_OptimizerParameters = optimizerParameters;
}
/* void SetMetricParameters(mitk::MetricParameters::Pointer metricParameters)
{
m_MetricParameters = metricParameters;
}*/
/* void SetParameters(mitk::OptimizerParameters::Pointer optimizerParameters, mitk::MetricParameters::Pointer metricParameters)
{
m_OptimizerParameters = optimizerParameters;
m_MetricParameters = metricParameters;
}*/
itkSetMacro(NumberOfGridPoints, int);
itkSetMacro(SaveDeformationField, bool);
itkSetMacro(UpdateInputImage, bool);
itkSetMacro(DeformationFileName, std::string);
itkSetMacro(Metric, int);
itkSetMacro(MatchHistograms, bool);
protected:
/*!
* \brief Default constructor
*/
BSplineRegistration();
/*!
* \brief Default destructor
*/
virtual ~BSplineRegistration();
/*!
* \brief Template class to perform the demons registration with any kind of image. Called by GenerateData().
*/
template < typename TPixel, unsigned int VImageDimension >
void GenerateData2( const itk::Image<TPixel, VImageDimension>* itkImage1);
int m_Iterations;
const char* m_ResultName;
bool m_SaveResult;
mitk::OptimizerParameters::Pointer m_OptimizerParameters;
//mitk::MetricParameters::Pointer m_MetricParameters;
int m_NumberOfGridPoints;
bool m_SaveDeformationField;
bool m_UpdateInputImage;
std::string m_DeformationFileName;
bool m_MatchHistograms;
int m_Metric;
RigidRegistrationObserver::Pointer m_Observer;
};
}
#endif // MITKDEMONSREGISTRATION_H
diff --git a/Modules/DeformableRegistration/mitkDemonsRegistration.h b/Modules/DeformableRegistration/mitkDemonsRegistration.h
index 9ab24bc793..8da54836e6 100644
--- a/Modules/DeformableRegistration/mitkDemonsRegistration.h
+++ b/Modules/DeformableRegistration/mitkDemonsRegistration.h
@@ -1,125 +1,125 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDEMONSREGISTRATION_H
#define MITKDEMONSREGISTRATION_H
#include "itkDemonsRegistrationFilter.h"
#include "MitkDeformableRegistrationExports.h"
#include "mitkRegistrationBase.h"
#include "mitkImageAccessByItk.h"
namespace mitk
{
/*!
\brief This class performes a demons registration between two images with the same modality..
\ingroup DeformableRegistration
\author Daniel Stein
*/
class MITKDEFORMABLEREGISTRATION_EXPORT DemonsRegistration : public RegistrationBase
{
public:
mitkClassMacro(DemonsRegistration, RegistrationBase);
/*!
* \brief Method for creation through the object factory.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*!
* \brief Sets the number of iterations which will be performed during the registration process.
*/
void SetNumberOfIterations(int iterations);
/*!
* \brief Sets the standard deviation used by the demons registration.
*/
void SetStandardDeviation(float deviation);
/*!
* \brief Sets whether the resulting deformation field should be saved or not.
*/
void SetSaveDeformationField(bool saveField);
/*!
* \brief Sets the filename for the resulting deformation field.
*/
void SetDeformationFieldFileName(const char* fieldName);
/*!
* \brief Sets whether the result should be saved or not.
*/
void SetSaveResult(bool saveResult);
/*!
* \brief Sets the filename for the resulting deformed image.
*/
void SetResultFileName(const char* resultName);
/*!
* \brief Returns the deformation field, which results by the registration.
*/
itk::Image<itk::Vector<float, 3>,3>::Pointer GetDeformationField();
/*!
* \brief Starts the demons registration.
*/
- virtual void GenerateData()
+ virtual void GenerateData() override
{
if (this->GetInput())
{
AccessByItk(this->GetInput(), GenerateData2);
}
}
protected:
/*!
* \brief Default constructor
*/
DemonsRegistration();
/*!
* \brief Default destructor
*/
virtual ~DemonsRegistration();
/*!
* \brief Template class to perform the demons registration with any kind of image. Called by GenerateData().
*/
template < typename TPixel, unsigned int VImageDimension >
void GenerateData2( const itk::Image<TPixel, VImageDimension>* itkImage1);
int m_Iterations;
float m_StandardDeviation;
const char* m_FieldName;
const char* m_ResultName;
bool m_SaveField;
bool m_SaveResult;
itk::Image<class itk::Vector<float, 3>,3>::Pointer m_DeformationField;
};
}
#endif // MITKDEMONSREGISTRATION_H
diff --git a/Modules/DeformableRegistration/mitkHistogramMatching.h b/Modules/DeformableRegistration/mitkHistogramMatching.h
index f41dcb7cd8..7f3a460632 100644
--- a/Modules/DeformableRegistration/mitkHistogramMatching.h
+++ b/Modules/DeformableRegistration/mitkHistogramMatching.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKHISTOGRAMMATCHING_H
#define MITKHISTOGRAMMATCHING_H
#include "itkHistogramMatchingImageFilter.h"
#include "MitkDeformableRegistrationExports.h"
#include "mitkRegistrationBase.h"
#include "mitkImageAccessByItk.h"
namespace mitk
{
/*!
\brief This class performes a histogram matching between the fixed image and moving image to improve the registration results.
\ingroup DeformableRegistration
\author Daniel Stein
*/
class MITKDEFORMABLEREGISTRATION_EXPORT HistogramMatching : public RegistrationBase
{
public:
mitkClassMacro(HistogramMatching, RegistrationBase);
/*!
* \brief Method for creation through the object factory.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*!
* \brief Sets the number of match points for the histogram generation.
*/
void SetNumberOfMatchPoints(int matchPoints);
/*!
* \brief Sets the number of histogram levels for the histogram generation.
*/
void SetNumberOfHistogramLevels(int histogrammLevels);
/*!
* \brief Sets whether a threshold at mean intensity should be used for the histogram generation.
*/
void SetThresholdAtMeanIntensity(bool on);
/*!
* \brief Starts the histogram matching.
*/
- virtual void GenerateData()
+ virtual void GenerateData() override
{
if (this->GetInput())
{
AccessByItk(this->GetInput(), GenerateData2);
}
}
protected:
/*!
* \brief Default constructor
*/
HistogramMatching();
/*!
* \brief Default destructor
*/
virtual ~HistogramMatching();
/*!
* \brief Template class to perform the histogram matching with any kind of image. Called by GenerateData().
*/
template < typename TPixel, unsigned int VImageDimension >
void GenerateData2( const itk::Image<TPixel, VImageDimension>* itkImage1);
bool m_ThresholdAtMeanIntensity;
int m_NumberOfHistogramLevels;
int m_NumberOfMatchPoints;
};
} // end namespace
#endif // MITKHISTOGRAMMATCHING_H
diff --git a/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.h b/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.h
index a3ac264a35..03ea61d214 100644
--- a/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.h
+++ b/Modules/DeformableRegistration/mitkSymmetricForcesDemonsRegistration.h
@@ -1,124 +1,124 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSYMMETRICFORCESDEMONSREGISTRATION_H
#define MITKSYMMETRICFORCESDEMONSREGISTRATION_H
#include "itkSymmetricForcesDemonsRegistrationFilter.h"
#include "MitkDeformableRegistrationExports.h"
#include "mitkRegistrationBase.h"
#include "mitkImageAccessByItk.h"
namespace mitk
{
/*!
\brief This class performes a symmetric forces demons registration between two images with the same modality.
\ingroup DeformableRegistration
\author Daniel Stein
*/
class MITKDEFORMABLEREGISTRATION_EXPORT SymmetricForcesDemonsRegistration : public RegistrationBase
{
public:
mitkClassMacro(SymmetricForcesDemonsRegistration, RegistrationBase);
/*!
* \brief Method for creation through the object factory.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*!
* \brief Sets the number of iterations which will be performed during the registration process.
*/
void SetNumberOfIterations(int iterations);
/*!
* \brief Sets the standard deviation used by the symmetric forces demons registration.
*/
void SetStandardDeviation(float deviation);
/*!
* \brief Sets whether the resulting deformation field should be saved or not.
*/
void SetSaveDeformationField(bool saveField);
/*!
* \brief Sets the filename for the resulting deformation field.
*/
void SetDeformationFieldFileName(const char* fieldName);
/*!
* \brief Sets whether the result should be saved or not.
*/
void SetSaveResult(bool saveResult);
/*!
* \brief Sets the filename for the resulting deformed image.
*/
void SetResultFileName(const char* resultName);
/*!
* \brief Returns the deformation field, which results by the registration.
*/
itk::Image<class itk::Vector<float, 3>,3>::Pointer GetDeformationField();
/*!
* \brief Starts the symmetric forces demons registration.
*/
- virtual void GenerateData()
+ virtual void GenerateData() override
{
if (this->GetInput())
{
AccessByItk(this->GetInput(), GenerateData2);
}
}
protected:
/*!
* \brief Default constructor
*/
SymmetricForcesDemonsRegistration();
/*!
* \brief Default destructor
*/
virtual ~SymmetricForcesDemonsRegistration();
/*!
* \brief Template class to perform the symmetric forces demons registration with any kind of image. Called by GenerateData().
*/
template < typename TPixel, unsigned int VImageDimension >
void GenerateData2( const itk::Image<TPixel, VImageDimension>* itkImage1);
int m_Iterations;
float m_StandardDeviation;
const char* m_FieldName;
const char* m_ResultName;
bool m_SaveField;
bool m_SaveResult;
itk::Image<class itk::Vector<float, 3>,3>::Pointer m_DeformationField;
};
}
#endif // MITKSYMMETRICFORCESDEMONSREGISTRATION_H
diff --git a/Modules/DicomRT/include/mitkIsoDoseLevel.h b/Modules/DicomRT/include/mitkIsoDoseLevel.h
index bf187f7b1d..5a77a7226c 100644
--- a/Modules/DicomRT/include/mitkIsoDoseLevel.h
+++ b/Modules/DicomRT/include/mitkIsoDoseLevel.h
@@ -1,104 +1,104 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DOSE_ISO_LEVEL_H_
#define _MITK_DOSE_ISO_LEVEL_H_
#include <itkRGBPixel.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
#include "mitkCommon.h"
#include "mitkDoseValueType.h"
#include "MitkDicomRTExports.h"
namespace mitk
{
/**
\brief Stores values needed for the representation/visualization of dose iso levels.
*
* The dose iso level is defined in the topology of a dose distribution by the dose value
* that indicates the lower boundary of the iso level. The upper boundary is implicitly defined
* by the next IsoDoseLevel greater (higher dose value) than the current iso level.
* Color and the visibility options are used to indicate the visualization style.
*/
class MITKDICOMRT_EXPORT IsoDoseLevel: public itk::Object
{
public:
typedef ::itk::RGBPixel<float> ColorType;
typedef DoseValueRel DoseValueType;
- mitkClassMacro(IsoDoseLevel, itk::Object);
+ mitkClassMacroItkParent(IsoDoseLevel, itk::Object);
itkNewMacro(Self);
mitkNewMacro4Param(Self,DoseValueType, ColorType, bool, bool);
/** Checks if current dose iso level instances is greater
according to the dose values.*/
bool operator> ( const IsoDoseLevel& right ) const;
/** Checks if current dose iso level instances is lesser
according to the dose values.*/
bool operator< ( const IsoDoseLevel& right ) const;
bool operator == ( const IsoDoseLevel& right) const;
itkSetMacro(DoseValue,DoseValueType);
itkGetConstMacro(DoseValue,DoseValueType);
itkSetMacro(Color,ColorType);
itkGetConstMacro(Color,ColorType);
itkSetMacro(VisibleIsoLine,bool);
itkGetConstMacro(VisibleIsoLine,bool);
itkBooleanMacro(VisibleIsoLine);
itkSetMacro(VisibleColorWash,bool);
itkGetConstMacro(VisibleColorWash,bool);
itkBooleanMacro(VisibleColorWash);
protected:
IsoDoseLevel();
IsoDoseLevel(const IsoDoseLevel & other);
IsoDoseLevel(const DoseValueType & value, const ColorType& color, bool visibleIsoLine = true, bool visibleColorWash = true );
virtual ~IsoDoseLevel();
mitkCloneMacro(IsoDoseLevel);
- void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ void PrintSelf(std::ostream &os, itk::Indent indent) const override;
private:
/** Relative dose value and lower boundary of the iso level instance
*/
DoseValueType m_DoseValue;
/** RGB color code that should be used for the iso level.*/
ColorType m_Color;
/** indicates if an iso line should be shown for the iso level
(the lower boundary indicated by m_DoseValue)*/
bool m_VisibleIsoLine;
/** indicates if a color wash should be shown for the iso level.*/
bool m_VisibleColorWash;
/** Not implemented on purpose*/
IsoDoseLevel& operator = (const IsoDoseLevel& source);
};
} // namespace mitk
#endif //_MITK_DOSE_ISO_LEVEL_H_
diff --git a/Modules/DicomRT/include/mitkIsoDoseLevelCollections.h b/Modules/DicomRT/include/mitkIsoDoseLevelCollections.h
index 7ca827d98b..7cf0d76a77 100644
--- a/Modules/DicomRT/include/mitkIsoDoseLevelCollections.h
+++ b/Modules/DicomRT/include/mitkIsoDoseLevelCollections.h
@@ -1,158 +1,158 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DOSE_ISO_LEVEL_COLLECTIONS_H_
#define _MITK_DOSE_ISO_LEVEL_COLLECTIONS_H_
#include <set>
#include <itkVectorContainer.h>
#include "mitkIsoDoseLevel.h"
namespace mitk
{
/**
\class IsoDoseLevelVector
\brief Simple vector that stores dose iso levels.
*
* This class is for example used to store the user defined free iso values.
*/
typedef ::itk::VectorContainer<unsigned int, mitk::IsoDoseLevel::Pointer> IsoDoseLevelVector;
/**
\class IsoDoseLevelSet
\brief Stores values needed for the representation/visualization of dose iso levels.
*
* Set of dose iso levels sorted by the dose values of the iso levels (low to high values).
* This data structure is used to represent the dose iso level setup used for the
* visualization of a dose distribution.
*/
class MITKDICOMRT_EXPORT IsoDoseLevelSet:
public itk::Object
{
public:
- mitkClassMacro(IsoDoseLevelSet, itk::Object);
+ mitkClassMacroItkParent(IsoDoseLevelSet, itk::Object);
itkNewMacro(Self);
private:
/** Quick access to the STL vector type that was inherited. */
typedef std::vector< IsoDoseLevel::Pointer > InternalVectorType;
typedef InternalVectorType::size_type size_type;
typedef InternalVectorType::iterator VectorIterator;
typedef InternalVectorType::const_iterator VectorConstIterator;
InternalVectorType m_IsoLevels;
protected:
IsoDoseLevelSet() {};
IsoDoseLevelSet(const IsoDoseLevelSet & other);
virtual ~IsoDoseLevelSet() {};
mitkCloneMacro(IsoDoseLevelSet);
public:
typedef size_type IsoLevelIndexType;
typedef IsoDoseLevel::DoseValueType DoseValueType;
/** Convenient typedefs for the iterator and const iterator. */
class ConstIterator;
/** Friends to this class. */
friend class ConstIterator;
/** \class ConstIterator
* Simulate STL-vector style const iteration where dereferencing the iterator
* gives read access to the value.
*/
class ConstIterator
{
public:
ConstIterator() {}
ConstIterator(const VectorConstIterator & i): m_Iter(i) {}
ConstIterator(const ConstIterator & r) { m_Iter = r.m_Iter; }
const IsoDoseLevel & operator*() { return *(m_Iter->GetPointer()); }
const IsoDoseLevel * operator->() { return m_Iter->GetPointer(); }
ConstIterator & operator++() {++m_Iter; return *this; }
ConstIterator operator++(int) { ConstIterator temp(*this); ++m_Iter; return temp; }
ConstIterator & operator--() {--m_Iter; return *this; }
ConstIterator operator--(int) { ConstIterator temp(*this); --m_Iter; return temp; }
ConstIterator & operator=(const ConstIterator & r) {m_Iter = r.m_Iter; return *this; }
bool operator==(const ConstIterator & r) const { return m_Iter == r.m_Iter; }
bool operator!=(const ConstIterator & r) const { return m_Iter != r.m_Iter; }
const IsoDoseLevel & Value(void) const { return *(m_Iter->GetPointer()); }
private:
VectorConstIterator m_Iter;
};
/* Declare the public interface routines. */
/**
* Read the element from the given index.
* It is assumed that the index exists.
*/
const IsoDoseLevel& GetIsoDoseLevel(IsoLevelIndexType) const;
const IsoDoseLevel& GetIsoDoseLevel(DoseValueType) const;
/**
* Set the element value at the given index.
* It is assumed that the index exists.
*/
void SetIsoDoseLevel(const IsoDoseLevel*);
/**
* Check if the index range of the vector is large enough to allow the
* given index without expansion.
*/
bool DoseLevelExists(IsoLevelIndexType) const;
bool DoseLevelExists(DoseValueType) const;
/**
* Delete the element defined by the index identifier. In practice, it
* doesn't make sense to delete a vector index. Instead, this method just
* overwrites the index with the default element.
*/
void DeleteIsoDoseLevel(DoseValueType);
void DeleteIsoDoseLevel(IsoLevelIndexType);
/**
* Get a begin const iterator for the vector.
*/
ConstIterator Begin(void) const;
/**
* Get an end const iterator for the vector.
*/
ConstIterator End(void) const;
/**
* Get the number of elements currently stored in the vector.
*/
IsoLevelIndexType Size(void) const;
/**
* Clear the elements. The final size will be zero.
*/
void Reset(void);
};
}
#endif //_MITK_DOSE_ISO_LEVEL_COLLECTIONS_H_
diff --git a/Modules/DicomRT/include/mitkIsoDoseLevelSetProperty.h b/Modules/DicomRT/include/mitkIsoDoseLevelSetProperty.h
index be1687ca0e..a3e58bcabb 100644
--- a/Modules/DicomRT/include/mitkIsoDoseLevelSetProperty.h
+++ b/Modules/DicomRT/include/mitkIsoDoseLevelSetProperty.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DOSE_ISO_LEVEL_SET_PROPERTY_H_
#define _MITK_DOSE_ISO_LEVEL_SET_PROPERTY_H_
#include "mitkBaseProperty.h"
#include "mitkIsoDoseLevelCollections.h"
#include "MitkDicomRTExports.h"
namespace mitk {
/**
\brief Property class for dose iso level sets.
*/
class MITKDICOMRT_EXPORT IsoDoseLevelSetProperty : public BaseProperty
{
protected:
IsoDoseLevelSet::Pointer m_IsoLevelSet;
IsoDoseLevelSetProperty();
IsoDoseLevelSetProperty(const IsoDoseLevelSetProperty& other);
IsoDoseLevelSetProperty(IsoDoseLevelSet* levelSet);
public:
mitkClassMacro(IsoDoseLevelSetProperty, BaseProperty);
itkNewMacro(IsoDoseLevelSetProperty);
mitkNewMacro1Param(IsoDoseLevelSetProperty, IsoDoseLevelSet*);
typedef IsoDoseLevelSet ValueType;
virtual ~IsoDoseLevelSetProperty();
const IsoDoseLevelSet * GetIsoDoseLevelSet() const;
const IsoDoseLevelSet * GetValue() const;
IsoDoseLevelSet * GetIsoDoseLevelSet();
IsoDoseLevelSet * GetValue();
void SetIsoDoseLevelSet(IsoDoseLevelSet* levelSet);
void SetValue(IsoDoseLevelSet* levelSet);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
IsoDoseLevelSetProperty& operator=(const IsoDoseLevelSetProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
} // namespace mitk
#endif /* _MITK_DOSE_ISO_LEVEL_SET_PROPERTY_H_ */
diff --git a/Modules/DicomRT/include/mitkIsoDoseLevelVectorProperty.h b/Modules/DicomRT/include/mitkIsoDoseLevelVectorProperty.h
index 58cd006177..3549c453d0 100644
--- a/Modules/DicomRT/include/mitkIsoDoseLevelVectorProperty.h
+++ b/Modules/DicomRT/include/mitkIsoDoseLevelVectorProperty.h
@@ -1,81 +1,81 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DOSE_ISO_LEVEL_VECTOR_PROPERTY_H_
#define _MITK_DOSE_ISO_LEVEL_VECTOR_PROPERTY_H_
#include "mitkBaseProperty.h"
#include "mitkIsoDoseLevelCollections.h"
#include "MitkDicomRTExports.h"
namespace mitk {
/**
\brief Property class for dose iso level vector.
*/
class MITKDICOMRT_EXPORT IsoDoseLevelVectorProperty : public BaseProperty
{
protected:
IsoDoseLevelVector::Pointer m_IsoLevelVector;
IsoDoseLevelVectorProperty();
IsoDoseLevelVectorProperty(const IsoDoseLevelVectorProperty& other);
IsoDoseLevelVectorProperty(IsoDoseLevelVector* levelVector);
public:
mitkClassMacro(IsoDoseLevelVectorProperty, BaseProperty);
itkNewMacro(IsoDoseLevelVectorProperty);
mitkNewMacro1Param(IsoDoseLevelVectorProperty, IsoDoseLevelVector*);
typedef IsoDoseLevelVector ValueType;
virtual ~IsoDoseLevelVectorProperty();
const IsoDoseLevelVector * GetIsoDoseLevelVector() const;
const IsoDoseLevelVector * GetValue() const;
IsoDoseLevelVector * GetIsoDoseLevelVector();
IsoDoseLevelVector * GetValue();
void SetIsoDoseLevelVector(IsoDoseLevelVector* levelVector);
void SetValue(IsoDoseLevelVector* levelVector);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
IsoDoseLevelVectorProperty& operator=(const IsoDoseLevelVectorProperty&);
- itk::LightObject::Pointer InternalClone() const;
+ itk::LightObject::Pointer InternalClone() const override;
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
};
} // namespace mitk
#endif /* _MITK_DOSE_ISO_LEVEL_SET_PROPERTY_H_ */
diff --git a/Modules/DicomRT/include/mitkRTDoseReader.h b/Modules/DicomRT/include/mitkRTDoseReader.h
index ee7a970310..2142547ea2 100644
--- a/Modules/DicomRT/include/mitkRTDoseReader.h
+++ b/Modules/DicomRT/include/mitkRTDoseReader.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDicomRTReader_h
#define mitkDicomRTReader_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <mitkCommon.h>
#include <MitkDicomRTExports.h>
#include "dcmtk/dcmrt/drtdose.h"
#include <itkGDCMSeriesFileNames.h>
#include <mitkDicomSeriesReader.h>
#include <mitkImage.h>
namespace mitk
{
class MITKDICOMRT_EXPORT RTDoseReader: public itk::Object
{
public:
- mitkClassMacro( RTDoseReader, itk::Object );
+ mitkClassMacroItkParent( RTDoseReader, itk::Object );
itkNewMacro( Self );
template<typename TPixel, unsigned int VImageDimension>
void MultiplayGridScaling( itk::Image< TPixel, VImageDimension>* image, Float32 gridscale);
/**
* @brief Get the maximum dose value from the dose file
* @param dataSet The DcmDataset of the DicomRTDose file
* @return The dose value
*
* Checks all pixel values for the maximum value
*/
double GetMaxDoseValue(DcmDataset* dataSet);
/**
* @brief Reads a DcmDataset from a DicomRT dose file
* @param dataset DcmDataset-object from DCMTK
* @param filename The path with the dose file used for getting the geometry
* @return Returns a mitkDataNode::Pointer in which a mitk::Image is stored
*
* The method reads the PixelData from the DicomRT dose file and scales
* them with a factor for getting Gray-values instead of pixel-values.
* The Gray-values are stored in a mitkImage with a vtkColorTransferFunc.
* Relative values are used for coloring the image. The relative values are
* relative to a PrescriptionDose definied in the RT-Plan. If there is no
* RT-Plan file PrescriptionDose is set to 80% of the maximum dose.
*/
mitk::DataNode::Pointer LoadRTDose(const char* filename);
/**
* Virtual destructor.
*/
virtual ~RTDoseReader();
protected:
/**
* Constructor.
*/
RTDoseReader();
};
}
#endif
diff --git a/Modules/DicomRT/include/mitkRTStructureSetReader.h b/Modules/DicomRT/include/mitkRTStructureSetReader.h
index 70762785cb..1ac771678d 100644
--- a/Modules/DicomRT/include/mitkRTStructureSetReader.h
+++ b/Modules/DicomRT/include/mitkRTStructureSetReader.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRTSTRUCTURESETREADER_H
#define MITKRTSTRUCTURESETREADER_H
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <MitkDicomRTExports.h>
#include <mitkContourModelSet.h>
#include <mitkProperties.h>
#include "dcmtk/dcmrt/drtstrct.h"
#include <mitkDataNode.h>
namespace mitk
{
class MITKDICOMRT_EXPORT RTStructureSetReader: public itk::Object
{
typedef std::deque<mitk::DataNode::Pointer> ContourModelSetNodes;
/**
* Represent a region of interest (ROI)
*/
class RoiEntry
{
public:
RoiEntry();
RoiEntry( const RoiEntry& src);
virtual ~RoiEntry();
RoiEntry &operator=(const RoiEntry &src);
void SetPolyData(ContourModelSet::Pointer roiPolyData);
unsigned int Number;
std::string Name;
std::string Description;
double DisplayColor[3];
mitk::ContourModelSet::Pointer ContourModelSet;
};
public:
- mitkClassMacro( RTStructureSetReader, itk::Object )
+ mitkClassMacroItkParent( RTStructureSetReader, itk::Object )
itkNewMacro( Self )
/**
* @brief Reading a RT StructureSet from the DICOM file and returns the ROIs
* (region of interest) as a ContourModelSet. One ContourModelSet represent
* one ROI. A ContourModelSet contains ContourModels which represent the
* single structures.
* @param filepath to the RT StructureSet (.dmc) file
* @return Returns a std::deque filled with ContourModelSet::Pointer the
* deque contains all ROIs from the DICOM file
*/
ContourModelSetNodes ReadStructureSet(const char* filepath);
protected:
/**
* containing the ROIs meta information like name number and description
*/
std::vector<RoiEntry> ROISequenceVector;
RTStructureSetReader();
virtual ~RTStructureSetReader();
/**
* Returns the number of ROIs from the ROISequenceVector
*/
size_t GetNumberOfROIs();
/**
* Returns the relevant ROI from the ROISequenceVector by its number
*/
RoiEntry* FindRoiByNumber(unsigned int roiNum);
};
}
#endif // MITKRTSTRUCTURESETREADER_H
diff --git a/Modules/DicomRT/test/mitkRTDoseReaderTest.cpp b/Modules/DicomRT/test/mitkRTDoseReaderTest.cpp
index 9ada1d9033..fe8166905e 100644
--- a/Modules/DicomRT/test/mitkRTDoseReaderTest.cpp
+++ b/Modules/DicomRT/test/mitkRTDoseReaderTest.cpp
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
#include <mitkRTDoseReader.h>
#include <mitkIOUtil.h>
class mitkRTDoseReaderTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkRTDoseReaderTestSuite);
MITK_TEST(TestDoseImage);
CPPUNIT_TEST_SUITE_END();
private:
mitk::RTDoseReader::Pointer m_rtDoseReader;
public:
- void setUp()
+ void setUp() override
{
m_rtDoseReader = mitk::RTDoseReader::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize RTDoseReader", m_rtDoseReader.IsNotNull());
}
void TestDoseImage()
{
mitk::Image::Pointer refImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("RT/Dose/RT_Dose.nrrd"));
mitk::DataNode::Pointer node = m_rtDoseReader->LoadRTDose(GetTestDataFilePath("RT/Dose/RD.dcm").c_str());
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());
MITK_ASSERT_EQUAL(refImage, image, "referece-Image and image should be equal");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkRTDoseReader)
diff --git a/Modules/DicomRT/test/mitkRTStructureSetReaderTest.cpp b/Modules/DicomRT/test/mitkRTStructureSetReaderTest.cpp
index b80a1506b4..548d6d6845 100644
--- a/Modules/DicomRT/test/mitkRTStructureSetReaderTest.cpp
+++ b/Modules/DicomRT/test/mitkRTStructureSetReaderTest.cpp
@@ -1,158 +1,158 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkTestFixture.h>
#include "mitkRTStructureSetReader.h"
#include <mitkIOUtil.h>
#include <mitkStringProperty.h>
class mitkRTStructureSetReaderTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkRTStructureSetReaderTestSuite);
// MITK_TEST(TestBody);
MITK_TEST(TestStructureSets);
CPPUNIT_TEST_SUITE_END();
private:
mitk::RTStructureSetReader::Pointer m_rtStructureReader;
public:
- void setUp()
+ void setUp() override
{
m_rtStructureReader = mitk::RTStructureSetReader::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize RTStructureSetReader", m_rtStructureReader.IsNotNull());
}
void TestStructureSets()
{
std::deque<mitk::ContourModelSet::Pointer> contourModelVectorCorrect;
std::deque<mitk::ContourModelSet::Pointer> contourModelVectorCorrectSequ;
std::deque<mitk::DataNode::Pointer> contourModelVectorTest;
std::deque<mitk::ContourModelSet::Pointer> contourModelVectorTestDel;
LoadData(contourModelVectorCorrect);
contourModelVectorTest = m_rtStructureReader->ReadStructureSet(GetTestDataFilePath("RT/StructureSet/RS.dcm").c_str());
//Deleting all empty contourmodelsets - empty contourmodelsets cant be
//saved so we have reference for the comparison
for(unsigned int i=0; i<contourModelVectorTest.size();++i)
{
if(dynamic_cast<mitk::ContourModelSet*>(contourModelVectorTest.at(i)->GetData())->GetSize()>0){
contourModelVectorTestDel.push_back(dynamic_cast<mitk::ContourModelSet*>(contourModelVectorTest.at(i)->GetData()));
}
}
//Loop for ordering the loaded contourmodelsets(contourModelVectorCorrect)
for(unsigned int i=0; i<contourModelVectorTestDel.size();++i)
{
mitk::BaseProperty::Pointer name = contourModelVectorTestDel.at(i)->GetProperty("name");
for(unsigned int j=0; j<contourModelVectorCorrect.size();++j)
{
mitk::BaseProperty::Pointer tmp = contourModelVectorCorrect.at(j)->GetProperty("name");
if(tmp->GetValueAsString().compare(name->GetValueAsString()) == 0)
contourModelVectorCorrectSequ.push_back(contourModelVectorCorrect.at(j));
}
}
//Testing wheather the two deques are equal
bool equal = true;
for(unsigned int i=0;i<contourModelVectorCorrectSequ.size();++i)
{
if(!Compare(contourModelVectorCorrectSequ.at(i),contourModelVectorTestDel.at(i)))
equal = false;
}
CPPUNIT_ASSERT(equal);
}
bool Compare(mitk::ContourModelSet::Pointer c1, mitk::ContourModelSet::Pointer c2){
if(c1->GetSize()!=c2->GetSize())
{
MITK_INFO << "Number of ContourModelSets different" << std::endl;
return false;
}
else
{
for(int i=0;i<c1->GetSize();++i)
{
mitk::ContourModel::Pointer cm1 = c1->GetContourModelAt(i);
mitk::ContourModel::Pointer cm2 = c2->GetContourModelAt(i);
if(cm1->GetNumberOfVertices()!=cm2->GetNumberOfVertices())
{
MITK_INFO << "Number of Vertices different" << std::endl;
return false;
}
else
{
float ep = 0.001;
for(int j=0;j<cm1->GetNumberOfVertices();++j)
{
mitk::Point3D p1 = cm1->GetVertexAt(i)->Coordinates;
mitk::Point3D p2 = cm2->GetVertexAt(i)->Coordinates;
if(abs(p1[0]-p2[0]) > ep || abs(p1[0]-p2[0]) > ep || abs(p1[0]-p2[0]) > ep)
{
return false;
}
}
}
}
}
return true;
}
void LoadData(std::deque<mitk::ContourModelSet::Pointer> &r)
{
std::vector<itk::SmartPointer<mitk::BaseData> > readerOutput;
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/BODY.cnt_set"));
mitk::ContourModelSet::Pointer cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("BODY"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Bladder.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Bladder"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Femoral Head Lt.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Femoral Head Lt"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Femoral Head RT.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Femoral Head RT"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/PTV.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("PTV"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Rectum.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Rectum"));
r.push_back(cnt_set);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkRTStructureSetReader)
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsBetweennessHistogram.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsBetweennessHistogram.h
index 80dda02313..4393cfa26b 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsBetweennessHistogram.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsBetweennessHistogram.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ConnectomicsBetweennessHistogram_H
#define _MITK_ConnectomicsBetweennessHistogram_H
#include<mitkConnectomicsHistogramBase.h>
#include <boost/graph/betweenness_centrality.hpp>
namespace mitk {
/**
* \brief A class to calculate and store the betweenness of each node */
class ConnectomicsBetweennessHistogram : public mitk::ConnectomicsHistogramBase
{
public:
/** Enum for different ways to calculate betweenness centrality */
enum BetweennessCalculationMode
{
UnweightedUndirectedMode,
WeightedUndirectedMode
};
ConnectomicsBetweennessHistogram();
virtual ~ConnectomicsBetweennessHistogram();
/** Set the calucaltion mode */
void SetBetweennessCalculationMode( const BetweennessCalculationMode & );
/** Get the calculation mode */
BetweennessCalculationMode GetBetweennessCalculationMode();
protected:
/* Typedefs */
typedef mitk::ConnectomicsNetwork::NetworkType NetworkType;
typedef boost::graph_traits< NetworkType >::vertex_iterator IteratorType;
typedef std::vector< double > BCMapType;
/** @brief Creates a new histogram from the network source. */
- virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source );
+ virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source ) override;
/** Calculate betweenness centrality ignoring the weight of the edges */
void CalculateUnweightedUndirectedBetweennessCentrality( NetworkType*, IteratorType, IteratorType );
/** Calculate betweenness centrality taking into consideration the weight of the edges */
void CalculateWeightedUndirectedBetweennessCentrality( NetworkType*, IteratorType, IteratorType );
/** Converts the centrality map to a histogram by binning */
void ConvertCentralityMapToHistogram();
/** Stores which mode has been selected for betweenness centrality calculation */
BetweennessCalculationMode m_Mode;
/** Stores the betweenness centralities for each node */
BCMapType m_CentralityMap;
};
}
#endif /* _MITK_ConnectomicsBetweennessHistogram_H */
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsDegreeHistogram.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsDegreeHistogram.h
index 97a117dae5..118a10c234 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsDegreeHistogram.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsDegreeHistogram.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ConnectomicsDegreeHistogram_H
#define _MITK_ConnectomicsDegreeHistogram_H
#include<mitkConnectomicsHistogramBase.h>
namespace mitk {
/**
* \brief A class to calculate and store the degree of each node */
class ConnectomicsDegreeHistogram : public mitk::ConnectomicsHistogramBase
{
public:
ConnectomicsDegreeHistogram();
virtual ~ConnectomicsDegreeHistogram();
protected:
/** @brief Creates a new histogram from the network source. */
- virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source );
+ virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source ) override;
};
}
#endif /* _MITK_ConnectomicsDegreeHistogram_H */
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramBase.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramBase.h
index 75c7fec4f7..17ffb436fe 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramBase.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramBase.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ConnectomicsHistogramBase_H
#define _MITK_ConnectomicsHistogramBase_H
#include "mitkSimpleHistogram.h"
#include "mitkCommon.h"
#include "mitkConnectomicsNetwork.h"
namespace mitk {
/**
* \brief Superclass for histograms working with connectomic networks
*/
class ConnectomicsHistogramBase : public mitk::SimpleHistogram
{
public:
ConnectomicsHistogramBase();
virtual ~ConnectomicsHistogramBase();
/** @brief Returns the minimal y=f(x) value of the histogram. */
virtual double GetYMin() const;
/** @brief Returns the maximum y=f(x) value of the histogram. */
virtual double GetYMax() const;
/** @brief Returns the minimal x value of the histogram. */
virtual double GetXMin() const;
/** @brief Returns the maximum x value of the histogram. */
virtual double GetXMax() const;
/** @brief Returns the range of the histogram. */
virtual int GetRange() const;
/** @brief Update the Y maximum to the maximal value in the histogram */
virtual void UpdateYMax();
/** @brief Creates a new histogram from the source. */
- virtual void ComputeFromBaseData( BaseData* source );
+ virtual void ComputeFromBaseData( BaseData* source ) override;
/** @brief Print values to console. */
virtual void PrintToConsole( ) const;
/** @brief Returns whether the histogram can be considered valid. */
virtual bool IsValid() const;
/** @brief Returns the subject of the histogram as a string. */
virtual std::string GetSubject() const;
/** @brief Set the subject of the histogram as a string. */
virtual void SetSubject( std::string );
/** @brief Get bin height for the bin between start and end*/
- virtual float GetRelativeBin( double start, double end ) const;
+ virtual float GetRelativeBin( double start, double end ) const override;
/** @brief Get the double vector*/
virtual std::vector< double > GetHistogramVector();
protected:
// Functions
/** @brief Creates a new histogram from the network source. */
virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source ) = 0;
/** @brief Legacy method, do no use */
- virtual double GetMin() const;
+ virtual double GetMin() const override;
/** @brief Legacy method, do no use */
- virtual double GetMax() const;
+ virtual double GetMax() const override;
// Variables
/** @brief Is this a valid histogram*/
bool m_Valid;
/** @brief Which is the baseline value for the histogram
This value should be zero for all network histograms */
int m_BaselineValue;
/** @brief Which is the top value for the histogram */
int m_TopValue;
/** @brief Which is the starting x value for the histogram */
int m_StartValue;
/** @brief We expect not continuous but discrete histograms */
std::vector< double > m_HistogramVector;
/** @brief Subject of the histogram as a string. */
std::string m_Subject;
};
}
#endif /* _MITK_ConnectomicsHistogramBase_H */
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramCache.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramCache.h
index 546c6c6eca..622e5878cf 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramCache.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsHistogramCache.h
@@ -1,113 +1,113 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCONNECTOMICSHISTOGRAMCACHE_H
#define MITKCONNECTOMICSHISTOGRAMCACHE_H
#include "mitkSimpleHistogram.h"
#include "mitkConnectomicsNetwork.h"
#include <mitkConnectomicsDegreeHistogram.h>
#include <mitkConnectomicsBetweennessHistogram.h>
#include <mitkConnectomicsShortestPathHistogram.h>
#include <MitkConnectomicsExports.h>
namespace mitk {
/**
* @brief Provides a method to cache network histograms
*/
class ConnectomicsHistogramsContainer
{
public:
void ComputeFromBaseData(BaseData* baseData)
{
m_BetweennessHistogram.ComputeFromBaseData(baseData);
m_DegreeHistogram.ComputeFromBaseData(baseData);
m_ShortestPathHistogram.ComputeFromBaseData(baseData);
}
ConnectomicsBetweennessHistogram* GetBetweennessHistogram( )
{
return &m_BetweennessHistogram;
}
ConnectomicsDegreeHistogram* GetDegreeHistogram( )
{
return &m_DegreeHistogram;
}
ConnectomicsShortestPathHistogram* GetShortestPathHistogram( )
{
return &m_ShortestPathHistogram;
}
ConnectomicsBetweennessHistogram m_BetweennessHistogram;
ConnectomicsDegreeHistogram m_DegreeHistogram;
ConnectomicsShortestPathHistogram m_ShortestPathHistogram;
};
class MITKCONNECTOMICS_EXPORT ConnectomicsHistogramCache : public SimpleHistogramCache
{
public:
ConnectomicsHistogramCache();
~ConnectomicsHistogramCache();
ConnectomicsHistogramsContainer *operator[]( ConnectomicsNetwork::Pointer sp_NetworkData);
protected:
// purposely not implemented
SimpleHistogram *operator[](BaseData::Pointer sp_BaseData);
};
class ConnectomicsHistogramsCacheElement : public ConnectomicsHistogramCache::Element
{
public:
- void ComputeFromBaseData(BaseData* baseData)
+ void ComputeFromBaseData(BaseData* baseData) override
{
m_Container.ComputeFromBaseData(baseData);
}
ConnectomicsHistogramsContainer* GetHistograms()
{
return &m_Container;
}
ConnectomicsHistogramsContainer m_Container;
private:
- ConnectomicsHistogramBase* GetHistogram()
+ ConnectomicsHistogramBase* GetHistogram() override
{
return NULL;
}
};
}
#endif // MITKCONNECTOMICSHISTOGRAMCACHE_H
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkConverter.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkConverter.h
index e4886feef9..1fe53b4d63 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkConverter.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkConverter.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsNetworkConverter_h
#define mitkConnectomicsNetworkConverter_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
#include <mitkConnectomicsNetwork.h>
namespace mitk
{
/**
* \brief A class giving functions for conversion of connectomics networks into different formats */
class MITKCONNECTOMICS_EXPORT ConnectomicsNetworkConverter : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsNetworkConverter, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsNetworkConverter, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Typedefs
typedef mitk::ConnectomicsNetwork::NetworkType NetworkType;
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType;
typedef mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeDescriptorType;
typedef boost::graph_traits<NetworkType>::vertex_iterator VertexIteratorType;
typedef boost::graph_traits<NetworkType>::adjacency_iterator AdjacencyIteratorType;
typedef std::map<EdgeDescriptorType, int> EdgeIndexStdMapType;
typedef boost::associative_property_map< EdgeIndexStdMapType > EdgeIndexMapType;
typedef boost::iterator_property_map< std::vector< double >::iterator, EdgeIndexMapType > EdgeIteratorPropertyMapType;
typedef boost::property_map< NetworkType, boost::vertex_index_t>::type VertexIndexMapType;
typedef boost::iterator_property_map< std::vector< double >::iterator, VertexIndexMapType > VertexIteratorPropertyMapType;
//Macro
itkSetObjectMacro( Network, mitk::ConnectomicsNetwork );
// Conversion Getters
vnl_matrix<double> GetNetworkAsVNLAdjacencyMatrix();
vnl_matrix<double> GetNetworkAsVNLDegreeMatrix();
protected:
//////////////////// Functions ///////////////////////
ConnectomicsNetworkConverter();
~ConnectomicsNetworkConverter();
/////////////////////// Variables ////////////////////////
// The connectomics network, which is converted
mitk::ConnectomicsNetwork::Pointer m_Network;
};
}// end namespace mitk
#endif // mitkConnectomicsNetworkConverter_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkCreator.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkCreator.h
index a7d399ce82..192db2abbd 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkCreator.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkCreator.h
@@ -1,249 +1,249 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsNetworkCreator_h
#define mitkConnectomicsNetworkCreator_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include "mitkImage.h"
#include "mitkFiberBundle.h"
#include "mitkConnectomicsNetwork.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
/**
* \brief Creates connectomics networks from fibers and parcellation
*
* This class needs a parcellation image and a fiber image to be set. Then you can create
* a connectomics network from the two, using different strategies.
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsNetworkCreator : public itk::Object
{
public:
/** Enum for different ways to create the mapping from fibers to network */
enum MappingStrategy
{
EndElementPosition,
EndElementPositionAvoidingWhiteMatter,
JustEndPointVerticesNoLabel,
PrecomputeAndDistance
};
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsNetworkCreator, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsNetworkCreator, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Type for Images **/
typedef itk::Image<int, 3 > ITKImageType;
/** Types for the standardized Tract **/
typedef itk::Point<float,3> PointType;
typedef itk::VectorContainer<unsigned int, PointType> TractType;
typedef itk::VectorContainer< unsigned int, TractType::Pointer > TractContainerType; //init via smartpointer
/** Types for Network **/
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexType;
typedef mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeType;
typedef mitk::ConnectomicsNetwork::NetworkNode NetworkNode;
typedef std::pair< VertexType, VertexType > ConnectionType;
/** Types for labels **/
typedef int ImageLabelType;
typedef std::pair< ImageLabelType, ImageLabelType > ImageLabelPairType;
/** Given a fiber bundle and a parcellation are set, this will create a network from both */
void CreateNetworkFromFibersAndSegmentation();
void SetFiberBundle(mitk::FiberBundle::Pointer fiberBundle);
void SetSegmentation(mitk::Image::Pointer segmentation);
mitk::ConnectomicsNetwork::Pointer GetNetwork();
itkSetMacro(MappingStrategy, MappingStrategy);
itkSetMacro(EndPointSearchRadius, double);
itkSetMacro(ZeroLabelInvalid, bool);
/** \brief Calculate the locations of vertices
*
* Calculate the center of mass for each label and store the information. This will need a set parcellation image.
* Unless this function is called the first location where a label is encountered will be used. After calling this function
* the center of mass will be used instead.
*/
void CalculateCenterOfMass();
protected:
//////////////////// Functions ///////////////////////
ConnectomicsNetworkCreator();
ConnectomicsNetworkCreator( mitk::Image::Pointer segmentation, mitk::FiberBundle::Pointer fiberBundle );
~ConnectomicsNetworkCreator();
/** Add a connection to the network */
void AddConnectionToNetwork(ConnectionType newConnection);
/** Determine if a label is already identified with a vertex, otherwise create a new one */
VertexType ReturnAssociatedVertexForLabel( ImageLabelType label );
/** Return the vertexes associated with a pair of labels */
ConnectionType ReturnAssociatedVertexPairForLabelPair( ImageLabelPairType labelpair );
/** Return the pair of labels which identify the areas connected by a single fiber */
ImageLabelPairType ReturnLabelForFiberTract( TractType::Pointer singleTract, MappingStrategy strategy );
/** Assign the additional information which should be part of the vertex */
void SupplyVertexWithInformation( ImageLabelType& label, VertexType& vertex );
/** Create a string from the label */
std::string LabelToString( ImageLabelType& label );
/** Check whether the label in question belongs to white matter according to the freesurfer table */
bool IsNonWhiteMatterLabel( int labelInQuestion );
/** Check whether the label in question belongs to background according to the freesurfer table */
bool IsBackgroundLabel( int labelInQuestion );
/** Extend a straight line through the given points and look for the first non white matter label
It will try extend in the direction of the points in the vector so a vector {B,C} will result in
extending from C in the direction C-B */
void LinearExtensionUntilGreyMatter( std::vector<int> & indexVectorOfPointsToUse, TractType::Pointer singleTract,
int & label, itk::Index<3> & mitkIndex );
/** Retract fiber until the first brain matter label is hit
The bool parameter controls whether the front or the end is retracted */
void RetractionUntilBrainMatter( bool retractFront, TractType::Pointer singleTract,
int & label, itk::Index<3> & mitkIndex );
/** \brief Get the location of the center of mass for a specific label
* This can throw an exception if the label is not found.
*/
std::vector< double > GetCenterOfMass( int label );
/** Convert point to itk point */
itk::Point<float, 3> GetItkPoint(double point[3]);
/** \brief Creates a new node
*
* A new node will be created, using the label and either the supplied coordinates
* or the center of mass coordinates, depending on the supplied bool.
*/
void CreateNewNode( int label, itk::Index<3>, bool useIndex );
///////// Mapping strategies //////////
/** Use the position of the end and starting element only to map to labels
Map a fiber to a vertex by taking the value of the parcellation image at the same world coordinates as the last
and first element of the tract.*/
ImageLabelPairType EndElementPositionLabel( TractType::Pointer singleTract );
/** Map by distance between elements and vertices depending on their volume
First go through the parcellation and compute the coordinates of the future vertices. Assign a radius according on their volume.
Then map an edge to a label by considering the nearest vertices and comparing the distance to them to their radii. */
ImageLabelPairType PrecomputeVertexLocationsBySegmentation( TractType::Pointer singleTract );
/** Use the position of the end and starting element only to map to labels
Just take first and last position, no labelling, nothing */
ImageLabelPairType JustEndPointVerticesNoLabelTest( TractType::Pointer singleTract );
/** Use the position of the end and starting element unless it is in white matter, then search for nearby parcellation to map to labels
Map a fiber to a vertex by taking the value of the parcellation image at the same world coordinates as the last
and first element of the tract. If this happens to be white matter, then try to extend the fiber in a line and
take the first non-white matter parcel, that is intersected. */
ImageLabelPairType EndElementPositionLabelAvoidingWhiteMatter( TractType::Pointer singleTract );
///////// Conversions //////////
/** Convert fiber index to segmentation index coordinates */
void FiberToSegmentationCoords( mitk::Point3D& fiberCoord, mitk::Point3D& segCoord );
/** Convert segmentation index to fiber index coordinates */
void SegmentationToFiberCoords( mitk::Point3D& segCoord, mitk::Point3D& fiberCoord );
/////////////////////// Variables ////////////////////////
mitk::FiberBundle::Pointer m_FiberBundle;
mitk::Image::Pointer m_Segmentation;
ITKImageType::Pointer m_SegmentationItk;
// the graph itself
mitk::ConnectomicsNetwork::Pointer m_ConNetwork;
// the id counter
int idCounter;
// the map mapping labels to vertices
std::map< ImageLabelType, VertexType > m_LabelToVertexMap;
// mapping labels to additional information
std::map< ImageLabelType, NetworkNode > m_LabelToNodePropertyMap;
// toggles whether edges between a node and itself can exist
bool allowLoops;
// toggles whether to use the center of mass coordinates
bool m_UseCoMCoordinates;
// stores the coordinates of labels
std::map< int, std::vector< double> > m_LabelsToCoordinatesMap;
// the straty to use for mapping
MappingStrategy m_MappingStrategy;
// search radius for finding a non white matter/background area. Should be in mm
double m_EndPointSearchRadius;
// toggles whether a node with the label 0 may be present
bool m_ZeroLabelInvalid;
// used internally to communicate a connection should not be added if the a problem
// is encountered while adding it
bool m_AbortConnection;
//////////////////////// IDs ////////////////////////////
// These IDs are the freesurfer ids used in parcellation
static const int freesurfer_Left_Cerebral_White_Matter = 2;
static const int freesurfer_Left_Cerebellum_White_Matter = 7;
static const int freesurfer_Left_Cerebellum_Cortex = 8;
static const int freesurfer_Brain_Stem = 16;
static const int freesurfer_Right_Cerebral_White_Matter = 41;
static const int freesurfer_Right_Cerebellum_White_Matter = 46;
static const int freesurfer_Right_Cerebellum_Cortex = 47;
};
}// end namespace mitk
#endif // _mitkConnectomicsNetworkCreator_H_INCLUDED
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkThresholder.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkThresholder.h
index 5cac2741e4..0ffa240376 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkThresholder.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsNetworkThresholder.h
@@ -1,111 +1,111 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsNetworkThresholder_h
#define mitkConnectomicsNetworkThresholder_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
#include <mitkConnectomicsNetwork.h>
namespace mitk
{
/**
* \brief A class for thresholding connectomics networks */
class MITKCONNECTOMICS_EXPORT ConnectomicsNetworkThresholder : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsNetworkThresholder, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsNetworkThresholder, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Typedefs
typedef mitk::ConnectomicsNetwork::NetworkType NetworkType;
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType;
typedef mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeDescriptorType;
typedef boost::graph_traits<NetworkType>::vertex_iterator VertexIteratorType;
typedef boost::graph_traits<NetworkType>::edge_iterator EdgeIteratorType;
typedef boost::graph_traits<NetworkType>::adjacency_iterator AdjacencyIteratorType;
typedef std::map<EdgeDescriptorType, int> EdgeIndexStdMapType;
typedef boost::associative_property_map< EdgeIndexStdMapType > EdgeIndexMapType;
typedef std::map<VertexDescriptorType, int> VertexIndexStdMapType;
typedef boost::associative_property_map< VertexIndexStdMapType > VertexIndexMapType;
/** \brief Possible schemes for thresholding the network
*
* \li \c RandomRemovalOfWeakest: Randomly remove one of the weakest edges until a given density is reached
* \li \c LargestLowerThanDensity: Remove all edges of the lowest weight, repeat until below the specified density
* \li \c ThresholdBased: Remove all edges with a weight of threshold and lower. This will not take density information into account.
*/
enum ThresholdingSchemes
{
RandomRemovalOfWeakest,
LargestLowerThanDensity,
ThresholdBased
};
// Set/Get Macros
itkSetObjectMacro( Network, mitk::ConnectomicsNetwork );
itkSetMacro( ThresholdingScheme, ThresholdingSchemes );
itkSetMacro( TargetThreshold, double );
itkSetMacro( TargetDensity, double );
itkGetObjectMacro( Network, mitk::ConnectomicsNetwork );
itkGetMacro( ThresholdingScheme, ThresholdingSchemes );
itkGetMacro( TargetThreshold, double );
itkGetMacro( TargetDensity, double );
/** \brief Apply thresholding scheme and get resulting network */
mitk::ConnectomicsNetwork::Pointer GetThresholdedNetwork();
protected:
//////////////////// Functions ///////////////////////
ConnectomicsNetworkThresholder();
~ConnectomicsNetworkThresholder();
mitk::ConnectomicsNetwork::Pointer ThresholdByRandomRemoval( mitk::ConnectomicsNetwork::Pointer input, double targetDensity );
mitk::ConnectomicsNetwork::Pointer ThresholdBelowDensity( mitk::ConnectomicsNetwork::Pointer input, double targetDensity );
mitk::ConnectomicsNetwork::Pointer Threshold( mitk::ConnectomicsNetwork::Pointer input, double targetThreshold );
// Returns false if parameter combination is invalid
bool CheckValidity();
/////////////////////// Variables ////////////////////////
// The connectomics network, which is used for statistics calculation
mitk::ConnectomicsNetwork::Pointer m_Network;
// The thresholding scheme to be used
ThresholdingSchemes m_ThresholdingScheme;
double m_TargetThreshold;
double m_TargetDensity;
};
}// end namespace mitk
#endif // mitkConnectomicsNetworkThresholder_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsShortestPathHistogram.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsShortestPathHistogram.h
index beb1292313..7b537da41f 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsShortestPathHistogram.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsShortestPathHistogram.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ConnectomicsShortestPathHistogram_H
#define _MITK_ConnectomicsShortestPathHistogram_H
#include<mitkConnectomicsHistogramBase.h>
#include <MitkConnectomicsExports.h>
namespace mitk {
/**
* \brief A class to calculate and store the shortest path between each pair of nodes */
class MITKCONNECTOMICS_EXPORT ConnectomicsShortestPathHistogram : public mitk::ConnectomicsHistogramBase
{
public:
/** Enum for different ways to calculate shortest paths */
enum ShortestPathCalculationMode
{
UnweightedUndirectedMode,
WeightedUndirectedMode
};
ConnectomicsShortestPathHistogram();
virtual ~ConnectomicsShortestPathHistogram();
/** Set the calucaltion mode */
void SetShortestPathCalculationMode( const ShortestPathCalculationMode & );
/** Get the calculation mode */
ShortestPathCalculationMode GetShortestPathCalculationMode();
/** Get efficiency */
double GetEfficiency();
protected:
/* Typedefs */
typedef mitk::ConnectomicsNetwork::NetworkType NetworkType;
typedef boost::graph_traits< NetworkType >::vertex_descriptor DescriptorType;
typedef boost::graph_traits< NetworkType >::vertex_iterator IteratorType;
/** @brief Creates a new histogram from the network source. */
- virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source );
+ virtual void ComputeFromConnectomicsNetwork( ConnectomicsNetwork* source ) override;
/** Calculate shortest paths ignoring the weight of the edges */
void CalculateUnweightedUndirectedShortestPaths( NetworkType* boostGraph );
/** Calculate shortest paths taking into consideration the weight of the edges */
void CalculateWeightedUndirectedShortestPaths( NetworkType* boostGraph );
/** Converts the distance map to a histogram */
void ConvertDistanceMapToHistogram();
/** Stores which mode has been selected for shortest path calculation */
ShortestPathCalculationMode m_Mode;
/** Stores the shortest paths between the nodes */
std::vector< std::vector< int > > m_DistanceMatrix;
/** Stores, whether the graph has disconnected components */
bool m_EverythingConnected;
};
}
#endif /* _MITK_ConnectomicsShortestPathHistogram_H */
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h
index 0602d8fd0f..a7a02ba3a8 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h
@@ -1,55 +1,55 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSimulatedAnnealingCostFunctionBase_h
#define mitkConnectomicsSimulatedAnnealingCostFunctionBase_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
/**
* \brief A generic base class for cost functions for use in simulated annealing */
class MITKCONNECTOMICS_EXPORT ConnectomicsSimulatedAnnealingCostFunctionBase : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSimulatedAnnealingCostFunctionBase, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsSimulatedAnnealingCostFunctionBase, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
//////////////////// Functions ///////////////////////
ConnectomicsSimulatedAnnealingCostFunctionBase();
~ConnectomicsSimulatedAnnealingCostFunctionBase();
};
}// end namespace mitk
#endif // mitkConnectomicsSimulatedAnnealingCostFunctionBase_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h
index c5454d78c9..dff0001ba3 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSimulatedAnnealingCostFunctionModularity_h
#define mitkConnectomicsSimulatedAnnealingCostFunctionModularity_h
#include "mitkConnectomicsSimulatedAnnealingCostFunctionBase.h"
#include "mitkConnectomicsNetwork.h"
namespace mitk
{
/**
* \brief A cost function using the modularity of the network */
class MITKCONNECTOMICS_EXPORT ConnectomicsSimulatedAnnealingCostFunctionModularity : public mitk::ConnectomicsSimulatedAnnealingCostFunctionBase
{
public:
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType;
typedef std::map< VertexDescriptorType, int > ToModuleMapType;
typedef std::map< VertexDescriptorType, VertexDescriptorType > VertexToVertexMapType;
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSimulatedAnnealingCostFunctionModularity, itk::Object);
+ mitkClassMacro(ConnectomicsSimulatedAnnealingCostFunctionModularity, mitk::ConnectomicsSimulatedAnnealingCostFunctionBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Evaluate the network according to the set cost function
double Evaluate( mitk::ConnectomicsNetwork::Pointer network, ToModuleMapType *vertexToModuleMap ) const;
// Will calculate and return the modularity of the network
double CalculateModularity( mitk::ConnectomicsNetwork::Pointer network, ToModuleMapType *vertexToModuleMap ) const;
protected:
// returns the number of modules
int getNumberOfModules( ToModuleMapType *vertexToModuleMap ) const;
//////////////////// Functions ///////////////////////
ConnectomicsSimulatedAnnealingCostFunctionModularity();
~ConnectomicsSimulatedAnnealingCostFunctionModularity();
};
}// end namespace mitk
#endif // mitkConnectomicsSimulatedAnnealingCostFunctionModularity_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingManager.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingManager.h
index 1af35f8ca2..6e9a268116 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingManager.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingManager.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSimulatedAnnealingManager_h
#define mitkConnectomicsSimulatedAnnealingManager_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
#include "mitkConnectomicsSimulatedAnnealingPermutationBase.h"
namespace mitk
{
/**
* \brief A class allow generic simulated annealing by using classes derived from ConnectomicsSimulatedAnnealingPermutationBase */
class MITKCONNECTOMICS_EXPORT ConnectomicsSimulatedAnnealingManager : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSimulatedAnnealingManager, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsSimulatedAnnealingManager, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Decide whether to accept the change or not
bool AcceptChange( double costBefore, double costAfter, double temperature );
// Run the permutations at different temperatures, where t_n = t_n-1 / stepSize
void RunSimulatedAnnealing( double temperature, double stepSize );
// Set the permutation to be used
void SetPermutation( mitk::ConnectomicsSimulatedAnnealingPermutationBase::Pointer permutation );
protected:
//////////////////// Functions ///////////////////////
ConnectomicsSimulatedAnnealingManager();
~ConnectomicsSimulatedAnnealingManager();
/////////////////////// Variables ////////////////////////
// The permutation assigned to the simulated annealing manager
mitk::ConnectomicsSimulatedAnnealingPermutationBase::Pointer m_Permutation;
};
}// end namespace mitk
#endif // mitkConnectomicsSimulatedAnnealingManager_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationBase.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationBase.h
index 026fa0c873..c6992cc108 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationBase.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationBase.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSimulatedAnnealingPermutationBase_h
#define mitkConnectomicsSimulatedAnnealingPermutationBase_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
#include "mitkConnectomicsSimulatedAnnealingCostFunctionBase.h"
namespace mitk
{
/**
* \brief Base class of a permutation to be used in simulated annealing */
class MITKCONNECTOMICS_EXPORT ConnectomicsSimulatedAnnealingPermutationBase : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSimulatedAnnealingPermutationBase, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsSimulatedAnnealingPermutationBase, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Set the cost function
void SetCostFunction( mitk::ConnectomicsSimulatedAnnealingCostFunctionBase::Pointer costFunction );
// Returns true if a cost function is assigned
bool HasCostFunction( );
// Initialize the permutation
virtual void Initialize(){};
// Do a permutation for a specific temperature
virtual void Permutate( double /*temperature*/ ){};
// Do clean up necessary after a permutation
virtual void CleanUp(){};
protected:
//////////////////// Functions ///////////////////////
ConnectomicsSimulatedAnnealingPermutationBase();
~ConnectomicsSimulatedAnnealingPermutationBase();
/////////////////////// Variables ////////////////////////
// The cost function assigned to the permutation
mitk::ConnectomicsSimulatedAnnealingCostFunctionBase::Pointer m_CostFunction;
};
}// end namespace mitk
#endif // mitkConnectomicsSimulatedAnnealingPermutationBase_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationModularity.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationModularity.h
index 4dd03efca0..6e6d3c0b77 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationModularity.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSimulatedAnnealingPermutationModularity.h
@@ -1,140 +1,140 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSimulatedAnnealingPermutationModularity_h
#define mitkConnectomicsSimulatedAnnealingPermutationModularity_h
#include "mitkConnectomicsSimulatedAnnealingPermutationBase.h"
#include "mitkConnectomicsNetwork.h"
namespace mitk
{
/**
* \brief A class providing permutations for the calculation of modularity using simulated annealing */
class MITKCONNECTOMICS_EXPORT ConnectomicsSimulatedAnnealingPermutationModularity : public mitk::ConnectomicsSimulatedAnnealingPermutationBase
{
public:
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType;
typedef std::map< VertexDescriptorType, int > ToModuleMapType;
typedef std::map< VertexDescriptorType, VertexDescriptorType > VertexToVertexMapType;
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSimulatedAnnealingPermutationModularity, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsSimulatedAnnealingPermutationModularity, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Initialize the permutation
- virtual void Initialize();
+ virtual void Initialize() override;
// Do a permutation for a specific temperature
- virtual void Permutate( double temperature );
+ virtual void Permutate( double temperature ) override;
// Do clean up necessary after a permutation
- virtual void CleanUp();
+ virtual void CleanUp() override;
// set the network permutation is to be run upon
void SetNetwork( mitk::ConnectomicsNetwork::Pointer theNetwork );
// Get the number of modules the graph has ( highest number - 1 )
int getNumberOfModules( ToModuleMapType *vertexToModuleMap ) const;
// Get the number of vertices belonging to a given module
int getNumberOfVerticesInModule( ToModuleMapType *vertexToModuleMap, int module ) const;
// Set the mapping
void SetMapping( ToModuleMapType mapping );
// Get the mapping
ToModuleMapType GetMapping();
// Set depth
void SetDepth( int depth );
// Set stepSize
void SetStepSize( double size );
protected:
//////////////////// Functions ///////////////////////
ConnectomicsSimulatedAnnealingPermutationModularity();
~ConnectomicsSimulatedAnnealingPermutationModularity();
// This function moves one single node from a module to another
void permutateMappingSingleNodeShift(
ToModuleMapType *vertexToModuleMap,
mitk::ConnectomicsNetwork::Pointer network );
// This function splits and joins modules
void permutateMappingModuleChange(
ToModuleMapType *vertexToModuleMap,
double currentTemperature,
mitk::ConnectomicsNetwork::Pointer network );
// join the two given modules to a single one
void joinTwoModules( ToModuleMapType *vertexToModuleMap, int moduleA, int moduleB );
// split the given module recursively up to a certain level
// first randomly assigns nodes and then starts another simulated annealing
// on the sub network, as long as depthOfModuleChange > 0
void splitModule(
ToModuleMapType *vertexToModuleMap,
double currentTemperature,
mitk::ConnectomicsNetwork::Pointer network,
int moduleToSplit );
// Extract the subgraph of a network containing all nodes
// of a given module and the egdes between them
void extractModuleSubgraph(
ToModuleMapType *vertexToModuleMap,
mitk::ConnectomicsNetwork::Pointer network,
int moduleToSplit,
mitk::ConnectomicsNetwork::Pointer subNetwork,
VertexToVertexMapType* graphToSubgraphVertexMap,
VertexToVertexMapType* subgraphToGraphVertexMap );
// Remove empty modules by moving all nodes of the highest module to the given module
void removeModule( ToModuleMapType *vertexToModuleMap, int module );
// Randomly assign nodes to modules, this makes sure each module contains at least one node
// as long as numberOfIntendedModules < number of nodes
void randomlyAssignNodesToModules(ToModuleMapType *vertexToModuleMap, int numberOfIntendedModules );
// Evaluate mapping using a modularity cost function
double Evaluate( ToModuleMapType* mapping ) const;
// Whether to accept the permutation
bool AcceptChange( double costBefore, double costAfter, double temperature ) const;
// the current best solution
ToModuleMapType m_BestSolution;
// the network
mitk::ConnectomicsNetwork::Pointer m_Network;
// How many levels of recursive calls can be gone down
int m_Depth;
// The step size for recursive configuring of simulated annealing manager
double m_StepSize;
};
}// end namespace mitk
#endif // mitkConnectomicsSimulatedAnnealingPermutationModularity_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsStatisticsCalculator.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsStatisticsCalculator.h
index 34afc3d1af..d52ba6c743 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsStatisticsCalculator.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsStatisticsCalculator.h
@@ -1,243 +1,243 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsStatisticsCalculator_h
#define mitkConnectomicsStatisticsCalculator_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include <MitkConnectomicsExports.h>
#include <mitkConnectomicsNetwork.h>
namespace mitk
{
/**
* \brief A class giving functions for calculating a variety of network indices */
class MITKCONNECTOMICS_EXPORT ConnectomicsStatisticsCalculator : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsStatisticsCalculator, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsStatisticsCalculator, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
// Typedefs
typedef mitk::ConnectomicsNetwork::NetworkType NetworkType;
typedef mitk::ConnectomicsNetwork::VertexDescriptorType VertexDescriptorType;
typedef mitk::ConnectomicsNetwork::EdgeDescriptorType EdgeDescriptorType;
typedef boost::graph_traits<NetworkType>::vertex_iterator VertexIteratorType;
typedef boost::graph_traits<NetworkType>::edge_iterator EdgeIteratorType;
typedef boost::graph_traits<NetworkType>::adjacency_iterator AdjacencyIteratorType;
typedef std::map<EdgeDescriptorType, int> EdgeIndexStdMapType;
typedef boost::associative_property_map< EdgeIndexStdMapType > EdgeIndexMapType;
typedef boost::iterator_property_map< std::vector< double >::iterator, EdgeIndexMapType > EdgeIteratorPropertyMapType;
typedef boost::property_map< NetworkType, boost::vertex_index_t>::type VertexIndexMapType;
typedef boost::iterator_property_map< std::vector< double >::iterator, VertexIndexMapType > VertexIteratorPropertyMapType;
// Set/Get Macros
itkSetObjectMacro( Network, mitk::ConnectomicsNetwork );
itkGetMacro( NumberOfVertices, unsigned int );
itkGetMacro( NumberOfEdges, unsigned int );
itkGetMacro( AverageDegree, double );
itkGetMacro( ConnectionDensity, double );
itkGetMacro( NumberOfConnectedComponents, unsigned int );
itkGetMacro( AverageComponentSize, double );
itkGetMacro( Components, std::vector< int > );
itkGetMacro( LargestComponentSize, unsigned int );
itkGetMacro( RatioOfNodesInLargestComponent, double );
itkGetMacro( HopPlotExponent, double );
itkGetMacro( EffectiveHopDiameter, double );
itkGetMacro( VectorOfClusteringCoefficientsC, std::vector< double > );
itkGetMacro( VectorOfClusteringCoefficientsD, std::vector< double > );
itkGetMacro( VectorOfClusteringCoefficientsE, std::vector< double > );
itkGetMacro( AverageClusteringCoefficientsC, double );
itkGetMacro( AverageClusteringCoefficientsD, double );
itkGetMacro( AverageClusteringCoefficientsE, double );
itkGetMacro( VectorOfVertexBetweennessCentralities, std::vector< double > );
itkGetMacro( PropertyMapOfVertexBetweennessCentralities, VertexIteratorPropertyMapType );
itkGetMacro( AverageVertexBetweennessCentrality, double );
itkGetMacro( VectorOfEdgeBetweennessCentralities, std::vector< double > );
itkGetMacro( PropertyMapOfEdgeBetweennessCentralities, EdgeIteratorPropertyMapType );
itkGetMacro( AverageEdgeBetweennessCentrality, double );
itkGetMacro( NumberOfIsolatedPoints, unsigned int );
itkGetMacro( RatioOfIsolatedPoints, double );
itkGetMacro( NumberOfEndPoints, unsigned int );
itkGetMacro( RatioOfEndPoints, double );
itkGetMacro( VectorOfEccentrities, std::vector< unsigned int > );
itkGetMacro( VectorOfEccentrities90, std::vector< unsigned int > );
itkGetMacro( VectorOfAveragePathLengths, std::vector< double > );
itkGetMacro( Diameter, unsigned int );
itkGetMacro( Diameter90, unsigned int );
itkGetMacro( Radius, unsigned int );
itkGetMacro( Radius90, unsigned int );
itkGetMacro( AverageEccentricity, double );
itkGetMacro( AverageEccentricity90, double );
itkGetMacro( AveragePathLength, double );
itkGetMacro( NumberOfCentralPoints, unsigned int );
itkGetMacro( RatioOfCentralPoints, double );
itkGetMacro( VectorOfSortedEigenValues, std::vector< double > );
itkGetMacro( SpectralRadius, double );
itkGetMacro( SecondLargestEigenValue, double );
itkGetMacro( AdjacencyTrace, double );
itkGetMacro( AdjacencyEnergy, double );
itkGetMacro( VectorOfSortedLaplacianEigenValues, std::vector< double > );
itkGetMacro( LaplacianTrace, double );
itkGetMacro( LaplacianEnergy, double );
itkGetMacro( LaplacianSpectralGap, double );
itkGetMacro( VectorOfSortedNormalizedLaplacianEigenValues, std::vector< double > );
itkGetMacro( NormalizedLaplacianTrace, double );
itkGetMacro( NormalizedLaplacianEnergy, double );
itkGetMacro( NormalizedLaplacianNumberOf2s, unsigned int );
itkGetMacro( NormalizedLaplacianNumberOf1s, unsigned int );
itkGetMacro( NormalizedLaplacianNumberOf0s, unsigned int );
itkGetMacro( NormalizedLaplacianLowerSlope, double );
itkGetMacro( NormalizedLaplacianUpperSlope, double );
itkGetMacro( SmallWorldness, double );
void Update();
protected:
//////////////////// Functions ///////////////////////
ConnectomicsStatisticsCalculator();
~ConnectomicsStatisticsCalculator();
void CalculateNumberOfVertices();
void CalculateNumberOfEdges();
void CalculateAverageDegree();
void CalculateConnectionDensity();
void CalculateNumberOfConnectedComponents();
void CalculateAverageComponentSize();
void CalculateLargestComponentSize();
void CalculateRatioOfNodesInLargestComponent();
void CalculateHopPlotValues();
/**
* \brief Calculate the different clustering coefficients
*
* The clustering coefficient (cc) measures how strong the tendency to form cliques
* is in the network. Groups of nodes, that are highly interconnected.
*
* CC C - Percentage of connections between nodes connected with the given node
* CC D - Same as C, but including the connections with the given node
* CC E - Same as C, but not counting isolated nodes when averaging
*/
void CalculateClusteringCoefficients();
void CalculateBetweennessCentrality();
void CalculateIsolatedAndEndPoints();
void CalculateShortestPathMetrics();
void CalculateSpectralMetrics();
void CalculateLaplacianMetrics();
void CalculateNormalizedLaplacianMetrics();
/**
* \brief Calculate the small worldness of the network.
*
* This will compare the clustering coefficient and mean path length of the network
* to an Erdos-Reny network of the same number of nodes and edges.
*/
void CalculateSmallWorldness();
/////////////////////// Variables ////////////////////////
// The connectomics network, which is used for statistics calculation
mitk::ConnectomicsNetwork::Pointer m_Network;
// Statistics
unsigned int m_NumberOfVertices;
unsigned int m_NumberOfEdges;
double m_AverageDegree;
double m_ConnectionDensity;
unsigned int m_NumberOfConnectedComponents;
double m_AverageComponentSize;
std::vector< int > m_Components;
unsigned int m_LargestComponentSize;
double m_RatioOfNodesInLargestComponent;
double m_HopPlotExponent;
double m_EffectiveHopDiameter;
std::vector< double > m_VectorOfClusteringCoefficientsC;
std::vector< double > m_VectorOfClusteringCoefficientsD;
std::vector< double > m_VectorOfClusteringCoefficientsE;
double m_AverageClusteringCoefficientsC;
double m_AverageClusteringCoefficientsD;
double m_AverageClusteringCoefficientsE;
std::vector< double > m_VectorOfVertexBetweennessCentralities;
VertexIteratorPropertyMapType m_PropertyMapOfVertexBetweennessCentralities;
double m_AverageVertexBetweennessCentrality;
std::vector< double > m_VectorOfEdgeBetweennessCentralities;
EdgeIteratorPropertyMapType m_PropertyMapOfEdgeBetweennessCentralities;
double m_AverageEdgeBetweennessCentrality;
unsigned int m_NumberOfIsolatedPoints;
double m_RatioOfIsolatedPoints;
unsigned int m_NumberOfEndPoints;
double m_RatioOfEndPoints;
std::vector< unsigned int > m_VectorOfEccentrities;
std::vector< unsigned int > m_VectorOfEccentrities90;
std::vector< double > m_VectorOfAveragePathLengths;
unsigned int m_Diameter;
unsigned int m_Diameter90;
unsigned int m_Radius;
unsigned int m_Radius90;
double m_AverageEccentricity;
double m_AverageEccentricity90;
double m_AveragePathLength;
unsigned int m_NumberOfCentralPoints;
double m_RatioOfCentralPoints;
std::vector<double> m_VectorOfSortedEigenValues;
double m_SpectralRadius;
double m_SecondLargestEigenValue;
double m_AdjacencyTrace;
double m_AdjacencyEnergy;
std::vector<double> m_VectorOfSortedLaplacianEigenValues;
double m_LaplacianTrace;
double m_LaplacianEnergy;
double m_LaplacianSpectralGap;
std::vector<double> m_VectorOfSortedNormalizedLaplacianEigenValues;
double m_NormalizedLaplacianTrace;
double m_NormalizedLaplacianEnergy;
unsigned int m_NormalizedLaplacianNumberOf2s;
unsigned int m_NormalizedLaplacianNumberOf1s;
unsigned int m_NormalizedLaplacianNumberOf0s;
double m_NormalizedLaplacianLowerSlope;
double m_NormalizedLaplacianUpperSlope;
double m_SmallWorldness;
};
}// end namespace mitk
#endif // mitkConnectomicsStatisticsCalculator_h
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSyntheticNetworkGenerator.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSyntheticNetworkGenerator.h
index 9860a712f6..5fdf5dd8ad 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSyntheticNetworkGenerator.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkConnectomicsSyntheticNetworkGenerator.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsSyntheticNetworkGenerator_h
#define mitkConnectomicsSyntheticNetworkGenerator_h
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMacro.h>
#include "mitkCommon.h"
#include "mitkImage.h"
#include "mitkConnectomicsNetwork.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
/**
* \brief A class to generate synthetic networks */
class MITKCONNECTOMICS_EXPORT ConnectomicsSyntheticNetworkGenerator : public itk::Object
{
public:
/** Standard class typedefs. */
/** Method for creation through the object factory. */
- mitkClassMacro(ConnectomicsSyntheticNetworkGenerator, itk::Object);
+ mitkClassMacroItkParent(ConnectomicsSyntheticNetworkGenerator, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Create Synthetic Networks */
mitk::ConnectomicsNetwork::Pointer CreateSyntheticNetwork(int networkTypeId, int paramterOne, double parameterTwo);
/** Return whether the last attempted network generation was a success*/
bool WasGenerationSuccessfull();
protected:
//////////////////// Functions ///////////////////////
ConnectomicsSyntheticNetworkGenerator();
~ConnectomicsSyntheticNetworkGenerator();
/** Generate a default geometry for synthetic images */
mitk::Geometry3D::Pointer GenerateDefaultGeometry();
/** Generate a synthetic cube (regular lattice) network */
void GenerateSyntheticCubeNetwork( mitk::ConnectomicsNetwork::Pointer network, int cubeExtent, double distance );
/** Generate a highly heterogenic network
*
* This is achieved by generating a center vertex and vertices on
* a sphere surface, which are all only connected to the center
* vertex. */
void GenerateSyntheticCenterToSurfaceNetwork(
mitk::ConnectomicsNetwork::Pointer network, int numberOfPoints, double radius );
/** Generate a random network without specific characteristics
*
* This is achieved by generating vertices and then deciding whether to
* specific vertices are connected by comparing a random number to the threshold */
void GenerateSyntheticRandomNetwork(
mitk::ConnectomicsNetwork::Pointer network, int numberOfPoints, double threshold );
/////////////////////// Variables ////////////////////////
/** Store whether the network generated last was generated properly */
bool m_LastGenerationWasSuccess;
};
}// end namespace mitk
#endif // _mitkConnectomicsSyntheticNetworkGenerator_H_INCLUDED
diff --git a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkFreeSurferParcellationTranslator.h b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkFreeSurferParcellationTranslator.h
index 0ec3abc881..b943c2f054 100644
--- a/Modules/DiffusionImaging/Connectomics/Algorithms/mitkFreeSurferParcellationTranslator.h
+++ b/Modules/DiffusionImaging/Connectomics/Algorithms/mitkFreeSurferParcellationTranslator.h
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFreeSurferParcellationTranslator_h
#define mitkFreeSurferParcellationTranslator_h
// MITK
#include <MitkConnectomicsExports.h>
#include <itkObject.h>
#include <mitkDataNode.h>
#include <mitkLookupTable.h>
#include <mitkTransferFunction.h>
// VTK
#include <vtkSmartPointer.h>
using namespace mitk;
using namespace std;
namespace mitk
{
/**
* @brief The mitkFreeSurferParcellationTranslator class
*
* This class provides a ready to use lookup table for freesurfer processed images and further functions e.g. to get the name assigned to a given label.
* Additional you can assign the lookup table or transferfunction by using the AssignLookupTable(DataNode* node) or AssignTransferfunction(DataNode* node) methods.
*
*/
class MITKCONNECTOMICS_EXPORT FreeSurferParcellationTranslator : public itk::Object
{
/*########### Constructors, Typedefs and Enumerations ###########*/
public:
typedef map<string, string> NameTable;
- mitkClassMacro( FreeSurferParcellationTranslator, Object )
+ mitkClassMacroItkParent( FreeSurferParcellationTranslator, itk::Object )
itkNewMacro( FreeSurferParcellationTranslator )
protected:
FreeSurferParcellationTranslator();
~FreeSurferParcellationTranslator();
/*########### Methods ###########*/
public:
/**
* @brief Assign the lookup table to the given node
* @param node the lookup table should be assigned to
*/
virtual void AssignLookupTable( DataNode::Pointer node ) const;
/**
* @brief Assign the color transfer function to the given node
* @param node the transferfunction should be assigned to
*/
virtual void AssignTransferFunction( DataNode::Pointer node ) const;
/**
* @brief Get the label assigned to the given name
* @param name the label should be assigned to
* @return label
*/
virtual const string GetLabel( const string & name ) const;
/**
* @brief Get the label assigned to the given name
* @param name the label should be assigned to
* @return label
*/
virtual int GetLabelAsNumber( const string & name ) const;
/**
* @brief Return the lookup table
* @return lookup table
*/
virtual LookupTable::Pointer GetLookupTable() const;
/**
* @brief Get the name assigned to the given label
* @param label
* @return name
*/
virtual const string GetName( const string & label ) const;
/**
* @brief Get the name assigned to the given label
* @param label
* @return name
*/
virtual const string GetName( int label ) const;
/**
* @brief Get the transfer function
* @return transfer function
*/
virtual TransferFunction::Pointer GetTransferFunction() const;
private:
static LookupTable::Pointer CreateLookupTable();
static TransferFunction::Pointer CreateTransferFunction();
static NameTable CreateNameTable();
/*########### Static Members ###########*/
private:
static LookupTable::Pointer m_LookupTable;
static TransferFunction::Pointer m_TransferFunction;
static const NameTable m_NameTable;
};
}
#endif // mitkFreeSurferParcellationTranslator_h
diff --git a/Modules/DiffusionImaging/Connectomics/IODataStructures/mitkConnectomicsNetwork.h b/Modules/DiffusionImaging/Connectomics/IODataStructures/mitkConnectomicsNetwork.h
index ad32a3d1d5..0487855989 100644
--- a/Modules/DiffusionImaging/Connectomics/IODataStructures/mitkConnectomicsNetwork.h
+++ b/Modules/DiffusionImaging/Connectomics/IODataStructures/mitkConnectomicsNetwork.h
@@ -1,236 +1,236 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_ConnectomicsNetwork_H
#define _MITK_ConnectomicsNetwork_H
#include <MitkConnectomicsExports.h>
#include "mitkBaseData.h"
#include <boost/graph/adjacency_list.hpp>
namespace mitk {
/**
* \brief Connectomics Network Class
*
* This class is designed to represent a connectomics network (brain network). It encapsulates a
* boost adjacency list and provides additional capabilities. The information contained in the nodes and edges is:
*
* Network Node:
* <ul>
* <li> int ID - The id of the node
* <li> string label - The label of the node, this can be any string, such as an anatomical label
* <li> vector<float> coordinates - The coordinates the node should be displayed at
* </ul>
*
* Network Edge:
* <ul>
* <li> int sourceId - The Id of the source node
* <li> int targetId - The Id of the target node
* <li> int weight - Weight of the edge as int (used for counting fibers)
* <li> double edge_weight - Used for boost and algorithms, should be between 0 and 1
* </ul>
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsNetwork : public BaseData
{
public:
/** Structs for the graph */
/** The Node */
struct NetworkNode
{
int id;
std::string label;
std::vector< float > coordinates;
};
/** The Edge */
struct NetworkEdge
{
int sourceId;
int targetId;
int weight; // For now the number of times it was present
double edge_weight; // For boost, currently set to 1 by default for unweighted calculations
};
/** Typedefs **/
//typedef boost::adjacency_list< boost::listS, boost::listS, boost::undirectedS, NetworkNode, NetworkEdge > NetworkType;
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, NetworkNode, NetworkEdge > NetworkType;
typedef boost::graph_traits<NetworkType>::vertex_descriptor VertexDescriptorType;
typedef boost::graph_traits<NetworkType>::edge_descriptor EdgeDescriptorType;
// virtual methods that need to be implemented
- virtual void UpdateOutputInformation();
- virtual void SetRequestedRegionToLargestPossibleRegion();
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
- virtual bool VerifyRequestedRegion();
- virtual void SetRequestedRegion(const itk::DataObject * );
+ virtual void UpdateOutputInformation() override;
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
+ virtual bool VerifyRequestedRegion() override;
+ virtual void SetRequestedRegion(const itk::DataObject * ) override;
// Macros
mitkClassMacro( ConnectomicsNetwork, BaseData );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
////////////////// Interface ///////////////////
/** return whether an edge exists between the two given vertices */
bool EdgeExists( VertexDescriptorType vertexA, VertexDescriptorType vertexB ) const;
/** increase the weight of an edge between the two given vertices */
void IncreaseEdgeWeight( VertexDescriptorType vertexA, VertexDescriptorType vertexB );
/** add an edge between two given vertices */
void AddEdge( VertexDescriptorType vertexA, VertexDescriptorType vertexB);
/** add an edge between two given vertices ( with a specific weight ) */
void AddEdge( VertexDescriptorType vertexA, VertexDescriptorType vertexB, int sourceID, int targetID, int weight = 1 );
/** add a vertex with a specified id */
VertexDescriptorType AddVertex( int id);
/** set the label of a vertex */
void SetLabel( VertexDescriptorType vertex, std::string inLabel );
/** set the coordinates of a vertex */
void SetCoordinates( VertexDescriptorType vertex, std::vector< float > inCoordinates );
/** clear the graph */
void clear();
/** return the node struct for a given node descriptor */
NetworkNode GetNode( VertexDescriptorType vertex ) const;
/** return the edge struct for two given node descriptors */
NetworkEdge GetEdge( VertexDescriptorType vertexA, VertexDescriptorType vertexB ) const;
/** get vector containing all the nodes of the network */
std::vector< NetworkNode > GetVectorOfAllNodes() const;
/** get vector containing all the vertex descriptors of the network */
std::vector< VertexDescriptorType > GetVectorOfAllVertexDescriptors() const;
/** get vector containing the descriptors of nodes adjacent to the vertex denoted by the given descriptor */
std::vector< VertexDescriptorType > GetVectorOfAdjacentNodes( VertexDescriptorType vertex ) const;
/** get vector containing all the edges of the network and the connected nodes */
std::vector< std::pair< std::pair< NetworkNode, NetworkNode > , NetworkEdge > > GetVectorOfAllEdges() const;
/** get overall number of vertices in the network */
int GetNumberOfVertices() const;
/** get overall number of edges in the network */
int GetNumberOfEdges() const;
/** get number of vertices, that are connected to themselves */
int GetNumberOfSelfLoops();
/** get number of vertices, that are connected to themselves */
double GetAverageDegree();
/** get number of edges divided by number of possible edges */
double GetConnectionDensity();
/** Get the maximum weight of all edges */
int GetMaximumWeight() const;
/** Get a vector in the format vector[ vertexID ] = degree */
std::vector< int > GetDegreeOfNodes( ) const;
/** Get the maximum degree of all nodes */
int GetMaximumDegree() const;
/** Get a vector in the format vector[ vertexID ] = clustering coefficient */
std::vector< double > GetLocalClusteringCoefficients( ) const;
/** Get a vector in the format vector[ degree ] = average clustering coefficient */
std::vector< double > GetClusteringCoefficientsByDegree( );
/** Get the global clustering coefficient */
double GetGlobalClusteringCoefficient( );
/** Get the betweenness centrality for each vertex in form of a vector of length (number vertices)*/
std::vector< double > GetNodeBetweennessVector() const;
/** Get the betweenness centrality for each edge in form of a vector of length (number edges)*/
std::vector< double > GetEdgeBetweennessVector() const;
/** Check whether a vertex with the specified label exists*/
bool CheckForLabel( std::string targetLabel ) const;
/** Get the shortest distance from a specified vertex to all other vertices in form of a vector of length (number vertices)*/
std::vector< double > GetShortestDistanceVectorFromLabel( std::string targetLabel ) const;
/** Access boost graph directly */
NetworkType* GetBoostGraph();
/** Set the boost graph directly */
void SetBoostGraph( NetworkType* newGraph );
void ImportNetwort( mitk::ConnectomicsNetwork::Pointer source );
/** Get the modified flag */
bool GetIsModified() const;
/** Set the modified flag */
void SetIsModified( bool );
/** Update the bounds of the geometry to fit the network */
void UpdateBounds( );
/** Remove nodes not connected to any other node */
void PruneUnconnectedSingleNodes();
/** This function will relabel all vertices and edges in a continuous manner
*
* Mainly important after removing vertices, to make sure that the ids run continuously from
* 0 to number of vertices - 1 and edge target and source ids match the corresponding node.
*/
void UpdateIDs();
protected:
ConnectomicsNetwork();
virtual ~ConnectomicsNetwork();
NetworkType m_Network;
/// Flag which indicates whether the network has been modified since the last check
///
/// mainly for rendering purposes
bool m_IsModified;
private:
};
/**
* \brief Returns true if the networks are considered equal.
*
* For now two networks are considered equal if they have the following properties are equal:
* - Number of nodes
* - Number of edges
* - Smallworldness
*/
MITKCONNECTOMICS_EXPORT bool Equal( mitk::ConnectomicsNetwork* leftHandSide, mitk::ConnectomicsNetwork* rightHandSide, mitk::ScalarType eps, bool verbose);
} // namespace mitk
#endif /* _MITK_ConnectomicsNetwork_H */
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.h
index 6ddf446ff5..9b92b89117 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsNetworkMapper3D.h
@@ -1,135 +1,135 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ConnectomicsNetworkMapper3D_H_HEADER_INCLUDED
#define ConnectomicsNetworkMapper3D_H_HEADER_INCLUDED
// VTK includes
#include <vtkSmartPointer.h>
#include "vtkPropAssembly.h"
// MITK includes
// base class
#include "mitkVtkMapper.h"
// data type
#include "mitkConnectomicsNetwork.h"
#include <vtkActor.h>
#include <vtkPolyData.h>
#include <vtkSphereSource.h>
#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <vtkPoints.h>
#include <vtkPolyLine.h>
#include <vtkLineSource.h>
#include <vtkProperty.h>
#include <vtkTubeFilter.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkInteractorStyleTrackball.h>
#include <vector>
#include <MitkConnectomicsExports.h>
namespace mitk {
/**
* \brief Mapper for Networks
* \ingroup Mapper
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsNetworkMapper3D : public VtkMapper
{
public:
mitkClassMacro(ConnectomicsNetworkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); //looks like deprecated.. should be replaced bz GetViewProp()
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override; //looks like deprecated.. should be replaced bz GetViewProp()
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper);
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
virtual const mitk::ConnectomicsNetwork* GetInput();
protected:
ConnectomicsNetworkMapper3D();
virtual ~ConnectomicsNetworkMapper3D();
void UpdateVtkObjects();
vtkPropAssembly *m_NetworkAssembly;
/**
* \brief Returns true if the properties have changed since the last data generation
*/
bool PropertiesChanged();
// Create vectors for customizing color and radius and return maximum
double FillNodeParameterVector( std::vector< double > * parameterVector, std::string parameterName );
double FillEdgeParameterVector( std::vector< double > * parameterVector, std::string parameterName );
void FillNodeFilterBoolVector( std::vector< bool > * boolVector, std::string parameterName );
void FillEdgeFilterBoolVector( std::vector< bool > * boolVector, std::string parameterName );
// Property storing members
std::string m_ChosenRenderingScheme;
std::string m_ChosenEdgeFilter;
std::string m_EdgeThresholdParameter;
double m_EdgeThreshold;
std::string m_ChosenNodeFilter;
std::string m_NodeThresholdParameter;
double m_NodeThreshold;
mitk::Color m_NodeColorStart;
mitk::Color m_NodeColorEnd;
double m_NodeRadiusStart;
double m_NodeRadiusEnd;
std::string m_ChosenNodeLabel;
mitk::Color m_EdgeColorStart;
mitk::Color m_EdgeColorEnd;
double m_EdgeRadiusStart;
double m_EdgeRadiusEnd;
std::string m_NodeRadiusParameter;
std::string m_NodeColorParameter;
std::string m_EdgeRadiusParameter;
std::string m_EdgeColorParameter;
};
} // namespace mitk
#endif /* ConnectomicsNetworkMapper3D_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeColorParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeColorParameterProperty.h
index 2eb2da75e9..5a97f7c74f 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeColorParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeColorParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_EDGE_COLOR_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_EDGE_COLOR_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingEdgeColorParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingEdgeColorParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingEdgeColorParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingEdgeColorParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingEdgeColorParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingEdgeColorParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingEdgeColorParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingEdgeColorParameters();
private:
// purposely not implemented
ConnectomicsRenderingEdgeColorParameterProperty(const ConnectomicsRenderingEdgeColorParameterProperty&);
ConnectomicsRenderingEdgeColorParameterProperty& operator=(const ConnectomicsRenderingEdgeColorParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeFilteringProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeFilteringProperty.h
index c7d59cf3f6..061a1f730d 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeFilteringProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeFilteringProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_EDGE_FILTERING_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_EDGE_FILTERING_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different edge filtering options for rendering connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingEdgeFilteringProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingEdgeFilteringProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingEdgeFilteringProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingEdgeFilteringProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingEdgeFilteringProperty( );
/**
* Constructor. Sets the filter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the filter
*/
ConnectomicsRenderingEdgeFilteringProperty( const IdType& value );
/**
* Constructor. Sets the filter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the filter
*/
ConnectomicsRenderingEdgeFilteringProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingFilter();
private:
// purposely not implemented
ConnectomicsRenderingEdgeFilteringProperty(const ConnectomicsRenderingEdgeFilteringProperty&);
ConnectomicsRenderingEdgeFilteringProperty& operator=(const ConnectomicsRenderingEdgeFilteringProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeRadiusParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeRadiusParameterProperty.h
index cc7947bae0..e7f20ca444 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeRadiusParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeRadiusParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_EDGE_RADIUS_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_EDGE_RADIUS_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingEdgeRadiusParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingEdgeRadiusParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingEdgeRadiusParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingEdgeRadiusParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingEdgeRadiusParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingEdgeRadiusParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingEdgeRadiusParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingEdgeRadiusParameters();
private:
// purposely not implemented
ConnectomicsRenderingEdgeRadiusParameterProperty(const ConnectomicsRenderingEdgeRadiusParameterProperty&);
ConnectomicsRenderingEdgeRadiusParameterProperty& operator=(const ConnectomicsRenderingEdgeRadiusParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeThresholdParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeThresholdParameterProperty.h
index d9d42e456d..0baeb6d446 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeThresholdParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingEdgeThresholdParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_EDGE_THRESHOLD_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_EDGE_THRESHOLD_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingEdgeThresholdParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingEdgeThresholdParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingEdgeThresholdParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingEdgeThresholdParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingEdgeThresholdParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingEdgeThresholdParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingEdgeThresholdParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingEdgeThresholdParameters();
private:
// purposely not implemented
ConnectomicsRenderingEdgeThresholdParameterProperty(const ConnectomicsRenderingEdgeThresholdParameterProperty&);
ConnectomicsRenderingEdgeThresholdParameterProperty& operator=(const ConnectomicsRenderingEdgeThresholdParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeColorParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeColorParameterProperty.h
index 5c080033e4..b85b82218b 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeColorParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeColorParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_NODE_COLOR_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_NODE_COLOR_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingNodeColorParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingNodeColorParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingNodeColorParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingNodeColorParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingNodeColorParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingNodeColorParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingNodeColorParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingNodeColorParameters();
private:
// purposely not implemented
ConnectomicsRenderingNodeColorParameterProperty(const ConnectomicsRenderingNodeColorParameterProperty&);
ConnectomicsRenderingNodeColorParameterProperty& operator=(const ConnectomicsRenderingNodeColorParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeFilteringProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeFilteringProperty.h
index 3f98a35f80..aacfac79b1 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeFilteringProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeFilteringProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_NODE_FILTERING_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_NODE_FILTERING_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different node filtering options for rendering connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingNodeFilteringProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingNodeFilteringProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingNodeFilteringProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingNodeFilteringProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingNodeFilteringProperty( );
/**
* Constructor. Sets the filter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the filter
*/
ConnectomicsRenderingNodeFilteringProperty( const IdType& value );
/**
* Constructor. Sets the filter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the filter
*/
ConnectomicsRenderingNodeFilteringProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingFilter();
private:
// purposely not implemented
ConnectomicsRenderingNodeFilteringProperty(const ConnectomicsRenderingNodeFilteringProperty&);
ConnectomicsRenderingNodeFilteringProperty& operator=(const ConnectomicsRenderingNodeFilteringProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeRadiusParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeRadiusParameterProperty.h
index be17fddaf0..8fc6e3d179 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeRadiusParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeRadiusParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_NODE_RADIUS_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_NODE_RADIUS_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingNodeRadiusParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingNodeRadiusParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingNodeRadiusParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingNodeRadiusParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingNodeRadiusParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingNodeRadiusParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingNodeRadiusParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingNodeRadiusParameters();
private:
// purposely not implemented
ConnectomicsRenderingNodeRadiusParameterProperty(const ConnectomicsRenderingNodeRadiusParameterProperty&);
ConnectomicsRenderingNodeRadiusParameterProperty& operator=(const ConnectomicsRenderingNodeRadiusParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeThresholdParameterProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeThresholdParameterProperty.h
index d12b9d913a..3edeec5d47 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeThresholdParameterProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingNodeThresholdParameterProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_NODE_THRESHOLD_PARAMETER_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_NODE_THRESHOLD_PARAMETER_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingNodeThresholdParameterProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingNodeThresholdParameterProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingNodeThresholdParameterProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingNodeThresholdParameterProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingNodeThresholdParameterProperty( );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the parameter
*/
ConnectomicsRenderingNodeThresholdParameterProperty( const IdType& value );
/**
* Constructor. Sets the parameter to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the parameter
*/
ConnectomicsRenderingNodeThresholdParameterProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingNodeThresholdParameters();
private:
// purposely not implemented
ConnectomicsRenderingNodeThresholdParameterProperty(const ConnectomicsRenderingNodeThresholdParameterProperty&);
ConnectomicsRenderingNodeThresholdParameterProperty& operator=(const ConnectomicsRenderingNodeThresholdParameterProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingSchemeProperty.h b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingSchemeProperty.h
index f4b8244bee..8079b19f58 100644
--- a/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingSchemeProperty.h
+++ b/Modules/DiffusionImaging/Connectomics/Rendering/mitkConnectomicsRenderingSchemeProperty.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONNECTOMICS_RENDERING_SCHEME_PROPERTY__H_
#define _MITK_CONNECTOMICS_RENDERING_SCHEME_PROPERTY__H_
#include "mitkEnumerationProperty.h"
#include <MitkConnectomicsExports.h>
namespace mitk
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4522)
#endif
/**
* Encapsulates the enumeration of different rendering schemes for connectomics networks
*/
class MITKCONNECTOMICS_EXPORT ConnectomicsRenderingSchemeProperty : public EnumerationProperty
{
public:
mitkClassMacro( ConnectomicsRenderingSchemeProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(ConnectomicsRenderingSchemeProperty, const IdType&);
mitkNewMacro1Param(ConnectomicsRenderingSchemeProperty, const std::string&);
using BaseProperty::operator=;
protected:
/**
* Constructor. Sets the representation to a default value of 0
*/
ConnectomicsRenderingSchemeProperty( );
/**
* Constructor. Sets the scheme to the given value. If it is not
* valid, the value is set to 0
* @param value the integer representation of the scheme
*/
ConnectomicsRenderingSchemeProperty( const IdType& value );
/**
* Constructor. Sets the scheme to the given value. If it is not
* valid, the value is set to 0
* @param value the string representation of the scheme
*/
ConnectomicsRenderingSchemeProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional enumerations.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddRenderingSchemes();
private:
// purposely not implemented
ConnectomicsRenderingSchemeProperty(const ConnectomicsRenderingSchemeProperty&);
ConnectomicsRenderingSchemeProperty& operator=(const ConnectomicsRenderingSchemeProperty&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsNetworkCreationTest.cpp b/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsNetworkCreationTest.cpp
index 1af41ca778..e07ba8b76b 100644
--- a/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsNetworkCreationTest.cpp
+++ b/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsNetworkCreationTest.cpp
@@ -1,113 +1,113 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// Testing
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
// std includes
#include <string>
// MITK includes
#include "mitkConnectomicsNetworkCreator.h"
#include "mitkIOUtil.h"
// VTK includes
#include <vtkDebugLeaks.h>
class mitkConnectomicsNetworkCreationTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkConnectomicsNetworkCreationTestSuite);
/// \todo Fix VTK memory leaks. Bug 18097.
vtkDebugLeaks::SetExitError(0);
MITK_TEST(CreateNetworkFromFibersAndParcellation);
CPPUNIT_TEST_SUITE_END();
private:
std::string m_ParcellationPath;
std::string m_FiberPath;
std::string m_ReferenceNetworkPath;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
m_ReferenceNetworkPath = GetTestDataFilePath("DiffusionImaging/Connectomics/reference.cnf");
m_ParcellationPath = GetTestDataFilePath("DiffusionImaging/Connectomics/parcellation.nrrd");
m_FiberPath = GetTestDataFilePath("DiffusionImaging/Connectomics/fiberBundle.fib");
}
- void tearDown()
+ void tearDown() override
{
m_ReferenceNetworkPath = "";
m_ParcellationPath = "";
m_FiberPath = "";
}
void CreateNetworkFromFibersAndParcellation()
{
// load fiber image
std::vector<mitk::BaseData::Pointer> fiberInfile = mitk::IOUtil::Load( m_FiberPath );
if( fiberInfile.empty() )
{
std::string errorMessage = "Fiber Image at " + m_FiberPath + " could not be read. Aborting.";
CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
}
mitk::BaseData* fiberBaseData = fiberInfile.at(0);
mitk::FiberBundle* fiberBundle = dynamic_cast<mitk::FiberBundle*>( fiberBaseData );
// load parcellation
std::vector<mitk::BaseData::Pointer> parcellationInFile = mitk::IOUtil::Load( m_ParcellationPath );
if( parcellationInFile.empty() )
{
std::string errorMessage = "Parcellation at " + m_ParcellationPath + " could not be read. Aborting.";
CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
}
mitk::BaseData* parcellationBaseData = parcellationInFile.at(0);
mitk::Image* parcellationImage = dynamic_cast<mitk::Image*>( parcellationBaseData );
// do creation
mitk::ConnectomicsNetworkCreator::Pointer connectomicsNetworkCreator = mitk::ConnectomicsNetworkCreator::New();
connectomicsNetworkCreator->SetSegmentation( parcellationImage );
connectomicsNetworkCreator->SetFiberBundle( fiberBundle );
connectomicsNetworkCreator->CalculateCenterOfMass();
connectomicsNetworkCreator->SetEndPointSearchRadius( 15 );
connectomicsNetworkCreator->CreateNetworkFromFibersAndSegmentation();
// load network
std::vector<mitk::BaseData::Pointer> referenceFile = mitk::IOUtil::Load( m_ReferenceNetworkPath );
if( referenceFile.empty() )
{
std::string errorMessage = "Reference Network at " + m_ReferenceNetworkPath + " could not be read. Aborting.";
CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
}
mitk::BaseData* referenceBaseData = referenceFile.at(0);
mitk::ConnectomicsNetwork* referenceNetwork = dynamic_cast<mitk::ConnectomicsNetwork*>( referenceBaseData );
mitk::ConnectomicsNetwork::Pointer network = connectomicsNetworkCreator->GetNetwork();
CPPUNIT_ASSERT_MESSAGE( "Comparing created and reference network.", mitk::Equal( network.GetPointer(), referenceNetwork, mitk::eps, true) );
}
};
MITK_TEST_SUITE_REGISTRATION(mitkConnectomicsNetworkCreation)
diff --git a/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsStatisticsCalculatorTest.cpp b/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsStatisticsCalculatorTest.cpp
index e8a219c615..5b6b3c95f6 100644
--- a/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsStatisticsCalculatorTest.cpp
+++ b/Modules/DiffusionImaging/Connectomics/Testing/mitkConnectomicsStatisticsCalculatorTest.cpp
@@ -1,141 +1,141 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// Testing
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
// std includes
#include <string>
#include <sstream>
// MITK includes
#include <mitkIOUtil.h>
#include <mitkConnectomicsStatisticsCalculator.h>
// VTK includes
#include <vtkDebugLeaks.h>
class mitkConnectomicsStatisticsCalculatorTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkConnectomicsStatisticsCalculatorTestSuite);
/// \todo Fix VTK memory leaks. Bug 18097.
vtkDebugLeaks::SetExitError(0);
MITK_TEST(StatisticsCalculatorUpdate);
CPPUNIT_TEST_SUITE_END();
private:
mitk::ConnectomicsNetwork::Pointer m_Network;
std::string m_NetworkPath;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
//load network
m_NetworkPath = GetTestDataFilePath("DiffusionImaging/Connectomics/reference.cnf");
std::vector<mitk::BaseData::Pointer> networkFile = mitk::IOUtil::Load( m_NetworkPath );
if( networkFile.empty() )
{
std::string errorMessage = "File at " + m_NetworkPath + " could not be read. Aborting.";
CPPUNIT_ASSERT_MESSAGE( errorMessage, !networkFile.empty() );
return;
}
mitk::BaseData* networkBaseData = networkFile.at(0);
mitk::ConnectomicsNetwork* network = dynamic_cast<mitk::ConnectomicsNetwork*>( networkBaseData );
if( !network )
{
std::string errorMessage = "Read file at " + m_NetworkPath + " could not be recognized as network. Aborting.";
CPPUNIT_ASSERT_MESSAGE( errorMessage, network);
return;
}
m_Network = network;
}
- void tearDown()
+ void tearDown() override
{
m_Network = NULL;
m_NetworkPath = "";
}
void StatisticsCalculatorUpdate()
{
mitk::ConnectomicsStatisticsCalculator::Pointer statisticsCalculator = mitk::ConnectomicsStatisticsCalculator::New();
statisticsCalculator->SetNetwork( m_Network );
statisticsCalculator->Update();
double eps( 0.0001 );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfVertices", mitk::Equal( statisticsCalculator->GetNumberOfVertices( ), 4 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfEdges" , mitk::Equal( statisticsCalculator->GetNumberOfEdges( ), 5 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageDegree", mitk::Equal( statisticsCalculator->GetAverageDegree( ), 2.5 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetConnectionDensity", mitk::Equal( statisticsCalculator->GetConnectionDensity( ), 0.833333 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfConnectedComponents", mitk::Equal( statisticsCalculator->GetNumberOfConnectedComponents( ), 1 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageComponentSize", mitk::Equal( statisticsCalculator->GetAverageComponentSize( ), 4 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetLargestComponentSize", mitk::Equal( statisticsCalculator->GetLargestComponentSize( ), 4 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRatioOfNodesInLargestComponent", mitk::Equal( statisticsCalculator->GetRatioOfNodesInLargestComponent( ), 1 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetHopPlotExponent", mitk::Equal( statisticsCalculator->GetHopPlotExponent( ), 0.192645 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetEffectiveHopDiameter", mitk::Equal( statisticsCalculator->GetEffectiveHopDiameter( ), 1 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageClusteringCoefficientsC", mitk::Equal( statisticsCalculator->GetAverageClusteringCoefficientsC( ), 0.833333 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageClusteringCoefficientsD", mitk::Equal( statisticsCalculator->GetAverageClusteringCoefficientsD( ), 0.916667 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageClusteringCoefficientsE", mitk::Equal( statisticsCalculator->GetAverageClusteringCoefficientsE( ), 0.833333 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageVertexBetweennessCentrality", mitk::Equal( statisticsCalculator->GetAverageVertexBetweennessCentrality( ), 0.25 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageEdgeBetweennessCentrality", mitk::Equal( statisticsCalculator->GetAverageEdgeBetweennessCentrality( ), 1.4 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfIsolatedPoints" , mitk::Equal( statisticsCalculator->GetNumberOfIsolatedPoints( ), 0 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRatioOfIsolatedPoints", mitk::Equal( statisticsCalculator->GetRatioOfIsolatedPoints( ), 0 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfEndPoints", mitk::Equal( statisticsCalculator->GetNumberOfEndPoints( ), 0 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRatioOfEndPoints", mitk::Equal( statisticsCalculator->GetRatioOfEndPoints( ), 0 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetDiameter", mitk::Equal( statisticsCalculator->GetDiameter( ), 2 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetDiameter90", mitk::Equal( statisticsCalculator->GetDiameter90( ), 2 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRadius" , mitk::Equal( statisticsCalculator->GetRadius( ), 1 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRadius90", mitk::Equal( statisticsCalculator->GetRadius90( ), 1 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageEccentricity", mitk::Equal( statisticsCalculator->GetAverageEccentricity( ), 1.5 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAverageEccentricity90", mitk::Equal( statisticsCalculator->GetAverageEccentricity90( ), 1.5 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetAveragePathLength" , mitk::Equal( statisticsCalculator->GetAveragePathLength( ), 1.16667 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetNumberOfCentralPoints" , mitk::Equal( statisticsCalculator->GetNumberOfCentralPoints( ), 2 , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetRatioOfCentralPoints", mitk::Equal( statisticsCalculator->GetRatioOfCentralPoints( ), 0.5 , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetSpectralRadius( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetSecondLargestEigenValue( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetAdjacencyTrace( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetAdjacencyEnergy( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetLaplacianTrace( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetLaplacianEnergy( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetLaplacianSpectralGap( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianTrace( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianEnergy( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianNumberOf2s( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianNumberOf1s( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianNumberOf0s( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianLowerSlope( ), , eps, true ) );
// CPPUNIT_ASSERT_MESSAGE( " ", mitk::Equal( statisticsCalculator->GetNormalizedLaplacianUpperSlope( ), , eps, true ) );
CPPUNIT_ASSERT_MESSAGE( "GetSmallWorldness", mitk::Equal( statisticsCalculator->GetSmallWorldness( ), 1.72908 , eps, true ) );
}
};
MITK_TEST_SUITE_REGISTRATION(mitkConnectomicsStatisticsCalculator)
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.h
index 314c215347..84099cec01 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.h
@@ -1,56 +1,56 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _itk_ADCAverageFunctor_h_
#define _itk_ADCAverageFunctor_h_
#include "itkDWIVoxelFunctor.h"
#include <math.h>
namespace itk
{
class MITKDIFFUSIONCORE_EXPORT ADCAverageFunctor : public DWIVoxelFunctor
{
public:
ADCAverageFunctor(){}
~ADCAverageFunctor(){}
typedef ADCAverageFunctor Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef DWIVoxelFunctor Superclass;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Runtime information support. */
itkTypeMacro(ADCAverageFunctor, DWIVoxelFunctor)
- void operator()(vnl_matrix<double> & newSignal, const vnl_matrix<double> & SignalMatrix, const double & S0);
+ void operator()(vnl_matrix<double> & newSignal, const vnl_matrix<double> & SignalMatrix, const double & S0) override;
void setTargetBValue(const double & targetBValue){m_TargetBvalue = targetBValue;}
void setListOfBValues(const vnl_vector<double> & BValueList){m_BValueList = BValueList;}
protected:
double m_TargetBvalue;
vnl_vector<double> m_BValueList;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.h
index c125be5896..d118c95b43 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _itk_ADCFitFunctor_h_
#define _itk_ADCFitFunctor_h_
#include "itkDWIVoxelFunctor.h"
#include "vnl/vnl_least_squares_function.h"
#include "vnl/vnl_math.h"
namespace itk
{
class MITKDIFFUSIONCORE_EXPORT ADCFitFunctor : public DWIVoxelFunctor
{
public:
ADCFitFunctor(){}
~ADCFitFunctor(){}
typedef ADCFitFunctor Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef DWIVoxelFunctor Superclass;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Runtime information support. */
itkTypeMacro(ADCFitFunctor, DWIVoxelFunctor)
- void operator()(vnl_matrix<double> & newSignal, const vnl_matrix<double> & SignalMatrix, const double & S0);
+ void operator()(vnl_matrix<double> & newSignal, const vnl_matrix<double> & SignalMatrix, const double & S0) override;
void setTargetBValue(const double & targetBValue){m_TargetBvalue = targetBValue;}
void setListOfBValues(const vnl_vector<double> & BValueList){m_BValueList = BValueList;}
protected:
double m_TargetBvalue;
vnl_vector<double> m_BValueList;
/**
* \brief The lestSquaresFunction struct for Non-Linear-Least-Squres fit of monoexponential model
*/
struct lestSquaresFunction: public vnl_least_squares_function
{
void set_measurements(const vnl_vector<double>& x)
{
measurements.set_size(x.size());
measurements.copy_in(x.data_block());
}
void set_bvalues(const vnl_vector<double>& x)
{
bValueVector.set_size(x.size());
bValueVector.copy_in(x.data_block());
}
void set_reference_measurement(const double & x)
{
S0 = x;
}
vnl_vector<double> measurements;
vnl_vector<double> bValueVector;
double S0;
int N;
lestSquaresFunction(unsigned int number_of_measurements) :
vnl_least_squares_function(1 /*number of unknowns [ ADC ]*/, number_of_measurements, no_gradient)
{
N = get_number_of_residuals();
}
- void f(const vnl_vector<double>& x, vnl_vector<double>& fx) {
+ void f(const vnl_vector<double>& x, vnl_vector<double>& fx) override {
const double & ADC = x[0];
const vnl_vector<double> & b = bValueVector;
for(int s=0; s<N; s++)
{
double approx = S0 * std::exp(-b[s] * ADC);
fx[s] = vnl_math_abs( measurements[s] - approx );
}
}
};
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.h
index 6ffa6d73d8..e71527286a 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.h
@@ -1,111 +1,111 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _itk_BiExpFitFunctor_h_
#define _itk_BiExpFitFunctor_h_
#include "itkDWIVoxelFunctor.h"
#include <math.h>
// vnl include
#include "vnl/vnl_least_squares_function.h"
#include "vnl/algo/vnl_levenberg_marquardt.h"
#include "vnl/vnl_math.h"
namespace itk
{
class MITKDIFFUSIONCORE_EXPORT BiExpFitFunctor : public DWIVoxelFunctor
{
public:
BiExpFitFunctor(){}
~BiExpFitFunctor(){}
typedef BiExpFitFunctor Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef DWIVoxelFunctor Superclass;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Runtime information support. */
itkTypeMacro(BiExpFitFunctor, DWIVoxelFunctor)
- void operator()(vnl_matrix<double> & newSignal,const vnl_matrix<double> & SignalMatrix, const double & S0);
+ void operator()(vnl_matrix<double> & newSignal,const vnl_matrix<double> & SignalMatrix, const double & S0) override;
void setTargetBValue(const double & targetBValue){m_TargetBvalue = targetBValue;}
void setListOfBValues(const vnl_vector<double> & BValueList){m_BValueList = BValueList;}
protected:
double m_TargetBvalue;
vnl_vector<double> m_BValueList;
/**
* \brief The lestSquaresFunction struct for Non-Linear-Least-Squres fit of Biexponential model
*/
struct lestSquaresFunction: public vnl_least_squares_function
{
void set_measurements(const vnl_vector<double>& x)
{
measurements.set_size(x.size());
measurements.copy_in(x.data_block());
}
void set_bvalues(const vnl_vector<double>& x)
{
bValueVector.set_size(x.size());
bValueVector.copy_in(x.data_block());
}
void set_reference_measurement(const double & x)
{
S0 = x;
}
vnl_vector<double> measurements;
vnl_vector<double> bValueVector;
double S0;
int N;
lestSquaresFunction(unsigned int number_of_measurements) :
vnl_least_squares_function(3 /*number of unknowns [ ADC_slow ADC_fast lambda]*/, number_of_measurements, no_gradient)
{
N = get_number_of_residuals();
}
- void f(const vnl_vector<double>& x, vnl_vector<double>& fx) {
+ void f(const vnl_vector<double>& x, vnl_vector<double>& fx) override {
const double & ADC_slow = x[0];
const double & ADC_fast = x[1];
const double & lambda = x[2];
const vnl_vector<double> & b = bValueVector;
for(int s=0; s<N; s++)
{
double approx = lambda * std::exp(-b[s] * ADC_slow) + (1-lambda) * std::exp(-b[s] * ADC_fast);
fx[s] = vnl_math_abs( measurements[s] - approx*S0 );
}
}
};
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.h
index 14e9b7dcfe..3ad8bb9605 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.h
@@ -1,109 +1,109 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _itk_KurtosisFitFunctor_h_
#define _itk_KurtosisFitFunctor_h_
#include "itkDWIVoxelFunctor.h"
#include <math.h>
// vnl include
#include "vnl/vnl_least_squares_function.h"
#include "vnl/algo/vnl_levenberg_marquardt.h"
#include "vnl/vnl_math.h"
namespace itk
{
class MITKDIFFUSIONCORE_EXPORT KurtosisFitFunctor : public DWIVoxelFunctor
{
public:
KurtosisFitFunctor(){}
~KurtosisFitFunctor(){}
typedef KurtosisFitFunctor Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef DWIVoxelFunctor Superclass;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Runtime information support. */
itkTypeMacro(KurtosisFitFunctor, DWIVoxelFunctor)
- void operator()(vnl_matrix<double> & newSignal,const vnl_matrix<double> & SignalMatrix, const double & S0);
+ void operator()(vnl_matrix<double> & newSignal,const vnl_matrix<double> & SignalMatrix, const double & S0) override;
void setTargetBValue(const double & targetBValue){m_TargetBvalue = targetBValue;}
void setListOfBValues(const vnl_vector<double> & BValueList){m_BValueList = BValueList;}
protected:
double m_TargetBvalue;
vnl_vector<double> m_BValueList;
/**
* \brief The lestSquaresFunction struct for Non-Linear-Least-Squres fit of Kurtosis
*/
struct lestSquaresFunction: public vnl_least_squares_function
{
void set_measurements(const vnl_vector<double>& x)
{
measurements.set_size(x.size());
measurements.copy_in(x.data_block());
}
void set_bvalues(const vnl_vector<double>& x)
{
bValueVector.set_size(x.size());
bValueVector.copy_in(x.data_block());
}
void set_reference_measurement(const double & x)
{
S0 = x;
}
vnl_vector<double> measurements;
vnl_vector<double> bValueVector;
double S0;
int N;
lestSquaresFunction(unsigned int number_of_measurements) :
vnl_least_squares_function(2 /*number of unknowns [ADC AKC]*/, number_of_measurements, no_gradient)
{
N = get_number_of_residuals();
}
- void f(const vnl_vector<double>& x, vnl_vector<double>& fx) {
+ void f(const vnl_vector<double>& x, vnl_vector<double>& fx) override {
const double & D = x[0];
const double & K = x[1];
const vnl_vector<double> & b = bValueVector;
for(int s=0; s<N; s++)
{
double approx = S0 * std::exp(- b[s] * D + 1./6. *b[s] * b[s] *D * D * K);
fx[s] = vnl_math_abs( measurements[s] - approx );
}
}
};
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h
index f465a7c29c..4cc5dcb4e1 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h
@@ -1,116 +1,116 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkTeemDiffusionTensor3DReconstructionImageFilter_h__
#define __mitkTeemDiffusionTensor3DReconstructionImageFilter_h__
#include "mitkImage.h"
#include "mitkTensorImage.h"
#include "itkDiffusionTensor3D.h"
namespace mitk
{
enum TeemTensorEstimationMethods{
TeemTensorEstimationMethodsLLS,
TeemTensorEstimationMethodsNLS,
TeemTensorEstimationMethodsWLS,
TeemTensorEstimationMethodsMLE,
};
template< class DiffusionImagePixelType = short,
class TTensorPixelType=float >
class TeemDiffusionTensor3DReconstructionImageFilter : public itk::Object
{
public:
typedef TTensorPixelType TensorPixelType;
typedef itk::Vector<TensorPixelType,7> VectorType;
typedef itk::Image<VectorType,3> VectorImageType;
typedef itk::DiffusionTensor3D<TensorPixelType> TensorType;
typedef itk::Image<TensorType,3 > ItkTensorImageType;
typedef itk::Vector<TensorPixelType,6> ItkTensorVectorType;
typedef itk::Image<ItkTensorVectorType,3> ItkTensorVectorImageType;
typedef DiffusionImagePixelType DiffusionPixelType;
typedef itk::VectorImage< DiffusionPixelType, 3 > DiffusionImageType;
- mitkClassMacro( TeemDiffusionTensor3DReconstructionImageFilter,
+ mitkClassMacroItkParent( TeemDiffusionTensor3DReconstructionImageFilter,
itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro(Input,
mitk::Image::Pointer);
itkSetMacro(Input,
mitk::Image::Pointer);
itkGetMacro(EstimateErrorImage, bool);
itkSetMacro(EstimateErrorImage, bool);
itkGetMacro(Sigma, float);
itkSetMacro(Sigma, float);
itkGetMacro(EstimationMethod, TeemTensorEstimationMethods);
itkSetMacro(EstimationMethod, TeemTensorEstimationMethods);
itkGetMacro(NumIterations, int);
itkSetMacro(NumIterations, int);
itkGetMacro(ConfidenceThreshold, double);
itkSetMacro(ConfidenceThreshold, double);
itkGetMacro(ConfidenceFuzzyness, float);
itkSetMacro(ConfidenceFuzzyness, float);
itkGetMacro(MinPlausibleValue, double);
itkSetMacro(MinPlausibleValue, double);
itkGetMacro(Output, mitk::TensorImage::Pointer);
itkGetMacro(OutputItk, mitk::TensorImage::Pointer);
// do the work
virtual void Update();
protected:
TeemDiffusionTensor3DReconstructionImageFilter();
virtual ~TeemDiffusionTensor3DReconstructionImageFilter();
mitk::Image::Pointer m_Input;
bool m_EstimateErrorImage;
float m_Sigma;
TeemTensorEstimationMethods m_EstimationMethod;
int m_NumIterations;
double m_ConfidenceThreshold;
float m_ConfidenceFuzzyness;
double m_MinPlausibleValue;
mitk::TensorImage::Pointer m_Output;
mitk::TensorImage::Pointer m_OutputItk;
mitk::Image::Pointer m_ErrorImage;
};
}
#include "mitkTeemDiffusionTensor3DReconstructionImageFilter.cpp"
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkDWIHeadMotionCorrectionFilter.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkDWIHeadMotionCorrectionFilter.h
index 356b9ef0a0..18d06614cb 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkDWIHeadMotionCorrectionFilter.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkDWIHeadMotionCorrectionFilter.h
@@ -1,131 +1,131 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDWIHEADMOTIONCORRECTIONFILTER_H
#define MITKDWIHEADMOTIONCORRECTIONFILTER_H
#include "mitkImageToImageFilter.h"
#include <itkAccumulateImageFilter.h>
#include <itkExtractImageFilter.h>
#include "mitkITKImageImport.h"
#include <itkVectorImage.h>
#include <MitkDiffusionCoreExports.h>
namespace mitk
{
/**
* @class DWIHeadMotionCorrectionFilter
*
* @brief Performs standard head-motion correction by using affine registration of the gradient images.
*
* (Head) motion correction is a essential pre-processing step before performing any further analysis of a diffusion-weighted
* images since all model fits ( tensor, QBI ) rely on an aligned diffusion-weighted dataset. The correction is done in two steps. First the
* unweighted images ( if multiple present ) are separately registered on the first one by means of rigid registration and normalized correlation
* as error metric. Second, the weighted gradient images are registered to the unweighted reference ( computed as average from the aligned images from first step )
* by an affine transformation using the MattesMutualInformation metric as optimizer guidance.
*
*/
class MITKDIFFUSIONCORE_EXPORT DWIHeadMotionCorrectionFilter
: public ImageToImageFilter
{
public:
// class macros
mitkClassMacro( DWIHeadMotionCorrectionFilter,
ImageToImageFilter )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro( Steps, unsigned long )
itkGetMacro( CurrentStep, unsigned long )
itkGetMacro( IsInValidState, bool)
itkSetMacro( AbortRegistration, bool )
itkSetMacro( AverageUnweighted, bool )
// public typedefs
typedef short DiffusionPixelType;
typedef Superclass::InputImageType InputImageType;
typedef Superclass::OutputImageType OutputImageType;
typedef itk::VectorImage<DiffusionPixelType, 3> ITKDiffusionImageType;
protected:
DWIHeadMotionCorrectionFilter();
virtual ~DWIHeadMotionCorrectionFilter() {}
- virtual void GenerateData();
+ virtual void GenerateData() override;
unsigned long m_CurrentStep;
unsigned long m_Steps;
bool m_IsInValidState; ///< Whether the filter is in a valid state, false if error occured
bool m_AbortRegistration; ///< set flag to abort
bool m_AverageUnweighted;
};
/**
* @brief Averages an 3d+t image along the time axis.
*
* The method uses the AccumulateImageFilter as provided by ITK and collapses the given 3d+t image
* to an 3d image while computing the average over the time axis for each of the spatial voxels.
*/
template< typename TPixel, unsigned int VDimensions>
static void ItkAccumulateFilter(
const itk::Image< TPixel, VDimensions>* image,
mitk::Image::Pointer& output)
{
// input 3d+t --> output 3d
typedef itk::Image< TPixel, 4> InputItkType;
typedef itk::Image< TPixel, 3> OutputItkType;
// the accumulate filter requires the same dimension in output and input image
typedef typename itk::AccumulateImageFilter< InputItkType, InputItkType > FilterType;
typename FilterType::Pointer filter = FilterType::New();
filter->SetInput( image );
filter->SetAccumulateDimension( 3 );
filter->SetAverage( true );
// we need to extract the volume to reduce the size from 4 to 3 for further processing
typedef typename itk::ExtractImageFilter< InputItkType, OutputItkType > ExtractFilterType;
typename ExtractFilterType::Pointer extractor = ExtractFilterType::New();
extractor->SetInput( filter->GetOutput() );
extractor->SetDirectionCollapseToIdentity();
typename InputItkType::RegionType extractRegion = image->GetLargestPossibleRegion();
// crop out the time axis
extractRegion.SetSize( 3, 0);
extractor->SetExtractionRegion( extractRegion );
try
{
extractor->Update();
}
catch( const itk::ExceptionObject& e)
{
mitkThrow() << " Exception while averaging: " << e.what();
}
output = mitk::GrabItkImageMemory( extractor->GetOutput() );
}
} //end namespace mitk
#endif // MITKDWIHEADMOTIONCORRECTIONFILTER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidImageRegistrationMethod.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidImageRegistrationMethod.h
index f0f67c99c4..f8709320fd 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidImageRegistrationMethod.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidImageRegistrationMethod.h
@@ -1,341 +1,341 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPYRAMIDIMAGEREGISTRATION_H
#define MITKPYRAMIDIMAGEREGISTRATION_H
#include <MitkDiffusionCoreExports.h>
#include <itkObject.h>
#include "itkImageMaskSpatialObject.h"
#include "itkNotImageFilter.h"
#include <itkCenteredVersorTransformInitializer.h>
#include <vnl/vnl_matrix_fixed.h>
#include "mitkImage.h"
#include "mitkBaseProcess.h"
#include "mitkPyramidRegistrationMethodHelper.h"
#include <itkWindowedSincInterpolateImageFunction.h>
#include "mitkImageToItk.h"
#include "mitkImageCast.h"
#include "mitkImageCaster.h"
#include "mitkITKImageImport.h"
#include "mitkIOUtil.h"
namespace mitk
{
/**
* @brief The PyramidImageRegistration class implements a multi-scale registration method
*
* The PyramidImageRegistration class is suitable for aligning (f.e.) brain MR images. The method offers two
* transform types
* - Rigid: optimizing translation and rotation only and
* - Affine ( default ): with scaling in addition ( 12 DOF )
*
* The error metric is internally chosen based on the selected task type : \sa SetCrossModalityOn
*
* It uses
* - MattesMutualInformation for CrossModality=on ( default ) and
* - NormalizedCorrelation for CrossModality=off.
*/
class MITKDIFFUSIONCORE_EXPORT PyramidImageRegistrationMethod :
public itk::Object
{
public:
/** Typedefs */
- mitkClassMacro(PyramidImageRegistrationMethod, itk::Object)
+ mitkClassMacroItkParent(PyramidImageRegistrationMethod, itk::Object)
/** Smart pointer support */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef itk::OptimizerParameters<double> ParametersType;
/** Typedef for the transformation matrix, corresponds to the InternalMatrixType from ITK transforms */
typedef vnl_matrix_fixed< double, 3, 3> TransformMatrixType;
typedef itk::AffineTransform< double > AffineTransformType;
typedef itk::Euler3DTransform< double > RigidTransformType;
/** Registration is between modalities - will take MattesMutualInformation as error metric */
void SetCrossModalityOn()
{
m_CrossModalityRegistration = true;
}
/** Registration is between modalities - will take NormalizedCorrelation as error metric */
void SetCrossModalityOff()
{
m_CrossModalityRegistration = false;
}
/** Turn the cross-modality on/off */
void SetCrossModality(bool flag)
{
if( flag )
this->SetCrossModalityOn();
else
this->SetCrossModalityOff();
}
/** Controll the verbosity of the registration output
*
* for true, each iteration step of the optimizer is watched and passed to the std::cout
*/
void SetVerbose(bool flag)
{
if( flag )
this->SetVerboseOn();
else
this->SetVerboseOff();
}
/** Turn verbosity on, \sa SetVerbose */
void SetVerboseOn()
{
m_Verbose = true;
}
/** Turn verbosity off, \sa SetVerbose */
void SetVerboseOff()
{
m_Verbose = false;
}
/** A rigid ( 6dof : translation + rotation ) transform is optimized */
void SetTransformToRigid()
{
m_UseAffineTransform = false;
}
/** An affine ( 12dof : Rigid + scale + skew ) transform is optimized */
void SetTransformToAffine()
{
m_UseAffineTransform = true;
}
/** Input image, the reference one */
void SetFixedImage( mitk::Image::Pointer );
/** Input image, the one to be transformed */
void SetMovingImage( mitk::Image::Pointer );
/** Fixed image mask, excludes the masked voxels from the registration metric*/
void SetFixedImageMask( mitk::Image::Pointer mask);
/** \brief Use the itk::CenteredVersorTransformInitializer to perform initialization step for the registration
*
* The initializer takes the geometries and their features to perform an initialization for the successive registration
*/
void SetInitializeByGeometry(bool flag)
{
m_InitializeByGeometry = flag;
}
void Update();
/**
* @brief Get the number of parameters optimized ( 12 or 6 )
*
* @return number of paramters
*/
unsigned int GetNumberOfParameters()
{
unsigned int retValue = 12;
if(!m_UseAffineTransform)
retValue = 6;
return retValue;
}
/**
* @brief Copies the estimated parameters to the given array
* @param paramArray, target array for copy, make sure to allocate enough space
*/
void GetParameters( double* paramArray)
{
if( m_EstimatedParameters == NULL )
{
mitkThrow() << "No parameters were estimated yet, call Update() first.";
}
unsigned int dim = 12;
if( !m_UseAffineTransform )
dim = 6;
for( unsigned int i=0; i<dim; i++)
{
*(paramArray+i) = m_EstimatedParameters[i];
}
}
/**
* @brief Retrieve the parameters of the last registration computed
*
* @return Parameters array ( as an itk::Array )
*/
ParametersType GetLastRegistrationParameters()
{
if( m_EstimatedParameters == NULL )
{
mitkThrow() << "No parameters were estimated yet, call Update() first.";
}
unsigned int dim = 12;
if( !m_UseAffineTransform )
dim = 6;
ParametersType params(dim);
params.SetData( m_EstimatedParameters );
return params;
}
/**
* @brief Set the starting position of the registration
*
* @param params make sure the parameters have the same dimension as the selected transform type
* otherwise the update call will throw an exception
*/
void SetInitialParameters( ParametersType& params )
{
m_InitialParameters = params;
}
/**
* @brief Control the interpolator used for resampling.
*
* The Windowed Sinc Interpolator is more time consuming, but the interpolation preserves more structure
* in the data
*
* The class uses the
* - Linear interpolator on default ( flag = false )
* - WindowedSinc interpolator if called with true
*/
void SetUseAdvancedInterpolation( bool flag)
{
m_UseWindowedSincInterpolator = flag;
}
/**
* @brief Control the interpolator used for resampling.
*
* The class uses the
* - Linear interpolator on default ( flag = false )
* - Nearest neighbor interpolation if this is true
*
* used to resample e.g. segmentations.
*/
void SetUseNearestNeighborInterpolation( bool flag)
{
m_UseNearestNeighborInterpolator = flag;
}
/**
* @brief Set if fixed image mask is used to exclude a region.
* @param flag , true if mask is to be used, false if mask is to be ignored (default)
*/
void SetUseFixedImageMask( bool flag)
{
m_UseMask = flag;
}
/**
* @brief Returns the moving image transformed according to the estimated transformation and resampled
* to the geometry of the fixed/resampling reference image
*
*/
mitk::Image::Pointer GetResampledMovingImage();
/**
* @brief Returns a provided moving image transformed according to the given transformation and resampled
* to the geometry of the fixed/resampling reference image
*/
mitk::Image::Pointer GetResampledMovingImage(mitk::Image::Pointer movingImage, double *transform );
/**
* @brief Get the rotation part of the transformation as a vnl_fixed_matrix<double, 3,3>
*
* It returns identity if the internal parameters are not-yet allocated ( i.e. the filter did not run yet )
*
* @return \sa TransformMatrixType
*/
TransformMatrixType GetLastRotationMatrix();
protected:
PyramidImageRegistrationMethod();
~PyramidImageRegistrationMethod();
/** Fixed image, used as reference for registration */
mitk::Image::Pointer m_FixedImage;
/** Moving image, will be transformed */
mitk::Image::Pointer m_MovingImage;
mitk::Image::Pointer m_FixedImageMask;
bool m_CrossModalityRegistration;
bool m_UseAffineTransform;
bool m_UseWindowedSincInterpolator;
bool m_UseNearestNeighborInterpolator;
bool m_UseMask;
double* m_EstimatedParameters;
ParametersType m_InitialParameters;
/** Control the verbosity of the regsitistration output */
bool m_Verbose;
bool m_InitializeByGeometry;
/**
* @brief The method takes two itk::Images and performs a multi-scale registration on them
*
* Can be accessed by the AccessTwoImagesFixedDimensionByItk macro.
*
* @note Currently the access is currently reduced only for short and float ( the only types occuring with mitk::DiffusionImage ) and
* hence the method is accessed by means of the \sa AccessTwoImagesFixedDimensionTypeSubsetByItk macro.
*/
template <typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void RegisterTwoImagesV4(itk::Image<TPixel1, VImageDimension1>* itkImage1, itk::Image<TPixel2, VImageDimension2>* itkImage2);
/**
* @brief ResampleMitkImage applies the functionality of an the itk::ResampleImageFilter to the given
* mitk::Image.
*
* The API of the function is conform to the interface of \sa AccessByItk_1 macros.
*/
template< typename TPixel, unsigned int VDimension>
void ResampleMitkImage( itk::Image<TPixel, VDimension>* itkImage,
mitk::Image::Pointer& outputImage );
};
} // end namespace
#endif // MITKPYRAMIDIMAGEREGISTRATION_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidRegistrationMethodHelper.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidRegistrationMethodHelper.h
index 4b0b84fad9..67d022daba 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidRegistrationMethodHelper.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/Registration/mitkPyramidRegistrationMethodHelper.h
@@ -1,212 +1,212 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPYRAMIDREGISTRATIONMETHODHELPER_H
#define MITKPYRAMIDREGISTRATIONMETHODHELPER_H
#include <MitkDiffusionCoreExports.h>
#include <itkCommand.h>
#include <itkRegularStepGradientDescentOptimizer.h>
#include <itkMattesMutualInformationImageToImageMetricv4.h>
#include <itkCorrelationImageToImageMetricv4.h>
#include <itkGradientDescentLineSearchOptimizerv4.h>
#include <itkImageRegistrationMethodv4.h>
#include <itkAffineTransform.h>
#include <itkEuler3DTransform.h>
#include <itkMattesMutualInformationImageToImageMetric.h>
#include <itkNormalizedCorrelationImageToImageMetric.h>
#include <itkMultiResolutionImageRegistrationMethod.h>
#include <itkImageMomentsCalculator.h>
#include "mitkImageAccessByItk.h"
/**
* @brief Provides same functionality as \a AccessTwoImagesFixedDimensionByItk for a subset of types
*
* For now, the subset defined is only short and float.
*/
#define AccessTwoImagesFixedDimensionTypeSubsetByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
{ \
const mitk::PixelType& pixelType1 = mitkImage1->GetPixelType(); \
const mitk::PixelType& pixelType2 = mitkImage2->GetPixelType(); \
const mitk::Image* constImage1 = mitkImage1; \
const mitk::Image* constImage2 = mitkImage2; \
mitk::Image* nonConstImage1 = const_cast<mitk::Image*>(constImage1); \
mitk::Image* nonConstImage2 = const_cast<mitk::Image*>(constImage2); \
nonConstImage1->Update(); \
nonConstImage2->Update(); \
_checkSpecificDimension(mitkImage1, (dimension)); \
_checkSpecificDimension(mitkImage2, (dimension)); \
_accessTwoImagesByItkForEach(itkImageTypeFunction, ((short, dimension))((unsigned short, dimension))((float, dimension))((double, dimension)), ((short, dimension))((unsigned short, dimension))((float, dimension))((double, dimension)) ) \
{ \
std::string msg("Pixel type "); \
msg.append(pixelType1.GetComponentTypeAsString() ); \
msg.append(" or pixel type "); \
msg.append(pixelType2.GetComponentTypeAsString() ); \
msg.append(" is not in " MITK_PP_STRINGIZE(MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension))); \
throw mitk::AccessByItkException(msg); \
} \
}
/**
* @brief The PyramidOptControlCommand class stears the step lenght of the
* gradient descent optimizer in multi-scale registration methods
*/
template <typename RegistrationType >
class PyramidOptControlCommand : public itk::Command
{
public:
typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
- mitkClassMacro(PyramidOptControlCommand<RegistrationType>, itk::Command)
+ mitkClassMacroItkParent(PyramidOptControlCommand<RegistrationType>, itk::Command)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- void Execute(itk::Object *caller, const itk::EventObject & /*event*/)
+ void Execute(itk::Object *caller, const itk::EventObject & /*event*/) override
{
RegistrationType* registration = dynamic_cast< RegistrationType* >( caller );
if( registration == NULL)
return;
MITK_DEBUG << "\t - Pyramid level " << registration->GetCurrentLevel();
if( registration->GetCurrentLevel() == 0 )
{ MITK_WARN("OptCommand") << "Cast to registration failed";
return;
}
OptimizerType* optimizer = dynamic_cast< OptimizerType* >(registration->GetOptimizer());
if( optimizer == NULL)
{ MITK_WARN("OptCommand") << "Cast to optimizer failed";
return;
}
MITK_DEBUG /*<< optimizer->GetStopConditionDescription() << "\n"*/
<< optimizer->GetValue() << " : " << optimizer->GetCurrentPosition();
optimizer->SetMaximumStepLength( optimizer->GetMaximumStepLength() * 0.25f );
optimizer->SetMinimumStepLength( optimizer->GetMinimumStepLength() * 0.1f );
// optimizer->SetNumberOfIterations( optimizer->GetNumberOfIterations() * 1.5f );
}
- void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/){}
+ void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/) override{}
};
#include <itkGradientDescentLineSearchOptimizerv4.h>
template <typename RegistrationType >
class PyramidOptControlCommandv4 : public itk::Command
{
public:
typedef itk::GradientDescentLineSearchOptimizerv4 OptimizerType;
- mitkClassMacro(PyramidOptControlCommandv4<RegistrationType>, itk::Command)
+ mitkClassMacroItkParent(PyramidOptControlCommandv4<RegistrationType>, itk::Command)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- void Execute(itk::Object *caller, const itk::EventObject & /*event*/)
+ void Execute(itk::Object *caller, const itk::EventObject & /*event*/) override
{
RegistrationType* registration = dynamic_cast< RegistrationType* >( caller );
if( registration == NULL)
return;
MITK_DEBUG << "\t - Pyramid level " << registration->GetCurrentLevel();
if( registration->GetCurrentLevel() == 0 )
return;
OptimizerType* optimizer = dynamic_cast< OptimizerType* >( registration->GetOptimizer() );
if( optimizer == NULL)
{ MITK_WARN("OptCommand4") << "Cast to optimizer failed";
return;
}
optimizer->SetNumberOfIterations( optimizer->GetNumberOfIterations() * 2.5 );
optimizer->SetMaximumStepSizeInPhysicalUnits( optimizer->GetMaximumStepSizeInPhysicalUnits() * 0.4);
MITK_INFO("Pyramid.Command.Iter") << optimizer->GetNumberOfIterations();
MITK_INFO("Pyramid.Command.MaxStep") << optimizer->GetMaximumStepSizeInPhysicalUnits();
}
- void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/){}
+ void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/) override{}
};
template <typename OptimizerType>
class OptimizerIterationCommand : public itk::Command
{
public:
- mitkClassMacro(OptimizerIterationCommand<OptimizerType>, itk::Command)
+ mitkClassMacroItkParent(OptimizerIterationCommand<OptimizerType>, itk::Command)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- void Execute(itk::Object *caller, const itk::EventObject & /*event*/)
+ void Execute(itk::Object *caller, const itk::EventObject & /*event*/) override
{
OptimizerType* optimizer = dynamic_cast< OptimizerType* >( caller );
unsigned int currentIter = optimizer->GetCurrentIteration();
MITK_INFO << "[" << currentIter << "] : " << optimizer->GetValue() << " : " << optimizer->GetCurrentPosition();
}
- void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/)
+ void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/) override
{
}
};
template <typename OptimizerType>
class OptimizerIterationCommandv4 : public itk::Command
{
public:
itkNewMacro( OptimizerIterationCommandv4 )
- void Execute(itk::Object *object, const itk::EventObject & event)
+ void Execute(itk::Object *object, const itk::EventObject & event) override
{
OptimizerType* optimizer = dynamic_cast< OptimizerType* >( object );
if( typeid( event ) != typeid( itk::IterationEvent ) )
{ return; }
unsigned int currentIter = optimizer->GetCurrentIteration();
MITK_INFO << "[" << currentIter << "] : " << optimizer->GetCurrentMetricValue() << " : "
<< optimizer->GetMetric()->GetParameters() ;
//<< " : " << optimizer->GetScales();
}
- void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/)
+ void Execute(const itk::Object * /*object*/, const itk::EventObject & /*event*/) override
{
}
};
#endif // MITKPYRAMIDREGISTRATIONMETHODHELPER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDwiGradientLengthCorrectionFilter.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDwiGradientLengthCorrectionFilter.h
index 0ff4395343..c4d230d4dd 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDwiGradientLengthCorrectionFilter.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkDwiGradientLengthCorrectionFilter.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _itk_DwiGradientLengthCorrectionFilter_h_
#define _itk_DwiGradientLengthCorrectionFilter_h_
#include <itkProcessObject.h>
#include <vnl/vnl_vector_fixed.h>
#include <itkVectorContainer.h>
#include <MitkDiffusionCoreExports.h>
namespace itk
{
class MITKDIFFUSIONCORE_EXPORT DwiGradientLengthCorrectionFilter : public ProcessObject
{
public:
typedef DwiGradientLengthCorrectionFilter Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef ProcessObject Superclass;
typedef vnl_vector_fixed< double, 3 > GradientDirectionType;
typedef itk::VectorContainer< unsigned int, GradientDirectionType > GradientDirectionContainerType;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkTypeMacro(DwiGradientLengthCorrectionFilter,ProcessObject)
- void GenerateData();
+ void GenerateData() override;
- virtual void Update(){
+ virtual void Update() override{
this->GenerateData();
}
// input
itkSetMacro(RoundingValue, int)
itkSetMacro(ReferenceBValue, double)
itkSetMacro(ReferenceGradientDirectionContainer, GradientDirectionContainerType::Pointer)
// output
itkGetMacro(OutputGradientDirectionContainer, GradientDirectionContainerType::Pointer)
itkGetMacro(NewBValue, double)
protected:
DwiGradientLengthCorrectionFilter();
~DwiGradientLengthCorrectionFilter();
double m_NewBValue;
double m_ReferenceBValue;
int m_RoundingValue;
GradientDirectionContainerType::Pointer m_ReferenceGradientDirectionContainer;
GradientDirectionContainerType::Pointer m_OutputGradientDirectionContainer;
};
} // end of namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkShCoefficientImageImporter.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkShCoefficientImageImporter.h
index 564b050054..78eb5da6e6 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkShCoefficientImageImporter.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/itkShCoefficientImageImporter.h
@@ -1,95 +1,95 @@
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkDiffusionTensor3DReconstructionImageFilter.h,v $
Language: C++
Date: $Date: 2006-03-27 17:01:06 $
Version: $Revision: 1.12 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkShCoefficientImageImporter_h_
#define __itkShCoefficientImageImporter_h_
#include <itkOrientationDistributionFunction.h>
namespace itk{
/** \class ShCoefficientImageImporter
Converts FSL reconstructions of diffusionweighted images (4D images containing the sh coefficients) to qball images or 3D sh-coefficient images.
*/
template< class PixelType, int ShOrder >
class ShCoefficientImageImporter : public ProcessObject
{
public:
enum NormalizationMethods {
NO_NORM,
SINGLE_VEC_NORM,
SPACING_COMPENSATION
};
enum Toolkit { ///< SH coefficient convention (depends on toolkit)
FSL,
MRTRIX
};
typedef ShCoefficientImageImporter Self;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef ProcessObject Superclass;
typedef itk::Image< float, 4 > InputImageType;
typedef Image< Vector< PixelType, (ShOrder*ShOrder + ShOrder + 2)/2 + ShOrder >, 3 > CoefficientImageType;
typedef Image< Vector< PixelType, QBALL_ODFSIZE >, 3 > QballImageType;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Runtime information support. */
itkTypeMacro(ShCoefficientImageImporter, ProcessObject)
// input
itkSetMacro( InputImage, InputImageType::Pointer) ///< sh coefficient image in FSL file format
// output
itkGetMacro( CoefficientImage, typename CoefficientImageType::Pointer) ///< mitk style image containing the SH coefficients
itkGetMacro( QballImage, typename QballImageType::Pointer) ///< mitk Q-Ball image generated from the coefficients
itkSetMacro( Toolkit, Toolkit) ///< define SH coefficient convention (depends on toolkit)
itkGetMacro( Toolkit, Toolkit) ///< SH coefficient convention (depends on toolkit)
- void GenerateData();
+ void GenerateData() override;
protected:
ShCoefficientImageImporter();
~ShCoefficientImageImporter(){}
void CalcShBasis();
vnl_matrix_fixed<double, 2, QBALL_ODFSIZE> GetSphericalOdfDirections();
InputImageType::Pointer m_InputImage;
typename CoefficientImageType::Pointer m_CoefficientImage; ///< mitk style image containing the SH coefficients
typename QballImageType::Pointer m_QballImage; ///< mitk Q-Ball image generated from the coefficients
vnl_matrix<double> m_ShBasis;
Toolkit m_Toolkit;
private:
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkShCoefficientImageImporter.cpp"
#endif
#endif //__itkShCoefficientImageImporter_h_
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h
index f7d44edf0e..2d26fee6fe 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h
@@ -1,505 +1,505 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PartialVolumeAnalysisClusteringCalculator_H
#define _MITK_PartialVolumeAnalysisClusteringCalculator_H
#include <MitkDiffusionCoreExports.h>
#include "mitkCommon.h"
#include "mitkImage.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkImage.h>
#include <itkRGBAPixel.h>
#include <vnl/vnl_vector.h>
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT PartialVolumeAnalysisClusteringCalculator : public itk::Object
{
public:
typedef vnl_vector<double> VecType;
typedef mitk::Image::HistogramType MitkHistType;
class HistType
{
public:
HistType()
{
}
HistType(const HistType& p)
{
this->xVals = p.xVals;
this->hVals = p.hVals;
}
~HistType()
{
}
HistType operator= (const HistType& p)
{
if (this != &p) // protect against invalid self-assignment
{
this->xVals = p.xVals;
this->hVals = p.hVals;
}
return *this;
}
void InitByMitkHistogram(const MitkHistType* histogram)
{
xVals.set_size(histogram->GetSize()[0]);
hVals.set_size(histogram->GetSize()[0]);
double sum = histogram->GetTotalFrequency();
MitkHistType::ConstIterator endIt = histogram->End();
MitkHistType::ConstIterator it = histogram->Begin();
bool firstNonEmptyBinFound = false;
//++it;
int i=0;
while (it != endIt)
{
if(it.GetFrequency() || firstNonEmptyBinFound)
{
firstNonEmptyBinFound = true;
xVals(i) = it.GetMeasurementVector().GetElement(0);
hVals(i) = it.GetFrequency()/sum;
}
++i;
++it;
}
}
void SetXVals(VecType x)
{xVals = x;}
void SetHVals(VecType h)
{hVals = h;}
void SetXVals(std::vector<double> x)
{
int s = x.size();
xVals.set_size(s);
for(int i=0; i<s; i++)
{
xVals(i) = x[i];
}
}
void SetHVals(std::vector<double> h)
{
int s = h.size();
hVals.set_size(s);
for(int i=0; i<s; i++)
{
hVals(i) = h[i];
}
}
std::vector<double>* GetXVals()
{
int s = xVals.size();
std::vector<double>* retval = new std::vector<double>(s);
for(int i=0; i<s; i++)
{
(*retval)[i] = xVals(i);
}
return retval;
}
std::vector<double>* GetHVals()
{
int s = hVals.size();
std::vector<double>* retval = new std::vector<double>(s);
for(int i=0; i<s; i++)
{
(*retval)[i] = hVals(i);
}
return retval;
}
VecType xVals;
VecType hVals;
};
class ClusterResultType
{
public:
// ClusterResultType()
// {
// vals.push_back(VecType());
// vals.push_back(VecType());
// mixedVals.push_back(VecType());
// }
ClusterResultType(int sz)
{
vals.push_back(VecType(sz));
vals.push_back(VecType(sz));
mixedVals.push_back(VecType(sz));
combiVals.set_size(sz);
}
~ClusterResultType()
{
}
// ClusterResultType operator= (const ClusterResultType *p)
// {
// MITK_DEBUG << "AOJHIFAHFOF";
// if (this != &p) // protect against invalid self-assignment
// {
// MITK_DEBUG << "HRRRHRHRR";
// this->vals.clear();
// this->mixedVals.clear();
// int s = p.vals.size();
// for(int i=0; i<s;i++)
// {
// VecType v = p.vals[i];
// this->vals.push_back(v);
// }
// s = p.mixedVals.size();
// for(int i=0; i<s;i++)
// {
// VecType v = p.mixedVals[i];
// this->mixedVals.push_back(v);
// }
// this->combiVals = p.combiVals;
// }
// return *this;
// }
void Initialize (const ClusterResultType *p)
{
if (this != p) // protect against invalid self-assignment
{
this->vals.clear();
this->mixedVals.clear();
int s = p->vals.size();
for(int i=0; i<s;i++)
{
VecType v = p->vals[i];
this->vals.push_back(v);
}
s = p->mixedVals.size();
for(int i=0; i<s;i++)
{
VecType v = p->mixedVals[i];
this->mixedVals.push_back(v);
}
this->combiVals = p->combiVals;
}
}
std::vector<double> GetFiberVals()
{
if(vals.size()==2 && vals[1].data_block())
{
int s = vals[1].size();
std::vector<double> retval(s);
for(int i=0; i<s; i++)
{
retval[i] = vals[1](i);
}
return retval;
}
else
{
MITK_ERROR << "GetFiberVals() struct not initialized!!";
return std::vector<double>(0);
}
}
std::vector<double> GetNonFiberVals()
{
if(vals.size()==2 && vals[0].data_block())
{
int s = vals[0].size();
std::vector<double> retval(s);
for(int i=0; i<s; i++)
{
retval[i] = vals[0](i);
}
return retval;
}
else
{
MITK_ERROR << "GetNonFiberVals() struct not initialized!!";
return std::vector<double>(0);
}
}
std::vector<double> GetMixedVals()
{
if(mixedVals.size()==1 && mixedVals[0].data_block())
{
int s = mixedVals[0].size();
std::vector<double> retval(s);
for(int i=0; i<s; i++)
{
retval[i] = mixedVals[0](i);
}
return retval;
}
else
{
MITK_ERROR << "GetMixedVals() struct not initialized!!";
return std::vector<double>(0);
}
}
std::vector<double> GetCombiVals()
{
if(combiVals.data_block())
{
int s = combiVals.size();
std::vector<double> retval(s);
for(int i=0; i<s; i++)
{
retval[i] = combiVals(i);
}
return retval;
}
else
{
MITK_ERROR << "GetCombiVals() struct not initialized!!";
return std::vector<double>(0);
}
}
// void Print(VecType vec, int nr=10)
// {
// int sz = vec.size();
// int incr = (int)((1.0*sz)/(1.0*nr));
// for(int i=0; i<sz; i = i+incr)
// {
// std::cout << vec(i) << " ";
// }
// std::cout << std::endl;
// }
// void Print(int nr=10)
// {
// MITK_DEBUG << "CURVES" << std::endl;
// MITK_DEBUG << "Fiber Vals: ";
// Print(vals[0],nr);
// MITK_DEBUG << "Non-Fiber Vals: ";
// Print(vals[1],nr);
// MITK_DEBUG << "Mixed Vals: ";
// Print(mixedVals[0],nr);
// MITK_DEBUG << "Combined Vals: ";
// Print(combiVals,nr);
// }
std::vector<VecType> vals;
std::vector<VecType> mixedVals;
VecType combiVals;
};
class ParamsType
{
public:
ParamsType()
{
}
~ParamsType()
{
}
void Initialize(const ParamsType *p)
{
if (this != p) // protect against invalid self-assignment
{
means[0] = p->means[0];
means[1] = p->means[1];
sigmas[0] = p->sigmas[0];
sigmas[1] = p->sigmas[1];
ps[0] = p->ps[0];
ps[1] = p->ps[1];
}
}
// void Print()
// {
// MITK_DEBUG << "PARAMS" << std::endl;
// MITK_DEBUG << "Class 1: " << means[0] << " +- " << sqrt(sigmas[0]) << " (p=" << ps[0] << ")" << std::endl;
// MITK_DEBUG << "Class 2: " << means[1] << " +- " << sqrt(sigmas[1]) << " (p=" << ps[1] << ")" << std::endl;
// MITK_DEBUG << "Partial V: p=" << 1.0-ps[0]-ps[1] << std::endl;
// }
double means[2];
double sigmas[2];
double ps[2];
};
struct HelperStructClusteringResults
{
MitkHistType *interestingHist;
MitkHistType *totalHist;
double p_interesting;
};
struct HelperStructRGBChannels
{
mitk::Image::Pointer r;
mitk::Image::Pointer g;
mitk::Image::Pointer b;
~HelperStructRGBChannels()
{
r = 0;
g = 0;
b = 0;
}
};
struct HelperStructPerformRGBClusteringRetval
{
HelperStructRGBChannels *rgbChannels;
mitk::Image::Pointer rgb;
ParamsType *params;
ClusterResultType *result;
HistType *hist;
HelperStructPerformRGBClusteringRetval() :
rgbChannels(0), params(0), result(0), hist(0)
{
}
~HelperStructPerformRGBClusteringRetval()
{
rgb = 0;
delete rgbChannels;
}
};
struct HelperStructPerformClusteringRetval
{
mitk::Image::Pointer clusteredImage;
mitk::Image::Pointer displayImage;
ParamsType *params;
ClusterResultType *result;
HistType *hist;
HelperStructPerformClusteringRetval() :
clusteredImage(0), displayImage(0),
params(0), result(0), hist(0)
{
}
~HelperStructPerformClusteringRetval()
{
clusteredImage = 0;
displayImage = 0;
}
};
- mitkClassMacro( PartialVolumeAnalysisClusteringCalculator, itk::Object )
+ mitkClassMacroItkParent( PartialVolumeAnalysisClusteringCalculator, itk::Object )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
ParamsType *InitialGuess(HistType h) const;
ParamsType *Cluster(const HistType h, ParamsType* initialGuess) const;
ClusterResultType CalculateCurves(ParamsType params, VecType xVals) const;
void Normalize(ParamsType params, ClusterResultType* curves) const;
HelperStructPerformClusteringRetval* PerformClustering(mitk::Image::ConstPointer image, const MitkHistType *histogram, int classIdent, HelperStructPerformClusteringRetval* precResult = 0) const;
HelperStructPerformRGBClusteringRetval* PerformRGBClustering(mitk::Image::ConstPointer image, const MitkHistType *histogram) const;
HelperStructPerformClusteringRetval* PerformQuantiles(mitk::Image::ConstPointer image, const MitkHistType *histogram, double p1, double p2) const;
HelperStructPerformRGBClusteringRetval* PerformRGBQuantiles(mitk::Image::ConstPointer image, const MitkHistType *histogram, double p1, double p2 ) const;
double* PerformQuantification(mitk::Image::ConstPointer image, mitk::Image::Pointer clusteredImage, mitk::Image::Pointer mask = 0) const;
mitk::Image::Pointer CaculateAngularErrorImage(
mitk::Image::Pointer comp1, mitk::Image::Pointer comp2, mitk::Image::Pointer probImg) const;
template < unsigned int VImageDimension >
void InternalGenerateRGB( HelperStructRGBChannels *rgb, mitk::Image::Pointer retval ) const;
template < typename TPixel, unsigned int VImageDimension >
void InternalGenerateProbabilityImage(
const itk::Image< TPixel, VImageDimension > *image,
const HelperStructClusteringResults clusterResults,
mitk::Image::Pointer outImage1, mitk::Image::Pointer outImage2 ) const;
template < typename TPixel, unsigned int VImageDimension >
void InternalQuantify(
const itk::Image< TPixel, VImageDimension > *image,
mitk::Image::Pointer clusteredImage, double* retval, mitk::Image::Pointer mask ) const;
template < typename TPixel, unsigned int VImageDimension >
void InternalGenerateQuantileImage(
const itk::Image< TPixel, VImageDimension > *image,
double* q,
mitk::Image::Pointer outImage1, mitk::Image::Pointer outImage2 ) const;
ParamsType* Cluster(const HistType h) const
{return Cluster(h, InitialGuess(h));}
void SetMaxIt(unsigned int it)
{ m_MaxIt = it; }
unsigned int GetMaxIt()
{ return m_MaxIt; }
void SetStepsNumIntegration(unsigned int n)
{ m_StepsNumIntegration = n; }
unsigned int GetStepsNumIntegration()
{ return m_StepsNumIntegration; }
protected:
PartialVolumeAnalysisClusteringCalculator();
virtual ~PartialVolumeAnalysisClusteringCalculator();
unsigned int m_MaxIt;
unsigned int m_StepsNumIntegration;
};
}
#endif // #define _MITK_PartialVolumeAnalysisClusteringCalculator_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h b/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h
index 26a5756382..8f12194731 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h
@@ -1,384 +1,384 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PartialVolumeAnalysisHistogramCalculator_H
#define _MITK_PartialVolumeAnalysisHistogramCalculator_H
#include "MitkDiffusionCoreExports.h"
#include <itkObject.h>
#include <itkImage.h>
#include <itkTimeStamp.h>
#include "mitkImage.h"
#include "mitkImageTimeSelector.h"
#include "mitkPlanarFigure.h"
namespace mitk
{
/**
* \brief Class for calculating statistics and histogram for an (optionally
* masked) image.
*
* Images can be masked by either a (binary) image (of the same dimensions as
* the original image) or by a closed mitk::PlanarFigure, e.g. a circle or
* polygon. When masking with a planar figure, the slice corresponding to the
* plane containing the figure is extracted and then clipped with contour
* defined by the figure. Planar figures need to be aligned along the main axes
* of the image (axial, sagittal, coronal). Planar figures on arbitrary
* rotated planes are not supported.
*
* For each operating mode (no masking, masking by image, masking by planar
* figure), the calculated statistics and histogram are cached so that, when
* switching back and forth between operation modes without modifying mask or
* image, the information doesn't need to be recalculated.
*
* Note: currently time-resolved and multi-channel pictures are not properly
* supported.
*/
class MITKDIFFUSIONCORE_EXPORT PartialVolumeAnalysisHistogramCalculator : public itk::Object
{
public:
enum
{
MASKING_MODE_NONE = 0,
MASKING_MODE_IMAGE,
MASKING_MODE_PLANARFIGURE
};
typedef mitk::Image::HistogramType HistogramType;
typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType;
struct Statistics
{
unsigned int N;
double Min;
double Max;
double Mean;
double Median;
double Variance;
double Sigma;
double RMS;
void Reset()
{
N = 0;
Min = 0.0;
Max = 0.0;
Mean = 0.0;
Median = 0.0;
Variance = 0.0;
Sigma = 0.0;
RMS = 0.0;
}
};
typedef Statistics StatisticsType;
typedef itk::TimeStamp TimeStampType;
typedef bool BoolType;
typedef itk::Image< unsigned char, 3 > MaskImage3DType;
typedef itk::Image< unsigned char, 2 > MaskImage2DType;
typedef itk::Image< float, 2 > InternalImage2DType;
- mitkClassMacro( PartialVolumeAnalysisHistogramCalculator, itk::Object )
+ mitkClassMacroItkParent( PartialVolumeAnalysisHistogramCalculator, itk::Object )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Set image from which to compute statistics. */
void SetImage( const mitk::Image *image );
/** \brief Set binary image for masking. */
void SetImageMask( const mitk::Image *imageMask );
/** \brief Set planar figure for masking. */
void SetPlanarFigure( const mitk::PlanarFigure *planarFigure );
/** \brief Set image for which the same resampling will be applied.
and available via GetAdditionalResampledImage() */
void AddAdditionalResamplingImage( const mitk::Image *image );
/** \brief Set/Get operation mode for masking */
void SetMaskingMode( unsigned int mode );
/** \brief Set/Get operation mode for masking */
itkGetMacro( MaskingMode, unsigned int );
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToNone();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToImage();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToPlanarFigure();
/** \brief Set histogram number of bins. */
void SetNumberOfBins( unsigned int number )
{
if(m_NumberOfBins != number)
{
m_NumberOfBins = number;
SetModified();
}
}
/** \brief Get histogram number of bins. */
unsigned int GetNumberOfBins( )
{ return m_NumberOfBins; }
/** \brief Set upsampling factor. */
void SetUpsamplingFactor( float number )
{
if(m_UpsamplingFactor != number)
{
m_UpsamplingFactor = number;
SetModified();
}
}
/** \brief Get upsampling factor. */
float GetUpsamplingFactor( )
{ return m_UpsamplingFactor; }
/** \brief Set gaussian sigma. */
void SetGaussianSigma( float number )
{
if(m_GaussianSigma != number)
{
m_GaussianSigma = number;
SetModified();
}
}
/** \brief Get thickness of planar figure. */
unsigned int GetPlanarFigureThickness( )
{ return m_PlanarFigureThickness; }
/** \brief Set thickness of planar figure. */
void SetPlanarFigureThickness( unsigned int number )
{
if(m_PlanarFigureThickness != number)
{
m_PlanarFigureThickness = number;
SetModified();
}
}
/** \brief Get histogram number of bins. */
float GetGaussianSigma( )
{ return m_GaussianSigma; }
void SetModified();
/** \brief Compute statistics (together with histogram) for the current
* masking mode.
*
* Computation is not executed if statistics is already up to date. In this
* case, false is returned; otherwise, true.*/
virtual bool ComputeStatistics( );
/** \brief Retrieve the histogram depending on the current masking mode. */
const HistogramType *GetHistogram( ) const;
/** \brief Retrieve statistics depending on the current masking mode. */
const Statistics &GetStatistics( ) const;
const Image::Pointer GetInternalImage()
{
return m_InternalImage;
}
const Image::Pointer GetInternalAdditionalResampledImage(unsigned int i)
{
if(i < m_InternalAdditionalResamplingImages.size())
{
return m_InternalAdditionalResamplingImages[i];
}
else
{
return NULL;
}
}
void SetForceUpdate(bool b)
{
m_ForceUpdate = b;
}
protected:
PartialVolumeAnalysisHistogramCalculator();
virtual ~PartialVolumeAnalysisHistogramCalculator();
/** \brief Depending on the masking mode, the image and mask from which to
* calculate statistics is extracted from the original input image and mask
* data.
*
* For example, a when using a PlanarFigure as mask, the 2D image slice
* corresponding to the PlanarFigure will be extracted from the original
* image. If masking is disabled, the original image is simply passed
* through. */
void ExtractImageAndMask( );
/** \brief If the passed vector matches any of the three principal axes
* of the passed geometry, the ínteger value corresponding to the axis
* is set and true is returned. */
bool GetPrincipalAxis( const Geometry3D *geometry, Vector3D vector,
unsigned int &axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsUnmasked(
const itk::Image< TPixel, VImageDimension > *image,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsMasked(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned char, VImageDimension > *maskImage,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateMaskFromPlanarFigure(
itk::Image< TPixel, VImageDimension > *image, unsigned int axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalReorientImagePlane(
const itk::Image< TPixel, VImageDimension > *image, mitk::BaseGeometry* imggeo, mitk::BaseGeometry* planegeo3D, int additionalIndex );
template < typename TPixel, unsigned int VImageDimension >
void InternalResampleImageFromMask(
const itk::Image< TPixel, VImageDimension > *image, int additionalIndex );
void InternalResampleImage(
const MaskImage3DType *image/*, mitk::Geometry3D* imggeo*/ );
template < typename TPixel, unsigned int VImageDimension >
void InternalCropAdditionalImage(
itk::Image< TPixel, VImageDimension > *image, int additionalIndex );
void InternalMaskImage( mitk::Image *image );
/** Connection from ITK to VTK */
template <typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
/** Connection from VTK to ITK */
template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
void UnmaskedStatisticsProgressUpdate();
void MaskedStatisticsProgressUpdate();
mitk::Image::ConstPointer m_Image;
mitk::Image::ConstPointer m_ImageMask;
mitk::PlanarFigure::ConstPointer m_PlanarFigure;
HistogramType::ConstPointer m_ImageHistogram;
HistogramType::ConstPointer m_MaskedImageHistogram;
HistogramType::ConstPointer m_PlanarFigureHistogram;
HistogramType::Pointer m_EmptyHistogram;
StatisticsType m_ImageStatistics;
StatisticsType m_MaskedImageStatistics;
StatisticsType m_PlanarFigureStatistics;
Statistics m_EmptyStatistics;
unsigned int m_MaskingMode;
bool m_MaskingModeChanged;
mitk::Image::Pointer m_InternalImage;
MaskImage3DType::Pointer m_InternalImageMask3D;
MaskImage2DType::Pointer m_InternalImageMask2D;
itk::ImageRegion<3> m_InternalMask3D;
std::vector<mitk::Image::ConstPointer> m_AdditionalResamplingImages;
std::vector<mitk::Image::Pointer> m_InternalAdditionalResamplingImages;
TimeStampType m_ImageStatisticsTimeStamp;
TimeStampType m_MaskedImageStatisticsTimeStamp;
TimeStampType m_PlanarFigureStatisticsTimeStamp;
BoolType m_ImageStatisticsCalculationTriggerBool;
BoolType m_MaskedImageStatisticsCalculationTriggerBool;
BoolType m_PlanarFigureStatisticsCalculationTriggerBool;
unsigned int m_NumberOfBins;
float m_UpsamplingFactor;
float m_GaussianSigma;
itk::ImageRegion<3> m_CropRegion;
bool m_ForceUpdate;
unsigned int m_PlanarFigureThickness;
};
}
#endif // #define _MITK_PartialVolumeAnalysisHistogramCalculator_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDicomDiffusionImageHeaderReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDicomDiffusionImageHeaderReader.h
index 638846ddc6..fc0b3d4550 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDicomDiffusionImageHeaderReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDicomDiffusionImageHeaderReader.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkDicomDiffusionImageHeaderReader_h__
#define __mitkDicomDiffusionImageHeaderReader_h__
#include <MitkDiffusionCoreExports.h>
#include <mitkFileReader.h>
#include "itkImageSeriesReader.h"
#include "itkImageFileReader.h"
#include "itkImage.h"
#include "itkGDCMImageIO.h"
#include "mitkDiffusionImageHeaderInformation.h"
namespace mitk
{
/**
@brief Reads the header information from a DICOM series and stores it into an output object of type
DiffusionImageHeaderInformation
*/
class MITKDIFFUSIONCORE_EXPORT DicomDiffusionImageHeaderReader : public itk::Object
{
public:
- mitkClassMacro( DicomDiffusionImageHeaderReader, itk::Object );
+ mitkClassMacroItkParent( DicomDiffusionImageHeaderReader, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** En enum to distinguish in processing between the different vendoors */
enum SupportedVendors{
SV_SIEMENS,
SV_SIEMENS_MOSAIC,
SV_PHILIPS,
SV_GE,
SV_UNKNOWN_VENDOR
};
typedef std::vector< std::string > FileNamesContainer;
typedef short PixelValueType;
typedef itk::Image< PixelValueType, 2 > SliceType;
typedef itk::Image< PixelValueType, 3 > VolumeType;
typedef itk::ImageSeriesReader< VolumeType > VolumeReaderType;
typedef itk::ImageFileReader< SliceType > SliceReaderType;
typedef itk::GDCMImageIO ImageIOType;
/** Set the dicom file names to be considered */
void SetSeriesDicomFilenames(FileNamesContainer dicomFilenames)
{ this->m_DicomFilenames = dicomFilenames; }
void SetGdcmIO(ImageIOType::Pointer gdcmIO)
{ this->m_GdcmIO = gdcmIO; }
/** Set the volume reader in case the default volume reader shouldn't be used */
void SetVolumeReader(VolumeReaderType::Pointer volumeReader)
{ this->m_VolumeReader = volumeReader; }
/** Set the output object that will contain the read-in information after update */
void SetOutputPointer(DiffusionImageHeaderInformation::Pointer output)
{ this->m_Output = output; }
/** do the work */
virtual void Update();
/** return output */
DiffusionImageHeaderInformation::Pointer GetOutput();
/** identify vendor */
SupportedVendors GetVendorID();
protected:
/** Default c'tor */
DicomDiffusionImageHeaderReader();
/** Default d'tor */
virtual ~DicomDiffusionImageHeaderReader();
void ReadPublicTags();
void ReadPublicTags2();
void TransformGradients();
FileNamesContainer m_DicomFilenames;
DiffusionImageHeaderInformation::Pointer m_Output;
ImageIOType::Pointer m_GdcmIO;
VolumeReaderType::Pointer m_VolumeReader;
bool m_SliceOrderIS;
bool m_SingleSeries;
int m_nSlice;
std::vector<float> m_sliceLocations;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h
index 97e791096c..24ed2ff9d2 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONDICOMFILEREADER_H
#define MITKDIFFUSIONDICOMFILEREADER_H
#include "MitkDiffusionCoreExports.h"
#include "mitkDICOMITKSeriesGDCMReader.h"
#include "mitkDiffusionHeaderDICOMFileReader.h"
#include "mitkThreeDnTDICOMSeriesReader.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionDICOMFileReader
: public ThreeDnTDICOMSeriesReader
{
public:
mitkClassMacro( DiffusionDICOMFileReader, DICOMITKSeriesGDCMReader )
mitkCloneMacro( DiffusionDICOMFileReader )
itkNewMacro( DiffusionDICOMFileReader )
- virtual void AnalyzeInputFiles();
+ virtual void AnalyzeInputFiles() override;
- virtual bool LoadImages();
+ virtual bool LoadImages() override;
- virtual bool CanHandleFile(const std::string &filename);
+ virtual bool CanHandleFile(const std::string &filename) override;
void SetResolveMosaic( bool flag )
{
m_ResolveMosaic = flag;
}
protected:
DiffusionDICOMFileReader();
virtual ~DiffusionDICOMFileReader();
bool LoadSingleOutputImage( DiffusionHeaderDICOMFileReader::DICOMHeaderListType, DICOMImageBlockDescriptor&, bool);
//mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType m_RetrievedHeader;
std::vector< mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType > m_OutputHeaderContainer;
std::vector< mitk::DiffusionHeaderDICOMFileReader::Pointer> m_OutputReaderContainer;
std::vector< bool > m_IsMosaicData;
bool m_ResolveMosaic;
};
}
#endif // MITKDIFFUSIONDICOMFILEREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h
index 782d40a92a..575e8a3dc7 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h
@@ -1,120 +1,120 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONHEADERFILEREADER_H
#define MITKDIFFUSIONHEADERFILEREADER_H
#include <MitkDiffusionCoreExports.h>
#include <mitkCommon.h>
#include <itkLightObject.h>
#include <itkObjectFactory.h>
#include "gdcmScanner.h"
#include "gdcmReader.h"
#include <vnl/vnl_vector_fixed.h>
namespace mitk
{
/**
* @brief The DiffusionImageHeaderInformation struct
*/
struct DiffusionImageDICOMHeaderInformation
{
DiffusionImageDICOMHeaderInformation()
: b_value(0),
baseline(false),
isotropic(false)
{
g_vector.fill(0);
}
void Print()
{
MITK_INFO << " DiffusionImageHeaderInformation : \n"
<< " : b value : " << b_value << "\n"
<< " : gradient : " << g_vector << "\n"
<< " : isotropic : " << isotropic << "\n --- \n";
}
unsigned int b_value;
vnl_vector_fixed< double, 3> g_vector;
bool baseline;
bool isotropic;
};
struct DiffusionImageMosaicDICOMHeaderInformation
: public DiffusionImageDICOMHeaderInformation
{
unsigned long n_images;
bool slicenormalup;
};
/**
* @class DiffusionHeaderDICOMFileReader
*
* @brief Abstract class for all vendor specific diffusion file header reader
*
* To provide a diffusion header reader for a new vendor, reimplement the \sa ReadDiffusionHeader method.
*/
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderDICOMFileReader
: public itk::LightObject
{
public:
typedef std::vector< DiffusionImageDICOMHeaderInformation > DICOMHeaderListType;
- mitkClassMacro( DiffusionHeaderDICOMFileReader, itk::LightObject )
+ mitkClassMacroItkParent( DiffusionHeaderDICOMFileReader, itk::LightObject )
itkSimpleNewMacro( Self )
/**
* @brief IsDiffusionHeader Parse the given dicom file and collect the special diffusion image information
* @return
*/
virtual bool ReadDiffusionHeader( std::string ){ return false; }
DICOMHeaderListType GetHeaderInformation();
protected:
DiffusionHeaderDICOMFileReader();
virtual ~DiffusionHeaderDICOMFileReader();
DICOMHeaderListType m_HeaderInformationList;
};
/**
* @brief Retrieve the value of a gdcm tag to the given string
*
* @param tag the gdcm::Tag to be search for
* @param dataset a gdcm::DataSet to look into
* @param target a string to store the value of the given tag if found
* @param verbose make some output
*
* @return true if a string was found, false otherwise
*/
bool RevealBinaryTag(const gdcm::Tag tag, const gdcm::DataSet& dataset, std::string& target);
bool RevealBinaryTagC(const gdcm::Tag tag, const gdcm::DataSet& dataset, char* target_array );
} // end namespace mitk
#endif // MITKDIFFUSIONHEADERFILEREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h
index 0f1c89d1fc..716bdfd901 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h
@@ -1,28 +1,28 @@
#ifndef MITKDIFFUSIONHEADERGEDICOMFILEREADER_H
#define MITKDIFFUSIONHEADERGEDICOMFILEREADER_H
#include "MitkDiffusionCoreExports.h"
#include "mitkDiffusionHeaderDICOMFileReader.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderGEDICOMFileReader
: public DiffusionHeaderDICOMFileReader
{
public:
mitkClassMacro( DiffusionHeaderGEDICOMFileReader, DiffusionHeaderDICOMFileReader )
itkNewMacro( Self )
- virtual bool ReadDiffusionHeader(std::string filename);
+ virtual bool ReadDiffusionHeader(std::string filename) override;
protected:
DiffusionHeaderGEDICOMFileReader();
virtual ~DiffusionHeaderGEDICOMFileReader();
};
}
#endif // MITKDIFFUSIONHEADERGEDICOMFILEREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h
index 92b6244c0e..ec6f09f1bc 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderPhilipsDICOMFileReader.h
@@ -1,45 +1,45 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
#define MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
#include <MitkDiffusionCoreExports.h>
#include "mitkDiffusionHeaderDICOMFileReader.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderPhilipsDICOMFileReader
: public DiffusionHeaderDICOMFileReader
{
public:
mitkClassMacro( DiffusionHeaderPhilipsDICOMFileReader, DiffusionHeaderDICOMFileReader )
itkNewMacro( Self )
- virtual bool ReadDiffusionHeader(std::string filename);
+ virtual bool ReadDiffusionHeader(std::string filename) override;
protected:
DiffusionHeaderPhilipsDICOMFileReader();
virtual ~DiffusionHeaderPhilipsDICOMFileReader();
};
}
#endif // MITKDIFFUSIONHEADERPHILIPSDICOMREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h
index 8c8a7a0825..74b8cbb38c 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h
@@ -1,49 +1,49 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H
#define MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H
#include "MitkDiffusionCoreExports.h"
#include "mitkDiffusionHeaderDICOMFileReader.h"
#include "mitkDiffusionHeaderSiemensDICOMFileHelper.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderSiemensDICOMFileReader
: public DiffusionHeaderDICOMFileReader
{
public:
mitkClassMacro( DiffusionHeaderSiemensDICOMFileReader, DiffusionHeaderDICOMFileReader )
itkNewMacro( Self )
- virtual bool ReadDiffusionHeader(std::string filename);
+ virtual bool ReadDiffusionHeader(std::string filename) override;
protected:
DiffusionHeaderSiemensDICOMFileReader();
~DiffusionHeaderSiemensDICOMFileReader();
bool ExtractSiemensDiffusionTagInformation( std::string tag_value, mitk::DiffusionImageDICOMHeaderInformation& values );
std::vector< Siemens_Header_Format > m_SiemensFormatsCollection;
};
}
#endif // MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h
index b51223f693..2852333d68 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONHEADERSIEMENSMOSAICDICOMFILEREADER_H
#define MITKDIFFUSIONHEADERSIEMENSMOSAICDICOMFILEREADER_H
#include "mitkDiffusionHeaderSiemensDICOMFileReader.h"
#include "mitkDiffusionDICOMFileReaderHelper.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT DiffusionHeaderSiemensMosaicDICOMFileReader
: public DiffusionHeaderSiemensDICOMFileReader
{
public:
mitkClassMacro( DiffusionHeaderSiemensMosaicDICOMFileReader,
DiffusionHeaderSiemensDICOMFileReader )
itkNewMacro( Self )
- virtual bool ReadDiffusionHeader(std::string filename);
+ virtual bool ReadDiffusionHeader(std::string filename) override;
mitk::MosaicDescriptor GetMosaicDescriptor()
{
return m_MosaicDescriptor;
}
void RetrieveMosaicInformation(std::string filename);
protected:
DiffusionHeaderSiemensMosaicDICOMFileReader();
virtual ~DiffusionHeaderSiemensMosaicDICOMFileReader();
mitk::MosaicDescriptor m_MosaicDescriptor;
};
}
#endif // MITKDIFFUSIONHEADERSIEMENSMOSAICDICOMFILEREADER_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkGEDicomDiffusionImageHeaderReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkGEDicomDiffusionImageHeaderReader.h
index 48ef803ba3..8b1b8b1661 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkGEDicomDiffusionImageHeaderReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkGEDicomDiffusionImageHeaderReader.h
@@ -1,48 +1,48 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkGEDicomDiffusionImageHeaderReader_h__
#define __mitkGEDicomDiffusionImageHeaderReader_h__
#include "mitkDicomDiffusionImageHeaderReader.h"
namespace mitk
{
class GEDicomDiffusionImageHeaderReader : public DicomDiffusionImageHeaderReader
{
public:
mitkClassMacro( GEDicomDiffusionImageHeaderReader, DicomDiffusionImageHeaderReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void Update();
+ virtual void Update() override;
protected:
GEDicomDiffusionImageHeaderReader();
virtual ~GEDicomDiffusionImageHeaderReader();
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.h
index 76abfd93d6..9c2bdedd54 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkPhilipsDicomDiffusionImageHeaderReader_h__
#define __mitkPhilipsDicomDiffusionImageHeaderReader_h__
#include "mitkDicomDiffusionImageHeaderReader.h"
namespace mitk
{
/**
@brief The PhilipsDicomDiffusionImageHeaderReader class reads in the image header information for the Philips DICOM Format */
class PhilipsDicomDiffusionImageHeaderReader : public DicomDiffusionImageHeaderReader
{
public:
mitkClassMacro( PhilipsDicomDiffusionImageHeaderReader, DicomDiffusionImageHeaderReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** read in the data */
- virtual void Update();
+ virtual void Update() override;
protected:
/** Default c'tor */
PhilipsDicomDiffusionImageHeaderReader();
/** Default d'tor */
virtual ~PhilipsDicomDiffusionImageHeaderReader();
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.h
index c28e6b5954..f770113899 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkSiemensDicomDiffusionImageHeaderReader_h__
#define __mitkSiemensDicomDiffusionImageHeaderReader_h__
#include "mitkDicomDiffusionImageHeaderReader.h"
namespace mitk
{
/**
@brief The SiemensDicomDiffusionImageHeaderReader class reads in the header information for the standard Siemens DICOM format
*/
class SiemensDicomDiffusionImageHeaderReader : public DicomDiffusionImageHeaderReader
{
public:
mitkClassMacro( SiemensDicomDiffusionImageHeaderReader, DicomDiffusionImageHeaderReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Extract the key value for the key nameString from the tagString */
int ExtractSiemensDiffusionInformation( std::string tagString, std::string nameString, std::vector<double>& valueArray, int startPos = 0 );
/** Extracts the diffusion gradient information from the tagString and stores it into the valueArray vector */
int ExtractSiemensDiffusionGradientInformation( std::string tagString, std::string nameString, std::vector<double>& valueArray);
/** Read the data */
- virtual void Update();
+ virtual void Update() override;
protected:
/** Default c'tor */
SiemensDicomDiffusionImageHeaderReader();
/** Default d'tor */
virtual ~SiemensDicomDiffusionImageHeaderReader();
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.h
index fee06d5a80..11e7765e24 100644
--- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.h
+++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.h
@@ -1,55 +1,55 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkSiemensMosaicDicomDiffusionImageHeaderReader_h__
#define __mitkSiemensMosaicDicomDiffusionImageHeaderReader_h__
#include "mitkDicomDiffusionImageHeaderReader.h"
namespace mitk
{
/**
@brief The SiemensMosaicDicomDiffusionImageHeaderReader class reads the image header for diffusion MR data stored in
Siemens MOSAIC Format
*/
class SiemensMosaicDicomDiffusionImageHeaderReader : public DicomDiffusionImageHeaderReader
{
public:
mitkClassMacro( SiemensMosaicDicomDiffusionImageHeaderReader, DicomDiffusionImageHeaderReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Extracts the information stored under the key nameString in the tagString */
int ExtractSiemensDiffusionInformation( std::string tagString, std::string nameString, std::vector<double>& valueArray );
/** Read the data */
- virtual void Update();
+ virtual void Update() override;
protected:
/** Default c'tor */
SiemensMosaicDicomDiffusionImageHeaderReader();
/** Default class d'tor */
virtual ~SiemensMosaicDicomDiffusionImageHeaderReader();
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.h
index 967def60b9..d5ebff5855 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.h
@@ -1,123 +1,123 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_DiffusionImageHeaderInformation_H
#define MITK_DiffusionImageHeaderInformation_H
#include <itkObject.h>
#include "vnl/vnl_vector_fixed.h"
#include "mitkCommon.h"
#include "itkObjectFactory.h"
namespace mitk
{
enum DiffusionHeaderGroup{
DHG_NotYetGrouped,
DHG_ZeroDiffusionWeighted,
DHG_NonZeroDiffusionWeighted,
DHG_Other,
};
class DiffusionImageHeaderInformation : public itk::Object
{
public:
- mitkClassMacro( DiffusionImageHeaderInformation, itk::Object );
+ mitkClassMacroItkParent( DiffusionImageHeaderInformation, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef std::vector< std::string > FileNamesContainer;
//DiffusionImageHeaderInformation(int nRows, int nCols, float xRes, float yRes, float xOrigin,
// float yOrigin, float zOrigin, float sliceThickness, float sliceSpacing,
// int nSliceInVolume, float xRow, float yRow, float zRow, float xCol,
// float yCol, float zCol, float xSlice, float ySlice, float zSlice,
// float bValue, vnl_vector_fixed<double, 3> DiffusionVector,
// std::string vendor, bool mosaic, DiffusionHeaderGroup headerGroup = DHG_NotYetGrouped):
// nRows(nRows), nCols(nCols),xRes(xRes),
// yRes(yRes),xOrigin(xOrigin),yOrigin(yOrigin),zOrigin(zOrigin),
// sliceThickness(sliceThickness),sliceSpacing(sliceSpacing),
// nSliceInVolume(nSliceInVolume), xRow(xRow), yRow(yRow), zRow(zRow),
// xCol(xCol),yCol(yCol),zCol(zCol),xSlice(xSlice),ySlice(ySlice),zSlice(zSlice),
// bValue(bValue), DiffusionVector(DiffusionVector), vendor(vendor),mosaic(mosaic),
// headerGroup(headerGroup) {}
std::string seriesDescription;
int seriesNumber;
std::string patientName;
int nRows;
int nCols;
float xRes;
float yRes;
float xOrigin;
float yOrigin;
float zOrigin;
float sliceThickness;
float sliceSpacing;
int nSliceInVolume;
float xRow;
float yRow;
float zRow;
float xCol;
float yCol;
float zCol;
float xSlice;
float ySlice;
float zSlice;
float bValue;
vnl_vector_fixed<double, 3> DiffusionVector;
std::string vendor;
bool mosaic;
DiffusionHeaderGroup headerGroup;
FileNamesContainer m_DicomFilenames;
inline bool isIdentical(const DiffusionImageHeaderInformation::Pointer other) const {
return nRows == other->nRows &&
nCols == other->nCols &&
xRes == other->xRes &&
yRes == other->yRes &&
xOrigin == other->xOrigin &&
yOrigin == other->yOrigin &&
zOrigin == other->zOrigin &&
sliceThickness == other->sliceThickness &&
sliceSpacing == other->sliceSpacing &&
nSliceInVolume == other->nSliceInVolume &&
xRow == other->xRow &&
yRow == other->yRow &&
zRow == other->zRow &&
xCol == other->xCol &&
yCol == other->yCol &&
zCol == other->zCol &&
xSlice == other->xSlice &&
ySlice == other->ySlice &&
zSlice == other->zSlice;
}
protected:
DiffusionImageHeaderInformation();
virtual ~DiffusionImageHeaderInformation();
};
} // namespace
#endif // MITK_DiffusionImageHeaderInformation_H
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapProperty.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapProperty.h
index 4a939539ba..8d8ebf6a97 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapProperty.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapProperty.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKBVALUEMAPPROPERTY_H
#define MITKBVALUEMAPPROPERTY_H
#include "mitkBaseProperty.h"
#include <map>
#include <vector>
#include <MitkDiffusionCoreExports.h>
#include <itkVectorContainer.h>
#include <vnl/vnl_vector_fixed.h>
namespace mitk
{
/** This property will store the b value map */
class MITKDIFFUSIONCORE_EXPORT BValueMapProperty : public mitk::BaseProperty
{
public:
/**
* \brief The BValueMap contains seperated IndicesVectors for each b value (index for GradientDirectionContainer)
* key := b value
* value := indicesVector
*/
typedef std::map< unsigned int , std::vector< unsigned int > > BValueMap;
typedef unsigned int IndexType;
typedef vnl_vector_fixed< double, 3 > ValueType;
typedef ValueType GradientDirectionType;
typedef itk::VectorContainer< IndexType, GradientDirectionType > GradientDirectionsContainerType;
mitkClassMacro(BValueMapProperty, BaseProperty)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(BValueMapProperty, const BValueMapProperty&)
mitkNewMacro1Param(BValueMapProperty, const BValueMap&)
const BValueMap & GetBValueMap() const;
void SetBValueMap(const BValueMap & map);
static BValueMap CreateBValueMap(const GradientDirectionsContainerType * gdc, float referenceBValue);
static float GetBValueOfGradientDirection(unsigned int i, float referenceBValue, const GradientDirectionsContainerType *gdc);
protected:
BValueMapProperty();
~BValueMapProperty();
BValueMapProperty(const BValueMapProperty& other);
BValueMapProperty(const BValueMap& bValueMap);
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty & property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty & property) override;
BValueMap m_BValueMap;
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapPropertySerializer.cpp b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapPropertySerializer.cpp
index b33d56edd2..0b3153fd00 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapPropertySerializer.cpp
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkBValueMapPropertySerializer.cpp
@@ -1,131 +1,131 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkBValueMapPropertySerializer_h_included
#define mitkBValueMapPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkBValueMapProperty.h"
#include <MitkDiffusionCoreExports.h>
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT BValueMapPropertySerializer : public BasePropertySerializer
{
protected:
void split(const std::string &s, char delim, std::vector<unsigned int> &elems) {
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim)) {
elems.push_back(std::atoi(item.c_str()));
}
}
std::vector<unsigned int> split(const std::string &s, char delim) {
std::vector<unsigned int> elems;
split(s, delim, elems);
return elems;
}
public:
mitkClassMacro( BValueMapPropertySerializer, BasePropertySerializer )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const BValueMapProperty* prop = dynamic_cast<const BValueMapProperty*>(m_Property.GetPointer()))
{
BValueMapProperty::BValueMap map = prop->GetBValueMap();
if(map.empty()) return NULL;
BValueMapProperty::BValueMap::const_iterator it = map.begin();
BValueMapProperty::BValueMap::const_iterator end = map.end();
TiXmlElement* element = new TiXmlElement("bvaluemap");
while (it != end) {
TiXmlElement* child = new TiXmlElement("entry");
{
std::stringstream ss;
ss << it->first;
child->SetAttribute("key", ss.str());
}
{
std::stringstream ss;
for(unsigned int i = 0 ; i < it->second.size(); i++)
{
ss << it->second[i] << ",";
}
child->SetAttribute("value", ss.str());
}
element->InsertEndChild(*child);
++it;
}
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
BValueMapProperty::BValueMap map;
TiXmlElement* entry = element->FirstChildElement( "entry" )->ToElement();
while(entry != NULL){
std::string key, value;
entry->QueryStringAttribute("key",&key);
entry->QueryStringAttribute("value",&value);
std::vector<unsigned int> indices = split(value.c_str(), ',');
map[std::atoi(key.c_str())] = indices;
entry = entry->NextSiblingElement( "entry" );
}
return BValueMapProperty::New(map).GetPointer();
}
protected:
BValueMapPropertySerializer(){}
virtual ~BValueMapPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(BValueMapPropertySerializer)
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsProperty.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsProperty.h
index 3b797d1bf4..cf88ae7aad 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsProperty.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsProperty.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGRADIENTDIRECTIONSPROPERTY_H
#define MITKGRADIENTDIRECTIONSPROPERTY_H
#include "mitkBaseProperty.h"
#include <vnl/vnl_vector_fixed.h>
#include <itkVectorContainer.h>
#include <itkVector.h>
#include <MitkDiffusionCoreExports.h>
namespace mitk
{
/** This property will store the gradients directions and the original gradient directions */
class MITKDIFFUSIONCORE_EXPORT GradientDirectionsProperty : public mitk::BaseProperty
{
public:
typedef unsigned int IndexType;
typedef vnl_vector_fixed< double, 3 > ValueType;
typedef ValueType GradientDirectionType;
typedef itk::VectorContainer< IndexType, GradientDirectionType > GradientDirectionsContainerType;
typedef std::vector< itk::Vector<double,3> > AlternativeGradientDirectionsContainerType;
mitkClassMacro(GradientDirectionsProperty, BaseProperty)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(GradientDirectionsProperty, const GradientDirectionsProperty&);
mitkNewMacro1Param(GradientDirectionsProperty, const GradientDirectionsContainerType::Pointer);
mitkNewMacro1Param(GradientDirectionsProperty, const AlternativeGradientDirectionsContainerType );
const GradientDirectionsContainerType::Pointer GetGradientDirectionsContainer() const;
protected:
GradientDirectionsProperty();
~GradientDirectionsProperty();
GradientDirectionsProperty(const GradientDirectionsProperty& other);
GradientDirectionsProperty(const GradientDirectionsContainerType::Pointer gradientDirectionsContainer);
GradientDirectionsProperty(const AlternativeGradientDirectionsContainerType gradientDirectionsContainer);
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty & property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty & property) override;
GradientDirectionsContainerType::Pointer m_GradientDirectionsContainer;
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsPropertySerializer.cpp b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsPropertySerializer.cpp
index e56917e5ea..68cfb43835 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsPropertySerializer.cpp
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkGradientDirectionsPropertySerializer.cpp
@@ -1,106 +1,106 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkGradientDirectionPropertySerializer_h_included
#define mitkGradientDirectionPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkGradientDirectionsProperty.h"
#include "MitkDiffusionCoreExports.h"
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT GradientDirectionsPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( GradientDirectionsPropertySerializer, BasePropertySerializer )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const GradientDirectionsProperty* prop = dynamic_cast<const GradientDirectionsProperty*>(m_Property.GetPointer()))
{
typedef mitk::GradientDirectionsProperty::GradientDirectionsContainerType GradientDirectionsContainerType;
GradientDirectionsContainerType::Pointer gdc = prop->GetGradientDirectionsContainer().GetPointer();
if(gdc.IsNull() || gdc->Size() == 0) return NULL;
GradientDirectionsContainerType::Iterator it = gdc->Begin();
GradientDirectionsContainerType::Iterator end = gdc->End();
TiXmlElement* element = new TiXmlElement("gradientdirections");
while (it != end) {
TiXmlElement* child = new TiXmlElement("entry");
std::stringstream ss;
ss << it.Value();
child->SetAttribute("value", ss.str());
element->InsertEndChild(*child);
++it;
}
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
mitk::GradientDirectionsProperty::GradientDirectionsContainerType::Pointer gdc;
gdc = mitk::GradientDirectionsProperty::GradientDirectionsContainerType::New();
TiXmlElement* entry = element->FirstChildElement( "entry" )->ToElement();
while(entry != NULL){
std::stringstream ss;
std::string value;
entry->QueryStringAttribute("value",&value);
ss << value;
vnl_vector_fixed<double, 3> vector;
vector.read_ascii(ss);
gdc->push_back(vector);
entry = entry->NextSiblingElement( "entry" );
}
return GradientDirectionsProperty::New(gdc).GetPointer();
}
protected:
GradientDirectionsPropertySerializer() {}
virtual ~GradientDirectionsPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(GradientDirectionsPropertySerializer)
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFrameProperty.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFrameProperty.h
index a1415f59a1..42eda4392a 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFrameProperty.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFrameProperty.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMEASUREMENTFRAMEPROPERTY_H
#define MITKMEASUREMENTFRAMEPROPERTY_H
#include "mitkBaseProperty.h"
#include <vnl/vnl_matrix_fixed.h>
#include <MitkDiffusionCoreExports.h>
namespace mitk
{
/** This property will store the measurement frame */
class MITKDIFFUSIONCORE_EXPORT MeasurementFrameProperty : public mitk::BaseProperty
{
public:
typedef vnl_matrix_fixed< double, 3, 3 > MeasurementFrameType;
mitkClassMacro(MeasurementFrameProperty, BaseProperty)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(MeasurementFrameProperty, const MeasurementFrameProperty&);
mitkNewMacro1Param(MeasurementFrameProperty, const MeasurementFrameType&);
const MeasurementFrameType &GetMeasurementFrame() const;
void SetMeasurementFrame(const MeasurementFrameType & frame);
protected:
MeasurementFrameProperty();
~MeasurementFrameProperty();
MeasurementFrameProperty(const MeasurementFrameProperty& other);
MeasurementFrameProperty(const MeasurementFrameType& measurementFrame);
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty & property);
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty & property) override;
MeasurementFrameType m_MeasurementFrame;
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFramePropertySerializer.cpp b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFramePropertySerializer.cpp
index 71a41931e5..9d0b807556 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFramePropertySerializer.cpp
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkMeasurementFramePropertySerializer.cpp
@@ -1,89 +1,89 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkMeasurementFramePropertySerializer_h_included
#define mitkMeasurementFramePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkMeasurementFrameProperty.h"
#include <MitkDiffusionCoreExports.h>
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT MeasurementFramePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( MeasurementFramePropertySerializer, BasePropertySerializer )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const MeasurementFrameProperty* prop = dynamic_cast<const MeasurementFrameProperty*>(m_Property.GetPointer()))
{
typedef mitk::MeasurementFrameProperty::MeasurementFrameType MeasurementFrameType;
const MeasurementFrameType & mft = prop->GetMeasurementFrame();
if(mft.is_zero()) return NULL;
TiXmlElement* element = new TiXmlElement("measurementframe");
TiXmlElement* child = new TiXmlElement("entry");
std::stringstream ss;
ss << mft;
child->SetAttribute("value", ss.str());
element->InsertEndChild(*child);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
TiXmlElement* entry = element->FirstChildElement( "entry" )->ToElement();
std::stringstream ss;
std::string value;
entry->QueryStringAttribute("value",&value);
ss << value;
MeasurementFrameProperty::MeasurementFrameType matrix;
matrix.read_ascii(ss);
return MeasurementFrameProperty::New(matrix).GetPointer();
}
protected:
MeasurementFramePropertySerializer() {}
virtual ~MeasurementFramePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(MeasurementFramePropertySerializer)
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkNodePredicateIsDWI.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkNodePredicateIsDWI.h
index 58ea20858c..5c1d23ff8d 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkNodePredicateIsDWI.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/Properties/mitkNodePredicateIsDWI.h
@@ -1,56 +1,56 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNODEPREDICATEISDWI_H_HEADER_INCLUDED_
#define MITKNODEPREDICATEISDWI_H_HEADER_INCLUDED_
#include <MitkDiffusionCoreExports.h>
#include "mitkNodePredicateBase.h"
#include "mitkBaseProperty.h"
#include "mitkBaseData.h"
namespace mitk {
/**Documentation
* @brief Predicate that evaluates whether a given node contains a diffusion weighted image
* @ingroup DataStorage
*/
class MITKDIFFUSIONCORE_EXPORT NodePredicateIsDWI : public NodePredicateBase
{
public:
mitkClassMacro(NodePredicateIsDWI, NodePredicateBase);
itkFactorylessNewMacro(NodePredicateIsDWI)
//##Documentation
//## @brief Standard Destructor
virtual ~NodePredicateIsDWI();
//##Documentation
//## @brief Checks, if the node's data contains a property that is equal to m_ValidProperty
- virtual bool CheckNode(const mitk::DataNode* node) const;
+ virtual bool CheckNode(const mitk::DataNode* node) const override;
protected:
//##Documentation
//## @brief Constructor to check for a named property
NodePredicateIsDWI();
};
} // namespace mitk
#endif /* MITKNODEPREDICATEISDWI_H_HEADER_INCLUDED_ */
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImage.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImage.h
index 6607479f06..a3344121b8 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImage.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImage.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkQBallImage__h
#define __mitkQBallImage__h
#include "mitkImage.h"
#include "itkVectorImage.h"
#include "mitkImageVtkAccessor.h"
#include <MitkDiffusionCoreExports.h>
// generate by n-fold subdivisions of an icosahedron
// 1 - 12
// 2 - 42
// 3 - 92
// 4 - 162
// 5 - 252
// 6 - 362
// 7 - 492
// 8 - 642
// 9 - 812
// 10 - 1002
#define QBALL_ODFSIZE 252
namespace mitk
{
/**
* \brief this class encapsulates qball images
*/
class MITKDIFFUSIONCORE_EXPORT QBallImage : public Image
{
public:
mitkClassMacro( QBallImage, Image );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const vtkImageData* GetNonRgbVtkImageData(int t = 0, int n = 0) const;
virtual vtkImageData* GetNonRgbVtkImageData(int t = 0, int n = 0);
- virtual const vtkImageData* GetVtkImageData(int t = 0, int n = 0) const;
- virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0);
+ virtual const vtkImageData* GetVtkImageData(int t = 0, int n = 0) const override;
+ virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0) override;
virtual void ConstructRgbImage() const;
protected:
QBallImage();
virtual ~QBallImage();
mutable mitk::Image::Pointer m_RgbImage;
};
} // namespace mitk
#endif /* __mitkQBallImage__h */
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImageSource.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImageSource.h
index f9972c71ca..de298dde04 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImageSource.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/QBallImages/mitkQBallImageSource.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC
#define QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC
#include "mitkImageSource.h"
#include "mitkQBallImage.h"
#include <MitkDiffusionCoreExports.h>
namespace mitk {
class MITKDIFFUSIONCORE_EXPORT QBallImageSource : public ImageSource
{
public:
typedef mitk::QBallImage OutputImageType;
typedef OutputImageType::Pointer OutputImagePointer;
typedef SlicedData::RegionType OutputImageRegionType;
typedef itk::DataObject::Pointer DataObjectPointer;
mitkClassMacro(QBallImageSource,ImageSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
QBallImageSource();
virtual ~QBallImageSource() {}
};
} // namespace mitk
#endif /* QBallImageSource_H_HEADER_INCLUDED_C1E7D6EC */
diff --git a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/TensorImages/mitkTensorImage.h b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/TensorImages/mitkTensorImage.h
index c46eafd12b..46f923044a 100644
--- a/Modules/DiffusionImaging/DiffusionCore/IODataStructures/TensorImages/mitkTensorImage.h
+++ b/Modules/DiffusionImaging/DiffusionCore/IODataStructures/TensorImages/mitkTensorImage.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkTensorImage__h
#define __mitkTensorImage__h
#include "mitkImage.h"
#include "itkVectorImage.h"
#include <MitkDiffusionCoreExports.h>
#define TENSOR_NUM_ELEMENTS 6
namespace mitk
{
/**
* \brief this class encapsulates tensor images
*/
class MITKDIFFUSIONCORE_EXPORT TensorImage : public Image
{
public:
mitkClassMacro( TensorImage, Image );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual vtkImageData* GetNonRgbVtkImageData(int t = 0, int n = 0);
- virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0);
- virtual const vtkImageData* GetVtkImageData(int t = 0, int n = 0) const;
+ virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0) override;
+ virtual const vtkImageData* GetVtkImageData(int t = 0, int n = 0) const override;
virtual void ConstructRgbImage() const;
protected:
TensorImage();
virtual ~TensorImage();
mutable mitk::Image::Pointer m_RgbImage;
};
} // namespace mitk
#endif /* __mitkTensorImage__h */
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfNormalizationMethodProperty.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfNormalizationMethodProperty.h
index 9548ca8ed3..364742e2ba 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfNormalizationMethodProperty.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfNormalizationMethodProperty.h
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_OdfNormalizationMethodProperty__H_
#define _MITK_OdfNormalizationMethodProperty__H_
#include "mitkEnumerationProperty.h"
#include "mitkEnumerationPropertySerializer.h"
#include <MitkDiffusionCoreExports.h>
#include "mitkSerializerMacros.h"
namespace mitk
{
enum OdfNormalizationMethod
{
ODFN_MINMAX,
ODFN_MAX,
ODFN_NONE,
ODFN_GLOBAL_MAX
};
/**
* Encapsulates the enumeration for ODF normalization. Valid values are
* ODFN_MINMAX, ODFN_MAX, ODFN_NONE ODFN_GLOBAL_MAX
* Default is ODFN_MINMAX
*/
class MITKDIFFUSIONCORE_EXPORT OdfNormalizationMethodProperty : public EnumerationProperty
{
public:
mitkClassMacro( OdfNormalizationMethodProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(OdfNormalizationMethodProperty, const IdType&);
mitkNewMacro1Param(OdfNormalizationMethodProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetNormalization();
/**
* Sets the interpolation type to ODFN_MINMAX.
*/
virtual void SetNormalizationToMinMax();
/**
* Sets the interpolation type to ODFN_MAX.
*/
virtual void SetNormalizationToMax();
/**
* Sets the interpolation type to ODFN_NONE.
*/
virtual void SetNormalizationToNone();
/**
* Sets the interpolation type to ODFN_GLOBAL_MAX.
*/
virtual void SetNormalizationToGlobalMax();
protected:
/** Sets reslice interpolation mode to default (VTK_RESLICE_NEAREST).
*/
OdfNormalizationMethodProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfNormalizationMethodProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfNormalizationMethodProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
class MITKDIFFUSIONCORE_EXPORT OdfNormalizationMethodPropertySerializer : public EnumerationPropertySerializer
{
public:
mitkClassMacro( OdfNormalizationMethodPropertySerializer, EnumerationPropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
const char* sa( element->Attribute("value") );
std::string s(sa?sa:"");
OdfNormalizationMethodProperty::Pointer property = OdfNormalizationMethodProperty::New();
property->SetValue( s );
return property.GetPointer();
}
protected:
OdfNormalizationMethodPropertySerializer () {}
virtual ~OdfNormalizationMethodPropertySerializer () {}
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfScaleByProperty.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfScaleByProperty.h
index 0e7c83777d..32a2b254a4 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfScaleByProperty.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfScaleByProperty.h
@@ -1,117 +1,117 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_OdfScaleByProperty__H_
#define _MITK_OdfScaleByProperty__H_
#include <MitkDiffusionCoreExports.h>
#include "mitkEnumerationProperty.h"
#include "mitkEnumerationPropertySerializer.h"
namespace mitk
{
enum OdfScaleBy
{
ODFSB_NONE,
ODFSB_GFA,
ODFSB_PC
};
/**
* Encapsulates the enumeration for ODF normalization. Valid values are
* ODFSB_NONE, ODFSB_GFA, ODFSB_PC
* Default is ODFSB_NONE
*/
class MITKDIFFUSIONCORE_EXPORT OdfScaleByProperty : public EnumerationProperty
{
public:
mitkClassMacro( OdfScaleByProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(OdfScaleByProperty, const IdType&);
mitkNewMacro1Param(OdfScaleByProperty, const std::string&);
/**
* Returns the current interpolation value as defined by VTK constants.
*/
virtual int GetScaleBy();
virtual void SetScaleByNothing();
virtual void SetScaleByGFA();
virtual void SetScaleByPrincipalCurvature();
protected:
/** Sets reslice interpolation mode to default (ODFSB_NONE).
*/
OdfScaleByProperty( );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfScaleByProperty( const IdType& value );
/**
* Constructor. Sets reslice interpolation to the given value.
*/
OdfScaleByProperty( const std::string& value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid interpolation types.
*/
- virtual bool AddEnum( const std::string& name, const IdType& id );
+ virtual bool AddEnum( const std::string& name, const IdType& id ) override;
/**
* Adds the enumeration types as defined by vtk to the list of known
* enumeration values.
*/
virtual void AddInterpolationTypes();
};
class MITKDIFFUSIONCORE_EXPORT OdfScaleByPropertySerializer : public EnumerationPropertySerializer
{
public:
mitkClassMacro( OdfScaleByPropertySerializer, EnumerationPropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
const char* sa( element->Attribute("value") );
std::string s(sa?sa:"");
OdfScaleByProperty::Pointer property = OdfScaleByProperty::New();
property->SetValue( s );
return property.GetPointer();
}
protected:
OdfScaleByPropertySerializer () {}
virtual ~OdfScaleByPropertySerializer () {}
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfVtkMapper2D.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfVtkMapper2D.h
index fb5bea8931..8763b450c7 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfVtkMapper2D.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkOdfVtkMapper2D.h
@@ -1,146 +1,146 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ODFVTKMAPPER2D_H_HEADER_INCLUDED
#define ODFVTKMAPPER2D_H_HEADER_INCLUDED
#include "mitkVtkMapper.h"
#include "vtkPropAssembly.h"
#include "vtkAppendPolyData.h"
#include "vtkActor.h"
#include "vtkPolyDataMapper.h"
#include "vtkPlane.h"
#include "vtkCutter.h"
#include "vtkClipPolyData.h"
#include "vtkTransform.h"
#include "vtkDataArrayTemplate.h"
#include "vtkSmartPointer.h"
#include "vtkOdfSource.h"
#include "vtkThickPlane.h"
namespace mitk {
//##Documentation
//## @brief Mapper for spherical object densitiy function representations
//##
template<class TPixelType, int NrOdfDirections>
class OdfVtkMapper2D : public VtkMapper
{
struct OdfDisplayGeometry {
double vp[ 3 ], vnormal[ 3 ];
Vector3D normal;
double d, d1, d2;
mitk::Point3D M3D, L3D, O3D;
double vp_original[ 3 ], vnormal_original[ 3 ];
mitk::Vector2D size, origin;
bool Equals(OdfDisplayGeometry other)
{
return other.vp_original[0] == vp[0] &&
other.vp_original[1] == vp[1] &&
other.vp_original[2] == vp[2] &&
other.vnormal_original[0] == vnormal[0] &&
other.vnormal_original[1] == vnormal[1] &&
other.vnormal_original[2] == vnormal[2] &&
other.size[0] == size[0] &&
other.size[1] == size[1] &&
other.origin[0] == origin[0] &&
other.origin[1] == origin[1];
}
};
public:
mitkClassMacro(OdfVtkMapper2D,VtkMapper)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
bool IsVisibleOdfs(mitk::BaseRenderer* renderer);
- virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer);
- virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer);
- virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer);
- virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* /*renderer*/){}
+ virtual void MitkRenderOverlay(mitk::BaseRenderer* renderer) override;
+ virtual void MitkRenderOpaqueGeometry(mitk::BaseRenderer* renderer) override;
+ virtual void MitkRenderTranslucentGeometry(mitk::BaseRenderer* renderer) override;
+ virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* /*renderer*/) override{}
OdfDisplayGeometry MeasureDisplayedGeometry(mitk::BaseRenderer* renderer);
double GetMinImageSpacing( int index );
void ApplyPropertySettings();
virtual void Slice(mitk::BaseRenderer* renderer, OdfDisplayGeometry dispGeo);
virtual int GetIndex(mitk::BaseRenderer* renderer);
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false);
- virtual void Update(mitk::BaseRenderer * renderer);
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
- virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const { return true; }
+ virtual void Update(mitk::BaseRenderer * renderer) override;
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
+ virtual bool IsLODEnabled( BaseRenderer * /*renderer*/ ) const override { return true; }
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
std::vector< vtkSmartPointer<vtkPropAssembly> > m_PropAssemblies;
std::vector< vtkSmartPointer<vtkAppendPolyData> > m_OdfsPlanes;
std::vector< vtkSmartPointer<vtkActor> > m_OdfsActors;
std::vector< vtkSmartPointer<vtkPolyDataMapper> > m_OdfsMappers;
vtkSmartPointer< vtkPolyData > m_TemplateOdf;
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage()
{
}
};
protected:
OdfVtkMapper2D();
virtual ~OdfVtkMapper2D();
static void GlyphMethod(void *arg);
bool IsPlaneRotated(mitk::BaseRenderer* renderer);
private:
mitk::Image* GetInput();
static vtkSmartPointer<vtkTransform> m_OdfTransform;
static vtkSmartPointer<vtkOdfSource> m_OdfSource;
static float m_Scaling;
static int m_Normalization;
static int m_ScaleBy;
static float m_IndexParam1;
static float m_IndexParam2;
int m_ShowMaxNumber;
std::vector< vtkSmartPointer<vtkPlane> > m_Planes;
std::vector< vtkSmartPointer<vtkCutter> > m_Cutters;
std::vector< vtkSmartPointer<vtkThickPlane> > m_ThickPlanes1;
std::vector< vtkSmartPointer<vtkClipPolyData> > m_Clippers1;
std::vector< vtkSmartPointer<vtkThickPlane> > m_ThickPlanes2;
std::vector< vtkSmartPointer<vtkClipPolyData> > m_Clippers2;
vtkImageData* m_VtkImage ;
OdfDisplayGeometry m_LastDisplayGeometry;
mitk::LocalStorageHandler<LocalStorage> m_LSH;
};
} // namespace mitk
#include "mitkOdfVtkMapper2D.txx"
#endif /* ODFVTKMAPPER2D_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkVectorImageVtkGlyphMapper3D.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkVectorImageVtkGlyphMapper3D.h
index 605002c238..4584bd4af8 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkVectorImageVtkGlyphMapper3D.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/mitkVectorImageVtkGlyphMapper3D.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VECTOR_IMAGE_VTK_MAPPER_3D__H
#define _MITK_VECTOR_IMAGE_VTK_MAPPER_3D__H
#include <MitkDiffusionCoreExports.h>
#include "mitkVtkMapper.h"
#include "mitkImage.h"
class vtkMaskedGlyph3D;
class vtkActor;
class vtkPolyDataMapper;
class vtkMaskPoints;
namespace mitk
{
class MITKDIFFUSIONCORE_EXPORT VectorImageVtkGlyphMapper3D : public VtkMapper
{
public:
mitkClassMacro( VectorImageVtkGlyphMapper3D, VtkMapper );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
enum GlyphType {LineGlyph, ArrowGlyph};
itkSetMacro(MaximumNumberOfPoints, unsigned int);
itkGetMacro(MaximumNumberOfPoints, unsigned int);
itkSetMacro(UseMaskPoints, bool);
itkGetMacro(UseMaskPoints, bool);
itkBooleanMacro(UseMaskPoints);
itkSetMacro(RandomMode, bool);
itkGetMacro(RandomMode, bool);
itkBooleanMacro(RandomMode);
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
/**
* Constructor. Doesn't do anything...
*/
VectorImageVtkGlyphMapper3D();
/**
* Destructor
*/
virtual ~VectorImageVtkGlyphMapper3D();
/**
* Generate a vtkPolyData by creating vectors as glyphs
* This method is called, each time a specific renderer is updated.
*/
- virtual void GenerateDataForRenderer( mitk::BaseRenderer* renderer );
+ virtual void GenerateDataForRenderer( mitk::BaseRenderer* renderer ) override;
/**
* Returns the input data object of the given filter. In this
* case, a mitk::Image is returned.
*/
Image* GetInput();
vtkMaskedGlyph3D* m_Glyph3DGenerator;
vtkActor* m_Glyph3DActor;
vtkPolyDataMapper* m_Glyph3DMapper;
GlyphType m_GlyphType;
unsigned int m_MaximumNumberOfPoints;
bool m_UseMaskPoints;
bool m_RandomMode;
};
} //end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkMaskedProgrammableGlyphFilter.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkMaskedProgrammableGlyphFilter.h
index c08fa95892..f1a420b798 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkMaskedProgrammableGlyphFilter.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkMaskedProgrammableGlyphFilter.h
@@ -1,114 +1,114 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkMaskedProgrammableGlyphFilter_h
#define __vtkMaskedProgrammableGlyphFilter_h
#include <MitkDiffusionCoreExports.h>
#include "vtkProgrammableGlyphFilter.h"
#include "mitkBaseGeometry.h"
class vtkMaskPoints;
/**
* This class masked points of the input data set and glyphs
* only the selected poitns. Points may be selected either by
* random or by ratio.
* Additionally, this class allows to set the InputScalars,
* InputVectors and InputNormals by their field name in the
* input dataset.
*/
class MITKDIFFUSIONCORE_EXPORT vtkMaskedProgrammableGlyphFilter : public vtkProgrammableGlyphFilter
{
public:
vtkTypeMacro(vtkMaskedProgrammableGlyphFilter,vtkProgrammableGlyphFilter);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Constructor
*/
static vtkMaskedProgrammableGlyphFilter *New();
/**
* Limit the number of points to glyph
*/
vtkSetMacro(MaximumNumberOfPoints, int);
vtkGetMacro(MaximumNumberOfPoints, int);
/**
* Set the input to this filter.
*/
virtual void SetInput(vtkDataSet *input);
/**
* Set/get whether to mask points
*/
vtkSetMacro(UseMaskPoints, int);
vtkGetMacro(UseMaskPoints, int);
/**
* Set/get flag to cause randomization of which points to mask.
*/
void SetRandomMode(int mode);
int GetRandomMode();
///**
// * If you want to use an arbitrary scalars array, then set its name here.
// * By default this in NULL and the filter will use the active scalar array.
// */
//vtkGetStringMacro(InputScalarsSelection);
//void SelectInputScalars(const char *fieldName)
// {this->SetInputScalarsSelection(fieldName);}
///**
// * If you want to use an arbitrary vectors array, then set its name here.
// * By default this in NULL and the filter will use the active vector array.
// */
//vtkGetStringMacro(InputVectorsSelection);
//void SelectInputVectors(const char *fieldName)
// {this->SetInputVectorsSelection(fieldName);}
///**
// * If you want to use an arbitrary normals array, then set its name here.
// * By default this in NULL and the filter will use the active normal array.
// */
//vtkGetStringMacro(InputNormalsSelection);
//void SelectInputNormals(const char *fieldName)
// {this->SetInputNormalsSelection(fieldName);}
void SetGeometry(mitk::BaseGeometry::Pointer geo)
{ this->m_Geometry = geo; }
mitk::BaseGeometry::Pointer GetGeometry()
{ return this->m_Geometry; }
protected:
vtkMaskedProgrammableGlyphFilter();
~vtkMaskedProgrammableGlyphFilter();
- virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
vtkMaskPoints *MaskPoints;
int MaximumNumberOfPoints;
int UseMaskPoints;
mitk::BaseGeometry::Pointer m_Geometry;
private:
vtkMaskedProgrammableGlyphFilter(const vtkMaskedProgrammableGlyphFilter&); // Not implemented.
void operator=(const vtkMaskedProgrammableGlyphFilter&); // Not implemented.
};
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.h
index 9c65f95286..8a658641db 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkOdfSource.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkOdfSource_h
#define __vtkOdfSource_h
#include <MitkDiffusionCoreExports.h>
#include "vtkPolyDataAlgorithm.h"
#include "mitkCommon.h"
#include <vtkFloatArray.h>
#include <itkOrientationDistributionFunction.h>
#include <mitkOdfNormalizationMethodProperty.h>
class MITKDIFFUSIONCORE_EXPORT vtkOdfSource : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkOdfSource,vtkPolyDataAlgorithm);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
typedef itk::OrientationDistributionFunction<float, QBALL_ODFSIZE> OdfType;
// Description:
// Construct sphere with radius=0.5 and default resolution 8 in both Phi
// and Theta directions. Theta ranges from (0,360) and phi (0,180) degrees.
static vtkOdfSource *New();
vtkSetMacro(Scale,double);
vtkGetMacro(Scale,double);
vtkSetMacro(AdditionalScale,double);
vtkGetMacro(AdditionalScale,double);
vtkSetMacro(Normalization,int);
vtkGetMacro(Normalization,int);
vtkSetMacro(Odf,OdfType);
vtkGetMacro(Odf,OdfType);
protected:
vtkOdfSource();
~vtkOdfSource() {}
- int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
- int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+ int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
+ int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
OdfType Odf;
double Scale;
double AdditionalScale;
int Normalization;
private:
vtkOdfSource(const vtkOdfSource&); // Not implemented.
void operator=(const vtkOdfSource&); // Not implemented.
};
#endif //__vtkOdfSource_h
diff --git a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkThickPlane.h b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkThickPlane.h
index 635d367e3e..359dadedae 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkThickPlane.h
+++ b/Modules/DiffusionImaging/DiffusionCore/Rendering/vtkThickPlane.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// .NAME vtkPlane - perform various plane computations
// .SECTION Description
// vtkPlane provides methods for various plane computations. These include
// projecting points onto a plane, evaluating the plane equation, and
// returning plane normal. vtkPlane is a concrete implementation of the
// abstract class vtkImplicitFunction.
#ifndef __vtkThickPlane_h
#define __vtkThickPlane_h
#include <MitkDiffusionCoreExports.h>
#include "vtkImplicitFunction.h"
#include "mitkCommon.h"
class MITKDIFFUSIONCORE_EXPORT vtkThickPlane : public vtkImplicitFunction
{
public:
// Description
// Construct plane passing through origin and normal to z-axis.
static vtkThickPlane *New();
vtkTypeMacro(vtkThickPlane,vtkImplicitFunction);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description
// Evaluate plane equation for point x[3].
- double EvaluateFunction(double x[3]);
+ double EvaluateFunction(double x[3]) override;
double EvaluateFunction(double x, double y, double z);
// Description
// Evaluate function gradient at point x[3].
- void EvaluateGradient(double x[3], double g[3]);
+ void EvaluateGradient(double x[3], double g[3]) override;
// Description:
// Set/get plane normal. Plane is defined by point and normal.
virtual void SetPose (double _n1, double _n2, double _n3, double _o1, double _o2, double _o3);
virtual void SetPose (double _n[3], double _o[3]);
vtkGetVectorMacro(Normal,double,3);
vtkGetVectorMacro(Origin,double,3);
// Description:
// Set/get point through which plane passes. Plane is defined by point
// and normal.
virtual void SetThickness (double _arg);
vtkGetMacro(Thickness,double);
int count;
protected:
vtkThickPlane();
~vtkThickPlane() {};
// Description:
// Set/get plane normal. Plane is defined by point and normal.
virtual void SetNormal (double _arg1, double _arg2, double _arg3);
virtual void SetNormal (double _arg[3]);
// Description:
// Set/get point through which plane passes. Plane is defined by point
// and normal.
virtual void SetOrigin (double _arg1, double _arg2, double _arg3);
virtual void SetOrigin (double _arg[3]);
double Normal[3];
double Origin[3];
double Thickness;
double Distance;
private:
vtkThickPlane(const vtkThickPlane&); // Not implemented.
void operator=(const vtkThickPlane&); // Not implemented.
};
#endif
diff --git a/Modules/DiffusionImaging/DiffusionCore/Testing/mitkDiffusionPropertySerializerTest.cpp b/Modules/DiffusionImaging/DiffusionCore/Testing/mitkDiffusionPropertySerializerTest.cpp
index 436646692c..3b032b0a4f 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Testing/mitkDiffusionPropertySerializerTest.cpp
+++ b/Modules/DiffusionImaging/DiffusionCore/Testing/mitkDiffusionPropertySerializerTest.cpp
@@ -1,184 +1,184 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkIOUtil.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include <mitkBasePropertySerializer.h>
#include <mitkBValueMapProperty.h>
#include <mitkGradientDirectionsProperty.h>
#include <mitkMeasurementFrameProperty.h>
#include <mitkDiffusionPropertyHelper.h>
class mitkDiffusionPropertySerializerTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkDiffusionPropertySerializerTestSuite);
MITK_TEST(Equal_SerializeandDeserialize_ReturnsTrue);
//MITK_TEST(Equal_DifferentChannels_ReturnFalse);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::PropertyList::Pointer propList; //represet image propertylist
mitk::BValueMapProperty::Pointer bvaluemap_prop;
mitk::GradientDirectionsProperty::Pointer gradientdirection_prop;
mitk::MeasurementFrameProperty::Pointer measurementframe_prop;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
propList = mitk::PropertyList::New();
mitk::BValueMapProperty::BValueMap map;
std::vector<unsigned int> indices1;
indices1.push_back(1);
indices1.push_back(2);
indices1.push_back(3);
indices1.push_back(4);
map[0] = indices1;
std::vector<unsigned int> indices2;
indices2.push_back(4);
indices2.push_back(3);
indices2.push_back(2);
indices2.push_back(1);
map[1000] = indices2;
bvaluemap_prop = mitk::BValueMapProperty::New(map).GetPointer();
propList->SetProperty(mitk::DiffusionPropertyHelper::BVALUEMAPPROPERTYNAME.c_str(),bvaluemap_prop);
mitk::GradientDirectionsProperty::GradientDirectionsContainerType::Pointer gdc;
gdc = mitk::GradientDirectionsProperty::GradientDirectionsContainerType::New();
double a[3] = {3.0,4.0,1.4};
vnl_vector_fixed<double,3> vec1;
vec1.set(a);
gdc->push_back(vec1);
double b[3] = {1.0,5.0,123.4};
vnl_vector_fixed<double,3> vec2;
vec2.set(b);
gdc->push_back(vec2);
double c[3] = {13.0,84.02,13.4};
vnl_vector_fixed<double,3> vec3;
vec3.set(c);
gdc->push_back(vec3);
gradientdirection_prop = mitk::GradientDirectionsProperty::New(gdc.GetPointer()).GetPointer();
propList->SetProperty(mitk::DiffusionPropertyHelper::GRADIENTCONTAINERPROPERTYNAME.c_str(), gradientdirection_prop);
mitk::MeasurementFrameProperty::MeasurementFrameType mft;
double row0[3] = {1,0,0};
double row1[3] = {0,1,0};
double row2[3] = {0,0,1};
mft.set_row(0,row0);
mft.set_row(1,row1);
mft.set_row(2,row2);
measurementframe_prop = mitk::MeasurementFrameProperty::New(mft).GetPointer();
propList->SetProperty(mitk::DiffusionPropertyHelper::MEASUREMENTFRAMEPROPERTYNAME.c_str(), measurementframe_prop);
}
- void tearDown()
+ void tearDown() override
{
}
void Equal_SerializeandDeserialize_ReturnsTrue()
{
assert(propList);
/* try to serialize each property in the list, then deserialize again and check for equality */
for (mitk::PropertyList::PropertyMap::const_iterator it = propList->GetMap()->begin(); it != propList->GetMap()->end(); ++it)
{
const mitk::BaseProperty* prop = it->second;
// construct name of serializer class
std::string serializername = std::string(prop->GetNameOfClass()) + "Serializer";
std::list<itk::LightObject::Pointer> allSerializers = itk::ObjectFactoryBase::CreateAllInstance(serializername.c_str());
MITK_TEST_CONDITION(allSerializers.size() > 0, std::string("Creating serializers for ") + serializername);
if (allSerializers.size() == 0)
{
MITK_TEST_OUTPUT( << "serialization not possible, skipping " << prop->GetNameOfClass());
continue;
}
if (allSerializers.size() > 1)
{
MITK_TEST_OUTPUT (<< "Warning: " << allSerializers.size() << " serializers found for " << prop->GetNameOfClass() << "testing only the first one.");
}
mitk::BasePropertySerializer* serializer = dynamic_cast<mitk::BasePropertySerializer*>( allSerializers.begin()->GetPointer());
MITK_TEST_CONDITION(serializer != NULL, serializername + std::string(" is valid"));
if (serializer != NULL)
{
serializer->SetProperty(prop);
TiXmlElement* valueelement = NULL;
try
{
valueelement = serializer->Serialize();
// TiXmlPrinter p;
// valueelement->Accept(&p);
// MITK_INFO << p.CStr();
}
catch (...)
{
}
MITK_TEST_CONDITION(valueelement != NULL, std::string("Serialize property with ") + serializername);
if (valueelement == NULL)
{
MITK_TEST_OUTPUT( << "serialization failed, skipping deserialization");
continue;
}
mitk::BaseProperty::Pointer deserializedProp = serializer->Deserialize( valueelement );
MITK_TEST_CONDITION(deserializedProp.IsNotNull(), "serializer created valid property");
if (deserializedProp.IsNotNull())
{
MITK_TEST_CONDITION(*(deserializedProp.GetPointer()) == *prop, "deserialized property equals initial property for type " << prop->GetNameOfClass());
}
}
else
{
MITK_TEST_OUTPUT( << "created serializer object is of class " << allSerializers.begin()->GetPointer()->GetNameOfClass())
}
} // for all properties
}
};
MITK_TEST_SUITE_REGISTRATION(mitkDiffusionPropertySerializer)
diff --git a/Modules/DiffusionImaging/DiffusionCore/Testing/mitkNonLocalMeansDenoisingTest.cpp b/Modules/DiffusionImaging/DiffusionCore/Testing/mitkNonLocalMeansDenoisingTest.cpp
index 62a7941cb4..de90e65686 100644
--- a/Modules/DiffusionImaging/DiffusionCore/Testing/mitkNonLocalMeansDenoisingTest.cpp
+++ b/Modules/DiffusionImaging/DiffusionCore/Testing/mitkNonLocalMeansDenoisingTest.cpp
@@ -1,169 +1,169 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkIOUtil.h"
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"
#include "itkNonLocalMeansDenoisingFilter.h"
#include "mitkGradientDirectionsProperty.h"
#include "mitkITKImageImport.h"
#include <mitkImageCast.h>
class mitkNonLocalMeansDenoisingTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkNonLocalMeansDenoisingTestSuite);
MITK_TEST(Denoise_NLMg_shouldReturnTrue);
MITK_TEST(Denoise_NLMr_shouldReturnTrue);
MITK_TEST(Denoise_NLMv_shouldReturnTrue);
MITK_TEST(Denoise_NLMvr_shouldReturnTrue);
CPPUNIT_TEST_SUITE_END();
private:
typedef itk::VectorImage<short,3> VectorImagetType;
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::Image::Pointer m_Image;
mitk::Image::Pointer m_ReferenceImage;
mitk::Image::Pointer m_DenoisedImage;
itk::Image<short, 3>::Pointer m_ImageMask;
itk::NonLocalMeansDenoisingFilter<short>::Pointer m_DenoisingFilter;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
*/
- void setUp()
+ void setUp() override
{
//generate test images
std::string imagePath = GetTestDataFilePath("DiffusionImaging/Denoising/test_multi.dwi");
m_Image = mitk::IOUtil::LoadImage(imagePath);
m_ReferenceImage = NULL;
m_DenoisedImage = mitk::Image::New();
//initialise Filter
m_DenoisingFilter = itk::NonLocalMeansDenoisingFilter<short>::New();
VectorImagetType::Pointer vectorImage;
mitk::CastToItkImage(m_Image,vectorImage);
m_DenoisingFilter->SetInputImage(vectorImage);
m_DenoisingFilter->SetNumberOfThreads(1);
m_DenoisingFilter->SetComparisonRadius(1);
m_DenoisingFilter->SetSearchRadius(1);
m_DenoisingFilter->SetVariance(500);
}
- void tearDown()
+ void tearDown() override
{
m_Image = NULL;
m_ImageMask = NULL;
m_ReferenceImage = NULL;
m_DenoisingFilter = NULL;
m_DenoisedImage = NULL;
}
void Denoise_NLMg_shouldReturnTrue()
{
std::string referenceImagePath = GetTestDataFilePath("DiffusionImaging/Denoising/test_multi_NLMg.dwi");
m_ReferenceImage = mitk::IOUtil::LoadImage(referenceImagePath);
m_DenoisingFilter->SetUseRicianAdaption(false);
m_DenoisingFilter->SetUseJointInformation(false);
try
{
m_DenoisingFilter->Update();
}
catch(std::exception& e)
{
MITK_ERROR << e.what();
}
mitk::GrabItkImageMemory(m_DenoisingFilter->GetOutput(),m_DenoisedImage);
m_DenoisedImage->SetPropertyList(m_Image->GetPropertyList()->Clone());
MITK_ASSERT_EQUAL( m_DenoisedImage, m_ReferenceImage, "NLMg should always return the same result.");
}
void Denoise_NLMr_shouldReturnTrue()
{
std::string referenceImagePath = GetTestDataFilePath("DiffusionImaging/Denoising/test_multi_NLMr.dwi");
m_ReferenceImage = mitk::IOUtil::LoadImage(referenceImagePath);
m_DenoisingFilter->SetUseRicianAdaption(true);
m_DenoisingFilter->SetUseJointInformation(false);
try
{
m_DenoisingFilter->Update();
}
catch(std::exception& e)
{
MITK_ERROR << e.what();
}
mitk::GrabItkImageMemory(m_DenoisingFilter->GetOutput(),m_DenoisedImage);
m_DenoisedImage->SetPropertyList(m_Image->GetPropertyList()->Clone());
MITK_ASSERT_EQUAL( m_DenoisedImage, m_ReferenceImage, "NLMr should always return the same result.");
}
void Denoise_NLMv_shouldReturnTrue()
{
std::string referenceImagePath = GetTestDataFilePath("DiffusionImaging/Denoising/test_multi_NLMv.dwi");
m_ReferenceImage = mitk::IOUtil::LoadImage(referenceImagePath);
m_DenoisingFilter->SetUseRicianAdaption(false);
m_DenoisingFilter->SetUseJointInformation(true);
try
{
m_DenoisingFilter->Update();
}
catch(std::exception& e)
{
MITK_ERROR << e.what();
}
mitk::GrabItkImageMemory(m_DenoisingFilter->GetOutput(),m_DenoisedImage);
m_DenoisedImage->SetPropertyList(m_Image->GetPropertyList()->Clone());
MITK_ASSERT_EQUAL( m_DenoisedImage, m_ReferenceImage, "NLMv should always return the same result.");
}
void Denoise_NLMvr_shouldReturnTrue()
{
std::string referenceImagePath = GetTestDataFilePath("DiffusionImaging/Denoising/test_multi_NLMvr.dwi");
m_ReferenceImage = mitk::IOUtil::LoadImage(referenceImagePath);
m_DenoisingFilter->SetUseRicianAdaption(true);
m_DenoisingFilter->SetUseJointInformation(true);
try
{
m_DenoisingFilter->Update();
}
catch(std::exception& e)
{
MITK_ERROR << e.what();
}
mitk::GrabItkImageMemory(m_DenoisingFilter->GetOutput(),m_DenoisedImage);
m_DenoisedImage->SetPropertyList(m_Image->GetPropertyList()->Clone());
MITK_ASSERT_EQUAL( m_DenoisedImage, m_ReferenceImage, "NLMvr should always return the same result.");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkNonLocalMeansDenoising)
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkCompositeMapper.h b/Modules/DiffusionImaging/DiffusionIO/mitkCompositeMapper.h
index ce84b9532c..2dc46b24cd 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkCompositeMapper.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkCompositeMapper.h
@@ -1,161 +1,161 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef COMPOSITEMAPPER_H_HEADER_INCLUDED
#define COMPOSITEMAPPER_H_HEADER_INCLUDED
#include "mitkGLMapper.h"
#include "mitkVtkMapper.h"
#include "mitkQBallImage.h"
#include "mitkImageVtkMapper2D.h"
#include "mitkOdfVtkMapper2D.h"
#include "mitkLevelWindowProperty.h"
namespace mitk {
class CopyImageMapper2D : public ImageVtkMapper2D
{
public:
mitkClassMacro(CopyImageMapper2D,ImageVtkMapper2D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
friend class CompositeMapper;
};
//##Documentation
//## @brief Composite pattern for combination of different mappers
//## @ingroup Mapper
class CompositeMapper : public VtkMapper
{
public:
mitkClassMacro(CompositeMapper,VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void MitkRenderOverlay(BaseRenderer* renderer)
+ virtual void MitkRenderOverlay(BaseRenderer* renderer) override
{
m_ImgMapper->MitkRenderOverlay(renderer);
m_OdfMapper->MitkRenderOverlay(renderer);
}
- virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer)
+ virtual void MitkRenderOpaqueGeometry(BaseRenderer* renderer) override
{
m_ImgMapper->MitkRenderOpaqueGeometry(renderer);
m_OdfMapper->MitkRenderOpaqueGeometry(renderer);
if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) == 0 )
{
renderer->Modified();
}
}
- virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer)
+ virtual void MitkRenderTranslucentGeometry(BaseRenderer* renderer) override
{
m_ImgMapper->MitkRenderTranslucentGeometry(renderer);
m_OdfMapper->MitkRenderTranslucentGeometry(renderer);
}
- virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer)
+ virtual void MitkRenderVolumetricGeometry(BaseRenderer* renderer) override
{
m_ImgMapper->MitkRenderVolumetricGeometry(renderer);
m_OdfMapper->MitkRenderVolumetricGeometry(renderer);
}
- void SetDataNode(DataNode* node)
+ void SetDataNode(DataNode* node) override
{
m_DataNode = node;
m_ImgMapper->SetDataNode(node);
m_OdfMapper->SetDataNode(node);
}
mitk::ImageVtkMapper2D::Pointer GetImageMapper()
{
ImageVtkMapper2D* retval = m_ImgMapper;
return retval;
}
- bool HasVtkProp( const vtkProp* prop, BaseRenderer* renderer )
+ bool HasVtkProp( const vtkProp* prop, BaseRenderer* renderer ) override
{
return m_OdfMapper->HasVtkProp(prop, renderer);
}
- void ReleaseGraphicsResources(mitk::BaseRenderer* renderer)
+ void ReleaseGraphicsResources(mitk::BaseRenderer* renderer) override
{
m_ImgMapper->ReleaseGraphicsResources(renderer);
m_OdfMapper->ReleaseGraphicsResources(renderer);
}
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false )
{
mitk::OdfVtkMapper2D<float,QBALL_ODFSIZE>::SetDefaultProperties(node, renderer, overwrite);
mitk::CopyImageMapper2D::SetDefaultProperties(node, renderer, overwrite);
mitk::LevelWindow opaclevwin;
opaclevwin.SetRangeMinMax(0,255);
opaclevwin.SetWindowBounds(0,0);
mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(opaclevwin);
node->AddProperty( "opaclevelwindow", prop );
}
- bool IsLODEnabled( BaseRenderer * renderer ) const
+ bool IsLODEnabled( BaseRenderer * renderer ) const override
{
return m_ImgMapper->IsLODEnabled(renderer) || m_OdfMapper->IsLODEnabled(renderer);
}
- vtkProp* GetVtkProp(mitk::BaseRenderer* renderer)
+ vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override
{
vtkPropAssembly* assembly = vtkPropAssembly::New();
assembly->AddPart( m_OdfMapper->GetVtkProp(renderer));
assembly->AddPart( m_ImgMapper->GetVtkProp(renderer));
return assembly;
}
protected:
- virtual void Update(mitk::BaseRenderer* renderer)
+ virtual void Update(mitk::BaseRenderer* renderer) override
{
m_OdfMapper->Update(renderer);
GenerateDataForRenderer(renderer);
}
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer)
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override
{
m_ImgMapper->GenerateDataForRenderer(renderer);
// if( mitk::RenderingManager::GetInstance()->GetNextLOD( renderer ) > 0 )
// {
// m_OdfMapper->GenerateDataForRenderer(renderer);
// }
}
CompositeMapper();
virtual ~CompositeMapper();
private:
mitk::OdfVtkMapper2D<float,QBALL_ODFSIZE>::Pointer m_OdfMapper;
mitk::CopyImageMapper2D::Pointer m_ImgMapper;
};
} // namespace mitk
#endif /* COMPOSITEMAPPER_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkReader.h
index f8e550746c..36c50c942c 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkReader.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkConnectomicsNetworkReader_h
#define __mitkConnectomicsNetworkReader_h
#include "mitkCommon.h"
#include <mitkAbstractFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
#include "mitkConnectomicsNetwork.h"
namespace mitk
{
/** \brief The reader for connectomics network files (.cnf)
*/
class ConnectomicsNetworkReader : public mitk::AbstractFileReader
{
public:
typedef mitk::ConnectomicsNetwork OutputType;
ConnectomicsNetworkReader(const ConnectomicsNetworkReader& other);
ConnectomicsNetworkReader();
virtual ~ConnectomicsNetworkReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
- ConnectomicsNetworkReader* Clone() const;
+ ConnectomicsNetworkReader* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkConnectomicsNetworkReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkSerializer.h b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkSerializer.h
index 08391345f2..40e3bb6813 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkSerializer.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkConnectomicsNetworkSerializer_h_included
#define mitkConnectomicsNetworkSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::ConnectomicsNetwork for mitk::SceneIO
*/
class ConnectomicsNetworkSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( ConnectomicsNetworkSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
ConnectomicsNetworkSerializer();
virtual ~ConnectomicsNetworkSerializer();
};
} // namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkWriter.h
index 74cbf74258..14280d8b2a 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsNetworkWriter.h
@@ -1,57 +1,57 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkConnectomicsNetworkWriter_h
#define __mitkConnectomicsNetworkWriter_h
#include <mitkAbstractFileWriter.h>
#include "mitkConnectomicsNetwork.h"
#include <vtkPolyDataWriter.h>
namespace mitk
{
/**
* Writes connectomics networks to a file
* @ingroup Process
*/
class ConnectomicsNetworkWriter : public mitk::AbstractFileWriter
{
public:
typedef mitk::ConnectomicsNetwork InputType;
typedef std::vector< std::pair< std::pair<
mitk::ConnectomicsNetwork::NetworkNode, mitk::ConnectomicsNetwork::NetworkNode >
, mitk::ConnectomicsNetwork::NetworkEdge > > EdgeVectorType;
typedef std::vector< mitk::ConnectomicsNetwork::NetworkNode > VertexVectorType;
ConnectomicsNetworkWriter();
virtual ~ConnectomicsNetworkWriter();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
protected:
ConnectomicsNetworkWriter(const ConnectomicsNetworkWriter& other);
- virtual mitk::ConnectomicsNetworkWriter* Clone() const;
+ virtual mitk::ConnectomicsNetworkWriter* Clone() const override;
};
} // end of namespace mitk
#endif //__mitkConnectomicsNetworkWriter_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsObjectFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsObjectFactory.h
index 1cdd8a18c3..bc525f7dc6 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsObjectFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkConnectomicsObjectFactory.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCONNECTOMICSOBJECTFACTORY_H
#define MITKCONNECTOMICSOBJECTFACTORY_H
#include "mitkCoreObjectFactory.h"
namespace mitk {
class ConnectomicsObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(ConnectomicsObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
~ConnectomicsObjectFactory();
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
- virtual void SetDefaultProperties(mitk::DataNode* node);
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
- virtual const char* GetFileExtensions();
+ virtual const char* GetFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
- virtual const char* GetSaveFileExtensions();
+ virtual const char* GetSaveFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
protected:
ConnectomicsObjectFactory();
private:
void CreateFileExtensionsMap();
std::string m_ExternalFileExtensions;
std::string m_InternalFileExtensions;
std::string m_SaveFileExtensions;
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
itk::ObjectFactoryBase::Pointer m_ConnectomicsNetworkIOFactory;
itk::ObjectFactoryBase::Pointer m_ConnectomicsNetworkWriterFactory;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionCoreObjectFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionCoreObjectFactory.h
index 4b75db9b9f..e6b7d2471b 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionCoreObjectFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionCoreObjectFactory.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef DiffusionCoreObjectFactory_H_INCLUDED
#define DiffusionCoreObjectFactory_H_INCLUDED
#include "mitkCoreObjectFactory.h"
namespace mitk {
class DiffusionCoreObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(DiffusionCoreObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
~DiffusionCoreObjectFactory();
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
- virtual void SetDefaultProperties(mitk::DataNode* node);
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
- virtual const char* GetFileExtensions();
+ virtual const char* GetFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
- virtual const char* GetSaveFileExtensions();
+ virtual const char* GetSaveFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
protected:
DiffusionCoreObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
private:
std::string m_ExternalFileExtensions;
std::string m_InternalFileExtensions;
std::string m_SaveFileExtensions;
itk::ObjectFactoryBase::Pointer m_NrrdDiffusionImageIOFactory;
itk::ObjectFactoryBase::Pointer m_NrrdQBallImageIOFactory;
itk::ObjectFactoryBase::Pointer m_NrrdDiffusionImageWriterFactory;
itk::ObjectFactoryBase::Pointer m_NrrdQBallImageWriterFactory;
};
}
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionIOMimeTypes.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionIOMimeTypes.h
index 123e18a961..04dbfc1e1d 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionIOMimeTypes.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionIOMimeTypes.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKDIFFUSIONIOMIMETYPES_H
#define MITKDIFFUSIONIOMIMETYPES_H
#include "mitkCustomMimeType.h"
#include <MitkDiffusionIOExports.h>
#include <string>
namespace mitk {
class DiffusionIOMimeTypes
{
public:
class MITKDIFFUSIONIO_EXPORT DiffusionImageNrrdMimeType : public CustomMimeType
{
public:
DiffusionImageNrrdMimeType();
- virtual bool AppliesTo(const std::string &path) const;
- virtual DiffusionImageNrrdMimeType* Clone() const;
+ virtual bool AppliesTo(const std::string &path) const override;
+ virtual DiffusionImageNrrdMimeType* Clone() const override;
};
class MITKDIFFUSIONIO_EXPORT DiffusionImageNiftiMimeType : public CustomMimeType
{
public:
DiffusionImageNiftiMimeType();
- virtual bool AppliesTo(const std::string &path) const;
- virtual DiffusionImageNiftiMimeType* Clone() const;
+ virtual bool AppliesTo(const std::string &path) const override;
+ virtual DiffusionImageNiftiMimeType* Clone() const override;
};
// Get all Diffusion Mime Types
static std::vector<CustomMimeType*> Get();
// ------------------------------ VTK formats ----------------------------------
static CustomMimeType FIBERBUNDLE_VTK_MIMETYPE();
static std::string FIBERBUNDLE_VTK_MIMETYPE_NAME();
static std::string FIBERBUNDLE_MIMETYPE_DESCRIPTION();
// ------------------------------ TrackVis formats ----------------------------------
static CustomMimeType FIBERBUNDLE_TRK_MIMETYPE();
static std::string FIBERBUNDLE_TRK_MIMETYPE_NAME();
// ------------------------- Image formats (ITK based) --------------------------
static DiffusionImageNrrdMimeType DWI_NRRD_MIMETYPE();
static DiffusionImageNiftiMimeType DWI_NIFTI_MIMETYPE();
static CustomMimeType DTI_MIMETYPE(); // dti, hdti
static CustomMimeType QBI_MIMETYPE(); // qbi, hqbi
static std::string DWI_NRRD_MIMETYPE_NAME();
static std::string DWI_NIFTI_MIMETYPE_NAME();
static std::string DTI_MIMETYPE_NAME();
static std::string QBI_MIMETYPE_NAME();
static std::string DWI_NRRD_MIMETYPE_DESCRIPTION();
static std::string DWI_NIFTI_MIMETYPE_DESCRIPTION();
static std::string DTI_MIMETYPE_DESCRIPTION();
static std::string QBI_MIMETYPE_DESCRIPTION();
// ------------------------------ MITK formats ----------------------------------
static CustomMimeType CONNECTOMICS_MIMETYPE(); // cnf
static std::string CONNECTOMICS_MIMETYPE_NAME();
static std::string CONNECTOMICS_MIMETYPE_DESCRIPTION();
static CustomMimeType PLANARFIGURECOMPOSITE_MIMETYPE();
static std::string PLANARFIGURECOMPOSITE_MIMETYPE_NAME();
static std::string PLANARFIGURECOMPOSITE_MIMETYPE_DESCRIPTION();
private:
// purposely not implemented
DiffusionIOMimeTypes();
DiffusionIOMimeTypes(const DiffusionIOMimeTypes&);
};
}
#endif // MITKDIFFUSIONIOMIMETYPES_H
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiReaderService.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiReaderService.h
index 864dc67ee2..7b2a780dcc 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiReaderService.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiReaderService.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkDiffusionImageNiftiReaderService_h
#define __mitkDiffusionImageNiftiReaderService_h
#include "mitkCommon.h"
// MITK includes
#include "mitkImageSource.h"
#include "mitkFileReader.h"
#include <mitkDiffusionPropertyHelper.h>
// ITK includes
#include "itkVectorImage.h"
#include "mitkAbstractFileReader.h"
namespace mitk
{
/** \brief
*/
class DiffusionImageNiftiReaderService : public mitk::AbstractFileReader
{
public:
DiffusionImageNiftiReaderService(const DiffusionImageNiftiReaderService & other);
DiffusionImageNiftiReaderService();
virtual ~DiffusionImageNiftiReaderService();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
typedef short DiffusionPixelType;
typedef mitk::Image OutputType;
typedef mitk::DiffusionPropertyHelper::ImageType VectorImageType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionType GradientDirectionType;
typedef mitk::DiffusionPropertyHelper::MeasurementFrameType MeasurementFrameType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionsContainerType GradientDirectionContainerType;
protected:
OutputType::Pointer m_OutputCache;
itk::TimeStamp m_CacheTime;
void InternalRead();
private:
- DiffusionImageNiftiReaderService* Clone() const;
+ DiffusionImageNiftiReaderService* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkDiffusionImageNiftiReaderService_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiWriterService.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiWriterService.h
index a57e4f3854..cb339bb86e 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiWriterService.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNiftiWriterService.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DiffusionImageNiftiWriterService__H_
#define _MITK_DiffusionImageNiftiWriterService__H_
#include <mitkAbstractFileWriter.h>
#include <mitkDiffusionPropertyHelper.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class DiffusionImageNiftiWriterService : public mitk::AbstractFileWriter
{
public:
DiffusionImageNiftiWriterService();
virtual ~DiffusionImageNiftiWriterService();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
typedef mitk::DiffusionPropertyHelper::ImageType VectorImageType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionType GradientDirectionType;
typedef mitk::DiffusionPropertyHelper::MeasurementFrameType MeasurementFrameType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionsContainerType GradientDirectionContainerType;
protected:
DiffusionImageNiftiWriterService(const DiffusionImageNiftiWriterService& other);
- virtual mitk::DiffusionImageNiftiWriterService* Clone() const;
+ virtual mitk::DiffusionImageNiftiWriterService* Clone() const override;
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdReaderService.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdReaderService.h
index 357b1b038a..684c522cbf 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdReaderService.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdReaderService.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkDiffusionImageNrrdReaderService_h
#define __mitkDiffusionImageNrrdReaderService_h
#include "mitkCommon.h"
// MITK includes
#include "mitkImageSource.h"
#include "mitkFileReader.h"
#include <mitkDiffusionPropertyHelper.h>
// ITK includes
#include "itkVectorImage.h"
#include "mitkAbstractFileReader.h"
namespace mitk
{
/** \brief
*/
class DiffusionImageNrrdReaderService : public mitk::AbstractFileReader
{
public:
DiffusionImageNrrdReaderService(const DiffusionImageNrrdReaderService & other);
DiffusionImageNrrdReaderService();
virtual ~DiffusionImageNrrdReaderService();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
typedef short DiffusionPixelType;
typedef mitk::Image OutputType;
typedef mitk::DiffusionPropertyHelper::ImageType VectorImageType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionType GradientDirectionType;
typedef mitk::DiffusionPropertyHelper::MeasurementFrameType MeasurementFrameType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionsContainerType GradientDirectionContainerType;
protected:
OutputType::Pointer m_OutputCache;
itk::TimeStamp m_CacheTime;
void InternalRead();
private:
- DiffusionImageNrrdReaderService* Clone() const;
+ DiffusionImageNrrdReaderService* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkDiffusionImageNrrdReaderService_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdWriterService.h b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdWriterService.h
index 9b436c66b5..cedb49ea42 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdWriterService.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionImageNrrdWriterService.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_DiffusionImageNrrdWriterService__H_
#define _MITK_DiffusionImageNrrdWriterService__H_
#include <mitkAbstractFileWriter.h>
#include <mitkDiffusionPropertyHelper.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class DiffusionImageNrrdWriterService : public mitk::AbstractFileWriter
{
public:
DiffusionImageNrrdWriterService();
virtual ~DiffusionImageNrrdWriterService();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
typedef mitk::DiffusionPropertyHelper::ImageType VectorImageType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionType GradientDirectionType;
typedef mitk::DiffusionPropertyHelper::MeasurementFrameType MeasurementFrameType;
typedef mitk::DiffusionPropertyHelper::GradientDirectionsContainerType GradientDirectionContainerType;
protected:
DiffusionImageNrrdWriterService(const DiffusionImageNrrdWriterService& other);
- virtual mitk::DiffusionImageNrrdWriterService* Clone() const;
+ virtual mitk::DiffusionImageNrrdWriterService* Clone() const override;
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionModuleActivator.cpp b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionModuleActivator.cpp
index b1c0313f82..13d1c254a7 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionModuleActivator.cpp
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkDiffusionModuleActivator.cpp
@@ -1,130 +1,130 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <mitkDiffusionImageNrrdReaderService.h>
#include <mitkDiffusionImageNiftiReaderService.h>
#include <mitkNrrdTensorImageReader.h>
#include <mitkNrrdQBallImageReader.h>
#include <mitkFiberBundleVtkReader.h>
#include <mitkFiberBundleTrackVisReader.h>
#include <mitkConnectomicsNetworkReader.h>
#include <mitkPlanarFigureCompositeReader.h>
#include <mitkDiffusionImageNrrdWriterService.h>
#include <mitkDiffusionImageNiftiWriterService.h>
#include <mitkNrrdTensorImageWriter.h>
#include <mitkNrrdQBallImageWriter.h>
#include <mitkFiberBundleVtkWriter.h>
#include <mitkFiberBundleTrackVisWriter.h>
#include <mitkConnectomicsNetworkWriter.h>
#include <mitkPlanarFigureCompositeWriter.h>
#include "mitkDiffusionIOMimeTypes.h"
namespace mitk
{
/**
\brief Registers services for segmentation module.
*/
class DiffusionModuleActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext* context)
+ void Load(us::ModuleContext* context) override
{
us::ServiceProperties props;
props[ us::ServiceConstants::SERVICE_RANKING() ] = 10;
m_MimeTypes = mitk::DiffusionIOMimeTypes::Get();
for (std::vector<mitk::CustomMimeType*>::const_iterator mimeTypeIter = m_MimeTypes.begin(),
iterEnd = m_MimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter)
{
context->RegisterService(*mimeTypeIter, props);
}
m_DiffusionImageNrrdReaderService = new DiffusionImageNrrdReaderService();
m_DiffusionImageNiftiReaderService = new DiffusionImageNiftiReaderService();
m_NrrdTensorImageReader = new NrrdTensorImageReader();
m_NrrdQBallImageReader = new NrrdQBallImageReader();
m_FiberBundleVtkReader = new FiberBundleVtkReader();
m_FiberBundleTrackVisReader = new FiberBundleTrackVisReader();
m_ConnectomicsNetworkReader = new ConnectomicsNetworkReader();
m_PlanarFigureCompositeReader = new PlanarFigureCompositeReader();
m_DiffusionImageNrrdWriterService = new DiffusionImageNrrdWriterService();
m_DiffusionImageNiftiWriterService = new DiffusionImageNiftiWriterService();
m_NrrdTensorImageWriter = new NrrdTensorImageWriter();
m_NrrdQBallImageWriter = new NrrdQBallImageWriter();
m_FiberBundleVtkWriter = new FiberBundleVtkWriter();
m_FiberBundleTrackVisWriter = new FiberBundleTrackVisWriter();
m_ConnectomicsNetworkWriter = new ConnectomicsNetworkWriter();
m_PlanarFigureCompositeWriter = new PlanarFigureCompositeWriter();
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
for (unsigned int loop(0); loop < m_MimeTypes.size(); ++loop)
{
delete m_MimeTypes.at(loop);
}
delete m_DiffusionImageNrrdReaderService;
delete m_DiffusionImageNiftiReaderService;
delete m_NrrdTensorImageReader;
delete m_NrrdQBallImageReader;
delete m_FiberBundleVtkReader;
delete m_FiberBundleTrackVisReader;
delete m_ConnectomicsNetworkReader;
delete m_PlanarFigureCompositeReader;
delete m_DiffusionImageNrrdWriterService;
delete m_DiffusionImageNiftiWriterService;
delete m_NrrdTensorImageWriter;
delete m_NrrdQBallImageWriter;
delete m_FiberBundleVtkWriter;
delete m_FiberBundleTrackVisWriter;
delete m_ConnectomicsNetworkWriter;
delete m_PlanarFigureCompositeWriter;
}
private:
DiffusionImageNrrdReaderService * m_DiffusionImageNrrdReaderService;
DiffusionImageNiftiReaderService * m_DiffusionImageNiftiReaderService;
NrrdTensorImageReader * m_NrrdTensorImageReader;
NrrdQBallImageReader * m_NrrdQBallImageReader;
FiberBundleVtkReader * m_FiberBundleVtkReader;
FiberBundleTrackVisReader * m_FiberBundleTrackVisReader;
ConnectomicsNetworkReader * m_ConnectomicsNetworkReader;
PlanarFigureCompositeReader* m_PlanarFigureCompositeReader;
DiffusionImageNrrdWriterService * m_DiffusionImageNrrdWriterService;
DiffusionImageNiftiWriterService * m_DiffusionImageNiftiWriterService;
NrrdTensorImageWriter * m_NrrdTensorImageWriter;
NrrdQBallImageWriter * m_NrrdQBallImageWriter;
FiberBundleVtkWriter * m_FiberBundleVtkWriter;
FiberBundleTrackVisWriter * m_FiberBundleTrackVisWriter;
ConnectomicsNetworkWriter * m_ConnectomicsNetworkWriter;
PlanarFigureCompositeWriter* m_PlanarFigureCompositeWriter;
std::vector<mitk::CustomMimeType*> m_MimeTypes;
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::DiffusionModuleActivator)
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper2D.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper2D.h
index ba1089e97f..08f8210889 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper2D.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper2D.h
@@ -1,109 +1,109 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef FiberBundleMAPPER2D_H_HEADER_INCLUDED
#define FiberBundleMAPPER2D_H_HEADER_INCLUDED
//MITK Rendering
#include <mitkCommon.h>
#include <mitkBaseRenderer.h>
//#include <MitkFiberTrackingExports.h>
#include <mitkVtkMapper.h>
#include <mitkFiberBundle.h>
#include <vtkSmartPointer.h>
class vtkActor;
//class vtkPropAssembly; //lets see if we need it
class mitkBaseRenderer;
class vtkPolyDataMapper;
class vtkCutter;
class vtkPlane;
class vtkPolyData;
namespace mitk {
struct IShaderRepository;
class FiberBundleMapper2D : public VtkMapper
{
public:
mitkClassMacro(FiberBundleMapper2D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitk::FiberBundle* GetInput();
/** \brief Checks whether this mapper needs to update itself and generate data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
//### methods of MITK-VTK rendering pipeline
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
//### end of methods of MITK-VTK rendering pipeline
class FBXLocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Point Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_PointActor;
/** \brief Point Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_FiberMapper;
vtkSmartPointer<vtkPlane> m_SlicingPlane; //needed later when optimized 2D mapper
vtkSmartPointer<vtkPolyData> m_SlicedResult; //might be depricated in optimized 2D mapper
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Constructor of the local storage. Do as much actions as possible in here to avoid double executions. */
FBXLocalStorage(); //if u copy&paste from this 2Dmapper, be aware that the implementation of this constructor is in the cpp file
~FBXLocalStorage()
{
}
};
/** \brief This member holds all three LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<FBXLocalStorage> m_LocalStorageHandler;
protected:
FiberBundleMapper2D();
virtual ~FiberBundleMapper2D();
/** Does the actual resampling, without rendering. */
- virtual void GenerateDataForRenderer(mitk::BaseRenderer*);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer*) override;
void UpdateShaderParameter(mitk::BaseRenderer*);
private:
vtkSmartPointer<vtkLookupTable> m_lut;
int m_LineWidth;
};
}//end namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h
index c7b6b5d0d0..0b69e3265c 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleMapper3D.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef FiberBundleMapper3D_H_HEADER_INCLUDED
#define FiberBundleMapper3D_H_HEADER_INCLUDED
//#include <mitkBaseData.h> //?? necessary
#include <mitkVtkMapper.h>
#include <mitkFiberBundle.h>
#include <vtkSmartPointer.h>
class vtkPropAssembly;
class vtkPolyDataMapper;
class vtkLookupTable;
class vtkOpenGLActor;
namespace mitk {
//##Documentation
//## @brief Mapper for FiberBundle
//## @ingroup Mapper
class FiberBundleMapper3D : public VtkMapper
{
public:
mitkClassMacro(FiberBundleMapper3D, VtkMapper)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//========== essential implementation for 3D mapper ========
const FiberBundle* GetInput();
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer); //looks like depricated.. should be replaced bz GetViewProp()
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override; //looks like depricated.. should be replaced bz GetViewProp()
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
static void SetVtkMapperImmediateModeRendering(vtkMapper *mapper);
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
//=========================================================
class FBXLocalStorage3D : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Point Actor of a 3D render window. */
vtkSmartPointer<vtkActor> m_FiberActor;
/** \brief Point Mapper of a 3D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_FiberMapper;
vtkSmartPointer<vtkPropAssembly> m_FiberAssembly;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Constructor of the local storage. Do as much actions as possible in here to avoid double executions. */
FBXLocalStorage3D(); //if u copy&paste from this 2Dmapper, be aware that the implementation of this constructor is in the cpp file
~FBXLocalStorage3D()
{
}
};
/** \brief This member holds all three LocalStorages for the 3D render window(s). */
mitk::LocalStorageHandler<FBXLocalStorage3D> m_LocalStorageHandler;
protected:
FiberBundleMapper3D();
virtual ~FiberBundleMapper3D();
void InternalGenerateData(mitk::BaseRenderer *renderer);
void UpdateVtkObjects(); //??
private:
vtkSmartPointer<vtkLookupTable> m_lut;
float m_TubeRadius;
int m_TubeSides;
int m_LineWidth;
float m_RibbonWidth;
bool m_Lighting;
};
} // end namespace mitk
#endif /* FiberBundleMapper3D_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleSerializer.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleSerializer.h
index df9640df27..1df2531466 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleSerializer.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFiberBundleSerializer_h_included
#define mitkFiberBundleSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class FiberBundleSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( FiberBundleSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
FiberBundleSerializer();
virtual ~FiberBundleSerializer();
};
} // namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisReader.h
index 035e96f44e..5906552be4 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisReader.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkFiberBundleTrackVisReader_h
#define __mitkFiberBundleTrackVisReader_h
#include <mitkCommon.h>
#include <mitkFileReader.h>
#include <mitkFiberBundle.h>
#include <vtkSmartPointer.h>
#include <mitkAbstractFileReader.h>
namespace mitk
{
/** \brief
*/
class FiberBundleTrackVisReader : public AbstractFileReader
{
public:
FiberBundleTrackVisReader();
virtual ~FiberBundleTrackVisReader(){}
FiberBundleTrackVisReader(const FiberBundleTrackVisReader& other);
- virtual FiberBundleTrackVisReader * Clone() const;
+ virtual FiberBundleTrackVisReader * Clone() const override;
using mitk::AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkFiberBundleReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisWriter.h
index 576a1b86b0..344873ddef 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleTrackVisWriter.h
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkFiberBundleTrackVisWriter_h
#define __mitkFiberBundleTrackVisWriter_h
#include <mitkAbstractFileWriter.h>
#include "mitkFiberBundle.h"
#include <vtkPolyDataWriter.h>
namespace mitk
{
/**
* Writes fiber bundles to a file
* @ingroup Process
*/
class FiberBundleTrackVisWriter : public mitk::AbstractFileWriter
{
public:
FiberBundleTrackVisWriter();
FiberBundleTrackVisWriter(const FiberBundleTrackVisWriter & other);
- virtual FiberBundleTrackVisWriter * Clone() const;
+ virtual FiberBundleTrackVisWriter * Clone() const override;
virtual ~FiberBundleTrackVisWriter();
using mitk::AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
static const char* XML_GEOMETRY;
static const char* XML_MATRIX_XX;
static const char* XML_MATRIX_XY;
static const char* XML_MATRIX_XZ;
static const char* XML_MATRIX_YX;
static const char* XML_MATRIX_YY;
static const char* XML_MATRIX_YZ;
static const char* XML_MATRIX_ZX;
static const char* XML_MATRIX_ZY;
static const char* XML_MATRIX_ZZ;
static const char* XML_ORIGIN_X;
static const char* XML_ORIGIN_Y;
static const char* XML_ORIGIN_Z;
static const char* XML_SPACING_X;
static const char* XML_SPACING_Y;
static const char* XML_SPACING_Z;
static const char* XML_SIZE_X;
static const char* XML_SIZE_Y;
static const char* XML_SIZE_Z;
static const char* XML_FIBER_BUNDLE;
static const char* XML_FIBER;
static const char* XML_PARTICLE;
static const char* XML_ID;
static const char* XML_POS_X;
static const char* XML_POS_Y;
static const char* XML_POS_Z;
static const char* VERSION_STRING;
static const char* XML_FIBER_BUNDLE_FILE;
static const char* XML_FILE_VERSION;
static const char* XML_NUM_FIBERS;
static const char* XML_NUM_PARTICLES;
static const char* ASCII_FILE;
static const char* FILE_NAME;
};
} // end of namespace mitk
#endif //__mitkFiberBundleWriter_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkReader.h
index 3f5ec08a60..5157aeda28 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkReader.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkFiberBundleVtkReader_h
#define __mitkFiberBundleVtkReader_h
#include <mitkCommon.h>
#include <mitkFileReader.h>
#include <mitkFiberBundle.h>
#include <vtkSmartPointer.h>
#include <mitkAbstractFileReader.h>
namespace mitk
{
/** \brief
*/
class FiberBundleVtkReader : public AbstractFileReader
{
public:
FiberBundleVtkReader();
virtual ~FiberBundleVtkReader(){}
FiberBundleVtkReader(const FiberBundleVtkReader& other);
- virtual FiberBundleVtkReader * Clone() const;
+ virtual FiberBundleVtkReader * Clone() const override;
using mitk::AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkFiberBundleReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkWriter.h
index bd44ba9d36..38a506a702 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberBundleVtkWriter.h
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkFiberBundleVtkWriter_h
#define __mitkFiberBundleVtkWriter_h
#include <mitkAbstractFileWriter.h>
#include "mitkFiberBundle.h"
#include <vtkPolyDataWriter.h>
namespace mitk
{
/**
* Writes fiber bundles to a file
* @ingroup Process
*/
class FiberBundleVtkWriter : public mitk::AbstractFileWriter
{
public:
FiberBundleVtkWriter();
FiberBundleVtkWriter(const FiberBundleVtkWriter & other);
- virtual FiberBundleVtkWriter * Clone() const;
+ virtual FiberBundleVtkWriter * Clone() const override;
virtual ~FiberBundleVtkWriter();
using mitk::AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
static const char* XML_GEOMETRY;
static const char* XML_MATRIX_XX;
static const char* XML_MATRIX_XY;
static const char* XML_MATRIX_XZ;
static const char* XML_MATRIX_YX;
static const char* XML_MATRIX_YY;
static const char* XML_MATRIX_YZ;
static const char* XML_MATRIX_ZX;
static const char* XML_MATRIX_ZY;
static const char* XML_MATRIX_ZZ;
static const char* XML_ORIGIN_X;
static const char* XML_ORIGIN_Y;
static const char* XML_ORIGIN_Z;
static const char* XML_SPACING_X;
static const char* XML_SPACING_Y;
static const char* XML_SPACING_Z;
static const char* XML_SIZE_X;
static const char* XML_SIZE_Y;
static const char* XML_SIZE_Z;
static const char* XML_FIBER_BUNDLE;
static const char* XML_FIBER;
static const char* XML_PARTICLE;
static const char* XML_ID;
static const char* XML_POS_X;
static const char* XML_POS_Y;
static const char* XML_POS_Z;
static const char* VERSION_STRING;
static const char* XML_FIBER_BUNDLE_FILE;
static const char* XML_FILE_VERSION;
static const char* XML_NUM_FIBERS;
static const char* XML_NUM_PARTICLES;
static const char* ASCII_FILE;
static const char* FILE_NAME;
};
} // end of namespace mitk
#endif //__mitkFiberBundleWriter_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkFiberTrackingObjectFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkFiberTrackingObjectFactory.h
index 0c0806e8c2..3fb7527295 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkFiberTrackingObjectFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkFiberTrackingObjectFactory.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKFIBERTRACKINGOBJECTFACTORY_H
#define MITKFIBERTRACKINGOBJECTFACTORY_H
#include "mitkCoreObjectFactory.h"
//modernized fiberbundle datastrucutre
#include "mitkFiberBundle.h"
#include "mitkFiberBundleMapper3D.h"
#include "mitkFiberBundleMapper2D.h"
//#include "mitkFiberBundleThreadMonitorMapper3D.h"
//#include "mitkFiberBundleThreadMonitor.h"
namespace mitk {
class FiberTrackingObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(FiberTrackingObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
~FiberTrackingObjectFactory();
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
- virtual void SetDefaultProperties(mitk::DataNode* node);
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
- virtual const char* GetFileExtensions();
+ virtual const char* GetFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
- virtual const char* GetSaveFileExtensions();
+ virtual const char* GetSaveFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
void RegisterIOFactories();
protected:
FiberTrackingObjectFactory();
private:
void CreateFileExtensionsMap();
std::string m_ExternalFileExtensions;
std::string m_InternalFileExtensions;
std::string m_SaveFileExtensions;
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
};
}
#endif // MITKFIBERTRACKINGOBJECTFACTORY_H
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageReader.h
index 3d61f01a50..fab36004e4 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageReader.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkNrrdQBallImageReader_h
#define __mitkNrrdQBallImageReader_h
#include "mitkCommon.h"
#include "itkVectorContainer.h"
#include "vnl/vnl_vector_fixed.h"
#include "mitkQBallImage.h"
#include "itkVectorImage.h"
#include <mitkAbstractFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
namespace mitk
{
/** \brief
*/
class NrrdQBallImageReader : public mitk::AbstractFileReader
{
public:
typedef mitk::QBallImage OutputType;
NrrdQBallImageReader(const NrrdQBallImageReader& other);
NrrdQBallImageReader();
virtual ~NrrdQBallImageReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
protected:
private:
private:
- NrrdQBallImageReader* Clone() const;
+ NrrdQBallImageReader* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkNrrdQBallImageReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageWriter.h
index fafaeb7a22..02438f1553 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdQBallImageWriter.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_NRRDQBI_WRITER__H_
#define _MITK_NRRDQBI_WRITER__H_
#include <mitkAbstractFileWriter.h>
#include <mitkQBallImage.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class NrrdQBallImageWriter : public mitk::AbstractFileWriter
{
public:
typedef mitk::QBallImage InputType;
NrrdQBallImageWriter();
virtual ~NrrdQBallImageWriter();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
protected:
NrrdQBallImageWriter(const NrrdQBallImageWriter& other);
- virtual mitk::NrrdQBallImageWriter* Clone() const;
+ virtual mitk::NrrdQBallImageWriter* Clone() const override;
};
} // end of namespace mitk
#endif //_MITK_NRRDQBI_WRITER__H_
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageIOFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageIOFactory.h
index d9ddf1b84d..f64b4f65f4 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageIOFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageIOFactory.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __MITK_NRRD_TBSS_VOULMES_IO_FACTORY_H_HEADER__
#define __MITK_NRRD_TBSS_VOULMES_IO_FACTORY_H_HEADER__
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of NrrdDiffusionImageReader objects using an object factory.
//##
class NrrdTbssImageIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef NrrdTbssImageIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static NrrdTbssImageIOFactory* FactoryNew() { return new NrrdTbssImageIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(NrrdTbssImageIOFactory, ObjectFactoryBase);
protected:
NrrdTbssImageIOFactory();
~NrrdTbssImageIOFactory();
private:
NrrdTbssImageIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif // __MITK_NRRD_TBSS_VOULMES_IO_FACTORY_H_HEADER__
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageWriterFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageWriterFactory.h
index be943f6bac..95c799d181 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageWriterFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssImageWriterFactory.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NRRDTBSSIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
#define NRRDTBSSIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
class NrrdTbssImageWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::NrrdTbssImageWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::NrrdTbssImageWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
protected:
NrrdTbssImageWriterFactory();
~NrrdTbssImageWriterFactory();
private:
NrrdTbssImageWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif // NRRDTBSSIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageIOFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageIOFactory.h
index 6845768d8c..9f4b91d697 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageIOFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageIOFactory.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __MITK_NRRD_TBSSROI_VOLUMES_IO_FACTORY_H_HEADER__
#define __MITK_NRRD_TBSSROI_VOLUMES_IO_FACTORY_H_HEADER__
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of NrrdDiffusionImageReader objects using an object factory.
//##
class NrrdTbssRoiImageIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef NrrdTbssRoiImageIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static NrrdTbssRoiImageIOFactory* FactoryNew() { return new NrrdTbssRoiImageIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(NrrdTbssRoiImageIOFactory, ObjectFactoryBase);
protected:
NrrdTbssRoiImageIOFactory();
~NrrdTbssRoiImageIOFactory();
private:
NrrdTbssRoiImageIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif // __MITK_NRRD_TBSS_VOULMES_IO_FACTORY_H_HEADER__
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageWriterFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageWriterFactory.h
index d7a00ac167..2781ee4ff9 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageWriterFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTbssRoiImageWriterFactory.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NRRDTBSSROIIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
#define NRRDTBSSROIIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
class NrrdTbssRoiImageWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::NrrdTbssRoiImageWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::NrrdTbssRoiImageWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self)
protected:
NrrdTbssRoiImageWriterFactory();
~NrrdTbssRoiImageWriterFactory();
private:
NrrdTbssRoiImageWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif // NRRDTBSSIMAGE_WRITERFACTORY_H_HEADER_INCLUDED
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageReader.h
index 22b57938ef..4f8d929f75 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageReader.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkNrrdTensorImageReader_h
#define __mitkNrrdTensorImageReader_h
#include "mitkCommon.h"
#include "itkVectorContainer.h"
#include "vnl/vnl_vector_fixed.h"
#include "mitkTensorImage.h"
#include "itkVectorImage.h"
#include "itkDiffusionTensor3D.h"
#include <mitkAbstractFileReader.h>
#include <mitkBaseData.h>
#include <mitkMimeType.h>
namespace mitk
{
/** \brief
*/
class NrrdTensorImageReader : public mitk::AbstractFileReader
{
public:
typedef mitk::TensorImage OutputType;
typedef itk::Matrix< float, 3, 3 > MeasurementFrameType;
NrrdTensorImageReader(const NrrdTensorImageReader& other);
NrrdTensorImageReader();
virtual ~NrrdTensorImageReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
protected:
private:
- NrrdTensorImageReader* Clone() const;
+ NrrdTensorImageReader* Clone() const override;
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
itk::DiffusionTensor3D<float> ConvertMatrixTypeToFixedArrayType(const itk::DiffusionTensor3D<float>::Superclass::MatrixType & matrix);
};
} //namespace MITK
#endif // __mitkNrrdTensorImageReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageWriter.h
index 12bf455042..4ae32415e8 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkNrrdTensorImageWriter.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_NRRDDTI_WRITER__H_
#define _MITK_NRRDDTI_WRITER__H_
#include <mitkAbstractFileWriter.h>
#include <mitkTensorImage.h>
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class NrrdTensorImageWriter : public mitk::AbstractFileWriter
{
public:
typedef mitk::TensorImage InputType;
NrrdTensorImageWriter();
virtual ~NrrdTensorImageWriter();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
- virtual ConfidenceLevel GetConfidenceLevel() const;
+ virtual ConfidenceLevel GetConfidenceLevel() const override;
protected:
NrrdTensorImageWriter(const NrrdTensorImageWriter& other);
- virtual mitk::NrrdTensorImageWriter* Clone() const;
+ virtual mitk::NrrdTensorImageWriter* Clone() const override;
};
} // end of namespace mitk
#endif //_MITK_NRRDDTI_WRITER__H_
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeReader.h b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeReader.h
index 3c629706bd..5bb50f4e8d 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeReader.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeReader.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkPlanarFigureCompositeReader_h
#define __mitkPlanarFigureCompositeReader_h
#include <mitkCommon.h>
#include <mitkFileReader.h>
#include <mitkFiberBundle.h>
#include <vtkSmartPointer.h>
#include <mitkAbstractFileReader.h>
namespace mitk
{
/** \brief
*/
class PlanarFigureCompositeReader : public AbstractFileReader
{
public:
PlanarFigureCompositeReader();
virtual ~PlanarFigureCompositeReader(){}
PlanarFigureCompositeReader(const PlanarFigureCompositeReader& other);
- virtual PlanarFigureCompositeReader * Clone() const;
+ virtual PlanarFigureCompositeReader * Clone() const override;
using mitk::AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
private:
us::ServiceRegistration<mitk::IFileReader> m_ServiceReg;
};
} //namespace MITK
#endif // __mitkFiberBundleReader_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeSerializer.h b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeSerializer.h
index dc89384c18..24184e2a5f 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeSerializer.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarFigureCompositeSerializer_h_included
#define mitkPlanarFigureCompositeSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class PlanarFigureCompositeSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( PlanarFigureCompositeSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
PlanarFigureCompositeSerializer();
virtual ~PlanarFigureCompositeSerializer();
};
} // namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeWriter.h b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeWriter.h
index 0be22c147e..d9a409f2ab 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeWriter.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkPlanarFigureCompositeWriter.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkPlanarFigureCompositeWriter_h
#define __mitkPlanarFigureCompositeWriter_h
#include <mitkAbstractFileWriter.h>
namespace mitk
{
/**
* Writes fiber bundles to a file
* @ingroup Process
*/
class PlanarFigureCompositeWriter : public mitk::AbstractFileWriter
{
public:
PlanarFigureCompositeWriter();
PlanarFigureCompositeWriter(const PlanarFigureCompositeWriter & other);
- virtual PlanarFigureCompositeWriter * Clone() const;
+ virtual PlanarFigureCompositeWriter * Clone() const override;
virtual ~PlanarFigureCompositeWriter();
using mitk::AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
};
} // end of namespace mitk
#endif //__mitkFiberBundleWriter_h
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkQBallImageSerializer.h b/Modules/DiffusionImaging/DiffusionIO/mitkQBallImageSerializer.h
index 8506987168..53db43f867 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkQBallImageSerializer.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkQBallImageSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkQBallImageSerializer_h_included
#define mitkQBallImageSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class QBallImageSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( QBallImageSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
QBallImageSerializer();
virtual ~QBallImageSerializer();
};
} // namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkQuantificationObjectFactory.h b/Modules/DiffusionImaging/DiffusionIO/mitkQuantificationObjectFactory.h
index 51d0655cb4..733546c674 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkQuantificationObjectFactory.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkQuantificationObjectFactory.h
@@ -1,49 +1,49 @@
#ifndef MITKQUANTIFICATIONOBJECTFACTORY_H
#define MITKQUANTIFICATIONOBJECTFACTORY_H
#include "mitkCoreObjectFactory.h"
namespace mitk {
class QuantificationObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(QuantificationObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
~QuantificationObjectFactory();
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
- virtual void SetDefaultProperties(mitk::DataNode* node);
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
- virtual const char* GetFileExtensions();
+ virtual const char* GetFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
- virtual const char* GetSaveFileExtensions();
+ virtual const char* GetSaveFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
protected:
QuantificationObjectFactory();
private:
void CreateFileExtensionsMap();
std::string m_ExternalFileExtensions;
std::string m_InternalFileExtensions;
std::string m_SaveFileExtensions;
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
itk::ObjectFactoryBase::Pointer m_NrrdTbssImageIOFactory;
itk::ObjectFactoryBase::Pointer m_NrrdTbssRoiImageIOFactory;
itk::ObjectFactoryBase::Pointer m_NrrdTbssImageWriterFactory;
itk::ObjectFactoryBase::Pointer m_NrrdTbssRoiImageWriterFactory;
};
}
#endif // MITKQUANTIFICATIONOBJECTFACTORY_H
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSerializer.h b/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSerializer.h
index 5defa045ad..24822474cc 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSerializer.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkTensorImageSerializer_h_included
#define mitkTensorImageSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class TensorImageSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( TensorImageSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
TensorImageSerializer();
virtual ~TensorImageSerializer();
};
} // namespace
#endif
diff --git a/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSource.h b/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSource.h
index 8f50b510b5..dba590e056 100644
--- a/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSource.h
+++ b/Modules/DiffusionImaging/DiffusionIO/mitkTensorImageSource.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TensorImageSource_H_HEADER_INCLUDED_C1E7D6EC
#define TensorImageSource_H_HEADER_INCLUDED_C1E7D6EC
#include "mitkImageSource.h"
#include "mitkTensorImage.h"
namespace mitk {
class TensorImageSource : public ImageSource
{
public:
typedef mitk::TensorImage OutputImageType;
typedef OutputImageType::Pointer OutputImagePointer;
typedef SlicedData::RegionType OutputImageRegionType;
typedef itk::DataObject::Pointer DataObjectPointer;
mitkClassMacro(TensorImageSource,ImageSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
TensorImageSource();
virtual ~TensorImageSource() {}
};
} // namespace mitk
#endif /* TensorImageSource_H_HEADER_INCLUDED_C1E7D6EC */
diff --git a/Modules/DiffusionImaging/FiberTracking/Algorithms/GibbsTracking/mitkGibbsEnergyComputer.h b/Modules/DiffusionImaging/FiberTracking/Algorithms/GibbsTracking/mitkGibbsEnergyComputer.h
index de37207a8c..37badc62ec 100644
--- a/Modules/DiffusionImaging/FiberTracking/Algorithms/GibbsTracking/mitkGibbsEnergyComputer.h
+++ b/Modules/DiffusionImaging/FiberTracking/Algorithms/GibbsTracking/mitkGibbsEnergyComputer.h
@@ -1,46 +1,46 @@
#ifndef GIBBSENERGYCOMPUTER_H
#define GIBBSENERGYCOMPUTER_H
#include <MitkFiberTrackingExports.h>
#include <itkOrientationDistributionFunction.h>
#include <mitkParticleGrid.h>
#include <mitkSphereInterpolator.h>
#include <itkMersenneTwisterRandomVariateGenerator.h>
#include "mitkEnergyComputer.h"
using namespace mitk;
/**
* \brief ODF lookuptable based energy computer. */
class MITKFIBERTRACKING_EXPORT GibbsEnergyComputer : public EnergyComputer
{
public:
typedef itk::Vector<float, QBALL_ODFSIZE> OdfVectorType;
typedef itk::Image<OdfVectorType, 3> ItkQBallImgType;
typedef itk::Image<float, 3> ItkFloatImageType;
typedef itk::Statistics::MersenneTwisterRandomVariateGenerator ItkRandGenType;
GibbsEnergyComputer(ItkQBallImgType* qballImage, ItkFloatImageType* mask, ParticleGrid* particleGrid, SphereInterpolator* interpolator, ItkRandGenType* randGen);
virtual ~GibbsEnergyComputer();
// external energy calculation
- float ComputeExternalEnergy(vnl_vector_fixed<float, 3>& R, vnl_vector_fixed<float, 3>& N, Particle* dp);
+ float ComputeExternalEnergy(vnl_vector_fixed<float, 3>& R, vnl_vector_fixed<float, 3>& N, Particle* dp) override;
// internal energy calculation
- float ComputeInternalEnergyConnection(Particle *p1,int ep1);
- float ComputeInternalEnergyConnection(Particle *p1,int ep1, Particle *p2, int ep2);
- float ComputeInternalEnergy(Particle *dp);
+ float ComputeInternalEnergyConnection(Particle *p1,int ep1) override;
+ float ComputeInternalEnergyConnection(Particle *p1,int ep1, Particle *p2, int ep2) override;
+ float ComputeInternalEnergy(Particle *dp) override;
float EvaluateOdf(vnl_vector_fixed<float, 3>& pos, vnl_vector_fixed<float, 3> dir);
protected:
ItkQBallImgType* m_Image;
};
#endif
diff --git a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkFibersFromPlanarFiguresFilter.h b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkFibersFromPlanarFiguresFilter.h
index 3e6c0c0809..940d41dcda 100644
--- a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkFibersFromPlanarFiguresFilter.h
+++ b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkFibersFromPlanarFiguresFilter.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef itkFibersFromPlanarFiguresFilter_h
#define itkFibersFromPlanarFiguresFilter_h
// MITK
#include <mitkPlanarEllipse.h>
#include <mitkFiberBundle.h>
#include <mitkFiberfoxParameters.h>
// ITK
#include <itkProcessObject.h>
// VTK
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkPolyLine.h>
using namespace std;
namespace itk{
/**
* \brief Generates artificial fibers distributed in and interpolated between the input planar figures. */
class FibersFromPlanarFiguresFilter : public ProcessObject
{
public:
typedef FibersFromPlanarFiguresFilter Self;
typedef ProcessObject Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
typedef mitk::FiberBundle::Pointer FiberType;
typedef vector< mitk::FiberBundle::Pointer > FiberContainerType;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkTypeMacro( FibersFromPlanarFiguresFilter, ProcessObject )
- virtual void Update(){
+ virtual void Update() override{
this->GenerateData();
}
// input
void SetParameters( FiberGenerationParameters param ) ///< Simulation parameters.
{
m_Parameters = param;
}
// output
FiberContainerType GetFiberBundles(){ return m_FiberBundles; }
protected:
- void GenerateData();
+ void GenerateData() override;
FibersFromPlanarFiguresFilter();
virtual ~FibersFromPlanarFiguresFilter();
void GeneratePoints();
FiberContainerType m_FiberBundles; ///< container for the output fiber bundles
vector< mitk::Vector2D > m_2DPoints; ///< container for the 2D fiber waypoints
FiberGenerationParameters m_Parameters;
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkFibersFromPlanarFiguresFilter.cpp"
#endif
#endif
diff --git a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkGibbsTrackingFilter.h b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkGibbsTrackingFilter.h
index 883d4314c1..f6ff305775 100644
--- a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkGibbsTrackingFilter.h
+++ b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkGibbsTrackingFilter.h
@@ -1,153 +1,153 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef itkGibbsTrackingFilter_h
#define itkGibbsTrackingFilter_h
// MITK
#include <mitkSphereInterpolator.h>
// ITK
#include <itkProcessObject.h>
#include <itkImage.h>
#include <itkDiffusionTensor3D.h>
#include <itkMersenneTwisterRandomVariateGenerator.h>
// VTK
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkPolyLine.h>
namespace itk{
/**
* \brief Performes global fiber tractography on the input Q-Ball or tensor image (Gibbs tracking, Reisert 2010). */
template< class ItkQBallImageType >
class GibbsTrackingFilter : public ProcessObject
{
public:
typedef GibbsTrackingFilter Self;
typedef ProcessObject Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkTypeMacro( GibbsTrackingFilter, ProcessObject )
typedef Image< DiffusionTensor3D<float>, 3 > ItkTensorImage;
typedef typename ItkQBallImageType::Pointer ItkQBallImageTypePointer;
typedef Image< float, 3 > ItkFloatImageType;
typedef vtkSmartPointer< vtkPolyData > FiberPolyDataType;
/** Setter. */
itkSetMacro( StartTemperature, float ) ///< Start temperature of simulated annealing process.
itkSetMacro( EndTemperature, float ) ///< End temperature of simulated annealing process.
itkSetMacro( Iterations, unsigned long ) ///< Number of iterations. More iterations usually mean better results. Maximum 5x10^8
itkSetMacro( ParticleWeight, float ) ///< Smaller particle weights result in a higher sensitivity if the method.
itkSetMacro( ParticleWidth, float ) ///< Thinner particles cause more reconstructed fibers.
itkSetMacro( ParticleLength, float )
itkSetMacro( ConnectionPotential, float )
itkSetMacro( InexBalance, float ) ///< Values < 0 result in a stronger weighting of the internal energy, values > 0 cause a stronger weighting of the external energy,
itkSetMacro( ParticlePotential, float )
itkSetMacro( MinFiberLength, int ) ///< Shorter fibers are discarded
itkSetMacro( AbortTracking, bool ) ///< Set flag to prematurely abort tracking.
itkSetMacro( CurvatureThreshold, float) ///< Absolute angular threshold between two particles (in radians).
itkSetMacro( DuplicateImage, bool ) ///< Work on copy of input image.
itkSetMacro( RandomSeed, int ) ///< Seed for random generator.
itkSetMacro( LoadParameterFile, std::string ) ///< Parameter file.
itkSetMacro( SaveParameterFile, std::string )
itkSetMacro( LutPath, std::string ) ///< Path to lookuptables. Default is binary directory.
/** Getter. */
itkGetMacro( ParticleWeight, float )
itkGetMacro( ParticleWidth, float )
itkGetMacro( ParticleLength, float )
itkGetMacro( CurrentStep, unsigned long )
itkGetMacro( NumParticles, int )
itkGetMacro( NumConnections, int )
itkGetMacro( NumAcceptedFibers, int )
itkGetMacro( ProposalAcceptance, float )
itkGetMacro( Steps, unsigned int)
itkGetMacro( IsInValidState, bool)
FiberPolyDataType GetFiberBundle(); ///< Output fibers
/** Input images. */
itkSetMacro(QBallImage, typename ItkQBallImageType::Pointer)
itkSetMacro(MaskImage, ItkFloatImageType::Pointer)
itkSetMacro(TensorImage, ItkTensorImage::Pointer)
- virtual void Update(){
+ virtual void Update() override{
this->GenerateData();
}
protected:
- void GenerateData();
+ void GenerateData() override;
GibbsTrackingFilter();
virtual ~GibbsTrackingFilter();
void EstimateParticleWeight();
void PrepareMaskImage();
bool LoadParameters();
bool SaveParameters();
// Input Images
typename ItkQBallImageType::Pointer m_QBallImage;
typename ItkFloatImageType::Pointer m_MaskImage;
typename ItkTensorImage::Pointer m_TensorImage;
// Tracking parameters
float m_StartTemperature; ///< Start temperature
float m_EndTemperature; ///< End temperature
unsigned long m_Iterations; ///< Total number of iterations
unsigned long m_CurrentStep; ///< current tracking step
float m_ParticleWeight; ///< w (unitless)
float m_ParticleWidth; ///< sigma (mm)
float m_ParticleLength; ///< l (mm)
float m_ConnectionPotential; ///< gross L (chemisches potential, default 10)
float m_InexBalance; ///< gewichtung zwischen den lambdas; -5 ... 5 -> nur intern ... nur extern,default 0
float m_ParticlePotential; ///< default 0.2
int m_MinFiberLength; ///< discard all fibers shortan than the specified length in mm
bool m_AbortTracking; ///< set flag to abort tracking
int m_NumAcceptedFibers; ///< number of reconstructed fibers generated by the FiberBuilder
volatile bool m_BuildFibers; ///< set flag to generate fibers from particle grid
unsigned int m_Steps; ///< number of temperature decrease steps
float m_ProposalAcceptance; ///< proposal acceptance rate (0-1)
float m_CurvatureThreshold; ///< curvature threshold in radians (1 -> no curvature is accepted, -1 all curvature angles are accepted)
bool m_DuplicateImage; ///< generates a working copy of the qball image so that the original image won't be changed by the mean subtraction
int m_NumParticles; ///< current number of particles in grid
int m_NumConnections; ///< current number of connections between particles in grid
int m_RandomSeed; ///< seed value for random generator (-1 for standard seeding)
std::string m_LoadParameterFile; ///< filename of parameter file (reader)
std::string m_SaveParameterFile; ///< filename of parameter file (writer)
std::string m_LutPath; ///< path to lookuptables used by the sphere interpolator
bool m_IsInValidState; ///< Whether the filter is in a valid state, false if error occured
FiberPolyDataType m_FiberPolyData; ///< container for reconstructed fibers
//Constant values
static const int m_ParticleGridCellCapacity = 1024;
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkGibbsTrackingFilter.cpp"
#endif
#endif
diff --git a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkTractsToVectorImageFilter.h b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkTractsToVectorImageFilter.h
index 67a324ac46..cbd65a26bd 100644
--- a/Modules/DiffusionImaging/FiberTracking/Algorithms/itkTractsToVectorImageFilter.h
+++ b/Modules/DiffusionImaging/FiberTracking/Algorithms/itkTractsToVectorImageFilter.h
@@ -1,110 +1,110 @@
#ifndef __itkTractsToVectorImageFilter_h__
#define __itkTractsToVectorImageFilter_h__
// MITK
#include <mitkFiberBundle.h>
// ITK
#include <itkImageSource.h>
#include <itkVectorImage.h>
// VTK
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkPolyLine.h>
using namespace mitk;
namespace itk{
/**
* \brief Extracts the voxel-wise main directions of the input fiber bundle. */
template< class PixelType >
class TractsToVectorImageFilter : public ImageSource< VectorImage< float, 3 > >
{
public:
typedef TractsToVectorImageFilter Self;
typedef ProcessObject Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
typedef itk::Vector<float,3> OutputVectorType;
typedef itk::Image<OutputVectorType, 3> OutputImageType;
typedef std::vector< OutputImageType::Pointer > OutputImageContainerType;
typedef vnl_vector_fixed< double, 3 > DirectionType;
typedef VectorContainer< unsigned int, DirectionType > DirectionContainerType;
typedef VectorContainer< unsigned int, DirectionContainerType::Pointer > ContainerType;
typedef Image< Vector< float, 3 >, 3> ItkDirectionImageType;
typedef VectorContainer< unsigned int, ItkDirectionImageType::Pointer > DirectionImageContainerType;
typedef itk::Image<unsigned char, 3> ItkUcharImgType;
typedef itk::Image<double, 3> ItkDoubleImgType;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkTypeMacro( TractsToVectorImageFilter, ImageSource )
itkSetMacro( SizeThreshold, float)
itkGetMacro( SizeThreshold, float)
itkSetMacro( AngularThreshold, float) ///< cluster directions that are closer together than the specified threshold
itkGetMacro( AngularThreshold, float) ///< cluster directions that are closer together than the specified threshold
itkSetMacro( NormalizeVectors, bool) ///< Normalize vectors to length 1
itkGetMacro( NormalizeVectors, bool) ///< Normalize vectors to length 1
itkSetMacro( UseWorkingCopy, bool) ///< Do not modify input fiber bundle. Use a copy.
itkGetMacro( UseWorkingCopy, bool) ///< Do not modify input fiber bundle. Use a copy.
itkSetMacro( MaxNumDirections, unsigned long) ///< If more directions are extracted, only the largest are kept.
itkGetMacro( MaxNumDirections, unsigned long) ///< If more directions are extracted, only the largest are kept.
itkSetMacro( MaskImage, ItkUcharImgType::Pointer) ///< only process voxels inside mask
itkSetMacro( FiberBundle, FiberBundle::Pointer) ///< input fiber bundle
itkGetMacro( ClusteredDirectionsContainer, ContainerType::Pointer) ///< output directions
itkGetMacro( NumDirectionsImage, ItkUcharImgType::Pointer) ///< number of directions per voxel
itkGetMacro( OutputFiberBundle, FiberBundle::Pointer) ///< vector field for visualization purposes
itkGetMacro( DirectionImageContainer, DirectionImageContainerType::Pointer) ///< output directions
itkSetMacro( CreateDirectionImages, bool)
- void GenerateData();
+ void GenerateData() override;
protected:
DirectionContainerType::Pointer FastClustering(DirectionContainerType::Pointer inDirs, std::vector< double > lengths); ///< cluster fiber directions
// std::vector< DirectionType > Clustering(std::vector< DirectionType >& inDirs);
// DirectionContainerType::Pointer MeanShiftClustering(DirectionContainerType::Pointer dirCont);
// vnl_vector_fixed<double, 3> ClusterStep(DirectionContainerType::Pointer dirCont, vnl_vector_fixed<double, 3> currentMean);
vnl_vector_fixed<double, 3> GetVnlVector(double point[3]);
itk::Point<double, 3> GetItkPoint(double point[3]);
TractsToVectorImageFilter();
virtual ~TractsToVectorImageFilter();
FiberBundle::Pointer m_FiberBundle; ///< input fiber bundle
float m_AngularThreshold; ///< cluster directions that are closer together than the specified threshold
float m_Epsilon; ///< epsilon for vector equality check
ItkUcharImgType::Pointer m_MaskImage; ///< only voxels inside the binary mask are processed
bool m_NormalizeVectors; ///< normalize vectors to length 1
itk::Vector<float> m_OutImageSpacing; ///< spacing of output image
ContainerType::Pointer m_DirectionsContainer; ///< container for fiber directions
bool m_UseWorkingCopy; ///< do not modify input fiber bundle but work on copy
unsigned long m_MaxNumDirections; ///< if more directions per voxel are extracted, only the largest are kept
float m_SizeThreshold;
bool m_CreateDirectionImages;
// output datastructures
ContainerType::Pointer m_ClusteredDirectionsContainer; ///< contains direction vectors for each voxel
ItkUcharImgType::Pointer m_NumDirectionsImage; ///< shows number of fibers per voxel
DirectionImageContainerType::Pointer m_DirectionImageContainer; ///< contains images that contain the output directions
FiberBundle::Pointer m_OutputFiberBundle; ///< vector field for visualization purposes
};
}
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkTractsToVectorImageFilter.cpp"
#endif
#endif // __itkTractsToVectorImageFilter_h__
diff --git a/Modules/DiffusionImaging/FiberTracking/IODataStructures/FiberBundle/mitkFiberBundle.h b/Modules/DiffusionImaging/FiberTracking/IODataStructures/FiberBundle/mitkFiberBundle.h
index 90f538b074..2e72a5eb1e 100644
--- a/Modules/DiffusionImaging/FiberTracking/IODataStructures/FiberBundle/mitkFiberBundle.h
+++ b/Modules/DiffusionImaging/FiberTracking/IODataStructures/FiberBundle/mitkFiberBundle.h
@@ -1,177 +1,177 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_FiberBundle_H
#define _MITK_FiberBundle_H
//includes for MITK datastructure
#include <mitkBaseData.h>
#include <MitkFiberTrackingExports.h>
#include <mitkImage.h>
#include <mitkDataStorage.h>
#include <mitkPlanarFigure.h>
#include <mitkPixelTypeTraits.h>
#include <mitkPlanarFigureComposite.h>
//includes storing fiberdata
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkDataSet.h>
#include <vtkTransform.h>
#include <vtkFloatArray.h>
namespace mitk {
/**
* \brief Base Class for Fiber Bundles; */
class MITKFIBERTRACKING_EXPORT FiberBundle : public BaseData
{
public:
typedef itk::Image<unsigned char, 3> ItkUcharImgType;
// fiber colorcodings
static const char* FIBER_ID_ARRAY;
- virtual void UpdateOutputInformation();
- virtual void SetRequestedRegionToLargestPossibleRegion();
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
- virtual bool VerifyRequestedRegion();
- virtual void SetRequestedRegion(const itk::DataObject*);
+ virtual void UpdateOutputInformation() override;
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
+ virtual bool VerifyRequestedRegion() override;
+ virtual void SetRequestedRegion(const itk::DataObject*) override;
mitkClassMacro( FiberBundle, BaseData )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(Self, vtkSmartPointer<vtkPolyData>) // custom constructor
// colorcoding related methods
void ColorFibersByCurvature();
void ColorFibersByScalarMap(mitk::Image::Pointer, bool opacity);
template <typename TPixel>
void ColorFibersByScalarMap(const mitk::PixelType pixelType, mitk::Image::Pointer, bool opacity);
void ColorFibersByOrientation();
void SetFiberOpacity(vtkDoubleArray *FAValArray);
void ResetFiberOpacity();
void SetFiberColors(vtkSmartPointer<vtkUnsignedCharArray> fiberColors);
void SetFiberColors(float r, float g, float b, float alpha=255);
vtkSmartPointer<vtkUnsignedCharArray> GetFiberColors() const { return m_FiberColors; }
// fiber compression
void Compress(float error = 0.0);
// fiber resampling
void ResampleSpline(float pointDistance=1);
void ResampleSpline(float pointDistance, double tension, double continuity, double bias );
bool RemoveShortFibers(float lengthInMM);
bool RemoveLongFibers(float lengthInMM);
bool ApplyCurvatureThreshold(float minRadius, bool deleteFibers);
void MirrorFibers(unsigned int axis);
void RotateAroundAxis(double x, double y, double z);
void TranslateFibers(double x, double y, double z);
void ScaleFibers(double x, double y, double z, bool subtractCenter=true);
void TransformFibers(double rx, double ry, double rz, double tx, double ty, double tz);
void RemoveDir(vnl_vector_fixed<double,3> dir, double threshold);
itk::Point<float, 3> TransformPoint(vnl_vector_fixed< double, 3 > point, double rx, double ry, double rz, double tx, double ty, double tz);
itk::Matrix< double, 3, 3 > TransformMatrix(itk::Matrix< double, 3, 3 > m, double rx, double ry, double rz);
// add/subtract fibers
FiberBundle::Pointer AddBundle(FiberBundle* fib);
FiberBundle::Pointer SubtractBundle(FiberBundle* fib);
// fiber subset extraction
FiberBundle::Pointer ExtractFiberSubset(DataNode *roi, DataStorage* storage);
std::vector<long> ExtractFiberIdSubset(DataNode* roi, DataStorage* storage);
FiberBundle::Pointer ExtractFiberSubset(ItkUcharImgType* mask, bool anyPoint, bool invert=false);
FiberBundle::Pointer RemoveFibersOutside(ItkUcharImgType* mask, bool invert=false);
vtkSmartPointer<vtkPolyData> GeneratePolyDataByIds( std::vector<long> ); // TODO: make protected
void GenerateFiberIds(); // TODO: make protected
// get/set data
vtkSmartPointer<vtkFloatArray> GetFiberWeights() const { return m_FiberWeights; }
float GetFiberWeight(unsigned int fiber);
void SetFiberWeights(float newWeight);
void SetFiberWeight(unsigned int fiber, float weight);
void SetFiberWeights(vtkSmartPointer<vtkFloatArray> weights);
void SetFiberPolyData(vtkSmartPointer<vtkPolyData>, bool updateGeometry = true);
vtkSmartPointer<vtkPolyData> GetFiberPolyData() const;
itkGetMacro( NumFibers, int)
//itkGetMacro( FiberSampling, int)
int GetNumFibers() const {return m_NumFibers;}
itkGetMacro( MinFiberLength, float )
itkGetMacro( MaxFiberLength, float )
itkGetMacro( MeanFiberLength, float )
itkGetMacro( MedianFiberLength, float )
itkGetMacro( LengthStDev, float )
itkGetMacro( UpdateTime2D, itk::TimeStamp )
itkGetMacro( UpdateTime3D, itk::TimeStamp )
void RequestUpdate2D(){ m_UpdateTime2D.Modified(); }
void RequestUpdate3D(){ m_UpdateTime3D.Modified(); }
void RequestUpdate(){ m_UpdateTime2D.Modified(); m_UpdateTime3D.Modified(); }
unsigned long GetNumberOfPoints();
// copy fiber bundle
mitk::FiberBundle::Pointer GetDeepCopy();
// compare fiber bundles
bool Equals(FiberBundle* fib, double eps=0.0001);
itkSetMacro( ReferenceGeometry, mitk::BaseGeometry::Pointer )
itkGetConstMacro( ReferenceGeometry, mitk::BaseGeometry::Pointer )
protected:
FiberBundle( vtkPolyData* fiberPolyData = NULL );
virtual ~FiberBundle();
itk::Point<float, 3> GetItkPoint(double point[3]);
// calculate geometry from fiber extent
void UpdateFiberGeometry();
private:
// actual fiber container
vtkSmartPointer<vtkPolyData> m_FiberPolyData;
// contains fiber ids
vtkSmartPointer<vtkDataSet> m_FiberIdDataSet;
int m_NumFibers;
vtkSmartPointer<vtkUnsignedCharArray> m_FiberColors;
vtkSmartPointer<vtkFloatArray> m_FiberWeights;
std::vector< float > m_FiberLengths;
float m_MinFiberLength;
float m_MaxFiberLength;
float m_MeanFiberLength;
float m_MedianFiberLength;
float m_LengthStDev;
int m_FiberSampling;
itk::TimeStamp m_UpdateTime2D;
itk::TimeStamp m_UpdateTime3D;
mitk::BaseGeometry::Pointer m_ReferenceGeometry;
};
} // namespace mitk
#endif /* _MITK_FiberBundle_H */
diff --git a/Modules/DiffusionImaging/FiberTracking/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h b/Modules/DiffusionImaging/FiberTracking/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h
index 132b531a46..474fcea2bc 100644
--- a/Modules/DiffusionImaging/FiberTracking/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h
+++ b/Modules/DiffusionImaging/FiberTracking/IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANARFIGURECOMPOSITE_H
#define _MITK_PLANARFIGURECOMPOSITE_H
#include "mitkCommon.h"
#include "mitkBaseData.h"
#include <MitkFiberTrackingExports.h>
#include "mitkPlanarFigure.h"
#include "itkVectorContainer.h"
#include "mitkDataNode.h"
namespace mitk {
class MITKFIBERTRACKING_EXPORT PlanarFigureComposite : public BaseData
{
public:
enum OperationType {
AND,
OR,
NOT
};
mitkClassMacro(PlanarFigureComposite, BaseData)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void SetRequestedRegionToLargestPossibleRegion();
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
- virtual bool VerifyRequestedRegion();
- virtual void SetRequestedRegion(const itk::DataObject*);
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
+ virtual bool VerifyRequestedRegion() override;
+ virtual void SetRequestedRegion(const itk::DataObject*) override;
// set if this compsition is AND, OR, NOT
void setOperationType(OperationType);
OperationType getOperationType() const;
protected:
PlanarFigureComposite();
virtual ~PlanarFigureComposite();
PlanarFigureComposite(const Self& other);
private:
OperationType m_compOperation;
};
}
#endif
diff --git a/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h b/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h
index 6622d09013..bfe67ca7a5 100644
--- a/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h
+++ b/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
#define MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include <mitkInteractor.h>
#include <mitkNumericTypes.h>
#include <MitkFiberTrackingExports.h>
#include <vtkType.h>
namespace mitk
{
class DataNode;
//##Documentation
//## @brief Just select a point, that's the only way to interact with the point
//##
//## Interact with a point: Select the point without moving to get parameters that does not change
//## All Set-operations would be done through the method "ExecuteAction", if there would be anyone.
//## the identificationnumber of this point is set by this points and evalued from an empty place in the DataStructure
//## @ingroup Interaction
class MITKFIBERTRACKING_EXPORT FiberBundleInteractor : public Interactor
{
public:
mitkClassMacro(FiberBundleInteractor, Interactor);
mitkNewMacro2Param(Self, const char*, DataNode*);
//##Documentation
//## @brief Sets the amount of precision
void SetPrecision(unsigned int precision);
//##Documentation
//## @brief derived from mitk::Interactor; calculates Jurisdiction according to points
//##
//## standard method can not be used, since it doesn't calculate in points, only in BoundingBox of Points
- virtual float CanHandleEvent(StateEvent const* stateEvent) const;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
protected:
//##Documentation
//##@brief Constructor
FiberBundleInteractor(const char * type, DataNode* dataNode);
//##Documentation
//##@brief Destructor
virtual ~FiberBundleInteractor();
//##Documentation
//## @brief select the point on the given position
virtual void SelectFiber(int position);
//##Documentation
//## @brief unselect all points that exist in mesh
virtual void DeselectAllFibers();
//##Documentation
//## @brief Executes Actions
- virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
private:
//##Documentation
//## @brief to calculate a direction vector from last point and actual point
Point3D m_LastPoint;
//##Documentation
//## @brief to store a position
unsigned int m_LastPosition;
// Point3D m_InitialPickedPoint;
// Point2D m_InitialPickedDisplayPoint;
// double m_InitialPickedPointWorld[4];
Point3D m_CurrentPickedPoint;
Point2D m_CurrentPickedDisplayPoint;
double m_CurrentPickedPointWorld[4];
};
}
#endif /* MITKFiberBundleInteractor_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberBundleReaderWriterTest.cpp b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberBundleReaderWriterTest.cpp
index 1105138c17..3b8cb84b7f 100644
--- a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberBundleReaderWriterTest.cpp
+++ b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberBundleReaderWriterTest.cpp
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkFiberBundle.h>
#include <mitkBaseData.h>
#include <itksys/SystemTools.hxx>
#include <mitkTestingConfig.h>
#include <mitkIOUtil.h>
#include "mitkTestFixture.h"
class mitkFiberBundleReaderWriterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkFiberBundleReaderWriterTestSuite);
MITK_TEST(Equal_SaveLoad_ReturnsTrue);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different (sub-)tests. All members are initialized via setUp().*/
mitk::FiberBundle::Pointer fib1;
mitk::FiberBundle::Pointer fib2;
public:
- void setUp()
+ void setUp() override
{
fib1 = NULL;
fib2 = NULL;
std::string filename = GetTestDataFilePath("DiffusionImaging/fiberBundleX.fib");
std::vector<mitk::BaseData::Pointer> fibInfile = mitk::IOUtil::Load( filename);
mitk::BaseData::Pointer baseData = fibInfile.at(0);
fib1 = dynamic_cast<mitk::FiberBundle*>(baseData.GetPointer());
}
- void tearDown()
+ void tearDown() override
{
fib1 = NULL;
fib2 = NULL;
}
void Equal_SaveLoad_ReturnsTrue()
{
mitk::IOUtil::Save(fib1.GetPointer(), std::string(MITK_TEST_OUTPUT_DIR)+"/writerTest.fib");
std::vector<mitk::BaseData::Pointer> baseData = mitk::IOUtil::Load(std::string(MITK_TEST_OUTPUT_DIR)+"/writerTest.fib");
fib2 = dynamic_cast<mitk::FiberBundle*>(baseData[0].GetPointer());
CPPUNIT_ASSERT_MESSAGE("Should be equal", fib1->Equals(fib2));
//MITK_ASSERT_EQUAL(fib1, fib2, "A saved and re-loaded file should be equal");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkFiberBundleReaderWriter)
diff --git a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberfoxAddArtifactsToDwiTest.cpp b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberfoxAddArtifactsToDwiTest.cpp
index 92284a7db5..b2140a4604 100644
--- a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberfoxAddArtifactsToDwiTest.cpp
+++ b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberfoxAddArtifactsToDwiTest.cpp
@@ -1,199 +1,199 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkIOUtil.h>
#include <mitkFiberBundle.h>
#include <itkAddArtifactsToDwiImageFilter.h>
#include <mitkFiberfoxParameters.h>
#include <mitkStickModel.h>
#include <mitkTensorModel.h>
#include <mitkBallModel.h>
#include <mitkDotModel.h>
#include <mitkAstroStickModel.h>
#include <mitkImage.h>
#include <itkTestingComparisonImageFilter.h>
#include <itkImageRegionConstIterator.h>
#include <mitkRicianNoiseModel.h>
#include <mitkChiSquareNoiseModel.h>
#include <mitkTestFixture.h>
#include <mitkITKImageImport.h>
#include <mitkProperties.h>
#include <mitkImageCast.h>
typedef itk::VectorImage<short, 3> ITKDiffusionImageType;
/**Documentation
* Test the Fiberfox simulation functions (diffusion weighted image -> diffusion weighted image)
*/
class mitkFiberfoxAddArtifactsToDwiTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkFiberfoxAddArtifactsToDwiTestSuite);
MITK_TEST(Spikes);
MITK_TEST(GibbsRinging);
MITK_TEST(Ghost);
MITK_TEST(Aliasing);
MITK_TEST(Eddy);
MITK_TEST(RicianNoise);
MITK_TEST(ChiSquareNoise);
MITK_TEST(Distortions);
CPPUNIT_TEST_SUITE_END();
private:
mitk::Image::Pointer m_InputDwi;
FiberfoxParameters<short> m_Parameters;
public:
- void setUp()
+ void setUp() override
{
// reference files
m_InputDwi = dynamic_cast<mitk::Image*>(mitk::IOUtil::LoadDataNode(GetTestDataFilePath("DiffusionImaging/Fiberfox/StickBall_RELAX.dwi"))->GetData());
// parameter setup
ITKDiffusionImageType::Pointer itkVectorImagePointer = ITKDiffusionImageType::New();
mitk::CastToItkImage(m_InputDwi, itkVectorImagePointer);
m_Parameters = FiberfoxParameters<short>();
m_Parameters.m_SignalGen.m_ImageRegion = itkVectorImagePointer->GetLargestPossibleRegion();
m_Parameters.m_SignalGen.m_ImageSpacing = itkVectorImagePointer->GetSpacing();
m_Parameters.m_SignalGen.m_ImageOrigin = itkVectorImagePointer->GetOrigin();
m_Parameters.m_SignalGen.m_ImageDirection = itkVectorImagePointer->GetDirection();
m_Parameters.m_SignalGen.m_Bvalue = static_cast<mitk::FloatProperty*>(m_InputDwi->GetProperty(mitk::DiffusionPropertyHelper::REFERENCEBVALUEPROPERTYNAME.c_str()).GetPointer() )->GetValue();
m_Parameters.m_SignalGen.SetGradienDirections( static_cast<mitk::GradientDirectionsProperty*>( m_InputDwi->GetProperty(mitk::DiffusionPropertyHelper::GRADIENTCONTAINERPROPERTYNAME.c_str()).GetPointer() )->GetGradientDirectionsContainer() );
}
bool CompareDwi(itk::VectorImage< short, 3 >* dwi1, itk::VectorImage< short, 3 >* dwi2)
{
typedef itk::VectorImage< short, 3 > DwiImageType;
try{
itk::ImageRegionIterator< DwiImageType > it1(dwi1, dwi1->GetLargestPossibleRegion());
itk::ImageRegionIterator< DwiImageType > it2(dwi2, dwi2->GetLargestPossibleRegion());
while(!it1.IsAtEnd())
{
if (it1.Get()!=it2.Get())
return false;
++it1;
++it2;
}
}
catch(...)
{
return false;
}
return true;
}
void StartSimulation(string testFileName)
{
mitk::Image::Pointer refImage = NULL;
if (!testFileName.empty())
CPPUNIT_ASSERT(refImage = dynamic_cast<mitk::Image*>(mitk::IOUtil::LoadDataNode(testFileName)->GetData()));
ITKDiffusionImageType::Pointer itkVectorImagePointer = ITKDiffusionImageType::New();
mitk::CastToItkImage(m_InputDwi, itkVectorImagePointer);
itk::AddArtifactsToDwiImageFilter< short >::Pointer artifactsToDwiFilter = itk::AddArtifactsToDwiImageFilter< short >::New();
artifactsToDwiFilter->SetUseConstantRandSeed(true);
artifactsToDwiFilter->SetInput(itkVectorImagePointer);
artifactsToDwiFilter->SetParameters(m_Parameters);
CPPUNIT_ASSERT_NO_THROW(artifactsToDwiFilter->Update());
mitk::Image::Pointer testImage = mitk::GrabItkImageMemory( artifactsToDwiFilter->GetOutput() );
testImage->SetProperty( mitk::DiffusionPropertyHelper::GRADIENTCONTAINERPROPERTYNAME.c_str(), mitk::GradientDirectionsProperty::New( m_Parameters.m_SignalGen.GetGradientDirections() ) );
testImage->SetProperty( mitk::DiffusionPropertyHelper::REFERENCEBVALUEPROPERTYNAME.c_str(), mitk::FloatProperty::New( m_Parameters.m_SignalGen.m_Bvalue ) );
mitk::DiffusionPropertyHelper propertyHelper( testImage );
propertyHelper.InitializeImage();
if (refImage.IsNotNull())
{
ITKDiffusionImageType::Pointer itkTestVectorImagePointer = ITKDiffusionImageType::New();
mitk::CastToItkImage(testImage, itkTestVectorImagePointer);
ITKDiffusionImageType::Pointer itkRefVectorImagePointer = ITKDiffusionImageType::New();
mitk::CastToItkImage(refImage, itkRefVectorImagePointer);
if (!CompareDwi( itkTestVectorImagePointer, itkRefVectorImagePointer))
mitk::IOUtil::SaveBaseData(testImage, mitk::IOUtil::GetTempPath()+"testImage.dwi");
CPPUNIT_ASSERT_MESSAGE(testFileName, CompareDwi( itkTestVectorImagePointer, itkRefVectorImagePointer));
}
}
void Spikes()
{
m_Parameters.m_SignalGen.m_Spikes = 5;
m_Parameters.m_SignalGen.m_SpikeAmplitude = 1;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/spikes2.dwi") );
}
void GibbsRinging()
{
m_Parameters.m_SignalGen.m_DoAddGibbsRinging = true;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/gibbsringing2.dwi") );
}
void Ghost()
{
m_Parameters.m_SignalGen.m_KspaceLineOffset = 0.25;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/ghost2.dwi") );
}
void Aliasing()
{
m_Parameters.m_SignalGen.m_CroppingFactor = 0.4;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/aliasing2.dwi") );
}
void Eddy()
{
m_Parameters.m_SignalGen.m_EddyStrength = 0.05;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/eddy2.dwi") );
}
void RicianNoise()
{
mitk::RicianNoiseModel<short>* ricianNoiseModel = new mitk::RicianNoiseModel<short>();
ricianNoiseModel->SetNoiseVariance(1000000);
ricianNoiseModel->SetSeed(0);
m_Parameters.m_NoiseModel = ricianNoiseModel;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/riciannoise2.dwi") );
delete m_Parameters.m_NoiseModel;
}
void ChiSquareNoise()
{
mitk::ChiSquareNoiseModel<short>* chiSquareNoiseModel = new mitk::ChiSquareNoiseModel<short>();
chiSquareNoiseModel->SetNoiseVariance(1000000);
chiSquareNoiseModel->SetSeed(0);
m_Parameters.m_NoiseModel = chiSquareNoiseModel;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/chisquarenoise2.dwi") );
delete m_Parameters.m_NoiseModel;
}
void Distortions()
{
mitk::Image::Pointer mitkFMap = dynamic_cast<mitk::Image*>(mitk::IOUtil::LoadDataNode( GetTestDataFilePath("DiffusionImaging/Fiberfox/Fieldmap.nrrd") )->GetData());
typedef itk::Image<double, 3> ItkDoubleImgType;
ItkDoubleImgType::Pointer fMap = ItkDoubleImgType::New();
mitk::CastToItkImage(mitkFMap, fMap);
m_Parameters.m_SignalGen.m_FrequencyMap = fMap;
StartSimulation( GetTestDataFilePath("DiffusionImaging/Fiberfox/distortions2.dwi") );
}
};
MITK_TEST_SUITE_REGISTRATION(mitkFiberfoxAddArtifactsToDwi)
diff --git a/Modules/DiffusionImaging/FiberTracking/mitkFiberTrackingModuleActivator.cpp b/Modules/DiffusionImaging/FiberTracking/mitkFiberTrackingModuleActivator.cpp
index f8acb70240..87579cf714 100644
--- a/Modules/DiffusionImaging/FiberTracking/mitkFiberTrackingModuleActivator.cpp
+++ b/Modules/DiffusionImaging/FiberTracking/mitkFiberTrackingModuleActivator.cpp
@@ -1,43 +1,43 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usModuleActivator.h>
namespace mitk
{
/**
\brief Registers services for segmentation module.
*/
class FiberTrackingModuleActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext* /*context*/)
+ void Load(us::ModuleContext* /*context*/) override
{
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
}
private:
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::FiberTrackingModuleActivator)
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageReader.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageReader.h
index 0ac49953ee..a0d49c89a0 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageReader.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageReader.h
@@ -1,103 +1,103 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkNrrdTbssImageReader_h
#define __mitkNrrdTbssImageReader_h
#include "mitkCommon.h"
#include "mitkFileReader.h"
#include "mitkTbssImageSource.h"
#include "itkImage.h"
#include "itkVectorImage.h"
#include "mitkTbssImage.h"
namespace mitk
{
/** \brief
*/
class MITKQUANTIFICATION_EXPORT NrrdTbssImageReader : public mitk::TbssImageSource, public FileReader
{
public:
typedef mitk::TbssImage OutputType;
typedef itk::VectorImage<float,3> ImageType;
typedef TbssImageSource TbssVolSourceType;
mitkClassMacro( NrrdTbssImageReader, TbssVolSourceType )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- const char* GetFileName() const;
- void SetFileName(const char* aFileName);
- const char* GetFilePrefix() const;
- void SetFilePrefix(const char* aFilePrefix);
- const char* GetFilePattern() const;
- void SetFilePattern(const char* aFilePattern);
+ const char* GetFileName() const override;
+ void SetFileName(const char* aFileName) override;
+ const char* GetFilePrefix() const override;
+ void SetFilePrefix(const char* aFilePrefix) override;
+ const char* GetFilePattern() const override;
+ void SetFilePattern(const char* aFilePattern) override;
static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern);
protected:
/** Does the real work. */
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::vector< std::pair<std::string, int> > m_GroupInfo;
OutputType::Pointer m_OutputCache;
itk::TimeStamp m_CacheTime;
void Tokenize(const std::string& str,
std::vector<std::string>& tokens,
const std::string& delimiters = " ")
{
// Skip delimiters at beginning.
std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
// Find first "non-delimiter".
std::string::size_type pos = str.find_first_of(delimiters, lastPos);
while (std::string::npos != pos || std::string::npos != lastPos)
{
// Found a token, add it to the vector.
tokens.push_back(str.substr(lastPos, pos - lastPos));
// Skip delimiters. Note the "not_of"
lastPos = str.find_first_not_of(delimiters, pos);
// Find next "non-delimiter"
pos = str.find_first_of(delimiters, lastPos);
}
}
private:
void operator=(const Self&); //purposely not implemented
};
} //namespace MITK
#endif // __mitkNrrdTbssImageReader_h
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageWriter.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageWriter.h
index fe58b28e92..63f1e40de7 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageWriter.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssImageWriter.h
@@ -1,143 +1,143 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_NRRDTBSSVOL_WRITER__H_
#define _MITK_NRRDTBSSVOL_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkTbssImage.h>
#include "MitkQuantificationExports.h"
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class MITKQUANTIFICATION_EXPORT NrrdTbssImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( NrrdTbssImageWriter, mitk::FileWriterWithInformation )
mitkWriterMacro
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::TbssImage InputType;
/**
* Sets the filename of the file to write.
* @param FileName the nameInputType of the file to write.
*/
itkSetStringMacro( FileName )
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName )
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix )
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix )
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern )
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern )
/**image
* Sets the input object for the filter.
* @param input the diffusion volumes to write to file.
*/
using ProcessObject::SetInput;
void SetInput( InputType* input );
/**itk::VectorImage<TPixelType, 3>
* @returns the 0'th input object of the filter.
*/
InputType* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool )
/**
* @return possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- std::string GetSupportedBaseData() const;
+ std::string GetSupportedBaseData() const override;
// FileWriterWithInformation methods
- virtual const char * GetDefaultFilename() { return "TbssImage.tbss"; }
- virtual const char * GetFileDialogPattern() { return "Tbss Images (*.tbss)"; }
- virtual const char * GetDefaultExtension() { return ".tbss"; }
- virtual bool CanWriteBaseDataType(BaseData::Pointer data)
+ virtual const char * GetDefaultFilename() override { return "TbssImage.tbss"; }
+ virtual const char * GetFileDialogPattern() override { return "Tbss Images (*.tbss)"; }
+ virtual const char * GetDefaultExtension() override { return ".tbss"; }
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override
{
return (dynamic_cast<mitk::TbssImage*>(data.GetPointer()) != NULL);
}
- virtual void DoWrite(BaseData::Pointer data) {
+ virtual void DoWrite(BaseData::Pointer data) override {
if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::TbssImage*>(data.GetPointer()));
this->Update();
}
}
protected:
NrrdTbssImageWriter();
virtual ~NrrdTbssImageWriter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.h
index 8c4d62827a..34568101c4 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkNrrdTbssRoiImageReader_h
#define __mitkNrrdTbssRoiImageReader_h
#include "mitkCommon.h"
#include "mitkFileReader.h"
#include "mitkTbssRoiImageSource.h"
#include "itkImage.h"
#include "mitkTbssRoiImage.h"
namespace mitk
{
/** \brief
*/
class MITKQUANTIFICATION_EXPORT NrrdTbssRoiImageReader : public mitk::TbssRoiImageSource, public FileReader
{
public:
typedef mitk::TbssRoiImage OutputType;
typedef itk::Image<unsigned char,3> ImageType;
typedef TbssRoiImageSource TbssVolSourceType;
mitkClassMacro( NrrdTbssRoiImageReader, TbssVolSourceType )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- const char* GetFileName() const;
- void SetFileName(const char* aFileName);
- const char* GetFilePrefix() const;
- void SetFilePrefix(const char* aFilePrefix);
- const char* GetFilePattern() const;
- void SetFilePattern(const char* aFilePattern);
+ const char* GetFileName() const override;
+ void SetFileName(const char* aFileName) override;
+ const char* GetFilePrefix() const override;
+ void SetFilePrefix(const char* aFilePrefix) override;
+ const char* GetFilePattern() const override;
+ void SetFilePattern(const char* aFilePattern) override;
static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern);
protected:
/** Does the real work. */
- virtual void GenerateData();
+ virtual void GenerateData() override;
void ReadRoiInfo(itk::MetaDataDictionary dict);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
OutputType::Pointer m_OutputCache;
itk::TimeStamp m_CacheTime;
private:
void operator=(const Self&); //purposely not implemented
};
} //namespace MITK
//#include "mitkNrrdTbssRoiImageReader.cpp"
#endif // __mitkNrrdTbssImageReader_h
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.h
index 73f087f042..6265dbfb54 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.h
@@ -1,141 +1,141 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_NRRDTBSSROIVOL_WRITER__H_
#define _MITK_NRRDTBSSROIVOL_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkTbssRoiImage.h>
#include "MitkQuantificationExports.h"
namespace mitk
{
/**
* Writes diffusion volumes to a file
* @ingroup Process
*/
class MITKQUANTIFICATION_EXPORT NrrdTbssRoiImageWriter : public mitk::FileWriterWithInformation
{
public:
typedef itk::Image<unsigned char,3> ImageType;
mitkClassMacro( NrrdTbssRoiImageWriter, mitk::FileWriterWithInformation )
mitkWriterMacro
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::TbssRoiImage InputType;
/**
* Sets the filename of the file to write.
* @param FileName the nameInputType of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**image
* Sets the input object for the filter.
* @param input the diffusion volumes to write to file.
*/
using ProcessObject::SetInput;
void SetInput( InputType* input );
/**
* @returns the 0'th input object of the filter.
*/
InputType* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @return possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- std::string GetSupportedBaseData() const;
+ std::string GetSupportedBaseData() const override;
// FileWriterWithInformation methods
- virtual const char * GetDefaultFilename() { return "TbssRoiImage.roi"; }
- virtual const char * GetFileDialogPattern() { return "Tbss Roi Images (*.roi)"; }
- virtual const char * GetDefaultExtension() { return ".roi"; }
- virtual bool CanWriteBaseDataType(BaseData::Pointer data)
+ virtual const char * GetDefaultFilename() override { return "TbssRoiImage.roi"; }
+ virtual const char * GetFileDialogPattern() override { return "Tbss Roi Images (*.roi)"; }
+ virtual const char * GetDefaultExtension() override { return ".roi"; }
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override
{
return (dynamic_cast<mitk::TbssRoiImage*>(data.GetPointer()) != NULL);
}
- virtual void DoWrite(BaseData::Pointer data) {
+ virtual void DoWrite(BaseData::Pointer data) override {
if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::TbssRoiImage*>(data.GetPointer()));
this->Update();
}
}
protected:
NrrdTbssRoiImageWriter();
virtual ~NrrdTbssRoiImageWriter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
} // end of namespace mitk
#endif
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImageSource.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImageSource.h
index be52c05686..a71f9a4754 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImageSource.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImageSource.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_TBSS_IMAGE_DATA_SOURCE_H_HEADER_
#define _MITK_TBSS_IMAGE_DATA_SOURCE_H_HEADER_
// Should be changed in a new type for TBSS
#include "mitkImageSource.h"
#include "MitkQuantificationExports.h"
namespace mitk {
class TbssImage;
//##Documentation
//## @brief Superclass of all classes generating diffusion volumes (instances
//## of class DiffusionImage) as output.
//##
//## @ingroup Process
class MITKQUANTIFICATION_EXPORT TbssImageSource : public ImageSource
{
public:
mitkClassMacro(TbssImageSource, BaseDataSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef TbssImage OutputType;
typedef itk::DataObject::Pointer DataObjectPointer;
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
OutputType* GetOutput()
{
return itkDynamicCastInDebugMode<OutputType*>( this->GetPrimaryOutput() );
}
//OutputType * GetOutput(unsigned int idx);
//void SetOutput(OutputType* output);
//{return Superclass::GetOutput();}
OutputType* GetOutput(unsigned int idx);
//virtual void GraftOutput(OutputType* graft);
//virtual void GraftNthOutput(unsigned int idx, OutputType *graft);
protected:
TbssImageSource();
virtual ~TbssImageSource(){}
};
} // namespace mitk
//#include "mitkTbssImageSource.cpp"
#endif /* _MITK_DIFFUSION_IMAGE_DATA_SOURCE_H_HEADER_ */
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImporter.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImporter.h
index 24fe2e37b1..1d16225aed 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImporter.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssImporter.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkTbssImporter_h
#define __mitkTbssImporter_h
#include "mitkCommon.h"
#include "mitkFileReader.h"
#include "itkImage.h"
#include "itkVectorImage.h"
#include "mitkTbssImage.h"
#include "MitkQuantificationExports.h"
namespace mitk
{
/**
* \brief Converts FSL TBSS data (4D skeleton projection images) to a NRRD image with meta data.
*
* The TBSS pipeline of FSL produces a 4D image containing the 3D skeleton projections of all individuals.
* This class converts the FSL Nifty image to NRRD and adds information about the type of measurement and the study groups.
*/
class MITKQUANTIFICATION_EXPORT TbssImporter : public itk::Object {
public:
// type of the 3d vector image containing the skeletonized images
typedef itk::VectorImage<float,3> DataImageType;
- mitkClassMacro( TbssImporter, Object )
+ mitkClassMacroItkParent( TbssImporter, itk::Object )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Converts the FSL Nifty to NRRD and adds the meta data */
mitk::TbssImage::Pointer Import();
template <typename TPixel>
void Import(const mitk::PixelType pixelType, mitk::TbssImage::Pointer tbssImg);
/** \brief Group info is set by providing a vector with pairs of group name and number*/
void SetGroupInfo(std::vector< std::pair<std::string, int> > groups)
{
m_Groups = groups;
}
/** \brief Used to indicate the type of measurement */
void SetMeasurementInfo(std::string s)
{
m_MeasurementInfo = s;
}
/** \brief Sets the FSL import volume */
void SetImportVolume(mitk::Image::Pointer inputVolume)
{
m_InputVolume = inputVolume;
}
protected:
TbssImporter(){}
virtual ~TbssImporter(){}
DataImageType::Pointer m_Data;
std::vector< std::pair<std::string, int> > m_Groups;
std::string m_MeasurementInfo;
mitk::Image::Pointer m_InputVolume;
};
}
#endif // __mitkTbssImporter_h
diff --git a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssRoiImageSource.h b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssRoiImageSource.h
index 27ffdd3a62..938b21c1e2 100644
--- a/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssRoiImageSource.h
+++ b/Modules/DiffusionImaging/Quantification/IODataStructures/TbssImages/mitkTbssRoiImageSource.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_TBSS_ROI_IMAGE_DATA_SOURCE_H_HEADER_
#define _MITK_TBSS_ROI_IMAGE_DATA_SOURCE_H_HEADER_
// Should be changed in a new type for TBSS
#include "mitkImageSource.h"
#include "MitkQuantificationExports.h"
namespace mitk {
class TbssRoiImage;
//##Documentation
//## @brief Superclass of all classes generating diffusion volumes (instances
//## of class DiffusionImage) as output.
//##
//## @ingroup Process
class MITKQUANTIFICATION_EXPORT TbssRoiImageSource : public ImageSource
{
public:
mitkClassMacro(TbssRoiImageSource, BaseDataSource)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef TbssRoiImage OutputType;
typedef itk::DataObject::Pointer DataObjectPointer;
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
OutputType* GetOutput(unsigned int idx);
protected:
TbssRoiImageSource();
virtual ~TbssRoiImageSource(){}
};
} // namespace mitk
#endif /* _MITK_DIFFUSION_IMAGE_DATA_SOURCE_H_HEADER_ */
diff --git a/Modules/DiffusionImaging/Quantification/Rendering/mitkTbssImageMapper.h b/Modules/DiffusionImaging/Quantification/Rendering/mitkTbssImageMapper.h
index 9aa29d231b..5a11c3ff9e 100644
--- a/Modules/DiffusionImaging/Quantification/Rendering/mitkTbssImageMapper.h
+++ b/Modules/DiffusionImaging/Quantification/Rendering/mitkTbssImageMapper.h
@@ -1,55 +1,55 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TbssImageMapper_H_HEADER_INCLUDED
#define TbssImageMapper_H_HEADER_INCLUDED
#include "mitkImageVtkMapper2D.h"
#include "MitkQuantificationExports.h"
namespace mitk {
//##Documentation
//## @brief Mapper for raw diffusion weighted images
//## @ingroup Mapper
class MITKQUANTIFICATION_EXPORT TbssImageMapper : public ImageVtkMapper2D
{
public:
mitkClassMacro(TbssImageMapper,ImageVtkMapper2D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- void GenerateDataForRenderer( mitk::BaseRenderer *renderer );
+ void GenerateDataForRenderer( mitk::BaseRenderer *renderer ) override;
static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = NULL, bool overwrite = false );
protected:
TbssImageMapper();
virtual ~TbssImageMapper();
};
} // namespace mitk
//#include "mitkTbssImageMapper.cpp"
#endif /* TbssImageMapper_H_HEADER_INCLUDED */
diff --git a/Modules/GraphAlgorithms/itkShortestPathCostFunction.h b/Modules/GraphAlgorithms/itkShortestPathCostFunction.h
index 34595b3f81..8d68f35d85 100644
--- a/Modules/GraphAlgorithms/itkShortestPathCostFunction.h
+++ b/Modules/GraphAlgorithms/itkShortestPathCostFunction.h
@@ -1,90 +1,90 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __itkShortestPathCostFunction_h
#define __itkShortestPathCostFunction_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkShapedNeighborhoodIterator.h"
namespace itk
{
// \brief this is a pure virtual superclass for all cost functions used in itkShortestPathImageFilter
template <class TInputImageType>
class ShortestPathCostFunction : public Object
{
public:
/** Standard class typedefs. */
typedef ShortestPathCostFunction Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef ShapedNeighborhoodIterator< TInputImageType > ShapedNeighborhoodIteratorType;
/** Run-time type information (and related methods). */
itkTypeMacro(ShortestPathCostFunction, Object);
/** Type definition for the input image. */
typedef TInputImageType ImageType;
// More typdefs for convenience
typedef typename TInputImageType::Pointer ImagePointer;
typedef typename TInputImageType::ConstPointer ImageConstPointer;
typedef typename TInputImageType::PixelType PixelType;
typedef typename TInputImageType::IndexType IndexType;
// \brief Set the input image.
itkSetConstObjectMacro(Image,TInputImageType);
// \brief Calculate the cost for going from pixel p1 to pixel p2
virtual double GetCost( IndexType p1, IndexType p2) = 0;
// \brief Return the minimal possible cost (needed for A*)
virtual double GetMinCost() = 0;
// \brief Initialize the metric
virtual void Initialize () = 0;
// \brief Set the starting index of a path
void SetStartIndex (const IndexType & index);
// \brief Set the ending index of a path
void SetEndIndex(const IndexType & index);
protected:
ShortestPathCostFunction() {};
virtual ~ShortestPathCostFunction() {};
- void PrintSelf(std::ostream& os, Indent indent) const;
+ void PrintSelf(std::ostream& os, Indent indent) const override;
ImageConstPointer m_Image;
IndexType m_StartIndex, m_EndIndex;
private:
ShortestPathCostFunction(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace itk
#include "itkShortestPathCostFunction.txx"
#endif /* __itkShortestPathCostFunction_h */
diff --git a/Modules/IGT/Common/mitkIGTTimeStamp.h b/Modules/IGT/Common/mitkIGTTimeStamp.h
index 6aaebe7dc5..46f1b8bd95 100644
--- a/Modules/IGT/Common/mitkIGTTimeStamp.h
+++ b/Modules/IGT/Common/mitkIGTTimeStamp.h
@@ -1,190 +1,190 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTIMESTAMP_H_HEADER_INCLUDED_
#define MITKTIMESTAMP_H_HEADER_INCLUDED_
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <MitkIGTExports.h>
#include "mitkRealTimeClock.h"
namespace mitk {
/**
* \brief Time stamp in milliseconds
*
* This class provides a timestamp in milliseconds.
* It is a Singleton class, that internally uses a mitkRealTimeClock() for
* time-acquisition.
*
* First you have to call Start() in order to set the reference-time to the current time.
* If the user has not created and set his own "RealTimeClock", initialize() will be called and a
* default mitkRealTimeClock() is created.
* In addition the TimeStamp() saves a pointer to the device calling and the respective offset-time.
* The first device will have an offset of 0, the following's offset will be the time elapsed since the
* starting of the first device. This offset can be prompted by calling GetOffset();
*
* You can always get the time elapsed since calling Start() with GetElapsed(). It returns the
* time spent in milliseconds as a double.
*
* When the TimeStamp is no longer used, you can call Stop(). This erases the pointer to the device
* and the offset. When all devices have "stopped tracking" the reference-time and the current-time are reset to 0.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT IGTTimeStamp : public itk::Object
{
public:
- mitkClassMacro(IGTTimeStamp, itk::Object);
+ mitkClassMacroItkParent(IGTTimeStamp, itk::Object);
/**
* \brief creates a new instance of mitkTimeStamp
*
* This method returns a pointer to the currently existing TimeStamp.
* If there is no exisiting instance, a new one is created and returned automatically
*
* DECREPATED: Use GetInstance instead
*/
static IGTTimeStamp* CreateInstance();
/**
* \brief returns a pointer to the current instance of mitkTimeStamp
*
* This method returns a pointer to the currently existing TimeStamp.
* If there is no exisiting instance, a new one is created and returned automatically
*/
static IGTTimeStamp* GetInstance();
/**
* \brief starts the time-acquisition
*
* Each device is to call this method when it starts tracking.
* The current time is saved as a reference-value (m_Time = 0).
* Internally the device (pointer) and its offset are saved in a map, so that
* no device can call this method twice.
* If the user has not set its own RealTimeClock, a default one is created dependant on the OS
* in use.
*
*/
void Start( itk::Object::Pointer device );
/**
* \brief stops the time-acqusition
*
* Each device has to call Stop() when it has finished and its
* pointer will be erased from the map. When the last device has "stopped"
* the reference-time and the current-time will be reset to 0.
*
*/
void Stop( itk::Object::Pointer device );
/**
* \brief returns the time elapsed since calling Start() for the first time in milliseconds
*
* GetElapsed() returns the time elapsed since Start() has been called first, no matter
* which itk::Object did the call.
* This method-call can be used if you want to need to have several processes you want to
* monitor and need timestamps in the same space of time, e.g. when using two tracking-devices
* on the same experiment.
*/
double GetElapsed();
/**
* \brief returns the time elapsed since 'device' called Start() in milliseconds
*
* GetElapsed(itk::Object device) returns the time elapsed since the given itk::Object called
* Start().
* This overloaded method should be used when you only have one independent process to keep
* track of, e.g. when you want to measure how long it takes to execute a piece of code.
*/
double GetElapsed(itk::Object::Pointer device);
/**
* \brief returns the offset of this device's starting-time to the
* reference-time in ms
*
* Device 'A' is the first device to call Start(). Device 'B' calls Start()
* some time later. This time-difference is the offset, that each device has realtive to the
* device that started the time-acquisition.
* Each device's offset is stored in a map with a pointer to the device.
*
* If this device has not been or is no longer saved in the map of devices,
* -1 will be returned.
*
*
* only used internally
*/
double GetOffset(itk::Object::Pointer Device);
/**
* \brief setter for the internally used RealTimeClock()
*
* If you want to use a "third-party" RealTimeClock, e.g PocoRealTimeClock, BoostRealTimeClock
* or ITKRealTimeClock, you can set it using this method:
* mitk::<bla>RealTimeClock::Pointer RealTimeClock = mitk::<bla>RealTimeClock::New();
* mitk::TimeStamp::GetInstance()->SetRealTimeClock(RealTimeClock);
*
* Right now, none of these RealTimeClocks have been implemented!!
*
* Notice: The mitk-implementation of an os-dependant RealTimeClock is used
* by default.
*/
void SetRealTimeClock(mitk::RealTimeClock::Pointer Clock);
/**
* \brief creates a new RealTimeClock
*
* Instanciates a new RealTimeClock, that will be specific for the Operating System.
* This will only be called internally when no other RealTimeClock has been set
* by the user.
*
*/
void Initialize();
protected:
IGTTimeStamp();
virtual ~IGTTimeStamp();
double GetCurrentStamp();
/* the current timestamp when GetCurrentStamp() is called. */
double m_Time;
/* the timestamp in ms acquired when Start() was called. */
double m_ReferenceTime;
/* pointer to the RealTimeClock used internally */
mitk::RealTimeClock::Pointer m_RealTimeClock;
/* pointer to the current instance */
static mitk::IGTTimeStamp::Pointer s_Instance;
/* map, in which pointer to all devices calling Start(), are saved */
std::map<itk::Object::Pointer, double> m_DeviceMap;
std::map<itk::Object::Pointer, double>::iterator m_MapIterator;
};
} // namespace mitk
#endif /* MITKTIMESTAMP_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/Common/mitkSerialCommunication.h b/Modules/IGT/Common/mitkSerialCommunication.h
index 5012ee3346..aa9df07f72 100644
--- a/Modules/IGT/Common/mitkSerialCommunication.h
+++ b/Modules/IGT/Common/mitkSerialCommunication.h
@@ -1,346 +1,346 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
#define MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_
#include <MitkIGTExports.h>
#include "mitkCommon.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#ifdef WIN32
#include <windows.h>
#else // Posix
#include <termios.h>
#endif
namespace mitk
{
/**Documentation
* \brief serial communication interface
*
* This class allows to send and receive data over a serial communication interface (COM Port).
* Define the serial interface that should be used either with SetPortNumber() or SetDeviceName()
* Next, define communication parameters: baud rate, number of data bits, number of stop bits,
* parity mode, usage of hardware handshake and timeout values (in ms).
* Use OpenConnection() to establish a connection on the serial interface with the selected
* parameters. While the connection is established, changes to the parameters will not take
* effect. You have to close the connection using CloseConnection() and then reopen it with
* the new parameters with OpenConnection().
*
* \ingroup IGT
*/
class MITKIGT_EXPORT SerialCommunication : public itk::Object
{
public:
- mitkClassMacro(SerialCommunication, itk::Object);
+ mitkClassMacroItkParent(SerialCommunication, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
enum PortNumber
{
COM1 = 1,
COM2 = 2,
COM3 = 3,
COM4 = 4,
COM5 = 5,
COM6 = 6,
COM7 = 7,
COM8 = 8,
COM9 = 9,
COM10 = 10,
COM11 = 11,
COM12 = 12,
COM13 = 13
};
enum BaudRate
{
BaudRate9600 = 9600,
BaudRate14400 = 14400,
BaudRate19200 = 19200,
BaudRate38400 = 38400,
BaudRate57600 = 57600,
BaudRate115200 = 115200, // Highest supported rate for NDI Aurora
BaudRate230400 = 230400,
BaudRate460800 = 460800,
BaudRate500000 = 500000,
BaudRate576000 = 576000,
BaudRate921600 = 921600,
BaudRate1000000 = 1000000,
BaudRate1152000 = 1152000,
// BaudRate1228739 = 1228739, // Highest supported rate for NDI Polaris According to handbook, unknown value to most compilers though
BaudRate1500000 = 1500000,
BaudRate2000000 = 2000000,
BaudRate2500000 = 2500000,
BaudRate3000000 = 3000000,
BaudRate3500000 = 3500000,
BaudRate4000000 = 4000000
};
enum DataBits
{
DataBits8 = 8,
DataBits7 = 7
};
enum Parity
{
None = 'N',
Odd = 'O',
Even = 'E'
};
enum StopBits
{
StopBits1 = 1,
StopBits2 = 2
};
enum HardwareHandshake
{
HardwareHandshakeOn = 1,
HardwareHandshakeOff = 0
};
/**
* \brief Opens connection to the COM port with port number m_PortNumber
* or the device name m_DeviceName and all port settings.
*
*/
int OpenConnection();
/**
* \brief Closes the connection
*
*/
void CloseConnection();
/**
* \brief Read numberOfBytes characters from the serial interface
*
* This method tries to read numberOfBytes characters from the serial
* interface or until an eol byte is received, whichever comes first. If
* The ReceiveTimeout is set to 0, the Receive() method will wait
* indefinetly until all characters are received or an eol character is
* received. If the ReceiveTimeout is set to another value, it will return
* after m_ReceiveTimeout milliseconds (or after all characters are read or
* an eol character is received).
*
* \param[out] answer String that stores the received characters. Note
* that this will overwrite the content of answer!
* \param[in] numberOfBytes The number of bytes to read. When an eol
* character is used this is interpretted as the
* maximum number of bytes to read.
* \param[in] eol Pointer to an End-of-Line character. If this is NULL
* (the default) then no End-of-Line character is used.
*/
int Receive(std::string& answer, unsigned int numberOfBytes, const char *eol=0);
/**
* \brief Send the string input
*
* \param[in] input The string to send to the serial interface. The string
* termination character \\0 is not sent.
* \param[in] block If false, the this method will return immediately. If
* true, this method will block until all bytes have been
* physically transmitted over the serial interface.
*/
int Send(const std::string& input, bool block = false);
/**
* \brief Send the break signal for ms milliseconds
*/
void SendBreak(unsigned int ms = 400);
/**
* \brief erase the receive buffer of the serial interface
*/
void ClearReceiveBuffer();
/**
* \brief erase the send buffer of the serial interface
*/
void ClearSendBuffer();
/**
* \brief Get the port number of the serial interface
*
* Returns the port number that will be used in the connection.
* The port number is only used if the m_DeviceName is empty ("").
*/
itkGetConstMacro(PortNumber, PortNumber);
/**
* \brief Set the port number of the serial interface
*
* SerialCommunication can either use PortNumber to create serial interface device names
* COM1 to COM9 for windows and /dev/ttyS0 to /dev/ttyS8 on linux
* (SetPortNumber(COM1) is mapped to /dev/ttyS0 and so on). Alternatively, use SetDeviceName()
* to set the device name directly (e.g. "CNCA0" for a com0com virtual com port or
* "/dev/ttyUSB0" for a USB to serial adapter on linux. If a device name is set (m_DeviceName != "")
* then OpenConnection() will try to open that device. Otherwise, it will build the device
* name using the port number
*/
itkSetMacro(PortNumber, PortNumber);
/**
* \brief Get the device name
*
* SerialCommunication can either use m_PortNumber to create serial interface device names
* or use m_DeviceName directly. This method allows to set an arbitrary device name
* that will be used to connect to the device. Common names are COM1, CNCA0, CNCB9
* on windows and /dev/ttyS0 or /dev/ttyUSB0 on linux.
*/
itkGetStringMacro(DeviceName);
/**
* \brief Set the device name
*
* if the device name is set (!=""), OpenConnection() will try to open the
* serial device on that device name. Normally, the serial interfaces are named COM1-COM9
* on windows and /dev/ttyS0 to /dev/ttyS9 on linux, but other names are possible too
* (e.g. /dev/ttyUSB0).
*/
itkSetStringMacro(DeviceName);
/**
* \brief Get the baud rate of the serial interface
*/
itkGetConstMacro(BaudRate, BaudRate);
/**
* \brief Set the baud rate of the serial interface
*/
itkSetMacro(BaudRate, BaudRate);
/**
* \brief Get the number of data bits of the serial interface
*/
itkGetConstMacro(DataBits, DataBits);
/**
* \brief Set the number of data bits of the serial interface
*/
itkSetMacro(DataBits, DataBits);
/**
* \brief Get the parity mode of the serial interface
*/
itkGetConstMacro(Parity, Parity);
/**
* \brief Set the parity mode of the serial interface
*/
itkSetMacro(Parity, Parity);
/**
* \brief Get number of stop bits of the serial interface
*/
itkGetConstMacro(StopBits, StopBits);
/**
* \brief Set number of stop bits of the serial interface
*/
itkSetMacro(StopBits, StopBits);
/**
* \brief returns true if hardware handshake should is used
*/
itkGetConstMacro(HardwareHandshake, HardwareHandshake);
/**
* \brief Set if hardware handshake should be used
*/
itkSetMacro(HardwareHandshake, HardwareHandshake);
/**
* \brief returns the send timeout in milliseconds
*/
itkGetConstMacro(SendTimeout, unsigned int);
/**
* \brief set the send timeout in milliseconds
*
* Only applies to WIN32, not POSIX
*/
itkSetMacro(SendTimeout, unsigned int);
/**
* \brief returns the receive timeout in milliseconds
*/
itkGetConstMacro(ReceiveTimeout, unsigned int);
/**
* \brief set the send timeout in milliseconds
*
* Specify the receive timeout in milliseconds.
* Setting this value to 0 will cause the Receive()
* method to wait until all expected characters are received.
*/
itkSetMacro(ReceiveTimeout, unsigned int);
protected:
SerialCommunication();
virtual ~SerialCommunication();
/**
* \brief configures the serial interface with all parameters
*
* This automatically reroutes the call to the hardware specific function
*/
int ApplyConfiguration();
#ifdef WIN32
/**
* \brief Applies the configuration for Windows
*/
int ApplyConfigurationWin();
#else
/**
* \brief Applies the configuration for Linux
*/
int ApplyConfigurationUnix();
#endif
std::string m_DeviceName; ///< device name that is used to connect to the serial interface (will be used if != "")
PortNumber m_PortNumber; ///< port number of the device
BaudRate m_BaudRate; ///< baud rate of the serial interface connection
DataBits m_DataBits; ///< number of data bits per symbol
Parity m_Parity; ///< parity mode
StopBits m_StopBits; ///< number of stop bits per symbol
HardwareHandshake m_HardwareHandshake; ///< whether to use hardware handshake for the connection
unsigned int m_ReceiveTimeout; ///< timeout for receiving data from the serial interface in milliseconds
unsigned int m_SendTimeout; ///< timeout for sending data to the serial interface in milliseconds
bool m_Connected; ///< is set to true if a connection currently established
#ifdef WIN32
HANDLE m_ComPortHandle;
DWORD m_PreviousMask;
COMMTIMEOUTS m_PreviousTimeout;
DCB m_PreviousDeviceControlBlock;
#else
int m_FileDescriptor;
#endif
};
} // namespace mitk
#endif /* MITKSERIALCOMMUNICATION_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/DataManagement/mitkNavigationData.h b/Modules/IGT/DataManagement/mitkNavigationData.h
index 09e9545c61..96929917dd 100644
--- a/Modules/IGT/DataManagement/mitkNavigationData.h
+++ b/Modules/IGT/DataManagement/mitkNavigationData.h
@@ -1,297 +1,297 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNAVIGATIONDATA_H_HEADER_INCLUDED_
#define MITKNAVIGATIONDATA_H_HEADER_INCLUDED_
#include <itkDataObject.h>
#include <MitkIGTExports.h>
#include <mitkCommon.h>
#include <mitkNumericTypes.h>
namespace mitk {
/**Documentation
* \brief Navigation Data
*
* This class represents the data object that is passed through the MITK-IGT navigation filter
* pipeline. It encapsulates position and orientation of a tracked tool/sensor. Additionally,
* it contains a data structure that contains error/plausibility information
*
* It provides methods to work with the affine transformation represented by its orientation and position.
* Additionally, it provides a constructor to construct a NavigationData object from an AffineTransform3D and
* a getter to create an AffineTransform3D from a NavigationData object.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationData : public itk::DataObject
{
public:
- mitkClassMacro(NavigationData, itk::DataObject);
+ mitkClassMacroItkParent(NavigationData, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkNewMacro2Param(Self, mitk::AffineTransform3D::Pointer, const bool);
mitkNewMacro1Param(Self, mitk::AffineTransform3D::Pointer);
/**
* \brief Type that holds the position part of the tracking data
*/
typedef mitk::Point3D PositionType;
/**
* \brief Type that holds the orientation part of the tracking data
*/
typedef mitk::Quaternion OrientationType;
/**
* \brief type that holds the error characterization of the position and orientation measurements
*/
typedef itk::Matrix<mitk::ScalarType,6,6> CovarianceMatrixType;
/**
* \brief type that holds the time at which the data was recorded
*/
typedef double TimeStampType;
/**
* \brief sets the position of the NavigationData object
*/
itkSetMacro(Position, PositionType);
/**
* \brief returns position of the NavigationData object
*/
itkGetConstMacro(Position, PositionType);
/**
* \brief sets the orientation of the NavigationData object
*/
itkSetMacro(Orientation, OrientationType);
/**
* \brief returns the orientation of the NavigationData object
*/
itkGetConstMacro(Orientation, OrientationType);
/**
* \brief returns true if the object contains valid data
*/
virtual bool IsDataValid() const;
/**
* \brief sets the dataValid flag of the NavigationData object indicating if the object contains valid data
*/
itkSetMacro(DataValid, bool);
/**
* \brief sets the IGT timestamp of the NavigationData object
*/
itkSetMacro(IGTTimeStamp, TimeStampType);
/**
* \brief gets the IGT timestamp of the NavigationData object
*/
itkGetConstMacro(IGTTimeStamp, TimeStampType);
/**
* \brief sets the HasPosition flag of the NavigationData object
*/
itkSetMacro(HasPosition, bool);
/**
* \brief gets the HasPosition flag of the NavigationData object
*/
itkGetConstMacro(HasPosition, bool);
/**
* \brief sets the HasOrientation flag of the NavigationData object
*/
itkSetMacro(HasOrientation, bool);
/**
* \brief gets the HasOrientation flag of the NavigationData object
*/
itkGetConstMacro(HasOrientation, bool);
/**
* \brief sets the 6x6 Error Covariance Matrix of the NavigationData object
*/
itkSetMacro(CovErrorMatrix, CovarianceMatrixType);
/**
* \brief gets the 6x6 Error Covariance Matrix of the NavigationData object
*/
itkGetConstMacro(CovErrorMatrix, CovarianceMatrixType);
/**
* \brief set the name of the NavigationData object
*/
itkSetStringMacro(Name);
/**
* \brief returns the name of the NavigationData object
*/
itkGetStringMacro(Name);
/**
* \brief Graft the data and information from one NavigationData to another.
*
* Copies the content of data into this object.
* This is a convenience method to setup a second NavigationData object with all the meta
* information of another NavigationData object.
* Note that this method is different than just using two
* SmartPointers to the same NavigationData object since separate DataObjects are
* still maintained.
*/
virtual void Graft(const DataObject *data);
/**
* \brief copy meta data of a NavigationData object
*
* copies all meta data from NavigationData data to this object
*/
virtual void CopyInformation(const DataObject* data);
/**
* \brief Prints the object information to the given stream os.
* \param os The stream which is used to print the output.
* \param indent Defines the indentation of the output.
*/
void PrintSelf(std::ostream& os, itk::Indent indent) const;
/**
* Set the position part of m_CovErrorMatrix to I*error^2
* This means that all position variables are assumed to be independent
*/
void SetPositionAccuracy(mitk::ScalarType error);
/**
* Set the orientation part of m_CovErrorMatrix to I*error^2
* This means that all orientation variables are assumed to be independent
*/
void SetOrientationAccuracy(mitk::ScalarType error);
/**
* \brief Calculate AffineTransform3D from the transformation held by this NavigationData.
* TODO: should throw an error if transformation is invalid.
*/
mitk::AffineTransform3D::Pointer GetAffineTransform3D() const;
/**
* \brief Calculate the RotationMatrix of this transformation.
*/
mitk::Matrix3D GetRotationMatrix() const;
/**
* \brief Transform by an affine transformation
*
* This method applies the affine transform given by self to a
* given point, returning the transformed point.
*/
mitk::Point3D TransformPoint(const mitk::Point3D point) const;
/**
* Get inverse of the Transformation represented by this NavigationData.
* @throws mitk::Exception in case the transformation is invalid (only case: quaternion is zero)
*/
mitk::NavigationData::Pointer GetInverse() const;
/** Compose with another NavigationData
*
* This method composes self with another NavigationData of the
* same dimension, 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. */
void Compose(const mitk::NavigationData::Pointer n, const bool pre = false);
protected:
mitkCloneMacro(Self);
NavigationData();
/*
* Copy constructor internally used.
*/
NavigationData(const mitk::NavigationData& toCopy);
/**
* Creates a NavigationData object from an affineTransform3D.
* Caution: NavigationData doesn't support spacing, only translation and rotation. If the affine
* transform includes spacing it cannot be converted to a NavigationData and an exception is thrown.
* @param checkForRotationMatrix if this is true, the rotation matrix coming from the affineTransform is checked
* for being a rotation matrix. If it isn't, an exception is thrown. Disable this check by
* setting checkForRotationMatrix to false.
*
* @throws mitkException if checkForRotationMatrix is true and a non rotation matrix was introduced by
* AffineTransform.
*/
NavigationData(mitk::AffineTransform3D::Pointer affineTransform3D, const bool checkForRotationMatrix = true);
virtual ~NavigationData();
/**
* \brief holds the position part of the tracking data
*/
PositionType m_Position;
/**
* \brief holds the orientation part of the tracking data
*/
OrientationType m_Orientation;
/**
* \brief A 6x6 covariance matrix parameterizing the Gaussian error
* distribution of the measured position and orientation.
*
* The hasPosition/hasOrientation fields define which entries
* are valid.
*/
CovarianceMatrixType m_CovErrorMatrix; ///< holds the error characterization of the position and orientation
/**
* \brief defines if position part of m_CovErrorMatrix is valid
*/
bool m_HasPosition;
/**
* \brief defines if orientation part of m_CovErrorMatrix is valid
*/
bool m_HasOrientation;
/**
* \brief defines if the object contains valid values
*/
bool m_DataValid;
/**
* \brief contains the time at which the tracking data was recorded
*/
TimeStampType m_IGTTimeStamp;
/**
* \brief name of the navigation data
*/
std::string m_Name;
private:
void ResetCovarianceValidity();
// pre = false
static mitk::NavigationData::Pointer getComposition(const mitk::NavigationData::Pointer nd1, const mitk::NavigationData::Pointer nd2);
};
/**
* @brief Equal A function comparing two navigation data objects for beeing equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - position
* - orientation
* - other members and flags of the class
*
* @param rightHandSide An NavigationData to be compared
* @param leftHandSide An NavigationData to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKIGT_EXPORT bool Equal( const mitk::NavigationData& leftHandSide, const mitk::NavigationData& rightHandSide, ScalarType eps = mitk::eps, bool verbose = false );
} // namespace mitk
#endif /* MITKNAVIGATIONDATA_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/DataManagement/mitkNavigationDataSource.h b/Modules/IGT/DataManagement/mitkNavigationDataSource.h
index 6b1601691e..3c6e2bdc72 100644
--- a/Modules/IGT/DataManagement/mitkNavigationDataSource.h
+++ b/Modules/IGT/DataManagement/mitkNavigationDataSource.h
@@ -1,185 +1,185 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNAVIGATIONDATASOURCE_H_HEADER_INCLUDED_
#define MITKNAVIGATIONDATASOURCE_H_HEADER_INCLUDED_
#include <itkProcessObject.h>
#include "mitkNavigationData.h"
#include "mitkPropertyList.h"
// Microservices
#include <mitkServiceInterface.h>
#include <usServiceRegistration.h>
namespace mitk {
/**Documentation
* \brief Navigation Data source
*
* Base class for all navigation filters that produce NavigationData objects as output.
* This class defines the output-interface for NavigationDataFilters.
* \warning: if Update() is called on any output object, all NavigationData filters will
* generate new output data for all outputs, not just the one on which Update() was called.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationDataSource : public itk::ProcessObject
{
public:
- mitkClassMacro(NavigationDataSource, itk::ProcessObject);
+ mitkClassMacroItkParent(NavigationDataSource, itk::ProcessObject);
/** @return Returns a human readable name of this source. There will be a default name,
* or you can set the name with the method SetName() if you want to change it.
*/
itkGetMacro(Name,std::string);
/** @brief Sets the human readable name of this source. There is also a default name,
* but you can use this method if you need to define it on your own.
*/
itkSetMacro(Name,std::string);
/**
*\brief return the output (output with id 0) of the filter
*/
NavigationData* GetOutput(void);
/**
*\brief return the output with id idx of the filter
*/
NavigationData* GetOutput(DataObjectPointerArraySizeType idx);
/**
*\brief return the output with name navDataName of the filter
*/
NavigationData* GetOutput(const std::string& navDataName);
/**
*\brief return the index of the output with name navDataName, -1 if no output with that name was found
*
* \warning if a subclass has outputs that have different data type than mitk::NavigationData, they have to overwrite this method
*/
DataObjectPointerArraySizeType GetOutputIndex(std::string navDataName);
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
* To unregister, call UnregisterMicroservice().
*/
virtual void RegisterAsMicroservice();
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
*/
virtual void UnRegisterMicroservice();
/**
*\brief Returns the id that this device is registered with. The id will only be valid, if the
* NavigationDataSource has been registered using RegisterAsMicroservice().
*/
std::string GetMicroserviceID();
/**
*\brief These Constants are used in conjunction with Microservices
*/
static const std::string US_INTERFACE_NAME;
static const std::string US_PROPKEY_DEVICENAME;
static const std::string US_PROPKEY_ID;
static const std::string US_PROPKEY_ISACTIVE; //NOT IMPLEMENTED YET!
/**
*\brief Graft the specified DataObject onto this ProcessObject's output.
*
* See itk::ImageSource::GraftNthOutput for details
*/
virtual void GraftNthOutput(unsigned int idx, itk::DataObject *graft);
/**
* \brief Graft the specified DataObject onto this ProcessObject's output.
*
* See itk::ImageSource::Graft Output for details
*/
virtual void GraftOutput(itk::DataObject *graft);
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
/**
* \brief Set all filter parameters as the PropertyList p
*
* This method allows to set all parameters of a filter with one
* method call. For the names of the parameters, take a look at
* the GetParameters method of the filter
* This method has to be overwritten by each MITK-IGT filter.
*/
virtual void SetParameters(const mitk::PropertyList*){};
/**
* \brief Get all filter parameters as a PropertyList
*
* This method allows to get all parameters of a filter with one
* method call. The returned PropertyList must be assigned to a
* SmartPointer immediately, or else it will get destroyed.
* Every filter must overwrite this method to create a filter-specific
* PropertyList. Note that property names must be unique over all
* MITK-IGT filters. Therefore each filter should use its name as a prefix
* for each property name.
* Secondly, each filter should list the property names and data types
* in the method documentation.
*/
virtual mitk::PropertyList::ConstPointer GetParameters() const;
/** Freezes the navigation data source which means the current state is frozen and the output
* navigation data stays at it is. Calling Update() does not have any effect until UnFreeze()
* is called. This also means that the data source is not updated any more. */
virtual void Freeze();
/** Unfreezes the data source. */
virtual void UnFreeze();
/** @return Returns whether the data source is currently frozen. */
itkGetMacro(IsFrozen,bool);
protected:
NavigationDataSource();
virtual ~NavigationDataSource();
std::string m_Name;
bool m_IsFrozen;
private:
us::ServiceRegistration<Self> m_ServiceRegistration;
};
} // namespace mitk
// This is the microservice declaration. Do not meddle!
MITK_DECLARE_SERVICE_INTERFACE(mitk::NavigationDataSource, "org.mitk.services.NavigationDataSource")
#endif /* MITKNAVIGATIONDATASOURCE_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/DataManagement/mitkNavigationTool.h b/Modules/IGT/DataManagement/mitkNavigationTool.h
index 4950fce6f0..360317e536 100644
--- a/Modules/IGT/DataManagement/mitkNavigationTool.h
+++ b/Modules/IGT/DataManagement/mitkNavigationTool.h
@@ -1,197 +1,197 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOL_H_INCLUDED
#define NAVIGATIONTOOL_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
#include <itkSpatialObject.h>
#include <itkDataObject.h>
//mitk headers
#include <mitkCommon.h>
#include <mitkDataNode.h>
#include <mitkPointSet.h>
#include <mitkTrackingTool.h>
#include <mitkTrackingTypes.h>
#include <mitkSurface.h>
#include <MitkIGTExports.h>
namespace mitk {
/**Documentation
* \brief An object of this class represents a navigation tool in the view of the software.
* A few informations like an identifier, a toolname, a surface and a itk spatial
* object are stored in such an object. The classes NavigationToolReader and
* are availiable to write/read tools to/from the harddisc. If you need a collection
* of navigation tools the class NavigationToolStorage could be used.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationTool : public itk::DataObject
{
public:
- mitkClassMacro(NavigationTool,itk::DataObject);
+ mitkClassMacroItkParent(NavigationTool,itk::DataObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
enum NavigationToolType {Instrument, Fiducial, Skinmarker, Unknown};
//## getter and setter ##
//NavigationToolType:
itkGetConstMacro(Type,NavigationToolType);
itkSetMacro(Type,NavigationToolType);
//Identifier:
itkGetConstMacro(Identifier,std::string);
itkSetMacro(Identifier,std::string);
//Datatreenode:
itkGetConstMacro(DataNode,mitk::DataNode::Pointer);
itkSetMacro(DataNode,mitk::DataNode::Pointer);
//SpatialObject:
itkGetConstMacro(SpatialObject,itk::SpatialObject<3>::Pointer);
itkSetMacro(SpatialObject,itk::SpatialObject<3>::Pointer);
//TrackingTool:
itkGetConstMacro(TrackingTool,mitk::TrackingTool::Pointer);
itkSetMacro(TrackingTool,mitk::TrackingTool::Pointer);
//CalibrationFile:
itkGetConstMacro(CalibrationFile,std::string);
void SetCalibrationFile(const std::string filename);
//Tool tip definition:
itkGetConstMacro(ToolTipPosition,mitk::Point3D);
itkSetMacro(ToolTipPosition,mitk::Point3D);
itkGetConstMacro(ToolTipOrientation,mitk::Quaternion);
itkSetMacro(ToolTipOrientation,mitk::Quaternion);
/** @return Returns the tooltip as transform object. */
mitk::AffineTransform3D::Pointer GetToolTipTransform();
/** @return Returns true if a tooltip is set, false if not. */
bool IsToolTipSet();
//Tool Landmarks:
/** For overview, here are descriptons of the two types of tool landmarks:
*
* tool calibration landmarks: These landmarks may be used clearly define the tools pose only by
* using landmarks in the tool coordinate system. E.g., two landmarks for a 5DoF tool and three
* landmarks for a 6DoF tool. These landmarks may be used, e.g., for a point based registration
* of a tool from image space to tracking space.
*
* tool registration landmarks: These landmarks are designed for representing defined landmarks
* on a tools surface. The number of these landmarks might exeed the number of tool calibration
* landmarks for reasons of redundancy and averaging. They are used for, e.g., manually registering
* the pose of a tool by visual markers in a CT scan. If you would use these landmarks to do a
* point based registration from image space to tracking space later, you might overweight the
* tool because of two many landmarks compared to other markers.
*
* @return Returns the tool registration landmarks which represent markers / special points on a
* tool that can be used for registration. The landmarks should be given in tool coordinates.
* If there are no landmarks defined for this tool the method returns an empty point set.
*/
itkGetConstMacro(ToolRegistrationLandmarks,mitk::PointSet::Pointer);
/** @brief Sets the tool registration landmarks which represent markers / special points on a
* tool that can be used for registration. The landmarks should be given in tool coordinates.
*/
itkSetMacro(ToolRegistrationLandmarks,mitk::PointSet::Pointer);
/** @return Returns the tool calibration landmarks for calibration of the defined points in the
* tool coordinate system, e.g. 2 landmarks for a 5DoF tool and 3 landmarks for a 6DoF tool.
*/
itkGetConstMacro(ToolCalibrationLandmarks,mitk::PointSet::Pointer);
/** @brief Sets the tool calibration landmarks for calibration of defined points in the
* tool coordinate system, e.g. 2 landmarks for a 5DoF tool and 3 landmarks for a 6DoF tool.
*/
itkSetMacro(ToolCalibrationLandmarks,mitk::PointSet::Pointer);
//SerialNumber:
itkGetConstMacro(SerialNumber,std::string);
itkSetMacro(SerialNumber,std::string);
//TrackingDeviceType:
itkGetConstMacro(TrackingDeviceType,mitk::TrackingDeviceType);
itkSetMacro(TrackingDeviceType,mitk::TrackingDeviceType);
//ToolName (only getter):
/** @return Returns the name of this navigation tool. Returns an empty string if there is
* no name (for example because the data node has not been set yet).
*
* Note: There is no setter for the name,
* because the name of the corresponding data node is used as tool name. So if you
* want to modify the name of this navigation tool only get the data node and modify
* its name.
*/
std::string GetToolName();
//ToolSurface (only getter):
/** @return Returns the surface of this navigation tool. Returns NULL if there is
* no surface (for example because the data node has not been set yet).
*
* Note: There is no setter for the surface,
* because the surface is the data of the corresponding data node. So if you
* want to set a new surface only get the data node and modify its data.
*/
mitk::Surface::Pointer GetToolSurface();
/**
* \brief Graft the data and information from one NavigationTool to another.
*
* Copies the content of data into this object.
* This is a convenience method to setup a second NavigationTool object with all the meta
* information of another NavigationTool object.
* Note that this method is different than just using two
* SmartPointers to the same NavigationTool object since separate DataObjects are
* still maintained.
*/
virtual void Graft(const DataObject *data);
//#######################
protected:
NavigationTool();
~NavigationTool();
//## data structure of a navigation tool object ##
std::string m_Identifier;
NavigationToolType m_Type;
/** @brief This DataNode holds a toolname and a tool surface */
mitk::DataNode::Pointer m_DataNode;
/** @brief This member variable holds a mathamatical description of the tool */
itk::SpatialObject<3>::Pointer m_SpatialObject;
/** @brief This member variable holds a pointer to the corresponding tracking tool in the hardware. */
mitk::TrackingTool::Pointer m_TrackingTool;
/** @brief The path to the calibration file of the tool. */
std::string m_CalibrationFile;
/** @brief A unique serial number of the tool which is needed to identify the tool correctly. This is very important
* in case of the NDI Aurora System. */
std::string m_SerialNumber;
/** @brief This member holds the tracking device type of the tool. */
mitk::TrackingDeviceType m_TrackingDeviceType;
/** @brief Holds landmarks for tool registration. */
mitk::PointSet::Pointer m_ToolRegistrationLandmarks;
/** @brief Holds landmarks for calibration of the defined points in the tool coordinate system,
* e.g. 2 landmarks for a 5DoF tool and 3 landmarks for a 6DoF tool.
*/
mitk::PointSet::Pointer m_ToolCalibrationLandmarks;
/** @brief Holds the position of the tool tip. */
mitk::Point3D m_ToolTipPosition;
/** @brief Holds the orientation of the tool tip. */
mitk::Quaternion m_ToolTipOrientation;
//#################################################
};
} // namespace mitk
#endif //NAVIGATIONTOOL
diff --git a/Modules/IGT/DataManagement/mitkNavigationToolStorage.h b/Modules/IGT/DataManagement/mitkNavigationToolStorage.h
index 8a264ffcc3..e1e617a977 100644
--- a/Modules/IGT/DataManagement/mitkNavigationToolStorage.h
+++ b/Modules/IGT/DataManagement/mitkNavigationToolStorage.h
@@ -1,181 +1,181 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOLSTORAGE_H_INCLUDED
#define NAVIGATIONTOOLSTORAGE_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include <MitkIGTExports.h>
#include "mitkNavigationTool.h"
#include <mitkDataStorage.h>
// Microservices
#include <mitkServiceInterface.h>
#include <usServiceRegistration.h>
#include <usServiceProperties.h>
namespace mitk {
/**Documentation
* \brief An object of this class represents a collection of navigation tools.
* You may add/delete navigation tools or store/load the whole collection
* to/from the harddisc by using the class NavigationToolStorageSerializer
* and NavigationToolStorageDeserializer.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationToolStorage : public itk::Object
{
public:
- mitkClassMacro(NavigationToolStorage,itk::Object);
+ mitkClassMacroItkParent(NavigationToolStorage,itk::Object);
/** @brief Constructs a NavigationToolStorage without reference to a DataStorage. The Data Nodes of tools have to be added and removed to a data storage outside this class.
* Normaly the other constructor should be used.
*/
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Constructs a NavigationToolStorage with reference to a DataStorage. The Data Nodes of tools are added and removed automatically to this data storage. */
mitkNewMacro1Param(Self,mitk::DataStorage::Pointer);
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
* To unregister, call UnregisterMicroservice(). Make sure to pass the id of the Device that this tool is connected to.
*/
virtual void RegisterAsMicroservice(std::string sourceID);
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
*/
virtual void UnRegisterMicroservice();
/**
*\brief Returns the id that this device is registered with. The id will only be valid, if the
* NavigationDataSource has been registered using RegisterAsMicroservice().
*/
std::string GetMicroserviceID();
/**
*\brief These constants are used in conjunction with Microservices
*/
static const std::string US_INTERFACE_NAME; // Name of the interface
static const std::string US_PROPKEY_SOURCE_ID; // ID of the device this ToolStorage is associated with
static const std::string US_PROPKEY_STORAGE_NAME; // name of the storage
/**
* @brief Adds a tool to the storage. Be sure that the tool has a unique
* identifier which is not already part of this storage.
* @return Returns true if the tool was added to the storage, false if not
* (false can be returned if the identifier already exists in this storage
* for example).
*/
bool AddTool(mitk::NavigationTool::Pointer tool);
/**
* @return Returns the tracking tool at the position "number"
* in the storage. Returns NULL if there is no
* tracking tool at this position.
*/
mitk::NavigationTool::Pointer GetTool(int number);
/**
* @return Returns the tracking tool with the given identifier.
* Returns NULL if there is no
* tracking tool with this identifier in the storage.
*/
mitk::NavigationTool::Pointer GetTool(std::string identifier);
/**
* @return Returns the tracking tool with the given name.
* Returns NULL if there is no
* tracking tool with this name in the storage.
*/
mitk::NavigationTool::Pointer GetToolByName(std::string name);
/** Assigns the given number to the tool with the given identifier. This means the tool is swapped with another tool in the internal tool vector.
* @return Returns true if the assignment was successfull. Returns false if assignment is not possible, e.g. because the identifier does not exist or if the given number is not available.
**/
bool AssignToolNumber(std::string identifier1, int number2);
/**
* @brief Deletes a tool from the collection.
* Warning, this method operates on the data storage and is not thread save. Calling it from outside the main thread may cause crashes.
*/
bool DeleteTool(int number);
/**
* @brief Deletes all tools from the collection.
* Warning, this method operates on the data storage and is not thread save. Calling it from outside the main thread may cause crashes.
*/
bool DeleteAllTools();
/**
* @return Returns the number of tools stored in the storage.
*/
int GetToolCount();
/**
* @return Returns true if the storage is empty, false if not.
*/
bool isEmpty();
/**
* @return Returns the corresponding data storage if one is set to this NavigationToolStorage.
* Returns NULL if none is set.
*/
itkGetMacro(DataStorage,mitk::DataStorage::Pointer);
/** Sets the name of this storage. The name should be understandable for the user.
* Something like "NDI Aurora Tool Storage". If a storage is loaded from the harddisk
* the name might be the filename.
*/
void SetName(std::string);
/** @return Returns the name of this storage. */
itkGetConstMacro(Name,std::string);
/** Locks the storage. A logged storage may not be modified.
* If a method tries to modify the storage anyway a waring message is given.
* The storage is unlocked by default. A Storage might be locked when a
* tracking device is active and needs the storage to stay consistent.
*/
void LockStorage();
/** Unlocks the storage again. */
void UnLockStorage();
/** @return Returns true if the storage is locked at the moment, false if not. */
bool isLocked();
protected:
NavigationToolStorage();
NavigationToolStorage(mitk::DataStorage::Pointer);
~NavigationToolStorage();
std::vector<mitk::NavigationTool::Pointer> m_ToolCollection;
mitk::DataStorage::Pointer m_DataStorage;
std::string m_Name;
bool m_storageLocked;
private:
us::ServiceRegistration<Self> m_ServiceRegistration;
us::ServiceProperties m_props;
};
} // namespace mitk
MITK_DECLARE_SERVICE_INTERFACE(mitk::NavigationToolStorage, "org.mitk.services.NavigationToolStorage")
#endif //NAVIGATIONTOOLSTORAGE
diff --git a/Modules/IGT/DataManagement/mitkTrackingDeviceSourceConfigurator.h b/Modules/IGT/DataManagement/mitkTrackingDeviceSourceConfigurator.h
index ab71f032f2..16a274e1dc 100644
--- a/Modules/IGT/DataManagement/mitkTrackingDeviceSourceConfigurator.h
+++ b/Modules/IGT/DataManagement/mitkTrackingDeviceSourceConfigurator.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRACKINGDEVICESOURCECONFIGURATOR_H_HEADER_INCLUDED_
#define MITKTRACKINGDEVICESOURCECONFIGURATOR_H_HEADER_INCLUDED_
#include <MitkIGTExports.h>
//itk includes
#include <itkObject.h>
//mitk IGT includes
#include "mitkTrackingDeviceSource.h"
#include "mitkNavigationToolStorage.h"
#include "mitkNavigationDataObjectVisualizationFilter.h"
namespace mitk {
/**Documentation
* \brief This class offers a factory method for objects of the class TrackingDeviceSource. It initializes this TrackingDeviceSource with
* the given navigation tools and the given tracking device. The factory method also checks if all tools are valid and of the same
* type like the TrackingDevice. You can do this check before trying to create the TrackingDeviceSource by calling the method
* IsCreateTrackingDeviceSourcePossible(), if it returns false you might want to get the error message by calling the method
* GetErrorMessage().
* \ingroup IGT
*/
class MITKIGT_EXPORT TrackingDeviceSourceConfigurator : public itk::Object
{
public:
- mitkClassMacro(TrackingDeviceSourceConfigurator, itk::Object);
+ mitkClassMacroItkParent(TrackingDeviceSourceConfigurator, itk::Object);
mitkNewMacro2Param(Self,mitk::NavigationToolStorage::Pointer,mitk::TrackingDevice::Pointer);
/** @return Returns if it's possible to create a tracking device source, which means the tools are checked
* if they are of the same type like the tracking device, etc. If it returns false you can get
* the reason for this by getting the error message.
*/
bool IsCreateTrackingDeviceSourcePossible();
/** @return Returns a new TrackingDeviceSource. Returns NULL if there was an error on creating the
* TrackingDeviceSource. If there was an error it's availiable as error message.
*/
mitk::TrackingDeviceSource::Pointer CreateTrackingDeviceSource();
/** @return Returns a new TrackingDeviceSource. Returns NULL if there was an error on creating the
* TrackingDeviceSource. If there was an error it's availiable as error message.
* @param visualizationFilter (return value) returns a visualization filter which is already connected to the tracking device source.
* This filter visualises the surfaces which are availiable by the navigation tool storage.
*/
mitk::TrackingDeviceSource::Pointer CreateTrackingDeviceSource(mitk::NavigationDataObjectVisualizationFilter::Pointer &visualizationFilter);
/** @return Returns the internal number of the corresponding tool in the tool storage of a output navigation data. Returns -1 if there was an error. */
int GetToolNumberInToolStorage(unsigned int outputID);
/** @return Returns the identifier of the corresponding tool in the tool storage of a output navigation data. Returns an empty string if there was an error.*/
std::string GetToolIdentifierInToolStorage(unsigned int outputID);
/** @return Returns a vector with all internal numbers of the corresponding tools in the tool storage of all outputs.
* The order is the same like the order of the outputs. Returns an empty vector if there was an error.
*/
std::vector<int> GetToolNumbersInToolStorage();
/** @return Returns a vector with all identifier of the corresponding tools in the tool storage of all outputs.
* The order is the same like the order of the outputs. Returns an empty vector if there was an error.
*/
std::vector<std::string> GetToolIdentifiersInToolStorage();
/** @return Returns a modified navigation tool storage which holds the tools currently in use in
* the same order like the output ids of the pipline.
*/
mitk::NavigationToolStorage::Pointer GetUpdatedNavigationToolStorage();
/** @return Returns the current error message. Returns an empty string if there was no error.
*/
std::string GetErrorMessage();
protected:
TrackingDeviceSourceConfigurator(mitk::NavigationToolStorage::Pointer NavigationTools, mitk::TrackingDevice::Pointer TrackingDevice);
virtual ~TrackingDeviceSourceConfigurator();
mitk::NavigationToolStorage::Pointer m_NavigationTools;
mitk::TrackingDevice::Pointer m_TrackingDevice;
std::string m_ErrorMessage;
std::vector<int> m_ToolCorrespondencesInToolStorage;
mitk::TrackingDeviceSource::Pointer CreateNDIPolarisTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools);
mitk::TrackingDeviceSource::Pointer CreateNDIAuroraTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools);
mitk::TrackingDeviceSource::Pointer CreateMicronTrackerTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools);
mitk::TrackingDeviceSource::Pointer CreateNPOptitrackTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools);
mitk::TrackingDeviceSource::Pointer CreateVirtualTrackingDeviceSource(mitk::TrackingDevice::Pointer trackingDevice, mitk::NavigationToolStorage::Pointer navigationTools);
mitk::NavigationDataObjectVisualizationFilter::Pointer CreateNavigationDataObjectVisualizationFilter(mitk::TrackingDeviceSource::Pointer trackingDeviceSource, mitk::NavigationToolStorage::Pointer navigationTools);
};
} // namespace mitk
#endif /* MITKTrackingDeviceSource_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/IO/mitkNavigationDataReaderInterface.h b/Modules/IGT/IO/mitkNavigationDataReaderInterface.h
index 608e65ee2e..45612ebf0d 100644
--- a/Modules/IGT/IO/mitkNavigationDataReaderInterface.h
+++ b/Modules/IGT/IO/mitkNavigationDataReaderInterface.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNavigationDataReaderInterface_H_HEADER_INCLUDED_
#define MITKNavigationDataReaderInterface_H_HEADER_INCLUDED_
#include "itkObject.h"
#include "mitkCommon.h"
#include "mitkNavigationDataSet.h"
namespace mitk {
class MITKIGT_EXPORT NavigationDataReaderInterface : public itk::Object
{
public:
- mitkClassMacro(NavigationDataReaderInterface, itk::Object);
+ mitkClassMacroItkParent(NavigationDataReaderInterface, itk::Object);
virtual mitk::NavigationDataSet::Pointer Read(std::string filename) = 0;
protected:
NavigationDataReaderInterface();
virtual ~NavigationDataReaderInterface();
};
}
#endif // MITKNavigationDataReaderInterface_H_HEADER_INCLUDED_
diff --git a/Modules/IGT/IO/mitkNavigationDataRecorderDeprecated.h b/Modules/IGT/IO/mitkNavigationDataRecorderDeprecated.h
index 709cab62f7..c83f260dac 100644
--- a/Modules/IGT/IO/mitkNavigationDataRecorderDeprecated.h
+++ b/Modules/IGT/IO/mitkNavigationDataRecorderDeprecated.h
@@ -1,212 +1,212 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_NavigationDataRecorderDeprecated_H
#define _MITK_NavigationDataRecorderDeprecated_H
#include <itkProcessObject.h>
#include "mitkNavigationData.h"
#include <iostream>
#include <mitkRealTimeClock.h>
namespace mitk
{
/**Documentation
* \brief This class records NavigationData objects.
*
* The output of this class is formated as a XML document.
*
* Internal this class uses streams for recording NavigationData objects. Therefore different types of output are possible
* and can be set with the SetOutputMode() method. The default output is directed to the console. If you want to save into a
* file you have to set a file name and the path. The recording is started with the call of the method StartRecording(). Now
* every Update() stores the current state of the added NavigationDatas. With StopRecording() the stream is stopped. With
* another call of StartRecording() the output is written to a new file with incremented filename counter.
*
* \warning At the moment there is no check if the file is already existing and this class will override existing files.
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationDataRecorderDeprecated : public itk::ProcessObject
{
public:
- mitkClassMacro( NavigationDataRecorderDeprecated, itk::ProcessObject );
+ mitkClassMacroItkParent( NavigationDataRecorderDeprecated, itk::ProcessObject );
itkNewMacro( Self );
/**Documentation
* \brief Determines where the output is directed to
*
* Console: std::cout
* NormalFile: std::ofstream
* ZipFile: Not supported yet -> std::cout
*/
enum RecordingMode
{
Console,
NormalFile,
ZipFile
};
/**Documentation
* \brief Determines the output format
*
* xml: XML format, also default, can be read by NavigationDataPlayer
* csv: use to export in excel, matlab, etc.
*/
enum OutputFormatEnum
{
xml,
csv
};
/**
* \brief sets the file name for the OutputMode NormalFile and ZipFile
*
* Any extensions will be cut
* \warning existing files will be overridden
* \warning do not use "." in file names at the end
*/
DEPRECATED( itkSetStringMacro(FileName));
/**
* \brief Returns the file name of the recording file (in OutputMode NormalFile and ZipFile)
*/
DEPRECATED( itkGetStringMacro(FileName));
/**
* \brief If true the recorder will never overwrite a file
*/
DEPRECATED( itkSetMacro(DoNotOverwriteFiles,bool));
/**
* \brief Returns whether the NavigationDataRecorderDeprecated is recording or not
*/
DEPRECATED( itkGetMacro(Recording,bool));
/**
* \brief Returns the recording mode
*/
DEPRECATED( itkGetMacro(RecordingMode,RecordingMode));
/**
* \brief Returns the number of data sets / frames which were recorded by the NavigationDataRecorderDeprecated since start
*/
DEPRECATED( itkGetMacro(RecordCounter,int));
/**
* \brief Sets a limit of recorded data sets / frames. Recording will be stopped if the number is reached. -1 disables the limit, -1 is default value as well.
*/
DEPRECATED( itkSetMacro(RecordCountLimit,int));
/**
* \brief Adds the input NavigationDatas
*/
DEPRECATED( virtual void AddNavigationData(const NavigationData* nd));
///
/// set an additional attribute for a specified navigation data
/// this will be written for each navigation data and may be
/// updated before calling Update()
///
DEPRECATED( void SetAdditionalAttribute( const NavigationData* nd, const std::string& attributeName
, const std::string& attributeValue ));
DEPRECATED(void RemoveAdditionalAttribute( const NavigationData* nd ));
/**
* Documentation
* \brief Starts the recording with the presetted OutputMode.
* This method calls StartRecording(std::ostream*).
* Does nothing if the recorder is already recording and
* the method StartRecording is called again.
* @throw mitk::IGTException Throws an exception if no file name or file path is set.
*/
DEPRECATED( void StartRecording());
/**
* Documentation
* \brief Starts the recording with an own preinitialized stream
* Does nothing if it is already recording and method StartRecorded is called
* @throw mitk::IGTException Throws an exception if the stream is not good.
*/
DEPRECATED( void StartRecording(std::ostream* stream));
/**Documentation
* \brief Stops the recording and closes the stream
*/
DEPRECATED( void StopRecording());
/**Documentation
* \brief Every call of update causes one line for each added NavigationData in the output if the recording was started
*/
DEPRECATED( virtual void Update());
/**Documentation
* \brief Sets the recording mode which causes different types of output streams
* see enum RecordingMode
*/
DEPRECATED( void SetRecordingMode(RecordingMode mode));
/**Documentation
* \brief Sets the output format which causes different formats of output streams. The XML format is default.
* Also see enum OutputFormat for more information.
*/
DEPRECATED( itkSetMacro(OutputFormat,mitk::NavigationDataRecorderDeprecated::OutputFormatEnum));
protected:
/**Documentation
* \brief filter execute method here it is not used
*
*/
virtual void GenerateData();
NavigationDataRecorderDeprecated();
virtual ~NavigationDataRecorderDeprecated();
std::string m_FileName; ///< stores the file name and path
unsigned int m_NumberOfInputs; ///< counts the numbers of added input NavigationDatas
std::ostream* m_Stream; ///< the output stream
bool m_StreamMustBeDeleted;
RecordingMode m_RecordingMode; ///< stores the mode see enum RecordingMode
OutputFormatEnum m_OutputFormat; ///< stores the output format; see enum OutputFormat
bool m_Recording; ///< indicates whether the recording is started or not
int m_RecordCounter; ///< counts the number of frames which are recorded since StartRecording
int m_RecordCountLimit; ///< limits the number of frames, recording will be stopped if the limit is reached. -1 disables the limit
bool m_firstLine; //for the csv writer to detect wether the header must be written
unsigned int m_NumberOfRecordedFiles; ///< necessary for the naming of the file if there is more than one start-stop cycle
mitk::RealTimeClock::Pointer m_SystemTimeClock; ///< system time clock for system time tag in output xml file
bool m_DoNotOverwriteFiles; ///< do not overwrite any files if true
std::map<const mitk::NavigationData*, std::pair<std::string, std::string> > m_AdditionalAttributes;
};
}
#endif // #define _MITK_POINT_SET_SOURCE_H
diff --git a/Modules/IGT/IO/mitkNavigationToolReader.h b/Modules/IGT/IO/mitkNavigationToolReader.h
index ac8fa37529..91afd131f4 100644
--- a/Modules/IGT/IO/mitkNavigationToolReader.h
+++ b/Modules/IGT/IO/mitkNavigationToolReader.h
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOLREADER_H_INCLUDED
#define NAVIGATIONTOOLREADER_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include "mitkNavigationTool.h"
#include "mitkDataStorage.h"
#include "mitkNavigationToolStorageDeserializer.h"
#include <MitkIGTExports.h>
namespace mitk {
/**Documentation
* \brief This class offers methods to read objects of the class NavigationTool from the
* harddisc. The tools have to be saved in a special format by the class NavigationToolWriter
* to be loadable.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationToolReader : public itk::Object
{
friend class mitk::NavigationToolStorageDeserializer;
public:
- mitkClassMacro(NavigationToolReader,itk::Object);
+ mitkClassMacroItkParent(NavigationToolReader,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief This method reads a navigation tool from a file.
* @param filename The filename where the tool is stored, "C:\temp\myTool.igtTool" for example.
* @return Returns a pointer to the tool which was read. Returns NULL, if something went
* wrong and no tool was read. In this case you may also want the error message which is availiable
* from the method GetErrorMessage().
*/
mitk::NavigationTool::Pointer DoRead(std::string filename);
itkGetMacro(ErrorMessage,std::string);
protected:
NavigationToolReader();
~NavigationToolReader();
std::string m_ErrorMessage;
std::string m_ToolfilePath; //This path is used to store the toolfiles. It must be available through the whole MITK run.
mitk::NavigationTool::Pointer ConvertDataNodeToNavigationTool(mitk::DataNode::Pointer node, std::string toolPath);
//################### protected help methods ########################
std::string GetFileWithoutPath(std::string FileWithPath);
mitk::PointSet::Pointer ConvertStringToPointSet(std::string string);
mitk::Point3D ConvertStringToPoint(std::string string);
mitk::Quaternion ConvertStringToQuaternion(std::string string);
void split(std::string& text, std::string& separators, std::vector<std::string>& words);
};
} // namespace mitk
#endif //NAVIGATIONTOOLREADER
diff --git a/Modules/IGT/IO/mitkNavigationToolStorageDeserializer.h b/Modules/IGT/IO/mitkNavigationToolStorageDeserializer.h
index c84ac94ca3..7154f0eff9 100644
--- a/Modules/IGT/IO/mitkNavigationToolStorageDeserializer.h
+++ b/Modules/IGT/IO/mitkNavigationToolStorageDeserializer.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOLSTORAGEDESERIALIZER_H_INCLUDED
#define NAVIGATIONTOOLSTORAGEDESERIALIZER_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include <mitkDataStorage.h>
#include "mitkNavigationToolStorage.h"
#include <MitkIGTExports.h>
namespace mitk {
/**Documentation
* \brief This class offers methods to load an object of the class NavigationToolStorage
* from the harddisc.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationToolStorageDeserializer : public itk::Object
{
public:
- mitkClassMacro(NavigationToolStorageDeserializer,itk::Object);
+ mitkClassMacroItkParent(NavigationToolStorageDeserializer,itk::Object);
mitkNewMacro1Param(Self,mitk::DataStorage::Pointer);
/**
* @brief Loads a collection of navigation tools represented by a mitk::NavigationToolStorage
* from a file.
* @return Returns the storage which was loaded or an empty storage if there was an error in the loading process.
* @throw mitk::IGTException Throws an Exception if the file cannot be decopressed.
* @throw mitk::IGTException Throws an Exception if no tool was found inside the storage.
*/
mitk::NavigationToolStorage::Pointer Deserialize(std::string filename);
itkGetMacro(ErrorMessage,std::string);
protected:
NavigationToolStorageDeserializer(mitk::DataStorage::Pointer dataStorage);
~NavigationToolStorageDeserializer();
std::string m_ErrorMessage;
mitk::DataStorage::Pointer m_DataStorage;
std::string m_tempDirectory;
std::string convertIntToString(int i);
/**
* @throws Throws an Exception if particular file cannot be opened for reading
*/
void decomressFiles(std::string file,std::string path);
};
} // namespace mitk
#endif //NAVIGATIONTOOLSTORAGEDESERIALIZER
diff --git a/Modules/IGT/IO/mitkNavigationToolStorageSerializer.h b/Modules/IGT/IO/mitkNavigationToolStorageSerializer.h
index bb3cced543..4f756f4fbf 100644
--- a/Modules/IGT/IO/mitkNavigationToolStorageSerializer.h
+++ b/Modules/IGT/IO/mitkNavigationToolStorageSerializer.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOLSTORAGESERIALIZER_H_INCLUDED
#define NAVIGATIONTOOLSTORAGESERIALIZER_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include "mitkNavigationToolStorage.h"
#include <MitkIGTExports.h>
namespace mitk {
/**Documentation
* \brief This class offers methods to save an object of the class NavigationToolStorage
* to the harddisc.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationToolStorageSerializer : public itk::Object
{
public:
- mitkClassMacro(NavigationToolStorageSerializer,itk::Object);
+ mitkClassMacroItkParent(NavigationToolStorageSerializer,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief Saves a mitk navigation tool storage to a file.
* @return Returns true always true since error handling was converted to exception handling.
* The return value is decrepated. Will be changed to void.
* @throw mitk::IGTIOException Throws an exception if the given filename cannot be opened for writing or
* if the temp directory is not accessible.
*/
bool Serialize(std::string filename, mitk::NavigationToolStorage::Pointer storage);
/**
* @brief This method is decrepated. Exceptions are used for error handling now!
* @return Returns always an empty string since error handling was converted to exception handling.
*/
itkGetMacro(ErrorMessage,std::string);
protected:
NavigationToolStorageSerializer();
~NavigationToolStorageSerializer();
std::string m_ErrorMessage;
std::string convertIntToString(int i);
std::string m_tempDirectory;
};
} // namespace mitk
#endif //NAVIGATIONTOOLSTORAGESERIALIZER
diff --git a/Modules/IGT/IO/mitkNavigationToolWriter.h b/Modules/IGT/IO/mitkNavigationToolWriter.h
index 1193e60382..82a8f7b80c 100644
--- a/Modules/IGT/IO/mitkNavigationToolWriter.h
+++ b/Modules/IGT/IO/mitkNavigationToolWriter.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONTOOLWRITER_H_INCLUDED
#define NAVIGATIONTOOLWRITER_H_INCLUDED
//itk headers
#include <itkObjectFactory.h>
//mitk headers
#include <mitkCommon.h>
#include "mitkNavigationTool.h"
#include "mitkNavigationToolStorageSerializer.h"
#include <MitkIGTExports.h>
namespace mitk
{
/**Documentation
* \brief This class offers methods to write objects of the class navigation tool permanently
* to the harddisk. The objects are saved in a special fileformat which can be read
* by the class NavigationToolReader to restore the object.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationToolWriter : public itk::Object
{
friend class mitk::NavigationToolStorageSerializer;
public:
- mitkClassMacro(NavigationToolWriter,itk::Object);
+ mitkClassMacroItkParent(NavigationToolWriter,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief Writes a navigation tool to a file.
* @param FileName The filename (complete, with path, C:/temp/myTool.igtTool for example)
* @param Tool The tool which should be written to the file.
* @return Returns true if the file was written successfully, false if not. In the second
* case you can get the error message by using the method GetErrorMessage().
*/
bool DoWrite(std::string FileName,mitk::NavigationTool::Pointer Tool);
itkGetMacro(ErrorMessage,std::string);
protected:
NavigationToolWriter();
~NavigationToolWriter();
std::string m_ErrorMessage;
mitk::DataNode::Pointer ConvertToDataNode(mitk::NavigationTool::Pointer Tool);
std::string GetFileWithoutPath(std::string FileWithPath);
std::string ConvertPointSetToString(mitk::PointSet::Pointer pointSet);
std::string ConvertPointToString(mitk::Point3D point);
std::string ConvertQuaternionToString(mitk::Quaternion quat);
};
} // namespace mitk
#endif //NAVIGATIONTOOLWRITER
diff --git a/Modules/IGT/Rendering/mitkNavigationDataVisualizationFilter.h b/Modules/IGT/Rendering/mitkNavigationDataVisualizationFilter.h
index 1df5dd3d4e..f00bd2395d 100644
--- a/Modules/IGT/Rendering/mitkNavigationDataVisualizationFilter.h
+++ b/Modules/IGT/Rendering/mitkNavigationDataVisualizationFilter.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef NAVIGATIONDATAVISUALIZATIONFILTER_H_INCLUDED
#define NAVIGATIONDATAVISUALIZATIONFILTER_H_INCLUDED
#include <itkProcessObject.h>
#include "mitkBaseRenderer.h"
#include "mitkCommon.h"
#include "mitkNavigationData.h"
#include "mitkNavigationDataToNavigationDataFilter.h"
namespace mitk {
/**Documentation
* \brief NavigationDataVisualizationFilter represents the superclass of all IGT Filters that visualize NavigationData
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationDataVisualizationFilter : public mitk::NavigationDataToNavigationDataFilter
{
public:
- mitkClassMacro(NavigationDataVisualizationFilter,itk::ProcessObject);
+ mitkClassMacroItkParent(NavigationDataVisualizationFilter,itk::ProcessObject);
/**Documentation
* \brief Set the input of this filter
*/
virtual void SetInput( const NavigationData* nd);
/**Documentation
* \brief Set input with id idx of this filter
*/
virtual void SetInput( unsigned int idx, const NavigationData* nd);
/**Documentation
* \brief Get the input of this filter
*/
const NavigationData* GetInput(void);
/**Documentation
* \brief Get the input with id idx of this filter
*/
const NavigationData* GetInput(unsigned int idx);
protected:
NavigationDataVisualizationFilter();
virtual ~NavigationDataVisualizationFilter();
virtual void GenerateData()=0;
};
} // namespace mitk
#endif
diff --git a/Modules/IGT/TrackingDevices/mitkClaronInterface.h b/Modules/IGT/TrackingDevices/mitkClaronInterface.h
index 73f4f57e89..5778ba854f 100644
--- a/Modules/IGT/TrackingDevices/mitkClaronInterface.h
+++ b/Modules/IGT/TrackingDevices/mitkClaronInterface.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCLARONINTERFACE_H_HEADER_INCLUDED_
#define MITKCLARONINTERFACE_H_HEADER_INCLUDED_
#define MTC(func) {int r = func; if (r!=mtOK) printf("MTC error: %s\n",MTLastErrorString()); };
#include <vector>
#include <string>
#include <MitkIGTExports.h>
#include "mitkCommon.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#ifdef _WIN64 //Defined for applications for Win64.
typedef long mtHandle;
#else
typedef int mtHandle;
#endif
namespace mitk
{
typedef int claronToolHandle;
/** Documentation:
* \brief An object of this class represents the interface to the MicronTracker. The methods of this class
* are calling the c-functions which are provided by the MTC-library. If the MicronTracker is not in
* use, which means the CMake-variable "MITK_USE_MICRON_TRACKER" is set to OFF, this class is replaced
* by a stub class called "ClaronInterfaceStub".
* \ingroup IGT
*/
class MITKIGT_EXPORT ClaronInterface : public itk::Object
{
public:
- mitkClassMacro(ClaronInterface,itk::Object);
+ mitkClassMacroItkParent(ClaronInterface,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Initialization of claroninterface.
* \param calibrationDir The directory where the device can find the camera calibration file.
* \param toolFilesDir The directory for the tool files.
*/
void Initialize(std::string calibrationDir, std::string toolFilesDir);
/**
* \brief Opens the connection to the device and makes it ready to track tools.
* \return Returns true if there is a connection to the device and the device is ready to track tools, false if not.
*/
bool StartTracking();
/**
* \brief Clears all resources. After this method have been called the system isn't ready to track any longer.
* \return Returns true if the operation was succesful, false if not.
*/
bool StopTracking();
/**
* \return Returns all tools which have been detected at the last frame grab.
*/
std::vector<claronToolHandle> GetAllActiveTools();
/**
* \return Returns the position of the tooltip. If no tooltip is defined the Method returns the position of the tool.
*/
std::vector<double> GetTipPosition(claronToolHandle c);
/**
* \return Returns the quarternions of the tooltip. If no tooltip is defined the Method returns the quarternions of the tool.
*/
std::vector<double> GetTipQuaternions(claronToolHandle c);
/**
* \return Returns the position of the tool
*/
std::vector<double> GetPosition(claronToolHandle c);
/**
* \return Returns the quaternion of the tool.
*/
std::vector<double> GetQuaternions(claronToolHandle c);
/**
* \return Returns the name of the tool. This name is given by the calibration file.
* \param c The handle of the tool, which name should be given back.
*/
const char* GetName(claronToolHandle c);
/**
* \brief Grabs a frame from the camera.
*/
void GrabFrame();
/**
* \return Returns wether the tracking device is tracking or not.
*/
bool IsTracking();
/**
* \return Returns wether the MicronTracker is installed (means wether the C-Make-Variable "MITK_USE_MICRON_TRACKER" is set ON),
* so returns true in this case. This is because the class mitkClaronInterfaceStub, in which the same Method returns false
* is used otherways.
*/
bool IsMicronTrackerInstalled();
protected:
/**
* \brief standard constructor
*/
ClaronInterface();
/**
* \brief standard destructor
*/
~ClaronInterface();
/** \brief Variable is true if the device is tracking at the moment, false if not.*/
bool isTracking;
/** \brief Variable which holds the directory which should contain the file BumbleBee_6400420.calib. This directory is needed by the MTC library.*/
char calibrationDir[512];
/** \brief Variable which holds a directory with some tool files in it. All this tools are trackable when the path is given to the MTC library.*/
char markerDir[512];
//Some handles to communicate with the MTC library.
mtHandle IdentifiedMarkers;
mtHandle PoseXf;
mtHandle CurrCamera;
mtHandle IdentifyingCamera;
//------------------------------------------------
};
}//mitk
#endif
diff --git a/Modules/IGT/TrackingDevices/mitkClaronInterfaceStub.h b/Modules/IGT/TrackingDevices/mitkClaronInterfaceStub.h
index f7e86e8baf..56465dcef1 100644
--- a/Modules/IGT/TrackingDevices/mitkClaronInterfaceStub.h
+++ b/Modules/IGT/TrackingDevices/mitkClaronInterfaceStub.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKCLARONINTERFACE_H_HEADER_INCLUDED_
#define MITKCLARONINTERFACE_H_HEADER_INCLUDED_
#include <vector>
#include <string>
#include <MitkIGTExports.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
#include "mitkCommon.h"
typedef int mtHandle;
namespace mitk
{
typedef int claronToolHandle;
/** Documentation:
* \brief An object of this class represents the interface to the MicronTracker. Normally the methods of this class
* are calling the c-functions which are provided by the MTC-library. But in this case the MicronTracker is
* not installed and so we only have stubs here. These stubs send error messages when you try to call the
* methods.
* \ingroup IGT
*/
class MITKIGT_EXPORT ClaronInterface : public itk::Object
{
public:
- mitkClassMacro(ClaronInterface, itk::Object);
+ mitkClassMacroItkParent(ClaronInterface, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Initialization of claroninterface.
* \param calibrationDir The directory where the device can find the camera calibration file.
* \param toolFilesDir The directory for the tool files.
*/
void Initialize(std::string calibrationDir, std::string toolFilesDir);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
bool StartTracking();
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
bool StopTracking();
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
std::vector<claronToolHandle> GetAllActiveTools();
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
std::vector<double> GetTipPosition(claronToolHandle c);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
std::vector<double> GetTipQuaternions(claronToolHandle c);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
std::vector<double> GetPosition(claronToolHandle c);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
std::vector<double> GetQuaternions(claronToolHandle c);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
const char* GetName(claronToolHandle c);
/**
* \brief This is only a stub, please switch the cmake variable USE_MICRON_TRACKER to on if you want to use the Microntracker.
*/
void GrabFrame();
/**
* \return Returns wether the MicronTracker is installed (means wether the C-Make-Variable "MITK_USE_MICRON_TRACKER" is set),
* so returns false in this case.
*/
bool IsMicronTrackerInstalled();
protected:
/**
* \brief standard constructor
*/
ClaronInterface();
/**
* \brief standard destructor
*/
~ClaronInterface();
};
}//mitk
#endif
diff --git a/Modules/IGT/TrackingDevices/mitkNDIProtocol.h b/Modules/IGT/TrackingDevices/mitkNDIProtocol.h
index d13e95b468..c5022ecd29 100644
--- a/Modules/IGT/TrackingDevices/mitkNDIProtocol.h
+++ b/Modules/IGT/TrackingDevices/mitkNDIProtocol.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKNDIPROTOCOL_H_HEADER_INCLUDED_
#define MITKNDIPROTOCOL_H_HEADER_INCLUDED_
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <MitkIGTExports.h>
#include "mitkSerialCommunication.h"
#include "mitkNDIPassiveTool.h"
namespace mitk
{
class NDITrackingDevice;
/**Documentation
* \brief The NDI Protocol class provides building and parsing of
* command strings and answers to and from a NDI tracking device.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NDIProtocol : public itk::Object
{
public:
- mitkClassMacro(NDIProtocol, itk::Object);
+ mitkClassMacroItkParent(NDIProtocol, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetObjectMacro(TrackingDevice, NDITrackingDevice);
typedef mitk::SerialCommunication::PortNumber PortNumber; ///< Port number of the serial connection
typedef mitk::SerialCommunication::BaudRate BaudRate; ///< Baud rate of the serial connection
typedef mitk::SerialCommunication::DataBits DataBits; ///< Number of data bits used in the serial connection
typedef mitk::SerialCommunication::Parity Parity; ///< Parity mode used in the serial connection
typedef mitk::SerialCommunication::StopBits StopBits; ///< Number of stop bits used in the serial connection
typedef mitk::SerialCommunication::HardwareHandshake HardwareHandshake; ///< Hardware handshake mode of the serial connection
typedef mitk::NDIPassiveTool::TrackingPriority TrackingPriority; ///< Tracking priority used for tracking a tool
/**
* \brief Gives information about the tool which is assosiated with the port handle. Writes portInfo to the string.
*/
NDIErrorCode APIREV(std::string* revision);
NDIErrorCode PHINF(std::string portHandle, std::string* portInfo);
NDIErrorCode PSOUT(std::string portHandle, std::string state); ///< Set GPIO Output (Aurora)
NDIErrorCode COMM(mitk::SerialCommunication::BaudRate baudRate, mitk::SerialCommunication::DataBits dataBits, mitk::SerialCommunication::Parity parity, mitk::SerialCommunication::StopBits stopBits, mitk::SerialCommunication::HardwareHandshake hardwareHandshake); ///< Change Serial Communication Parameters
NDIErrorCode INIT(); ///< Initialize the Measurement System
NDIErrorCode DSTART(); ///< Start the Diagnostic Mode
NDIErrorCode DSTOP(); ///< Stop the Diagnostic Mode
NDIErrorCode IRINIT(); ///< Initialize the System to Check for Infrared
NDIErrorCode IRCHK(bool* IRdetected); ///< This version of IRCHK uses only the simple "presence of infrared light" call, that returns a binary "IR detected/no IR detected" answer
NDIErrorCode PHSR(PHSRQueryType queryType, std::string* portHandles); ///< Port Handle Search. Will write returned port handles to the string portHandles
NDIErrorCode PHF(std::string* portHandle); ///< Port Handle Free. Frees the port handle.
NDIErrorCode PHRQ(std::string* portHandle); ///< Port Handle Request. Will request a Port Handle for a wireless tool and return it in the string portHandle
NDIErrorCode PVWR(std::string* portHandle, const unsigned char* sromData, unsigned int sromDataLength); ///< Port Virtual Write. Writes an SROM Image data to a tool
NDIErrorCode PINIT(std::string* portHandle); ///< Port Initialize. Will initialize a Port that has been acquired with PHRQ and has been assigned a SROM File with PVWR
NDIErrorCode PENA(std::string* portHandle, TrackingPriority prio); ///< Port Enable. Will enable a port that has been initialized with PINIT.
NDIErrorCode PDIS(std::string* portHandle); ///< Port Disable. Will disable a port that has been enabled with PENA
NDIErrorCode IRATE(IlluminationActivationRate rate); ///< Setting the illuminator rate. Will set the refresh rate for the illuminator for wireless tools
NDIErrorCode BEEP(unsigned char count); ///< Sounding the measurement system beeper. The tracking system will beep one to nine times
NDIErrorCode SFLIST(std::string* info); ///< Returns information about the supported feature of the tracking system
NDIErrorCode TSTART(bool resetFrameCounter = false); ///< Start Tracking Mode. The tracking system must be in setup mode and must be initialized.
NDIErrorCode TSTOP(); ///< Stop Tracking Mode. The tracking system must be in Tracking mode.
NDIErrorCode TX(bool trackIndividualMarkers = false, MarkerPointContainerType* markerPositions = NULL); ///< Report transformations in text mode. Optionally, individual markers can be tracked
NDIErrorCode BX(); ///< Report transformations in binary mode.
NDIErrorCode POS3D(MarkerPointContainerType* markerPositions); ///< Report 3D Positions of single markers. can only be used in diagnostics mode
NDIErrorCode VER(mitk::TrackingDeviceType& t); ///< returns if the tracking device is a Polaris or an Aurora system
NDIErrorCode VSEL(mitk::TrackingDeviceData deviceData); ///< Sets the tracking volume to the given type. Check available tracking volumes with SFLIST first
NDIErrorCode TX1000(MarkerPointContainerType* markerPositions); ///< Report transformations in text mode.
unsigned int ByteToNbBitsOn(char& c) const; ///<
itkGetConstMacro(UseCRC, bool); ///< Get whether to append a CRC16 checksum to each message
itkSetMacro(UseCRC, bool); ///< Set whether to append a CRC16 checksum to each message
itkBooleanMacro(UseCRC); ///< Set whether to append a CRC16 checksum to each message
protected:
NDIProtocol();
virtual ~NDIProtocol();
/**Documentation
* Reads the reply from the tracking device and checks if it is either "OKAY" or "ERROR##".
* if it reads an error, it returns the equivalent NDIErrorCode
* Replies other than OKAY or ERROR result in an NDIUNEXPECTEDREPLY
*/
NDIErrorCode ParseOkayError();
/**Documentation
* Sends the command command to the tracking system and checks for OKAY and ERROR as replies
* This is used by commands like INIT, DSTART, DSTOP,... that do not need parameters
* or special parsing of replies
*/
NDIErrorCode GenericCommand(const std::string command, const std::string* parameter = NULL);
/**Documentation
* \brief returns the error code for an Error String returned from the NDI tracking device
*/
NDIErrorCode GetErrorCode(const std::string* input);
NDITrackingDevice* m_TrackingDevice; ///< tracking device to which the commands will be send
bool m_UseCRC; ///< whether to append a CRC16 checksum to each message
};
} // namespace mitk
#endif /* MITKNDIPROTOCOL_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/TrackingDevices/mitkTrackingDevice.h b/Modules/IGT/TrackingDevices/mitkTrackingDevice.h
index be9d62f04b..1b0a6c88dc 100644
--- a/Modules/IGT/TrackingDevices/mitkTrackingDevice.h
+++ b/Modules/IGT/TrackingDevices/mitkTrackingDevice.h
@@ -1,187 +1,187 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRACKINGDEVICE_H_HEADER_INCLUDED_C1C2FCD2
#define MITKTRACKINGDEVICE_H_HEADER_INCLUDED_C1C2FCD2
#include <MitkIGTExports.h>
#include "itkObject.h"
#include "mitkCommon.h"
#include "mitkTrackingTypes.h"
#include "itkFastMutexLock.h"
namespace mitk {
class TrackingTool; // interface for a tool that can be tracked by the TrackingDevice
/**Documentation
* \brief Interface for all Tracking Devices
*
* Defines the methods that are common for all tracking devices.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT TrackingDevice : public itk::Object
{
public:
- mitkClassMacro(TrackingDevice, itk::Object);
+ mitkClassMacroItkParent(TrackingDevice, itk::Object);
/** Defines the rotation modes of this tracking device which results in different representations
* of quaternions.
*
* - Standard: normal representation, rawdata from the device is not changed (DEFAULT)
*
* - Transposed: the rotation is stored transposed, which is (by mistake!) expected by some older MITK classes due
* to an ambigious method naming in VNL.
*
* CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code.
* PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!
*
* use SetRotationMode to change the mode.
*/
enum RotationMode {RotationStandard, RotationTransposed};
enum TrackingDeviceState {Setup, Ready, Tracking}; ///< Type for state variable. The trackingdevice is always in one of these states
/**
* \brief Opens a connection to the device
*
* This may only be called if there is currently no connection to the device.
* If OpenConnection() is successful, the object will change from Setup state to Ready state
*/
virtual bool OpenConnection() = 0;
/**
* \brief Closes the connection to the device
*
* This may only be called if there is currently a connection to the device, but tracking is
* not running (e.g. object is in Ready state)
*/
virtual bool CloseConnection() = 0; ///< Closes the connection with the device
/**
* \brief start retrieving tracking data from the device.
*
* This may only be called after the connection to the device has been established
* with a call to OpenConnection() (E.g. object is in Ready mode). This will change the
* object state from Ready to Tracking
*/
virtual bool StartTracking() = 0;
/**
* \brief stop retrieving tracking data from the device.
* stop retrieving tracking data from the device.
* This may only be called after StartTracking was called
* (e.g. the object is in Tracking mode).
* This will change the object state from Tracking to Ready.
*/
virtual bool StopTracking();
/**
* \brief Return tool with index toolNumber
*
* tools are numbered from 0 to GetToolCount() - 1.
*/
virtual TrackingTool* GetTool(unsigned int toolNumber) const = 0;
/**
* \brief Returns the tool with the given tool name
*
* Note: subclasses can and should implement optimized versions of this method
* \return the given tool or NULL if no tool with that name exists
*/
virtual mitk::TrackingTool* GetToolByName(std::string name) const;
/**
* \brief Returns number of tracking tools
*/
virtual unsigned int GetToolCount() const = 0;
/** Sets the rotation mode of this class. See documentation of enum RotationMode for details
* on the different modes. This method has to be implemented in a deriving class to become
* functional / if different rotation modes should be supported.
* CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code.
* PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!
*/
virtual void SetRotationMode(RotationMode r);
/** @return Returns the rotation mode of this class. See documentation of enum
* RotationMode for details on the different modes.
*/
itkGetConstMacro(RotationMode,RotationMode);
/**
* \brief return current object state (Setup, Ready or Tracking)
*/
TrackingDeviceState GetState() const;
/**
* \brief Deprecated! Use the more specific getDeviceData instead. return device type identifier
*/
TrackingDeviceType GetType() const;
/**
* \brief Deprecated! Use the more specific setDeviceData instead. set device type
*/
void SetType(TrackingDeviceType type);
/**
* \brief return device data
*/
TrackingDeviceData GetData() const;
/**
* \brief set device type
*/
void SetData(TrackingDeviceData data);
/**
* @return Returns true if the device is installed on this system an can be used.
* Installed means activated in MITK, in some cases this means the MITK
* installation / build has to know the installation path of the device
* libraries on this system. This path is usually given as cmake variable
* during the build configuration in devellopers mode. If the device should
* be available for end users with an installer the libraries can be included
* into the installer or the installer has to be adapted such that it asks
* for the path.
* Returns fals if the device is not installed. It cannot be used on this build
* in this case.
*
* Note that some tracking systems communicate via a standard interface (e.g., serial
* port) and don't need any library or installation. These devices are always "installed".
*/
virtual bool IsDeviceInstalled();
protected:
/**
* \brief change object state
*/
void SetState(TrackingDeviceState state);
TrackingDevice();
virtual ~TrackingDevice();
TrackingDeviceData m_Data; ///< current device Data
TrackingDeviceState m_State; ///< current object state (Setup, Ready or Tracking)
bool m_StopTracking; ///< signal stop to tracking thread
itk::FastMutexLock::Pointer m_StopTrackingMutex; ///< mutex to control access to m_StopTracking
itk::FastMutexLock::Pointer m_TrackingFinishedMutex; ///< mutex to manage control flow of StopTracking()
itk::FastMutexLock::Pointer m_StateMutex; ///< mutex to control access to m_State
RotationMode m_RotationMode; ///< defines the rotation mode Standard or Transposed, Standard is default
};
} // namespace mitk
#endif /* MITKTRACKINGDEVICE_H_HEADER_INCLUDED_C1C2FCD2 */
diff --git a/Modules/IGT/TrackingDevices/mitkTrackingTool.h b/Modules/IGT/TrackingDevices/mitkTrackingTool.h
index e56af1d929..12c29f877b 100644
--- a/Modules/IGT/TrackingDevices/mitkTrackingTool.h
+++ b/Modules/IGT/TrackingDevices/mitkTrackingTool.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRACKINGTOOL_H_HEADER_INCLUDED_
#define MITKTRACKINGTOOL_H_HEADER_INCLUDED_
#include <itkObject.h>
#include <MitkIGTExports.h>
#include <mitkCommon.h>
#include <mitkNumericTypes.h>
#include <itkFastMutexLock.h>
namespace mitk
{
/**Documentation
* \brief Interface for all Tracking Tools
*
* Abstract class that defines the methods that are common for all tracking tools.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT TrackingTool : public itk::Object
{
public:
- mitkClassMacro(TrackingTool, itk::Object);
+ mitkClassMacroItkParent(TrackingTool, itk::Object);
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
virtual void SetToolTip(Point3D toolTipPosition, Quaternion orientation, ScalarType eps=0.0) = 0; ///< defines a tool tip for this tool in tool coordinates. GetPosition() and GetOrientation() return the data of the tool tip if it is defined. By default no tooltip is defined.
virtual void GetPosition(Point3D& position) const = 0; ///< returns the current position of the tool as an array of three floats (in the tracking device coordinate system)
virtual void GetOrientation(Quaternion& orientation) const = 0; ///< returns the current orientation of the tool as a quaternion in a mitk::Point4D (in the tracking device coordinate system)
virtual bool Enable() = 0; ///< enables the tool, so that it will be tracked
virtual bool Disable() = 0; ///< disables the tool, so that it will not be tracked anymore
virtual bool IsEnabled() const = 0; ///< returns whether the tool is enabled or disabled
virtual bool IsDataValid() const = 0; ///< returns true if the current position data is valid (no error during tracking, tracking error below threshold, ...)
virtual float GetTrackingError() const = 0; ///< returns one value that corresponds to the overall tracking error.
virtual const char* GetToolName() const; ///< every tool has a name that can be used to identify it.
virtual const char* GetErrorMessage() const; ///< if the data is not valid, ErrorMessage should contain a string explaining why it is invalid (the Set-method should be implemented in subclasses, it should not be accessible by the user)
itkSetMacro(IGTTimeStamp, double); ///< Sets the IGT timestamp of the tracking tool object (time in milliseconds)
itkGetConstMacro(IGTTimeStamp, double); ///< Gets the IGT timestamp of the tracking tool object (time in milliseconds). Returns 0 if the timestamp was not set.
protected:
TrackingTool();
virtual ~TrackingTool();
std::string m_ToolName; ///< every tool has a name that can be used to identify it.
std::string m_ErrorMessage; ///< if a tool is invalid, this member should contain a human readable explanation of why it is invalid
double m_IGTTimeStamp; ///< contains the time at which the tracking data was recorded
itk::FastMutexLock::Pointer m_MyMutex; ///< mutex to control concurrent access to the tool
};
} // namespace mitk
#endif /* MITKTRACKINGTOOL_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGTBase/mitkLinuxRealTimeClock.h b/Modules/IGTBase/mitkLinuxRealTimeClock.h
index fe25c0507a..e053f5301a 100644
--- a/Modules/IGTBase/mitkLinuxRealTimeClock.h
+++ b/Modules/IGTBase/mitkLinuxRealTimeClock.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKLINUXREALTIMECLOCK_H_HEADER_INCLUDED_
#define MITKLINUXREALTIMECLOCK_H_HEADER_INCLUDED_
#include "mitkRealTimeClock.h"
#include "MitkIGTBaseExports.h"
namespace mitk {
/**
* \brief RealTimeClock for linux-systems
*
* This class provides realtimeclock for linux-systems.
* It uses gettimeofday to acquire a current time-value as accurately
* as possible.
*
* \return Returns the current time since the Epoch (01.01.1970) in milliseconds as a double
*
* \ingroup IGT
*/
class MITKIGTBASE_EXPORT LinuxRealTimeClock : public RealTimeClock
{
public:
mitkClassMacro(mitk::LinuxRealTimeClock, mitk::RealTimeClock);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief basic contructor
*/
LinuxRealTimeClock();
/**
* \brief basic contructor
*/
virtual ~LinuxRealTimeClock();
/**
* \brief returns the current time in milliseconds as a double
*/
- virtual double GetCurrentStamp();
+ virtual double GetCurrentStamp() override;
}; //namespace
}
#endif /* MITKLINUXREALTIMECLOCK_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGTBase/mitkRealTimeClock.h b/Modules/IGTBase/mitkRealTimeClock.h
index 8146743385..d5147f0a9a 100644
--- a/Modules/IGTBase/mitkRealTimeClock.h
+++ b/Modules/IGTBase/mitkRealTimeClock.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKWREALTIMECLOCK_H_HEADER_INCLUDED_
#define MITKWREALTIMECLOCK_H_HEADER_INCLUDED_
#include <itkObject.h>
#include <itkObjectFactory.h>
#include "MitkIGTBaseExports.h"
#include "mitkCommon.h"
namespace mitk {
/**Documentation
* \brief RealTimeClock is a superclass to WindowsRealTimeClock, LinuxRealTimeClock, etc.
*
* When mitk::RealTimeClock::New() is called, a new instance of a RealTimeClock will be
* instantiated. WindowsRealTimeClock on a Windows-system and a LinuxRealTimeClock on a
* Linux-system
*
* \ingroup IGT
*/
class MITKIGTBASE_EXPORT RealTimeClock : public itk::Object
{
public:
- mitkClassMacro(RealTimeClock, itk::Object);
+ mitkClassMacroItkParent(RealTimeClock, itk::Object);
/**
*\brief instanciates a new, operating-system dependant, instance of mitk::RealTimeClock.
*/
static Pointer New(void);
virtual double GetCurrentStamp() = 0;
};
} //namespace
#endif /* MITKWREALTIMECLOCK_H_HEADER_INCLUDED_ */
diff --git a/Modules/IOExt/Internal/mitkIOExtActivator.h b/Modules/IOExt/Internal/mitkIOExtActivator.h
index 39e577910f..c56ff94edc 100644
--- a/Modules/IOExt/Internal/mitkIOExtActivator.h
+++ b/Modules/IOExt/Internal/mitkIOExtActivator.h
@@ -1,48 +1,48 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIOEXTACTIVATOR_H
#define MITKIOEXTACTIVATOR_H
#include <usModuleActivator.h>
#include <memory>
namespace mitk {
struct IFileReader;
struct IFileWriter;
class IOExtActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext*context);
- void Unload(us::ModuleContext* context);
+ void Load(us::ModuleContext*context) override;
+ void Unload(us::ModuleContext* context) override;
private:
std::unique_ptr<IFileReader> m_SceneReader;
std::unique_ptr<IFileReader> m_VtkUnstructuredGridReader;
std::unique_ptr<IFileReader> m_ObjReader;
std::unique_ptr<IFileWriter> m_ObjWriter;
std::unique_ptr<IFileReader> m_PlyReader;
};
}
#endif // MITKIOEXTACTIVATOR_H
diff --git a/Modules/IOExt/Internal/mitkIOExtObjectFactory.h b/Modules/IOExt/Internal/mitkIOExtObjectFactory.h
index 10c4b17d59..52535f9566 100644
--- a/Modules/IOExt/Internal/mitkIOExtObjectFactory.h
+++ b/Modules/IOExt/Internal/mitkIOExtObjectFactory.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef COREEXTOBJECTFACTORY_H_INCLUDED
#define COREEXTOBJECTFACTORY_H_INCLUDED
#include "mitkCoreObjectFactoryBase.h"
namespace mitk {
class IOExtObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(IOExtObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
- virtual void SetDefaultProperties(mitk::DataNode* node);
- virtual const char* GetFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
- virtual const char* GetSaveFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
+ virtual const char* GetFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
+ virtual const char* GetSaveFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
private:
IOExtObjectFactory();
~IOExtObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
itk::ObjectFactoryBase::Pointer m_ParRecFileIOFactory;
itk::ObjectFactoryBase::Pointer m_VtkUnstructuredGridIOFactory;
itk::ObjectFactoryBase::Pointer m_StlVolumeTimeSeriesIOFactory;
itk::ObjectFactoryBase::Pointer m_VtkVolumeTimeSeriesIOFactory;
itk::ObjectFactoryBase::Pointer m_UnstructuredGridVtkWriterFactory;
};
}
#endif
diff --git a/Modules/IOExt/Internal/mitkObjFileReaderService.h b/Modules/IOExt/Internal/mitkObjFileReaderService.h
index 9c72c0d271..6a5959549f 100644
--- a/Modules/IOExt/Internal/mitkObjFileReaderService.h
+++ b/Modules/IOExt/Internal/mitkObjFileReaderService.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ObjFileReaderService_h
#define ObjFileReaderService_h
#include <mitkAbstractFileReader.h>
#include <mitkIOMimeTypes.h>
namespace mitk {
class BaseData;
/**
* @brief Used to read surfaces from Wavefront OBJ files.
*
* @ingroup IOExt
*/
class ObjFileReaderService : public AbstractFileReader
{
public:
ObjFileReaderService();
virtual ~ObjFileReaderService();
using AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<BaseData> > Read();
+ virtual std::vector< itk::SmartPointer<BaseData> > Read() override;
static mitk::CustomMimeType mimeType;
private:
- ObjFileReaderService* Clone() const;
+ ObjFileReaderService* Clone() const override;
};
} // namespace mitk
#endif /* ObjFileReaderService_h */
diff --git a/Modules/IOExt/Internal/mitkParRecFileIOFactory.h b/Modules/IOExt/Internal/mitkParRecFileIOFactory.h
index f84480e283..13628a8ae7 100644
--- a/Modules/IOExt/Internal/mitkParRecFileIOFactory.h
+++ b/Modules/IOExt/Internal/mitkParRecFileIOFactory.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkParRecFileIOFactory_h
#define __mitkParRecFileIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of ParRecFileReader objects using an object factory.
//##
class ParRecFileIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef ParRecFileIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static ParRecFileIOFactory* FactoryNew() { return new ParRecFileIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(ParRecFileIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
ParRecFileIOFactory::Pointer ParRecFileIOFactory = ParRecFileIOFactory::New();
ObjectFactoryBase::RegisterFactory(ParRecFileIOFactory);
}
protected:
ParRecFileIOFactory();
~ParRecFileIOFactory();
private:
ParRecFileIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/IOExt/Internal/mitkParRecFileReader.h b/Modules/IOExt/Internal/mitkParRecFileReader.h
index e247ededd2..5c03bc02b8 100644
--- a/Modules/IOExt/Internal/mitkParRecFileReader.h
+++ b/Modules/IOExt/Internal/mitkParRecFileReader.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PARRECFILEREADER_H_HEADER_INCLUDED_C1F48A22
#define PARRECFILEREADER_H_HEADER_INCLUDED_C1F48A22
#include "mitkCommon.h"
#include "mitkFileReader.h"
#include "mitkImageSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read files in Philips PAR/REC file format
class ParRecFileReader : public ImageSource, public FileReader
{
public:
mitkClassMacro(ParRecFileReader, FileReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
ParRecFileReader();
~ParRecFileReader();
//##Description
//## @brief Time when Header was last read
itk::TimeStamp m_ReadHeaderTime;
int m_StartFileIndex;
protected:
std::string m_FileName;
std::string m_RecFileName;
std::string m_FilePrefix;
std::string m_FilePattern;
};
} // namespace mitk
#endif /* PARRECFILEREADER_H_HEADER_INCLUDED_C1F48A22 */
diff --git a/Modules/IOExt/Internal/mitkPlyFileReaderService.h b/Modules/IOExt/Internal/mitkPlyFileReaderService.h
index e8fdcf518f..7a0157ff54 100644
--- a/Modules/IOExt/Internal/mitkPlyFileReaderService.h
+++ b/Modules/IOExt/Internal/mitkPlyFileReaderService.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PlyFileReaderService_h
#define PlyFileReaderService_h
#include <mitkAbstractFileReader.h>
#include <mitkIOMimeTypes.h>
namespace mitk {
class BaseData;
/**
* @brief Used to read surfaces from the PLY format.
*
* This reader can read binary and ASCII versions of the format transparently.
*
* @ingroup IOExt
*/
class PlyFileReaderService : public AbstractFileReader
{
public:
PlyFileReaderService();
virtual ~PlyFileReaderService();
using AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<BaseData> > Read();
+ virtual std::vector< itk::SmartPointer<BaseData> > Read() override;
static mitk::CustomMimeType mimeType;
private:
- PlyFileReaderService* Clone() const;
+ PlyFileReaderService* Clone() const override;
};
} // namespace mitk
#endif /* PlyFileReaderService_h */
diff --git a/Modules/IOExt/Internal/mitkPlyFileWriterService.h b/Modules/IOExt/Internal/mitkPlyFileWriterService.h
index 82dc17d91e..cdf7a35d2e 100644
--- a/Modules/IOExt/Internal/mitkPlyFileWriterService.h
+++ b/Modules/IOExt/Internal/mitkPlyFileWriterService.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PlyFileWriterService_h
#define PlyFileWriterService_h
#include <mitkAbstractFileWriter.h>
namespace mitk
{
/**
* @brief Used to write Surfaces to the PLY format.
*
* Currently, this writer uses the binary format as standard. Should the ASCII Format be required,
* it is suggested to incorporate Options.
*
* @ingroup IOExt
*/
class PlyFileWriterService : public AbstractFileWriter
{
public:
PlyFileWriterService();
virtual ~PlyFileWriterService();
using AbstractFileWriter::Write;
- virtual void Write();
+ virtual void Write() override;
private:
PlyFileWriterService(const PlyFileWriterService& other);
- virtual mitk::PlyFileWriterService* Clone() const;
+ virtual mitk::PlyFileWriterService* Clone() const override;
};
}
#endif
diff --git a/Modules/IOExt/Internal/mitkSceneFileReader.h b/Modules/IOExt/Internal/mitkSceneFileReader.h
index fb7e6eb2a0..e33175273e 100644
--- a/Modules/IOExt/Internal/mitkSceneFileReader.h
+++ b/Modules/IOExt/Internal/mitkSceneFileReader.h
@@ -1,43 +1,43 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SceneFileReader_H_HEADER_INCLUDED
#define SceneFileReader_H_HEADER_INCLUDED
// MITK
#include <mitkAbstractFileReader.h>
namespace mitk {
class SceneFileReader : public mitk::AbstractFileReader
{
public:
SceneFileReader();
using AbstractFileReader::Read;
- virtual std::vector<itk::SmartPointer<BaseData> > Read();
- virtual DataStorage::SetOfObjects::Pointer Read(DataStorage& ds);
+ virtual std::vector<itk::SmartPointer<BaseData> > Read() override;
+ virtual DataStorage::SetOfObjects::Pointer Read(DataStorage& ds) override;
private:
- SceneFileReader* Clone() const;
+ SceneFileReader* Clone() const override;
};
} // namespace mitk
#endif /* SceneFileReader_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesIOFactory.h b/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesIOFactory.h
index 7a22640fb0..77ea0fbc91 100644
--- a/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesIOFactory.h
+++ b/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesIOFactory.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkStlVolumeTimeSeriesIOFactory_h
#define __mitkStlVolumeTimeSeriesIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of StlVolumeTimeSeriesReader objects using an object factory.
class StlVolumeTimeSeriesIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef StlVolumeTimeSeriesIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static StlVolumeTimeSeriesIOFactory* FactoryNew() { return new StlVolumeTimeSeriesIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(StlVolumeTimeSeriesIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
StlVolumeTimeSeriesIOFactory::Pointer StlVolumeTimeSeriesIOFactory = StlVolumeTimeSeriesIOFactory::New();
ObjectFactoryBase::RegisterFactory(StlVolumeTimeSeriesIOFactory);
}
protected:
StlVolumeTimeSeriesIOFactory();
~StlVolumeTimeSeriesIOFactory();
private:
StlVolumeTimeSeriesIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesReader.h b/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesReader.h
index ddda6fa7b0..f41f0aa442 100644
--- a/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesReader.h
+++ b/Modules/IOExt/Internal/mitkStlVolumeTimeSeriesReader.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _Stl_VOLUME_TIME_SERIES_READER__H_
#define _Stl_VOLUME_TIME_SERIES_READER__H_
#include "mitkCommon.h"
#include "mitkFileSeriesReader.h"
#include "mitkSurfaceSource.h"
namespace mitk
{
//##Documentation
//## @brief Reader to read a series of volume files in stl-format
class StlVolumeTimeSeriesReader : public SurfaceSource, public FileSeriesReader
{
public:
mitkClassMacro(StlVolumeTimeSeriesReader, FileSeriesReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
StlVolumeTimeSeriesReader();
~StlVolumeTimeSeriesReader();
//##Description
//## @brief Time when Header was last read
itk::TimeStamp m_ReadHeaderTime;
};
} // namespace mitk
#endif
diff --git a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriter.h b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriter.h
index 19ec1e1b64..d41a2d583c 100644
--- a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriter.h
+++ b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriter.h
@@ -1,152 +1,152 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
#define _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkXMLPUnstructuredGridWriter.h>
#include "mitkUnstructuredGrid.h"
namespace mitk
{
/**
* @brief VTK-based writer for mitk::UnstructuredGrid
*
* The mitk::UnstructuredGrid is written using the VTK-writer-type provided as the
* template argument. If the mitk::UnstructuredGrid contains multiple points of
* time, multiple files are written. The life-span (time-bounds) of each
* each point of time is included in the filename according to the
* following scheme:
* &lt;filename&gt;_S&lt;timebounds[0]&gt;E&lt;timebounds[1]&gt;_T&lt;framenumber&gt;
* (S=start, E=end, T=time).
* Writing of multiple files according to a given filename pattern is not
* yet supported.
*/
template<class VTKWRITER>
class UnstructuredGridVtkWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( UnstructuredGridVtkWriter, mitk::FileWriterWithInformation );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkWriterMacro;
/**
* Sets the filename of the file to write.
* @param _arg the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
using FileWriter::SetInput;
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( BaseData* input );
/**
* @returns the 0'th input object of the filter.
*/
const UnstructuredGrid* GetInput();
/**
* Returns false if an error happened during writing
*/
itkGetMacro( Success, bool );
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- virtual std::string GetSupportedBaseData() const
+ virtual std::string GetSupportedBaseData() const override
{ return UnstructuredGrid::GetStaticNameOfClass(); }
// FileWriterWithInformation methods
- virtual const char * GetDefaultFilename();
- virtual const char * GetFileDialogPattern();
- virtual const char * GetDefaultExtension();
- virtual bool CanWriteBaseDataType(BaseData::Pointer data);
- virtual void DoWrite(BaseData::Pointer data);
+ virtual const char * GetDefaultFilename() override;
+ virtual const char * GetFileDialogPattern() override;
+ virtual const char * GetDefaultExtension() override;
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override;
+ virtual void DoWrite(BaseData::Pointer data) override;
protected:
/**
* Constructor.
*/
UnstructuredGridVtkWriter();
/**
* Virtual destructor.
*/
virtual ~UnstructuredGridVtkWriter();
void ExecuteWrite(VTKWRITER* vtkWriter);
- virtual void GenerateData();
+ virtual void GenerateData() override;
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
}
#endif // _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_
diff --git a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.cpp b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.cpp
index f1db280d2e..0a8932caf5 100644
--- a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.cpp
+++ b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.cpp
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkUnstructuredGridVtkWriterFactory.h"
#include "itkCreateObjectFunction.h"
#include "itkVersion.h"
#include "mitkUnstructuredGridVtkWriter.h"
#include <vtkUnstructuredGridWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkXMLPUnstructuredGridWriter.h>
namespace mitk
{
template <class T>
class CreateUnstructuredGridWriter : public itk::CreateObjectFunctionBase
{
public:
/** Standard class typedefs. */
typedef CreateUnstructuredGridWriter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self);
- LightObject::Pointer CreateObject() { typename T::Pointer p = T::New();
+ LightObject::Pointer CreateObject() override { typename T::Pointer p = T::New();
p->Register();
return p.GetPointer();
}
protected:
CreateUnstructuredGridWriter() {}
~CreateUnstructuredGridWriter() {}
private:
CreateUnstructuredGridWriter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
UnstructuredGridVtkWriterFactory::UnstructuredGridVtkWriterFactory()
{
this->RegisterOverride("IOWriter",
"UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>",
"VTK Legacy Unstructured Grid Writer",
1,
mitk::CreateUnstructuredGridWriter< mitk::UnstructuredGridVtkWriter<vtkUnstructuredGridWriter> >::New());
this->RegisterOverride("IOWriter",
"UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>",
"VTK XML UnstructuredGrid Writer",
1,
mitk::CreateUnstructuredGridWriter< mitk::UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter> >::New());
this->RegisterOverride("IOWriter",
"UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>",
"VTK Parallel XML UnstructuredGrid Writer",
1,
mitk::CreateUnstructuredGridWriter< mitk::UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter> >::New());
}
UnstructuredGridVtkWriterFactory::~UnstructuredGridVtkWriterFactory()
{
}
const char* UnstructuredGridVtkWriterFactory::GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
const char* UnstructuredGridVtkWriterFactory::GetDescription() const
{
return "UnstructuredGridVtkWriterFactory";
}
} // end namespace mitk
diff --git a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.h b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.h
index ee2c9b2b0a..dded72a376 100644
--- a/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.h
+++ b/Modules/IOExt/Internal/mitkUnstructuredGridVtkWriterFactory.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef UNSTRUCTURED_GRID_WRITERFACTORY_H_HEADER_INCLUDED
#define UNSTRUCTURED_GRID_WRITERFACTORY_H_HEADER_INCLUDED
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
class UnstructuredGridVtkWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::UnstructuredGridVtkWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::UnstructuredGridVtkWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
static bool IsRegistered = false;
if ( !IsRegistered )
{
UnstructuredGridVtkWriterFactory::Pointer ugVtkWriterFactory = UnstructuredGridVtkWriterFactory::New();
ObjectFactoryBase::RegisterFactory( ugVtkWriterFactory );
IsRegistered = true;
}
}
protected:
UnstructuredGridVtkWriterFactory();
~UnstructuredGridVtkWriterFactory();
private:
UnstructuredGridVtkWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif // UNSTRUCTURED_GRID_WRITERFACTORY_H_HEADER_INCLUDED
diff --git a/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.h b/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.h
index 04eec0e8c9..d3e676c819 100644
--- a/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.h
+++ b/Modules/IOExt/Internal/mitkVtkUnstructuredGridReader.h
@@ -1,41 +1,41 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VtkUnstructuredGridReader_H_HEADER_INCLUDED
#define VtkUnstructuredGridReader_H_HEADER_INCLUDED
#include <mitkAbstractFileReader.h>
namespace mitk {
//##Documentation
//## @brief Reader to read unstructured grid files in vtk-format
class VtkUnstructuredGridReader : public AbstractFileReader
{
public:
VtkUnstructuredGridReader();
virtual ~VtkUnstructuredGridReader();
using AbstractFileReader::Read;
- virtual std::vector< itk::SmartPointer<BaseData> > Read();
+ virtual std::vector< itk::SmartPointer<BaseData> > Read() override;
protected:
- virtual VtkUnstructuredGridReader* Clone() const;
+ virtual VtkUnstructuredGridReader* Clone() const override;
};
} // namespace mitk
#endif /* VtkUnstructuredGridReader_H_HEADER_INCLUDED */
diff --git a/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesIOFactory.h b/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesIOFactory.h
index 0d1984f7af..34c6256392 100644
--- a/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesIOFactory.h
+++ b/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesIOFactory.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkVtkVolumeTimeSeriesIOFactory_h
#define __mitkVtkVolumeTimeSeriesIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of VtkVolumeTimeSeriesReader objects using an object factory.
class VtkVolumeTimeSeriesIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef VtkVolumeTimeSeriesIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static VtkVolumeTimeSeriesIOFactory* FactoryNew() { return new VtkVolumeTimeSeriesIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(VtkVolumeTimeSeriesIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
VtkVolumeTimeSeriesIOFactory::Pointer VtkVolumeTimeSeriesIOFactory = VtkVolumeTimeSeriesIOFactory::New();
ObjectFactoryBase::RegisterFactory(VtkVolumeTimeSeriesIOFactory);
}
protected:
VtkVolumeTimeSeriesIOFactory();
~VtkVolumeTimeSeriesIOFactory();
private:
VtkVolumeTimeSeriesIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesReader.h b/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesReader.h
index 3169e1b453..7954f1ad7c 100644
--- a/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesReader.h
+++ b/Modules/IOExt/Internal/mitkVtkVolumeTimeSeriesReader.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _Vtk_VOLUME_TIME_SERIES_READER__H_
#define _Vtk_VOLUME_TIME_SERIES_READER__H_
#include "mitkCommon.h"
#include "mitkFileSeriesReader.h"
#include "mitkSurfaceSource.h"
namespace mitk
{
//##Documentation
//## @brief Reader to read a series of volume files in Vtk-format
class VtkVolumeTimeSeriesReader : public SurfaceSource, public FileSeriesReader
{
public:
mitkClassMacro( VtkVolumeTimeSeriesReader, FileReader );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
VtkVolumeTimeSeriesReader();
~VtkVolumeTimeSeriesReader();
//##Description
//## @brief Time when Header was last read
itk::TimeStamp m_ReadHeaderTime;
};
} // namespace mitk
#endif
diff --git a/Modules/ImageDenoising/mitkBilateralFilter.h b/Modules/ImageDenoising/mitkBilateralFilter.h
index 5520cfcad1..9311f712dd 100644
--- a/Modules/ImageDenoising/mitkBilateralFilter.h
+++ b/Modules/ImageDenoising/mitkBilateralFilter.h
@@ -1,79 +1,79 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkBilateralFilter_h
#define __mitkBilateralFilter_h
#include "MitkImageDenoisingExports.h"
//MITK
#include <mitkImage.h>
#include "mitkImageToImageFilter.h"
#include <itkImage.h>
namespace mitk
{
class MITKIMAGEDENOISING_EXPORT BilateralFilter : public ImageToImageFilter
{
public:
mitkClassMacro( BilateralFilter , ImageToImageFilter );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(DomainSigma,float);
itkSetMacro(RangeSigma,float);
itkSetMacro(AutoKernel,bool);
itkSetMacro(KernelRadius,unsigned int);
itkGetMacro(DomainSigma,float);
itkGetMacro(RangeSigma,float);
itkGetMacro(AutoKernel,bool);
itkGetMacro(KernelRadius,unsigned int);
protected:
/*!
\brief standard constructor
*/
BilateralFilter();
/*!
\brief standard destructor
*/
~BilateralFilter();
/*!
\brief Method generating the output information of this filter (e.g. image dimension, image type, etc.).
The interface ImageToImageFilter requires this implementation. Everything is taken from the input image.
*/
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/*!
\brief Method generating the output of this filter. Called in the updated process of the pipeline.
This method generates the smoothed output image.
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/*!
\brief Internal templated method calling the ITK bilteral filter. Here the actual filtering is performed.
*/
template<typename TPixel, unsigned int VImageDimension>
void ItkImageProcessing( const itk::Image<TPixel,VImageDimension>* itkImage );
float m_DomainSigma; ///Sigma of the gaussian kernel. See ITK docu
float m_RangeSigma; ///Sigma of the range mask kernel. See ITK docu
bool m_AutoKernel; //true: kernel size is calculated from DomainSigma. See ITK Doc; false: set by m_KernelRadius
unsigned int m_KernelRadius; //use in combination with m_AutoKernel = true
};
} //END mitk namespace
#endif
diff --git a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilter.h b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilter.h
index 3086fb9819..dae82403ed 100644
--- a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilter.h
+++ b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilter.h
@@ -1,125 +1,125 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkExtractDirectedPlaneImageFilter_h_Included
#define mitkExtractDirectedPlaneImageFilter_h_Included
#include <MitkImageExtractionExports.h>
#include "mitkImageToImageFilter.h"
#include "vtkImageReslice.h"
#include "mitkVtkResliceInterpolationProperty.h"
#define setMacro(name,type) \
virtual void Set##name (type _arg) \
{ \
if (this->m_##name != _arg) \
{ \
this->m_##name = _arg; \
} \
}
#define getMacro(name,type) \
virtual type Get##name () \
{ \
return m_##name; \
}
class vtkPoints;
namespace mitk
{
/**
\deprecated This class is deprecated. Use mitk::ExtractSliceFilter instead.
\sa ExtractSliceFilter
\brief Extracts a 2D slice of arbitrary geometry from a 3D or 4D image.
\sa mitkImageMapper2D
\ingroup ImageToImageFilter
This class takes a 3D or 4D mitk::Image as input and tries to extract one slice from it.
This slice can be arbitrary oriented in space. The 2D slice is resliced by a
vtk::ResliceImage filter if not perpendicular to the input image.
The world geometry of the plane to be extracted image must be given as an input
to the filter in order to correctly calculate world coordinates of the extracted slice.
Setting a timestep from which the plane should be extracted is optional.
Output will not be set if there was a problem extracting the desired slice.
Last contributor: $Author: T. Schwarz$
*/
class MITKIMAGEEXTRACTION_EXPORT ExtractDirectedPlaneImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(ExtractDirectedPlaneImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro( WorldGeometry, PlaneGeometry* );
// The Reslicer is accessible to configure the desired interpolation;
// (See vtk::ImageReslice class for documentation).
// Misusage is at your own risk...
itkGetMacro( Reslicer, vtkImageReslice* );
// The target timestep in a 4D image from which the 2D plane is supposed
// to be extracted.
itkSetMacro( TargetTimestep, unsigned int );
itkGetMacro( TargetTimestep, unsigned int );
itkSetMacro( InPlaneResampleExtentByGeometry, bool );
itkGetMacro( InPlaneResampleExtentByGeometry, bool );
setMacro( ResliceInterpolationProperty, VtkResliceInterpolationProperty* );
itkGetMacro( ResliceInterpolationProperty, VtkResliceInterpolationProperty* );
setMacro( IsMapperMode, bool );
getMacro( IsMapperMode, bool );
protected:
ExtractDirectedPlaneImageFilter(); // purposely hidden
virtual ~ExtractDirectedPlaneImageFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
bool CalculateClippedPlaneBounds( const BaseGeometry *boundingGeometry,
const PlaneGeometry *planeGeometry, double *bounds );
bool LineIntersectZero( vtkPoints *points, int p1, int p2,
double *bounds );
const PlaneGeometry* m_WorldGeometry;
vtkImageReslice * m_Reslicer;
unsigned int m_TargetTimestep;
bool m_InPlaneResampleExtentByGeometry;
int m_ThickSlicesMode;
int m_ThickSlicesNum;
bool m_IsMapperMode;
VtkResliceInterpolationProperty* m_ResliceInterpolationProperty;
};
} // namespace mitk
#endif // mitkExtractDirectedPlaneImageFilter_h_Included
diff --git a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h
index e48658fff6..9b183f92ad 100644
--- a/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h
+++ b/Modules/ImageExtraction/mitkExtractDirectedPlaneImageFilterNew.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkExtractDirectedPlaneImageFilterNew_h_Included
#define mitkExtractDirectedPlaneImageFilterNew_h_Included
#include <MitkImageExtractionExports.h>
#include "mitkImageToImageFilter.h"
#include "itkImage.h"
#include "mitkITKImageImport.h"
namespace mitk {
/**
\deprecated This class is deprecated. Use mitk::ExtractSliceFilter instead.
\sa ExtractSliceFilter
\brief A filter that can extract a 2D slice from a 3D or 4D image especially if the image`s axes are rotated
\sa ContourTool
\sa SegTool2D
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\sa OverwriteDirectedPlaneImageFilter
\ingroup Process
\ingroup Reliver
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkSegmentationTechnicalPage
This class takes an 3D or 4D mitk::Image as input and extracts a slice from it. If you work with a 4D image as input you have to specify the
desired timestep at which the slice shall be extracted, otherwise the lowest given timestep is selected by default.
The special feature of this filter is, that the planes of the input image can be rotated in any way. To assure a proper extraction you have to
set the currentWorldPlaneGeometry with you can obtain from the BaseRenderer, respectively the positionEvent send by the renderer.
The output will not be set if there was a problem with the input image
$Author: fetzer $
*/
class MITKIMAGEEXTRACTION_EXPORT ExtractDirectedPlaneImageFilterNew : public ImageToImageFilter
{
public:
mitkClassMacro(ExtractDirectedPlaneImageFilterNew, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Set macro for the current worldgeometry
\a Parameter The current wordgeometry that describes the position (rotation, translation)
of the plane (and therefore the slice to be extracted) in our 3D(+t) image
*/
itkSetMacro(CurrentWorldPlaneGeometry, BaseGeometry* );
/**
* \deprecatedSince{2014_10} Please use SetCurrentWorldPlaneGeometry
*/
DEPRECATED(void SetCurrentWorldGeometry2D(BaseGeometry* geo)){SetCurrentWorldPlaneGeometry(geo);};
itkSetMacro(ImageGeometry, BaseGeometry* );
/**
\brief Set macro for the current timestep
\a Parameter The timestep of the image from which the slice shall be extracted
*/
itkSetMacro(ActualInputTimestep, int);
protected:
ExtractDirectedPlaneImageFilterNew();
virtual ~ExtractDirectedPlaneImageFilterNew();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
private:
const BaseGeometry* m_CurrentWorldPlaneGeometry;
const BaseGeometry* m_ImageGeometry;
int m_ActualInputTimestep;
template<typename TPixel, unsigned int VImageDimension>
void ItkSliceExtraction (const itk::Image<TPixel, VImageDimension>* inputImage);
};
}//namespace
#endif
diff --git a/Modules/ImageExtraction/mitkExtractImageFilter.h b/Modules/ImageExtraction/mitkExtractImageFilter.h
index 8bad322443..9aed01d84b 100644
--- a/Modules/ImageExtraction/mitkExtractImageFilter.h
+++ b/Modules/ImageExtraction/mitkExtractImageFilter.h
@@ -1,116 +1,116 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkExtractImageFilter_h_Included
#define mitkExtractImageFilter_h_Included
#include "mitkCommon.h"
#include <MitkImageExtractionExports.h>
#include "mitkImageToImageFilter.h"
#include "itkImage.h"
namespace mitk
{
/**
\deprecated This class is deprecated. Use mitk::ExtractSliceFilter instead.
\sa ExtractSliceFilter
\brief Extracts a 2D slice from a 3D image.
\sa SegTool2D
\sa OverwriteSliceImageFilter
\ingroup Process
\ingroup ToolManagerEtAl
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkSegmentationTechnicalPage
This class takes a 3D mitk::Image as input and tries to extract one slice from it.
Two parameters determine which slice is extracted: the "slice dimension" is that one, which is constant for all points in the plane, e.g. axial would mean 2.
The "slice index" is the slice index in the image direction you specified with "affected dimension". Indices count from zero.
Output will not be set if there was a problem extracting the desired slice.
Last contributor: $Author$
*/
class MITKIMAGEEXTRACTION_EXPORT ExtractImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(ExtractImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Which slice to extract (first one has index 0).
*/
itkSetMacro(SliceIndex, unsigned int);
itkGetConstMacro(SliceIndex, unsigned int);
/**
\brief The orientation of the slice to be extracted.
\a Parameter SliceDimension Number of the dimension which is constant for all pixels of the desired slice (e.g. 2 for axial)
*/
itkSetMacro(SliceDimension, unsigned int);
itkGetConstMacro(SliceDimension, unsigned int);
/**
\brief Time step of the image to be extracted.
*/
itkSetMacro(TimeStep, unsigned int);
itkGetConstMacro(TimeStep, unsigned int);
typedef enum DirectionCollapseStrategyEnum {
DIRECTIONCOLLAPSETOUNKOWN=0,
DIRECTIONCOLLAPSETOIDENTITY=1,
DIRECTIONCOLLAPSETOSUBMATRIX=2,
DIRECTIONCOLLAPSETOGUESS=3
} DIRECTIONCOLLAPSESTRATEGY;
/**
\brief Collapse strategy to be used.
*/
itkSetMacro(DirectionCollapseToStrategy, DIRECTIONCOLLAPSESTRATEGY);
itkGetConstMacro(DirectionCollapseToStrategy, DIRECTIONCOLLAPSESTRATEGY);
protected:
ExtractImageFilter(); // purposely hidden
virtual ~ExtractImageFilter();
- virtual void GenerateOutputInformation();
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateOutputInformation() override;
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
template<typename TPixel, unsigned int VImageDimension>
void ItkImageProcessing( const itk::Image<TPixel,VImageDimension>* image );
unsigned int m_SliceIndex;
unsigned int m_SliceDimension;
unsigned int m_TimeStep;
DIRECTIONCOLLAPSESTRATEGY m_DirectionCollapseToStrategy;
};
} // namespace
#endif
diff --git a/Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp b/Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp
index 9c4f24c6c2..cf9f6a15cd 100644
--- a/Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp
+++ b/Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp
@@ -1,412 +1,412 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkImageStatisticsCalculator.h"
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <mitkPlanarPolygon.h>
#include <mitkClassicDICOMSeriesReader.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <mitkStandaloneDataStorage.h>
/**
* \brief Test class for mitkImageStatisticsCalculator
*
* This test covers:
* - instantiation of an ImageStatisticsCalculator class
* - correctness of statistics when using PlanarFigures for masking
*/
class mitkImageStatisticsCalculatorTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageStatisticsCalculatorTestSuite);
MITK_TEST(TestUninitializedImage);
MITK_TEST(TestCase1);
MITK_TEST(TestCase2);
MITK_TEST(TestCase3);
MITK_TEST(TestCase4);
MITK_TEST(TestCase5);
MITK_TEST(TestCase6);
MITK_TEST(TestCase7);
MITK_TEST(TestCase8);
MITK_TEST(TestCase9);
MITK_TEST(TestCase10);
MITK_TEST(TestCase11);
MITK_TEST(TestCase12);
CPPUNIT_TEST_SUITE_END();
public:
- void setUp();
+ void setUp() override;
void TestUninitializedImage();
void TestCase1();
void TestCase2();
void TestCase3();
void TestCase4();
void TestCase5();
void TestCase6();
void TestCase7();
void TestCase8();
void TestCase9();
void TestCase10();
void TestCase11();
void TestCase12();
private:
mitk::Image::Pointer m_Image;
mitk::PlaneGeometry::Pointer m_Geometry;
// calculate statistics for the given image and planarpolygon
const mitk::ImageStatisticsCalculator::Statistics ComputeStatistics( mitk::Image::Pointer image,
mitk::PlanarFigure::Pointer polygon );
void VerifyStatistics(const mitk::ImageStatisticsCalculator::Statistics& stats,
double testMean, double testSD);
};
void mitkImageStatisticsCalculatorTestSuite::setUp()
{
std::string filename = this->GetTestDataFilePath("ImageStatistics/testimage.dcm");
if (filename.empty())
{
MITK_TEST_FAILED_MSG( << "Could not find test file" )
}
MITK_TEST_OUTPUT(<< "Loading test image '" << filename << "'")
mitk::StringList files;
files.push_back( filename );
mitk::ClassicDICOMSeriesReader::Pointer reader = mitk::ClassicDICOMSeriesReader::New();
reader->SetInputFiles( files );
reader->AnalyzeInputFiles();
reader->LoadImages();
MITK_TEST_CONDITION_REQUIRED( reader->GetNumberOfOutputs() == 1, "Loaded one result from file" );
m_Image = reader->GetOutput(0).GetMitkImage();
MITK_TEST_CONDITION_REQUIRED( m_Image.IsNotNull(), "Loaded an mitk::Image" );
m_Geometry = m_Image->GetSlicedGeometry()->GetPlaneGeometry(0);
MITK_TEST_CONDITION_REQUIRED( m_Geometry.IsNotNull(), "Getting image geometry" )
}
void mitkImageStatisticsCalculatorTestSuite::TestCase1()
{
/*****************************
* one whole white pixel
* -> mean of 255 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 10.5 ; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 10.5; pnt4[1] = 4.5;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 255.0, 0.0);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase2()
{
/*****************************
* half pixel in x-direction (white)
* -> mean of 255 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 10.0 ; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 10.0; pnt4[1] = 4.5;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 255.0, 0.0);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase3()
{
/*****************************
* half pixel in diagonal-direction (white)
* -> mean of 255 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 10.5 ; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
figure1->SetControlPoint( 2, pnt3, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 255.0, 0.0);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase4()
{
/*****************************
* one pixel (white) + 2 half pixels (white) + 1 half pixel (black)
* -> mean of 191.25 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 1.1; pnt1[1] = 1.1;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 2.0; pnt2[1] = 2.0;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 3.0; pnt3[1] = 1.0;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 2.0; pnt4[1] = 0.0;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 191.25, 127.5);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase5()
{
/*****************************
* whole pixel (white) + half pixel (gray) in x-direction
* -> mean of 191.5 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.5;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 191.50, 89.80);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase6()
{
/*****************************
* quarter pixel (black) + whole pixel (white) + half pixel (gray) in x-direction
* -> mean of 191.5 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.25; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.25; pnt3[1] = 4.5;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.5;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 191.5, 89.80);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase7()
{
/*****************************
* half pixel (black) + whole pixel (white) + half pixel (gray) in x-direction
* -> mean of 127.66 expected
******************************/
mitk::PlanarPolygon::Pointer figure1 = mitk::PlanarPolygon::New();
figure1->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
figure1->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.0; pnt2[1] = 3.5;
figure1->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 9.0; pnt3[1] = 4.0;
figure1->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.0;
figure1->SetControlPoint( 3, pnt4, true );
figure1->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure1.GetPointer()), 127.66, 127.5);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase8()
{
/*****************************
* whole pixel (gray)
* -> mean of 128 expected
******************************/
mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
figure2->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.5; pnt1[1] = 10.5;
figure2->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 11.5; pnt2[1] = 11.5;
figure2->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 12.5; pnt3[1] = 11.5;
figure2->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 12.5; pnt4[1] = 10.5;
figure2->SetControlPoint( 3, pnt4, true );
figure2->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 128.0, 0.0);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase9()
{
/*****************************
* whole pixel (gray) + half pixel (white) in y-direction
* -> mean of 191.5 expected
******************************/
mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
figure2->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.5; pnt1[1] = 10.5;
figure2->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 11.5; pnt2[1] = 12.0;
figure2->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 12.5; pnt3[1] = 12.0;
figure2->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 12.5; pnt4[1] = 10.5;
figure2->SetControlPoint( 3, pnt4, true );
figure2->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 191.5, 89.80);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase10()
{
/*****************************
* 2 whole pixel (white) + 2 whole pixel (black) in y-direction
* -> mean of 127.66 expected
******************************/
mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
figure2->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 11.5; pnt1[1] = 10.5;
figure2->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 11.5; pnt2[1] = 13.5;
figure2->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 12.5; pnt3[1] = 13.5;
figure2->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 12.5; pnt4[1] = 10.5;
figure2->SetControlPoint( 3, pnt4, true );
figure2->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 127.66, 127.5);
}
void mitkImageStatisticsCalculatorTestSuite::TestCase11()
{
/*****************************
* 9 whole pixels (white) + 3 half pixels (white)
* + 3 whole pixel (black) [ + 3 slightly less than half pixels (black)]
* -> mean of 204.0 expected
******************************/
mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
figure2->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 0.5; pnt1[1] = 0.5;
figure2->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 3.5; pnt2[1] = 3.5;
figure2->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 8.4999; pnt3[1] = 3.5;
figure2->SetControlPoint( 2, pnt3, true );
mitk::Point2D pnt4; pnt4[0] = 5.4999; pnt4[1] = 0.5;
figure2->SetControlPoint( 3, pnt4, true );
figure2->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 204.0, 105.58 );
}
void mitkImageStatisticsCalculatorTestSuite::TestCase12()
{
/*****************************
* half pixel (white) + whole pixel (white) + half pixel (black)
* -> mean of 212.66 expected
******************************/
mitk::PlanarPolygon::Pointer figure2 = mitk::PlanarPolygon::New();
figure2->SetPlaneGeometry( m_Geometry );
mitk::Point2D pnt1; pnt1[0] = 9.5; pnt1[1] = 0.5;
figure2->PlaceFigure( pnt1 );
mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 2.5;
figure2->SetControlPoint( 1, pnt2, true );
mitk::Point2D pnt3; pnt3[0] = 11.5; pnt3[1] = 2.5;
figure2->SetControlPoint( 2, pnt3, true );
figure2->GetPolyLine(0);
this->VerifyStatistics(ComputeStatistics(m_Image, figure2.GetPointer()), 212.66, 73.32);
}
const mitk::ImageStatisticsCalculator::Statistics
mitkImageStatisticsCalculatorTestSuite::ComputeStatistics( mitk::Image::Pointer image, mitk::PlanarFigure::Pointer polygon )
{
mitk::ImageStatisticsCalculator::Pointer statisticsCalculator = mitk::ImageStatisticsCalculator::New();
statisticsCalculator->SetImage( image );
statisticsCalculator->SetMaskingModeToPlanarFigure();
statisticsCalculator->SetPlanarFigure( polygon );
statisticsCalculator->ComputeStatistics();
return statisticsCalculator->GetStatistics();
}
void mitkImageStatisticsCalculatorTestSuite::VerifyStatistics(const mitk::ImageStatisticsCalculator::Statistics& stats,
double testMean, double testSD)
{
int tmpMean = stats.GetMean() * 100;
double calculatedMean = tmpMean / 100.0;
MITK_TEST_CONDITION( calculatedMean == testMean,
"Calculated mean grayvalue '" << calculatedMean <<
"' is equal to the desired value '" << testMean << "'" );
int tmpSD = stats.GetSigma() * 100;
double calculatedSD = tmpSD / 100.0;
MITK_TEST_CONDITION( calculatedSD == testSD,
"Calculated grayvalue sd '" << calculatedSD <<
"' is equal to the desired value '" << testSD <<"'" );
}
void mitkImageStatisticsCalculatorTestSuite::TestUninitializedImage()
{
/*****************************
* loading uninitialized image to datastorage
******************************/
MITK_TEST_FOR_EXCEPTION_BEGIN(mitk::Exception)
mitk::Image::Pointer image = mitk::Image::New();
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(image);
mitk::ImageStatisticsCalculator::Pointer is = mitk::ImageStatisticsCalculator::New();
is->ComputeStatistics();
MITK_TEST_FOR_EXCEPTION_END(mitk::Exception)
}
MITK_TEST_SUITE_REGISTRATION(mitkImageStatisticsCalculator)
diff --git a/Modules/ImageStatistics/mitkImageStatisticsCalculator.h b/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
index 5d1d526574..1a4b2cc4b7 100644
--- a/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
+++ b/Modules/ImageStatistics/mitkImageStatisticsCalculator.h
@@ -1,579 +1,579 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_IMAGESTATISTICSCALCULATOR_H
#define _MITK_IMAGESTATISTICSCALCULATOR_H
#include <itkObject.h>
#include "MitkImageStatisticsExports.h"
#include <itkImage.h>
#include <itkTimeStamp.h>
#include "mitkImage.h"
#include "mitkPlanarFigure.h"
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
#include <itkImageRegionIteratorWithIndex.h>
#include <vtkSmartPointer.h>
// just a helper to unclutter our code
// to be replaced with references to m_Member (when deprecated public members in Statistics are removed)
#define mitkSetGetConstMacro(name, type) \
virtual type Get##name() const \
{ \
return this->name; \
} \
\
virtual void Set##name(const type _arg) \
{ \
if ( this->name != _arg ) \
{ \
this->name = _arg; \
} \
}
namespace mitk
{
/**
* \brief Class for calculating statistics and histogram for an (optionally
* masked) image.
*
* Images can be masked by either a label image (of the same dimensions as
* the original image) or by a closed mitk::PlanarFigure, e.g. a circle or
* polygon. When masking with a planar figure, the slice corresponding to the
* plane containing the figure is extracted and then clipped with contour
* defined by the figure. Planar figures need to be aligned along the main axes
* of the image (axial, sagittal, coronal). Planar figures on arbitrary
* rotated planes are not supported.
*
* For each operating mode (no masking, masking by image, masking by planar
* figure), the calculated statistics and histogram are cached so that, when
* switching back and forth between operation modes without modifying mask or
* image, the information doesn't need to be recalculated.
*
* The class also has the possibility to calculate the location and separate
* statistics for a region called "hotspot". The hotspot is a sphere of
* user-defined size and its location is chosen in a way that the average
* pixel value within the sphere is maximized.
*
* \warning Hotspot calculation does not work in case of 2D-images!
*
* Note: currently time-resolved and multi-channel pictures are not properly
* supported.
*
* \section HotspotStatistics_caption Calculation of hotspot statistics
*
* Since calculation of hotspot location and statistics is not
* straight-forward, the following paragraphs will describe it in more detail.
*
* <b>Note: Calculation of hotspot statistics is optional and set to off by default.
* Multilabel-masks are supported.</b>
*
* \subsection HotspotStatistics_description Hotspot Definition
*
* The hotspot of an image is motivated from PET readings. It is defined
* as a spherical region of fixed size which maximizes the average pixel value
* within the region. The following image illustrates the concept: the
* colored areas are different image intensities and the hotspot is located
* in the hottest region of the image.
*
* <b> Note:</b> Only hotspots are calculated for which the whole hotspot-sphere is
* inside the image by default. This behaviour can be changed by
* by calling SetHotspotMustBeCompletlyInsideImage().
* \warning Note that SetHotspotMustBeCompletlyInsideImage(false) may overrate
* "hot" regions at image borders, because they have a stronger influence on the
* mean value! Think clearly about this fact and make sure this is what you
* want/need in your application, before calling
* SetHotspotMustBeCompletlyInsideImage(false)!
*
*
* \image html hotspotexample.JPG
*
* \subsection HotspotStatistics_calculation Hotspot Calculation
*
* Since only the size of the hotspot is known initially, we need to calculate
* two aspects (both implemented in CalculateHotspotStatistics() ):
* - the hotspot location
* - statistics of the pixels within the hotspot.
*
* Finding the hotspot location requires to calculate the average value at each
* position. This is done by convolution of the image with a sperical kernel
* image which reflects partial volumes (important in the case of low-resolution
* PET images).
*
* Once the hotspot location is known, calculating the actual statistics is a
* simple task which is implemented in CalculateHotspotStatistics() using a second
* instance of the ImageStatisticsCalculator.
*
* <b>Step 1: Finding the hotspot by image convolution</b>
*
* As described above, we use image convolution with a rasterized sphere to
* average the image at each position. To handle coarse resolutions, which would
* normally force us to decide for partially contained voxels whether to count
* them or not, we supersample the kernel image and use non-integer kernel values
* (see GenerateHotspotSearchConvolutionKernel()), which reflect the volume part that is contained in the
* sphere. For example, if three subvoxels are inside the sphere, the corresponding
* kernel voxel gets a value of 0.75 (3 out of 4 subvoxels, see 2D example below).
*
* \image html convolutionkernelsupersampling.jpg
*
* Convolution itself is done by means of the itkFFTConvolutionImageFilter.
* To find the hotspot location, we simply iterate the averaged image and find a
* maximum location (see CalculateExtremaWorld()). In case of images with multiple
* maxima the method returns value and corresponding index of the extrema that is
* found by the iterator first.
*
* <b>Step 2: Computation of hotspot statistics</b>
*
* Once the hotspot location is found, statistics for the region are calculated
* by simply iterating the input image and regarding all pixel centers inside the
* hotspot-sphere for statistics.
* \warning Index positions of maximum/minimum are not provided, because they are not necessarily unique
* \todo If index positions of maximum/minimum are required, output needs to be changed to multiple positions / regions, etc.
*
* \subsection HotspotStatistics_tests Tests
*
* To check the correctness of the hotspot calculation, a special class
* (\ref hotspottestdoc) has been created, which generates images with
* known hotspot location and statistics. A number of unit tests use this class
* to first generate an image of known properites and then verify that
* ImageStatisticsCalculator is able to reproduce the known statistics.
*
*/
class MITKIMAGESTATISTICS_EXPORT ImageStatisticsCalculator : public itk::Object
{
public:
/** \brief Enum for possible masking modi. */
enum
{
MASKING_MODE_NONE = 0,
MASKING_MODE_IMAGE = 1,
MASKING_MODE_PLANARFIGURE = 2
};
typedef itk::Statistics::Histogram<double> HistogramType;
typedef HistogramType::ConstIterator HistogramConstIteratorType;
/** \brief Class for common statistics, includig hotspot properties. */
class MITKIMAGESTATISTICS_EXPORT Statistics
{
public:
Statistics(bool withHotspotStatistics = true);
Statistics(const Statistics& other);
virtual ~Statistics();
Statistics& operator=(Statistics const& stats);
const Statistics& GetHotspotStatistics() const; // real statistics
Statistics& GetHotspotStatistics(); // real statistics
bool HasHotspotStatistics() const;
void SetHasHotspotStatistics(bool hasHotspotStatistics); // set a flag. if set, return empty hotspotstatistics object
void Reset(unsigned int dimension = 2);
mitkSetGetConstMacro(Label, unsigned int)
mitkSetGetConstMacro(N, unsigned int)
mitkSetGetConstMacro(Min, double)
mitkSetGetConstMacro(Max, double)
mitkSetGetConstMacro(Mean, double)
mitkSetGetConstMacro(Median, double)
double GetVariance() const;
/** \brief Set variance
*
* This method checks whether the variance is negative:
* The reason that the variance may be negative is that the underlying itk::LabelStatisticsImageFilter uses a naïve algorithm
* for calculating the variance ( http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance ) which can lead to negative values
* due to rounding errors.
*
* If the variance is negative the value will be set to 0.0, else the given value will be set.
*/
void SetVariance( const double );
double GetSigma() const;
/** \brief Set standard deviation (sigma)
*
* This method checks if the given standard deviation is a positive value. This is done because the underlying itk::LabelStatisticsImageFilter uses
* a naïve algorithm to calculate the variance. This may lead to a negative variance and because the square root of the variance is taken it also
* leads to NaN for sigma.
*
* If the given value is not reasonable the value will be set to 0.0, else the given value will be set.
*
* \see SetVariance()
*/
void SetSigma( const double );
mitkSetGetConstMacro(RMS, double)
mitkSetGetConstMacro(MinIndex, vnl_vector<int>)
mitkSetGetConstMacro(MaxIndex, vnl_vector<int>)
mitkSetGetConstMacro(HotspotIndex, vnl_vector<int>)
private:
unsigned int Label;
unsigned int N;
double Min;
double Max;
double Mean;
double Median;
double Variance;
double Sigma;
double RMS;
vnl_vector<int> MinIndex;
vnl_vector<int> MaxIndex;
Statistics* m_HotspotStatistics;
bool m_HasHotspotStatistics;
vnl_vector<int> HotspotIndex; //< index of hotspotsphere origin
};
typedef std::vector< HistogramType::ConstPointer > HistogramContainer;
typedef std::vector< Statistics > StatisticsContainer;
- mitkClassMacro( ImageStatisticsCalculator, itk::Object );
+ mitkClassMacroItkParent( ImageStatisticsCalculator, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Automatically calculate bin size to obtain 200 bins. */
void SetUseDefaultBinSize(bool useDefault);
/** \brief Set image from which to compute statistics. */
void SetImage( const mitk::Image *image );
/** \brief Set image for masking. */
void SetImageMask( const mitk::Image *imageMask );
/** \brief Set planar figure for masking. */
void SetPlanarFigure( mitk::PlanarFigure *planarFigure );
/** \brief Set/Get operation mode for masking */
void SetMaskingMode( unsigned int mode );
/** \brief Set/Get operation mode for masking */
itkGetMacro( MaskingMode, unsigned int );
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToNone();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToImage();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToPlanarFigure();
/** \brief Set a pixel value for pixels that will be ignored in the statistics */
void SetIgnorePixelValue(double value);
/** \brief Get the pixel value for pixels that will be ignored in the statistics */
double GetIgnorePixelValue();
/** \brief Set whether a pixel value should be ignored in the statistics */
void SetDoIgnorePixelValue(bool doit);
/** \brief Get whether a pixel value will be ignored in the statistics */
bool GetDoIgnorePixelValue();
/** \brief Set bin size for histogram resolution.*/
void SetHistogramBinSize( double size);
/** \brief Get bin size for histogram resolution.*/
unsigned int GetHistogramBinSize();
/** \brief Sets the radius for the hotspot */
void SetHotspotRadiusInMM (double hotspotRadiusInMM);
/** \brief Returns the radius of the hotspot */
double GetHotspotRadiusInMM();
/** \brief Sets whether the hotspot should be calculated */
void SetCalculateHotspot(bool calculateHotspot);
/** \brief Returns true whether the hotspot should be calculated, otherwise false */
bool IsHotspotCalculated();
/** \brief Sets flag whether hotspot is completly inside the image. Please note that if set to false
it can be possible that statistics are calculated for which the whole hotspot is not inside the image!
\warning regarding positions at the image centers may produce unexpected hotspot locations, please see \ref HotspotStatistics_description
*/
void SetHotspotMustBeCompletlyInsideImage(bool hotspotIsCompletlyInsideImage, bool warn = true);
/** \brief Returns true if hotspot has to be completly inside the image. */
bool GetHotspotMustBeCompletlyInsideImage() const;
/** \brief Compute statistics (together with histogram) for the current
* masking mode.
*
* Computation is not executed if statistics is already up to date. In this
* case, false is returned; otherwise, true.*/
virtual bool ComputeStatistics( unsigned int timeStep = 0 );
/** \brief Retrieve the histogram depending on the current masking mode.
*
* \param label The label for which to retrieve the histogram in multi-label situations (ascending order).
*/
const HistogramType *GetHistogram( unsigned int timeStep = 0, unsigned int label = 0 ) const;
/** \brief Retrieve the histogram depending on the current masking mode (for all image labels. */
const HistogramContainer &GetHistogramVector( unsigned int timeStep = 0 ) const;
/** \brief Retrieve statistics depending on the current masking mode.
*
* \param label The label for which to retrieve the statistics in multi-label situations (ascending order).
*/
const Statistics &GetStatistics( unsigned int timeStep = 0, unsigned int label = 0 ) const;
/** \brief Retrieve statistics depending on the current masking mode (for all image labels). */
const StatisticsContainer &GetStatisticsVector( unsigned int timeStep = 0 ) const;
protected:
typedef std::vector< HistogramContainer > HistogramVector;
typedef std::vector< StatisticsContainer > StatisticsVector;
typedef std::vector< itk::TimeStamp > TimeStampVectorType;
typedef std::vector< bool > BoolVectorType;
typedef itk::Image< unsigned short, 3 > MaskImage3DType;
typedef itk::Image< unsigned short, 2 > MaskImage2DType;
ImageStatisticsCalculator();
virtual ~ImageStatisticsCalculator();
/** \brief Depending on the masking mode, the image and mask from which to
* calculate statistics is extracted from the original input image and mask
* data.
*
* For example, a when using a PlanarFigure as mask, the 2D image slice
* corresponding to the PlanarFigure will be extracted from the original
* image. If masking is disabled, the original image is simply passed
* through. */
void ExtractImageAndMask( unsigned int timeStep = 0 );
/** \brief If the passed vector matches any of the three principal axes
* of the passed geometry, the ínteger value corresponding to the axis
* is set and true is returned. */
bool GetPrincipalAxis( const BaseGeometry *geometry, Vector3D vector,
unsigned int &axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsUnmasked(
const itk::Image< TPixel, VImageDimension > *image,
StatisticsContainer* statisticsContainer,
HistogramContainer *histogramContainer );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsMasked(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage,
StatisticsContainer* statisticsContainer,
HistogramContainer* histogramContainer );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateMaskFromPlanarFigure(
const itk::Image< TPixel, VImageDimension > *image, unsigned int axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalMaskIgnoredPixels(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned short, VImageDimension > *maskImage );
class ImageExtrema
{
public:
bool Defined;
double Max;
double Min;
vnl_vector<int> MaxIndex;
vnl_vector<int> MinIndex;
ImageExtrema()
:Defined(false)
,Max(itk::NumericTraits<double>::min())
,Min(itk::NumericTraits<double>::max())
{
}
};
/** \brief Calculates minimum, maximum, mean value and their
* corresponding indices in a given ROI. As input the function
* needs an image and a mask. Returns an ImageExtrema object. */
template <typename TPixel, unsigned int VImageDimension >
ImageExtrema CalculateExtremaWorld(
const itk::Image<TPixel, VImageDimension> *inputImage,
itk::Image<unsigned short, VImageDimension> *maskImage,
double neccessaryDistanceToImageBorderInMM,
unsigned int label);
/** \brief Calculates the hotspot statistics depending on
* masking mode. Hotspot statistics are calculated for a
* hotspot which is completly located inside the image by default. */
template < typename TPixel, unsigned int VImageDimension>
Statistics CalculateHotspotStatistics(
const itk::Image<TPixel, VImageDimension> *inputImage,
itk::Image<unsigned short, VImageDimension> *maskImage,
double radiusInMM,
bool& isHotspotDefined,
unsigned int label);
/** Connection from ITK to VTK */
template <typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines(ITK_Exporter exporter, vtkSmartPointer<VTK_Importer> importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
/** Connection from VTK to ITK */
template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(vtkSmartPointer<VTK_Exporter> exporter, ITK_Importer importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
void UnmaskedStatisticsProgressUpdate();
void MaskedStatisticsProgressUpdate();
/** \brief Returns size of convolution kernel depending on spacing and radius. */
template <unsigned int VImageDimension>
itk::Size<VImageDimension>
CalculateConvolutionKernelSize(double spacing[VImageDimension], double radiusInMM);
/** \brief Generates image of kernel which is needed for convolution. */
template <unsigned int VImageDimension>
itk::SmartPointer< itk::Image<float, VImageDimension> >
GenerateHotspotSearchConvolutionKernel(double spacing[VImageDimension], double radiusInMM);
/** \brief Convolves image with spherical kernel image. Used for hotspot calculation. */
template <typename TPixel, unsigned int VImageDimension>
itk::SmartPointer< itk::Image<TPixel, VImageDimension> >
GenerateConvolutionImage( const itk::Image<TPixel, VImageDimension>* inputImage );
/** \brief Fills pixels of the spherical hotspot mask. */
template < typename TPixel, unsigned int VImageDimension>
void
FillHotspotMaskPixels( itk::Image<TPixel, VImageDimension>* maskImage,
itk::Point<double, VImageDimension> sphereCenter,
double sphereRadiusInMM);
/** m_Image contains the input image (e.g. 2D, 3D, 3D+t)*/
mitk::Image::ConstPointer m_Image;
mitk::Image::ConstPointer m_ImageMask;
mitk::PlanarFigure::Pointer m_PlanarFigure;
HistogramVector m_ImageHistogramVector;
HistogramVector m_MaskedImageHistogramVector;
HistogramVector m_PlanarFigureHistogramVector;
HistogramType::Pointer m_EmptyHistogram;
HistogramContainer m_EmptyHistogramContainer;
StatisticsVector m_ImageStatisticsVector;
StatisticsVector m_MaskedImageStatisticsVector;
StatisticsVector m_PlanarFigureStatisticsVector;
StatisticsVector m_MaskedImageHotspotStatisticsVector;
Statistics m_EmptyStatistics;
StatisticsContainer m_EmptyStatisticsContainer;
unsigned int m_MaskingMode;
bool m_MaskingModeChanged;
/** m_InternalImage contains a image volume at one time step (e.g. 2D, 3D)*/
mitk::Image::ConstPointer m_InternalImage;
MaskImage3DType::Pointer m_InternalImageMask3D;
MaskImage2DType::Pointer m_InternalImageMask2D;
TimeStampVectorType m_ImageStatisticsTimeStampVector;
TimeStampVectorType m_MaskedImageStatisticsTimeStampVector;
TimeStampVectorType m_PlanarFigureStatisticsTimeStampVector;
BoolVectorType m_ImageStatisticsCalculationTriggerVector;
BoolVectorType m_MaskedImageStatisticsCalculationTriggerVector;
BoolVectorType m_PlanarFigureStatisticsCalculationTriggerVector;
double m_IgnorePixelValue;
bool m_DoIgnorePixelValue;
bool m_IgnorePixelValueChanged;
unsigned int m_PlanarFigureAxis; // Normal axis for PlanarFigure
unsigned int m_PlanarFigureSlice; // Slice which contains PlanarFigure
int m_PlanarFigureCoordinate0; // First plane-axis for PlanarFigure
int m_PlanarFigureCoordinate1; // Second plane-axis for PlanarFigure
double m_HistogramBinSize; ///Bin size for histogram resoluion.
bool m_UseDefaultBinSize;
double m_HotspotRadiusInMM;
bool m_CalculateHotspot;
bool m_HotspotRadiusInMMChanged;
bool m_HotspotMustBeCompletelyInsideImage;
private:
unsigned int calcNumberOfBins(mitk::ScalarType min, mitk::ScalarType max);
};
} // namespace
#endif
diff --git a/Modules/ImageStatistics/mitkPointSetDifferenceStatisticsCalculator.h b/Modules/ImageStatistics/mitkPointSetDifferenceStatisticsCalculator.h
index 8d51aadc28..1dbffb566b 100644
--- a/Modules/ImageStatistics/mitkPointSetDifferenceStatisticsCalculator.h
+++ b/Modules/ImageStatistics/mitkPointSetDifferenceStatisticsCalculator.h
@@ -1,110 +1,110 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PointSetDifferenceStatisticsCalculator_H
#define _MITK_PointSetDifferenceStatisticsCalculator_H
#include <itkObject.h>
#include <MitkImageStatisticsExports.h>
#include "mitkImageStatisticsCalculator.h"
#include <mitkPointSet.h>
namespace mitk
{
/**
* \brief Class for calculating the difference between two corresponding point sets.
* The user can access the single distances between corresponding points as well as a complete statistic (mean, sd, rms, median, max, min)
* The point sets must be of equal size!
*/
class MITKIMAGESTATISTICS_EXPORT PointSetDifferenceStatisticsCalculator : public itk::Object
{
public:
- mitkClassMacro( PointSetDifferenceStatisticsCalculator, itk::Object );
+ mitkClassMacroItkParent( PointSetDifferenceStatisticsCalculator, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro2Param(PointSetDifferenceStatisticsCalculator,mitk::PointSet::Pointer,mitk::PointSet::Pointer);
/*!
\brief set point sets to be compared
*/
void SetPointSets(mitk::PointSet::Pointer pSet1, mitk::PointSet::Pointer pSet2);
/*!
\brief returns a vector holding the differences between the corresponding points of the point sets
*/
std::vector<double> GetDifferences();
/*!
\brief returns a vector holding the squared differences between the corresponding points of the point sets
*/
std::vector<double> GetSquaredDifferences();
/*!
\brief returns the mean distance of all corresponding points of the point sets
*/
double GetMean();
/*!
\brief returns the standard deviation of the distances between all corresponding points of the point sets
*/
double GetSD();
/*!
\brief returns the variance of the distances between all corresponding points of the point sets
*/
double GetVariance();
/*!
\brief returns the root mean squared distance of all corresponding points of the point sets
*/
double GetRMS();
/*!
\brief returns the median distance of all corresponding points of the point sets
*/
double GetMedian();
/*!
\brief returns the maximal distance of all corresponding points of the point sets
*/
double GetMax();
/*!
\brief returns the minimal distance of all corresponding points of the point sets
*/
double GetMin();
/*!
\brief returns the total number of corresponding points of the point sets
*/
double GetNumberOfPoints();
protected:
PointSetDifferenceStatisticsCalculator();
PointSetDifferenceStatisticsCalculator(mitk::PointSet::Pointer,mitk::PointSet::Pointer);
virtual ~PointSetDifferenceStatisticsCalculator();
/*!
\brief Method for computing the complete statistics of the differences between the given point sets.
*/
void ComputeStatistics();
mitk::ImageStatisticsCalculator::Statistics m_Statistics; ///< struct holding the statistics
std::vector<double> m_DifferencesVector; ///< vector holding the differences between the corresponding points
std::vector<double> m_SquaredDifferencesVector; ///< vector holding the squared differences between the corresponding points
mitk::PointSet::Pointer m_PointSet1; ///< first point set used for comparison
mitk::PointSet::Pointer m_PointSet2; ///< second point set used for comparison
bool m_StatisticsCalculated; ///< flag indicating whether statistics are already calculated or not.
};
}
#endif // #define _MITK_PointSetDifferenceStatisticsCalculator_H
diff --git a/Modules/ImageStatistics/mitkPointSetStatisticsCalculator.h b/Modules/ImageStatistics/mitkPointSetStatisticsCalculator.h
index b330909fff..d2918c6e32 100644
--- a/Modules/ImageStatistics/mitkPointSetStatisticsCalculator.h
+++ b/Modules/ImageStatistics/mitkPointSetStatisticsCalculator.h
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PointSetSTATISTICSCALCULATOR_H
#define _MITK_PointSetSTATISTICSCALCULATOR_H
#include <itkObject.h>
#include <MitkImageStatisticsExports.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* \brief Class for calculating statistics (like standard derivation, RMS, mean, etc.) for a PointSet.
*/
class MITKIMAGESTATISTICS_EXPORT PointSetStatisticsCalculator : public itk::Object
{
public:
- mitkClassMacro( PointSetStatisticsCalculator, itk::Object );
+ mitkClassMacroItkParent( PointSetStatisticsCalculator, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(PointSetStatisticsCalculator,mitk::PointSet::Pointer);
/** @brief Sets the point set which will be analysed. */
void SetPointSet(mitk::PointSet::Pointer pSet);
/** @return Returns the mean position of the analysed point set (only valid navigation data). Returns [0;0;0] if there is no valid navigation data.*/
mitk::Point3D GetPositionMean();
/** @return Returns the standard derivation of each component (x, y and z) of the analysed point set (only valid navigation data). Returns [0;0;0] if there is no valid navigation data.*/
mitk::Vector3D GetPositionStandardDeviation();
/** @return Returns the sample standard derivation of each component (x, y and z) of the analysed point set (only valid navigation data). Returns [0;0;0] if there is no valid navigation data.*/
mitk::Vector3D GetPositionSampleStandardDeviation();
/** @return Returns the mean distance to the mean postion (=mean error) of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorMean();
/** @return Returns the standard derivation of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorStandardDeviation();
/** @return Returns the sample standard derivation of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorSampleStandardDeviation();
/** @return Returns the RMS of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorRMS();
/** @return Returns the median of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorMedian();
/** @return Returns the maximum of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorMax();
/** @return Returns the minimum of the errors of all positions of the analysed point set (only valid navigation data). Returns 0 if there is no valid navigation data. */
double GetPositionErrorMin();
//#####################################################################################################
//this both methods are used by another class an so they are public... perhaps we want to move them
//out of this class because they have nothing to do with point sets.
/** @return returns the standard derivation of the given list (NOT of the point set).*/
double GetStabw(std::vector<double> list);
/** @return returns the sample standard derivation of the given list (NOT of the point set).*/
double GetSampleStabw(std::vector<double> list);
//#####################################################################################################
protected:
PointSetStatisticsCalculator();
PointSetStatisticsCalculator(mitk::PointSet::Pointer);
virtual ~PointSetStatisticsCalculator();
// TODO: Remove the std::vector<mitk::Point3D> data structure and use mitk::PointSet everywhere
/** @return Returns a list with the distances to the mean of the list */
std::vector<double> GetErrorList(std::vector<mitk::Point3D> list);
/** @return Returns the mean of the point list. Returns [0;0;0] if the list is empty. */
mitk::Point3D GetMean(std::vector<mitk::Point3D> list);
/** @brief Converts a point set to a vector of Point3D. */
std::vector<mitk::Point3D> PointSetToVector(mitk::PointSet::Pointer pSet);
/** @return Returns true if all positions in the evaluated points set are equal. False if not. */
bool CheckIfAllPositionsAreEqual();
mitk::PointSet::Pointer m_PointSet;
double GetMean(std::vector<double> list);
double GetMedian(std::vector<double> list);
double GetMax(std::vector<double> list);
double GetMin(std::vector<double> list);
};
}
#endif // #define _MITK_PointSetSTATISTICSCALCULATOR_H
diff --git a/Modules/InputDevices/WiiMote/mitkKalmanFilter.h b/Modules/InputDevices/WiiMote/mitkKalmanFilter.h
index b131a321af..1d422bb09e 100644
--- a/Modules/InputDevices/WiiMote/mitkKalmanFilter.h
+++ b/Modules/InputDevices/WiiMote/mitkKalmanFilter.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_KALMAN_FILTER_H
#define MITK_KALMAN_FILTER_H
// mitk
#include <mitkCommon.h>
// itk
#include <itkObject.h>
#include "itkObjectFactory.h"
#include <cv.h>
namespace mitk
{
/**
*
* DOES NOT YET WORK!
*
*/
class KalmanFilter : public itk::Object
{
public:
// only needed for smartpointer
- mitkClassMacro(KalmanFilter,itk::Object);
+ mitkClassMacroItkParent(KalmanFilter,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
KalmanFilter();
virtual ~KalmanFilter();
float ProcessValue( float input );
void SetMeasurementNoise( float measurementNoise );
void SetProcessNoise( float processNoise );
void ResetFilter();
protected:
private:
CvKalman* m_cvKalman;
CvMat* m_StateVector; // x_k
bool m_IsInitialized;
}; // end class
} // end namespace
#endif // MITK_KALMAN_FILTER_H
diff --git a/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp b/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp
index 2e59c45b68..a8c2efac75 100644
--- a/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp
+++ b/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp
@@ -1,40 +1,40 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usModuleActivator.h>
#include "mitkPicFileReader.h"
class US_ABI_LOCAL mitkIpPicSupportIOActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext*)
+ void Load(us::ModuleContext*) override
{
m_Reader = new mitk::PicFileReader();
}
- void Unload(us::ModuleContext* )
+ void Unload(us::ModuleContext* ) override
{
delete m_Reader;
}
private:
mitk::IFileReader* m_Reader;
};
US_EXPORT_MODULE_ACTIVATOR(mitkIpPicSupportIOActivator)
diff --git a/Modules/IpPicSupportIO/Internal/mitkPicFileReader.h b/Modules/IpPicSupportIO/Internal/mitkPicFileReader.h
index af240e9771..403eeabffc 100644
--- a/Modules/IpPicSupportIO/Internal/mitkPicFileReader.h
+++ b/Modules/IpPicSupportIO/Internal/mitkPicFileReader.h
@@ -1,57 +1,57 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PICFILEREADER_H_HEADER_INCLUDED_C1F48A22
#define PICFILEREADER_H_HEADER_INCLUDED_C1F48A22
#include "mitkAbstractFileReader.h"
#include "mitkImage.h"
#include "mitkIpPic.h"
namespace mitk {
//##Documentation
//## @brief Reader to read files in DKFZ-pic-format
class PicFileReader : public AbstractFileReader
{
public:
PicFileReader();
using AbstractFileReader::Read;
- std::vector<mitk::BaseData::Pointer> Read();
+ std::vector<mitk::BaseData::Pointer> Read() override;
protected:
void FillImage(Image::Pointer image);
Image::Pointer CreateImage();
private:
static void ConvertHandedness(mitkIpPicDescriptor* pic);
- PicFileReader* Clone() const;
+ PicFileReader* Clone() const override;
};
} // namespace mitk
#endif /* PICFILEREADER_H_HEADER_INCLUDED_C1F48A22 */
diff --git a/Modules/LegacyGL/mitkGLMapper.h b/Modules/LegacyGL/mitkGLMapper.h
index 05086d6a73..0dd42b58f7 100644
--- a/Modules/LegacyGL/mitkGLMapper.h
+++ b/Modules/LegacyGL/mitkGLMapper.h
@@ -1,108 +1,108 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGLMAPPER_H_HEADER_INCLUDED_C197C872
#define MITKGLMAPPER_H_HEADER_INCLUDED_C197C872
#include <MitkLegacyGLExports.h>
#include "mitkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkVtkPropRenderer.h"
namespace mitk {
/** \brief Base class of all OpenGL-based mappers.
*
* Those must implement the abstract method Paint(BaseRenderer), which is called by
* method MitkRender().
* The Paint() method should be used to paint into a renderer via OpenGL-drawing commands.
* The OpenGL context matrices (GL_MODELVIEWMATRIX/GL_PROJECTIONMATRIX) are preinitialized by
* the mitkVtkPropRenderer so that the origin of the 2D-coordinate system of the 2D render
* window is located in the lower left corner and has the width and height in display pixels
* of the respective renderwindow. The x-axis is horizontally oriented, while the y-axis is
* vertically oriented. The drawing commands are directly interpreted as display coordinates.
* ApplyColorAndOpacity() can be used in the subclasses to apply color and opacity properties
* read from the PropertyList.
*
* @deprecatedSince{next_release} GLMappers are no longer supported in the rendering pipeline.
* Please use mitkVtkMapper instead or consider writing your own vtk classes, such as vtkActor
* or vtkMapper
* \ingroup Mapper
*/
class MITKLEGACYGL_EXPORT GLMapper : public Mapper
{
public:
mitkClassMacro(GLMapper, Mapper);
/** \brief Do the painting into the \a renderer */
virtual void Paint(mitk::BaseRenderer *renderer) = 0;
/** \brief Apply color and opacity properties read from the PropertyList
* \deprecatedSince{2013_03} Use ApplyColorAndOpacityProperties(...) instead
*/
DEPRECATED(inline virtual void ApplyProperties(mitk::BaseRenderer* renderer))
{
ApplyColorAndOpacityProperties(renderer);
}
/** \brief Apply color and opacity properties read from the PropertyList.
* The actor is not used in the GLMappers. Called by mapper subclasses.
*/
- virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor = NULL);
+ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor = NULL) override;
/** \brief Checks visibility and calls the paint method
*
* Note: The enumeration is disregarded, since OpenGL rendering only needs a
* single render pass.
*/
- void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type);
+ void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) override;
/** \brief Returns whether this is a vtk-based mapper
* \return false, since all mappers deriving from this class are OpenGL mappers
* \deprecatedSince{2013_03} All mappers of superclass VTKMapper are vtk based, use a dynamic_cast instead
*/
- DEPRECATED( virtual bool IsVtkBased() const );
+ DEPRECATED( virtual bool IsVtkBased() const override);
/** \brief Returns whether this mapper allows picking in the renderwindow
virtual bool IsPickable() const { return false; }*/
protected:
/** constructor */
GLMapper();
/** virtual destructor in order to derive from this class */
virtual ~GLMapper();
private:
/** copy constructor */
GLMapper( const GLMapper &);
/** assignment operator */
GLMapper & operator=(const GLMapper &);
};
} // namespace mitk
#endif /* MITKGLMAPPER2D_H_HEADER_INCLUDED_C197C872 */
diff --git a/Modules/LegacyGL/mitkPlaneGeometryDataGLMapper2D.h b/Modules/LegacyGL/mitkPlaneGeometryDataGLMapper2D.h
index 84d93ee3a4..c192827d4b 100644
--- a/Modules/LegacyGL/mitkPlaneGeometryDataGLMapper2D.h
+++ b/Modules/LegacyGL/mitkPlaneGeometryDataGLMapper2D.h
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB
#define MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB
#include <MitkLegacyGLExports.h>
#include "mitkGLMapper.h"
#include "mitkSurfaceGLMapper2D.h"
#include "mitkDataStorage.h"
#include "mitkDataNode.h"
#include "mitkWeakPointer.h"
#include "mitkLine.h"
namespace mitk {
class BaseRenderer;
class PlaneGeometryDataGLMapper2D;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometryDataGLMapper2D instead. */
DEPRECATED( typedef PlaneGeometryDataGLMapper2D Geometry2DDataMapper2D);
/**
* \brief OpenGL-based mapper to display a PlaneGeometry 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 PlaneGeometryDataGLMapper2D are:
*
* - \b "PlaneOrientationProperty": (PlaneOrientationProperty)
* \todo implement for AbstractTransformGeometry.
* \ingroup Mapper
*/
class MITKLEGACYGL_EXPORT PlaneGeometryDataGLMapper2D : public GLMapper
{
public:
mitkClassMacro(PlaneGeometryDataGLMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Get the PlaneGeometryData to map
*/
const PlaneGeometryData *GetInput();
- virtual void Paint( BaseRenderer *renderer );
+ virtual void Paint( BaseRenderer *renderer ) override;
virtual void SetDatastorageAndGeometryBaseNode(mitk::DataStorage::Pointer ds, mitk::DataNode::Pointer parent);
/** Applies properties specific to this mapper */
virtual void ApplyAllProperties( BaseRenderer *renderer );
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
PlaneGeometryDataGLMapper2D();
virtual ~PlaneGeometryDataGLMapper2D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/**
* \brief Returns the thick slice mode for the given datanode.
*
* This method returns the value of the 'reslice.thickslices' property for
* the given datanode.
* '0': thick slice mode disabled
* '1': thick slice mode enabled
*
* The variable 'thickSlicesNum' contains the value of the 'reslice.thickslices.num'
* property that defines how many slices are shown at once.
*/
int DetermineThickSliceMode( DataNode * dn, int &thickSlicesNum );
/**
* \brief Determines the cross position of two lines and stores them as parametric coordinates
*
* This method determines the parametric position at which a line 'otherLine' crosses another line
* 'mainLine'. The result is stored in 'crossPositions'.
*/
void DetermineParametricCrossPositions( Line<ScalarType,2> &mainLine, Line<ScalarType,2> &otherLine, std::vector<ScalarType> &crossPositions );
void DrawLine( BaseRenderer * renderer, ScalarType lengthInDisplayUnits,
Line< ScalarType, 2 > &line, std::vector< ScalarType > &gapPositions,
const PlaneGeometry * inputPlaneGeometry, bool drawDashed,
ScalarType gapSizeInPixel
);
void DrawOrientationArrow( Point2D &outerPoint, Point2D &innerPoint,
const PlaneGeometry *planeGeometry,
const PlaneGeometry *rendererPlaneGeometry,
const DisplayGeometry *displayGeometry,
bool positiveOrientation = true );
SurfaceGLMapper2D::Pointer m_SurfaceMapper;
mitk::WeakPointer<mitk::DataStorage> 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<DataNode*> NodesVectorType;
NodesVectorType m_OtherPlaneGeometries;
bool m_RenderOrientationArrows;
bool m_ArrowOrientationPositive;
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATAMAPPER2D_H_HEADER_INCLUDED_C19C0BFB */
diff --git a/Modules/LegacyGL/mitkPointSetGLMapper2D.h b/Modules/LegacyGL/mitkPointSetGLMapper2D.h
index 36e43e155c..9a2dc8f7a5 100644
--- a/Modules/LegacyGL/mitkPointSetGLMapper2D.h
+++ b/Modules/LegacyGL/mitkPointSetGLMapper2D.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPointSetMAPPER2D_H_HEADER_INCLUDED
#define MITKPointSetMAPPER2D_H_HEADER_INCLUDED
#include <MitkLegacyGLExports.h>
#include "mitkGLMapper.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
*/
/** \deprecatedSince{2013_06} This mapper is replaced by PointSetVtkMapper2D. The child classes of this class are deprecated.
* To further ensure their functionality PointSetGLMapper2D cannot be removed and is set deprecated too.
*/
class MITKLEGACYGL_EXPORT PointSetGLMapper2D : public GLMapper
{
public:
mitkClassMacro(PointSetGLMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Get the PointDataList to map */
virtual const mitk::PointSet * GetInput(void);
- virtual void Paint(mitk::BaseRenderer * renderer);
+ virtual void Paint(mitk::BaseRenderer * renderer) override;
virtual void ApplyAllProperties(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_PolygonClosed;
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/Modules/LegacyGL/mitkSurfaceGLMapper2D.h b/Modules/LegacyGL/mitkSurfaceGLMapper2D.h
index cda3059347..13ab375512 100644
--- a/Modules/LegacyGL/mitkSurfaceGLMapper2D.h
+++ b/Modules/LegacyGL/mitkSurfaceGLMapper2D.h
@@ -1,155 +1,155 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8
#define MITKSURFACEDATAMAPPER2D_H_HEADER_INCLUDED_C10EB2E8
#include <MitkLegacyGLExports.h>
#include "mitkGLMapper.h"
#include "mitkSurface.h"
class vtkCutter;
class vtkPlane;
class vtkLookupTable;
class vtkLinearTransform;
class vtkPKdTree;
class vtkStripper;
namespace mitk {
class BaseRenderer;
class PlaneGeometry;
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 MITKLEGACYGL_EXPORT SurfaceGLMapper2D : public GLMapper
{
public:
mitkClassMacro(SurfaceGLMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
const Surface* GetInput(void);
- virtual void Paint(BaseRenderer* renderer);
+ virtual void Paint(BaseRenderer* renderer) override;
/**
* @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 );
+ void SetDataNode( DataNode* node ) override;
/**
* \brief Generate OpenGL primitives for the VTK contour held in contour.
*/
void PaintCells(BaseRenderer* renderer, vtkPolyData* contour,
const PlaneGeometry* 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 ApplyAllProperties(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/Modules/LegacyGL/mitkVtkGLMapperWrapper.h b/Modules/LegacyGL/mitkVtkGLMapperWrapper.h
index 8122038e36..63e90ecb4d 100644
--- a/Modules/LegacyGL/mitkVtkGLMapperWrapper.h
+++ b/Modules/LegacyGL/mitkVtkGLMapperWrapper.h
@@ -1,90 +1,90 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKVtkGLMapperWrapper_H_HEADER
#define MITKVtkGLMapperWrapper_H_HEADER
#include <MitkLegacyGLExports.h>
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkLocalStorageHandler.h"
#include <vtkSmartPointer.h>
#include "mitkGLMapper.h"
class vtkGLMapperProp;
namespace mitk {
/**
* @brief Vtk-based 2D mapper for PointSet
*/
class MITKLEGACYGL_EXPORT VtkGLMapperWrapper : public VtkMapper
{
public:
mitkClassMacro(VtkGLMapperWrapper, VtkMapper);
mitkNewMacro1Param(Self,GLMapper::Pointer)
itkCloneMacro(Self)
/** \brief returns the a prop assembly */
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/* constructor */
LocalStorage();
/* destructor */
~LocalStorage();
vtkSmartPointer<vtkGLMapperProp> m_GLMapperProp;
};
- virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor);
+ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor * actor) override;
- void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type);
+ void MitkRender(mitk::BaseRenderer* renderer, mitk::VtkPropRenderer::RenderType type) override;
- virtual void Update(BaseRenderer *renderer);
+ virtual void Update(BaseRenderer *renderer) override;
- virtual void SetDataNode(DataNode* node);
+ virtual void SetDataNode(DataNode* node) override;
- virtual DataNode* GetDataNode() const;
+ virtual DataNode* GetDataNode() const override;
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
protected:
GLMapper::Pointer m_MitkGLMapper;
/* constructor */
VtkGLMapperWrapper(GLMapper::Pointer mitkGLMapper);
/* destructor */
virtual ~VtkGLMapperWrapper();
void Enable2DOpenGL(mitk::BaseRenderer *renderer);
void Disable2DOpenGL();
};
} // namespace mitk
#endif /* MITKVtkGLMapperWrapper_H_HEADER_INCLUDED_C1902626 */
diff --git a/Modules/LegacyGL/vtkGLMapperProp.h b/Modules/LegacyGL/vtkGLMapperProp.h
index 0e648a648c..accda76812 100644
--- a/Modules/LegacyGL/vtkGLMapperProp.h
+++ b/Modules/LegacyGL/vtkGLMapperProp.h
@@ -1,58 +1,58 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef vtkGLMapperProp_h
#define vtkGLMapperProp_h
#include "MitkLegacyGLExports.h"
#include <vtkSmartPointer.h>
#include <vtkProp.h>
#include "mitkGLMapper.h"
/**
* @brief The vtkGLMapperProp class is a VtkProp, wrapping a GLMapper
*/
class MITKLEGACYGL_EXPORT vtkGLMapperProp : public vtkProp
{
public:
static vtkGLMapperProp* New();
vtkTypeMacro(vtkGLMapperProp,vtkProp);
/**
* @brief RenderOverlay Calls the render method of the actor and renders it.
* @param viewport viewport of the renderwindow.
* @return
*/
- int RenderOverlay(vtkViewport* viewport);
- int RenderVolumetricGeometry(vtkViewport *);
- int RenderTranslucentPolygonalGeometry(vtkViewport *);
- int RenderOpaqueGeometry(vtkViewport *);
+ int RenderOverlay(vtkViewport* viewport) override;
+ int RenderVolumetricGeometry(vtkViewport *) override;
+ int RenderTranslucentPolygonalGeometry(vtkViewport *) override;
+ int RenderOpaqueGeometry(vtkViewport *) override;
const mitk::GLMapper *GetWrappedGLMapper() const;
void SetWrappedGLMapper(mitk::GLMapper *glMapper);
void SetBaseRenderer(mitk::BaseRenderer* baseRenderer);
protected:
vtkGLMapperProp();
virtual ~vtkGLMapperProp();
mitk::GLMapper* m_WrappedGLMapper;
mitk::BaseRenderer* m_BaseRenderer;
};
#endif /* vtkGLMapperProp2_h */
diff --git a/Modules/LegacyIO/mitkDataNodeFactory.h b/Modules/LegacyIO/mitkDataNodeFactory.h
index 0ab6ef9450..7168002e9b 100644
--- a/Modules/LegacyIO/mitkDataNodeFactory.h
+++ b/Modules/LegacyIO/mitkDataNodeFactory.h
@@ -1,184 +1,184 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _DATA_TREE_NODE_FACTORY_H_
#define _DATA_TREE_NODE_FACTORY_H_
#include "mitkDataNodeSource.h"
#include "mitkFileSeriesReader.h"
#include "mitkColorProperty.h"
#include <vtkConfigure.h>
#include <string>
namespace mitk
{
/**
* @brief Factory, which creates instances of mitk::DataNodes filled with
* data read from a given file
*
* This class reads files, creates an appropriate mitk::BaseData and adds the
* BaseData to a mitk::DataNode. This filter may produce one or more outputs
* (i.e. mitk::DataNodes). The number of generated nodes can be retrieved by a
* call of GetNumberOfOutputs().
*
* If you want to add a new file type, you have to register the factory
* of the file reader in the class mitk::BaseDataIOFactory.
* @ingroup MitkLegacyIOModule
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class MITKLEGACYIO_EXPORT DataNodeFactory : public DataNodeSource, public FileSeriesReader
{
public:
mitkClassMacro( DataNodeFactory, DataNodeSource );
DEPRECATED(itkFactorylessNewMacro(Self))
itkCloneMacro(Self)
/**
* Sets the filename of the file to read.
* @param FileName the name of the file to read.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be read from disk.
*/
itkGetStringMacro( FileName );
/**
* \brief Set prefix for multiple load
*/
itkSetStringMacro( FilePrefix );
/**
* \brief Get prefix for multiple load
*/
itkGetStringMacro( FilePrefix );
/**
* \brief Set pattern for multiple load
*/
itkSetStringMacro( FilePattern );
/**
* \brief Get pattern for multiple load
*/
itkGetStringMacro( FilePattern );
/**
* Nice default colors for segmentations of some "normal" organs.
*/
static ColorProperty::Pointer DefaultColorForOrgan( const std::string& );
void SetDefaultCommonProperties(mitk::DataNode::Pointer &node);
/**
* if true -> loaded image is part of a serie
*/
void SetImageSerie(bool serie);
void AddSeriesRestriction(const std::string &tag)
{m_SeriesRestrictions.push_back(tag);}
static bool m_TextureInterpolationActive;
protected:
/**
* Constructor.
*/
DataNodeFactory();
/**
* Virtual destructor.
*/
virtual ~DataNodeFactory();
bool m_Serie;
/**
* Determines of which file type a given file is and calls the
* appropriate reader function.
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/**
* Resizes the number of outputs of the factory.
* The outputs are initialized by empty DataNodes
* @param num the new number of outputs
*/
virtual void ResizeOutputs( const unsigned int& num );
/**
* Checks if the file name m_FileName ends with the given name.
* Currently, this check is done by a dumb search for name in
* the filename.
* @param name the extension of the file
* @returns true, if the filename contains name.
*/
virtual bool FileNameEndsWith(const std::string& name);
/**
* Checks if the file pattern m_FilePattern ends with the given name.
* Currently, this check is done by a dumb search for name in
* the filename.
* @param name the extension of the file
* @returns true, if the filepattern contains name.
*/
virtual bool FilePatternEndsWith(const std::string& name);
/**
* @returns the plain filename, that is, without any directory.
*/
virtual std::string GetBaseFileName();
/**
* @returns the plain file prefix, that is, without any directory.
*/
virtual std::string GetBaseFilePrefix();
/**
* @returns the directory of the file name m_FileName.
*/
virtual std::string GetDirectory();
#ifdef MBI_INTERNAL
virtual void ReadFileTypeHPSONOS();
#ifdef HAVE_IPDICOM
virtual void ReadFileTypeIPDCM();
#endif /* HAVE_IPDICOM */
#ifdef USE_TUS_READER
virtual void ReadFileTypeTUS();
#endif
#endif /* MBI_INTERNAL */
virtual void ReadFileSeriesTypeDCM();
virtual void ReadFileSeriesTypeITKImageSeriesReader();
std::vector<std::string> m_SeriesRestrictions;
int m_OldProgress;
};
}
#endif //#ifndef __DATA_TREE_NODE_FACTORY_H
diff --git a/Modules/LegacyIO/mitkImageWriter.h b/Modules/LegacyIO/mitkImageWriter.h
index 68addc2a9a..6097338cfb 100644
--- a/Modules/LegacyIO/mitkImageWriter.h
+++ b/Modules/LegacyIO/mitkImageWriter.h
@@ -1,179 +1,179 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_IMAGE_WRITER__H_
#define _MITK_IMAGE_WRITER__H_
#include <MitkLegacyIOExports.h>
#include <mitkFileWriterWithInformation.h>
namespace mitk
{
class Image;
/**
* @brief Writer for mitk::Image
*
* Uses the given extension (SetExtension) to decide the format to write
* (.mhd is default, .pic, .tif, .png, .jpg supported yet).
* @ingroup MitkLegacyIOModule
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileWriterRegistry instead.
*/
class MITKLEGACYIO_EXPORT ImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( ImageWriter, mitk::FileWriter );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkWriterMacro;
/**
* Sets the filename of the file to write.
* @param _arg the name of the file to write.
*/
- virtual void SetFileName (const char* fileName);
+ virtual void SetFileName (const char* fileName) override;
virtual void SetFileName (const std::string& fileName);
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* \brief Explicitly set the extension to be added to the filename.
* @param _arg to be added to the filename, including a "."
* (e.g., ".mhd").
*/
virtual void SetExtension (const char* extension);
virtual void SetExtension (const std::string& extension);
/**
* \brief Get the extension to be added to the filename.
* @returns the extension to be added to the filename (e.g.,
* ".mhd").
*/
itkGetStringMacro( Extension );
/**
* \brief Set the extension to be added to the filename to the default
*/
void SetDefaultExtension();
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( mitk::Image* input );
//##Documentation
//## @brief Return the possible file extensions for the data type associated with the writer
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- virtual std::string GetSupportedBaseData() const;
+ virtual std::string GetSupportedBaseData() const override;
/**
* @brief Return the extension to be added to the filename.
*/
- virtual std::string GetFileExtension();
+ virtual std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the
*/
- virtual bool CanWriteDataType( DataNode* );
+ virtual bool CanWriteDataType( DataNode* ) override;
/**
* @brief Return the MimeType of the saved File.
*/
- virtual std::string GetWritenMIMEType();
+ virtual std::string GetWritenMIMEType() override;
using Superclass::SetInput;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput( DataNode* );
/**
* @returns the 0'th input object of the filter.
*/
const mitk::Image* GetInput();
// FileWriterWithInformation methods
- virtual const char* GetDefaultFilename();
- virtual const char *GetFileDialogPattern();
- virtual const char *GetDefaultExtension();
- virtual bool CanWriteBaseDataType(BaseData::Pointer data);
- virtual void DoWrite(BaseData::Pointer data);
+ virtual const char* GetDefaultFilename() override;
+ virtual const char *GetFileDialogPattern() override;
+ virtual const char *GetDefaultExtension() override;
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override;
+ virtual void DoWrite(BaseData::Pointer data) override;
void SetUseCompression( bool useCompression );
protected:
/**
* Constructor.
*/
ImageWriter();
/**
* Virtual destructor.
*/
virtual ~ImageWriter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
virtual void WriteByITK(mitk::Image* image, const std::string& fileName);
std::string m_FileName;
std::string m_FileNameWithoutExtension;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
bool m_UseCompression;
};
}
#endif //_MITK_IMAGE_WRITER__H_
diff --git a/Modules/LegacyIO/mitkImageWriterFactory.cpp b/Modules/LegacyIO/mitkImageWriterFactory.cpp
index 85deb68f5c..c782543b4a 100644
--- a/Modules/LegacyIO/mitkImageWriterFactory.cpp
+++ b/Modules/LegacyIO/mitkImageWriterFactory.cpp
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkImageWriterFactory.h"
#include "itkCreateObjectFunction.h"
#include "itkVersion.h"
#include "mitkImageWriter.h"
namespace mitk
{
template <class T>
class CreateImageWriter : public itk::CreateObjectFunctionBase
{
public:
/** Standard class typedefs. */
typedef CreateImageWriter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self);
- LightObject::Pointer CreateObject() { typename T::Pointer p = T::New();
+ LightObject::Pointer CreateObject() override { typename T::Pointer p = T::New();
p->Register();
return p.GetPointer();
}
protected:
CreateImageWriter() {}
~CreateImageWriter() {}
private:
CreateImageWriter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
ImageWriterFactory::ImageWriterFactory()
{
this->RegisterOverride("IOWriter",
"ImageWriter",
"Image Writer",
1,
mitk::CreateImageWriter<mitk::ImageWriter>::New());
}
ImageWriterFactory::~ImageWriterFactory()
{
}
const char* ImageWriterFactory::GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
const char* ImageWriterFactory::GetDescription() const
{
return "ImageWriterFactory";
}
} // end namespace mitk
diff --git a/Modules/LegacyIO/mitkImageWriterFactory.h b/Modules/LegacyIO/mitkImageWriterFactory.h
index 5ccfe2b4f9..99fbe80ab0 100644
--- a/Modules/LegacyIO/mitkImageWriterFactory.h
+++ b/Modules/LegacyIO/mitkImageWriterFactory.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGEWRITERFACTORY_H_HEADER_INCLUDED
#define IMAGEWRITERFACTORY_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
/**
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class DEPRECATED() MITKLEGACYIO_EXPORT ImageWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::ImageWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::ImageWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
static bool IsRegistered = false;
if ( !IsRegistered )
{
ImageWriterFactory::Pointer imageWriterFactory = ImageWriterFactory::New();
ObjectFactoryBase::RegisterFactory( imageWriterFactory );
IsRegistered = true;
}
}
protected:
ImageWriterFactory();
~ImageWriterFactory();
private:
ImageWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkItkImageFileIOFactory.h b/Modules/LegacyIO/mitkItkImageFileIOFactory.h
index 4a9f1615d2..28ccd8eb7f 100644
--- a/Modules/LegacyIO/mitkItkImageFileIOFactory.h
+++ b/Modules/LegacyIO/mitkItkImageFileIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkItkImageFileIOFactory_h
#define __mitkItkImageFileIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of ItkImageFileReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT ItkImageFileIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef ItkImageFileIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static ItkImageFileIOFactory* FactoryNew() { return new ItkImageFileIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(ItkImageFileIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
ItkImageFileIOFactory::Pointer ItkImageFileIOFactory = ItkImageFileIOFactory::New();
ObjectFactoryBase::RegisterFactory(ItkImageFileIOFactory);
}
protected:
ItkImageFileIOFactory();
~ItkImageFileIOFactory();
private:
ItkImageFileIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkItkImageFileReader.h b/Modules/LegacyIO/mitkItkImageFileReader.h
index ff19c00cf4..59d5369379 100644
--- a/Modules/LegacyIO/mitkItkImageFileReader.h
+++ b/Modules/LegacyIO/mitkItkImageFileReader.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef ItkImageFileReader_H_HEADER_INCLUDED
#define ItkImageFileReader_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "mitkFileReader.h"
#include "mitkImageSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read file formats supported by itk
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class MITKLEGACYIO_EXPORT ItkImageFileReader : public ImageSource, public FileReader
{
public:
mitkClassMacro(ItkImageFileReader, FileReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
ItkImageFileReader();
~ItkImageFileReader();
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
};
} // namespace mitk
#endif /* ItkImageFileReader_H_HEADER_INCLUDED */
diff --git a/Modules/LegacyIO/mitkPointSetIOFactory.h b/Modules/LegacyIO/mitkPointSetIOFactory.h
index 5fdf0b69aa..5caaa1fcc7 100644
--- a/Modules/LegacyIO/mitkPointSetIOFactory.h
+++ b/Modules/LegacyIO/mitkPointSetIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkPointSetIOFactory_h
#define __mitkPointSetIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of PointSetReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT PointSetIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef PointSetIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static PointSetIOFactory* FactoryNew() { return new PointSetIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(PointSetIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
PointSetIOFactory::Pointer PointSetIOFactory = PointSetIOFactory::New();
ObjectFactoryBase::RegisterFactory(PointSetIOFactory);
}
protected:
PointSetIOFactory();
~PointSetIOFactory();
private:
PointSetIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkPointSetReader.h b/Modules/LegacyIO/mitkPointSetReader.h
index ab557f418f..d9a3cdeb76 100644
--- a/Modules/LegacyIO/mitkPointSetReader.h
+++ b/Modules/LegacyIO/mitkPointSetReader.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_SET_READER__H_
#define _MITK_POINT_SET_READER__H_
#include <MitkLegacyIOExports.h>
#include <mitkPointSetSource.h>
#include <mitkFileReader.h>
#include <string>
#include <stack>
#include <vtkXMLParser.h>
#include <tinyxml.h>
namespace mitk
{
/**
* @brief reads xml representations of mitk::PointSets from a file
*
* Reader for xml files containing one or multiple xml represenations of
* mitk::PointSets. If multiple mitk::PointSets are stored in one file,
* these are assigned to multiple outputs of the filter. The number of point
* sets which have be read can be retrieven by a call to GetNumberOfOutputs()
* after the pipeline update().
* The reader is able to read the old 3D Pointsets without the "specification" and "timeseries" tags and the new 4D Pointsets.
* @note loading point sets from multiple files according to a given file pattern
* is not yet supported!
*
* @ingroup MitkLegacyIOModule
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class MITKLEGACYIO_EXPORT PointSetReader: public PointSetSource, public FileReader
{
public:
mitkClassMacro( PointSetReader, FileReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief Sets the filename of the file to be read
* @param _arg the filename of the point set xml-file
*/
itkSetStringMacro( FileName );
/**
* @brief Returns the filename of the point set xml-file.
* @returns the filename of the point set xml-file.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple load not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple load not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple load not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple load not (yet) supported
*/
itkGetStringMacro( FilePattern );
static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern);
/**
* @returns whether the last read attempt was successful or not.
*/
bool GetSuccess() const;
protected:
/**
* Constructor
*/
PointSetReader();
/**
* Virtual destructor
*/
virtual ~PointSetReader();
/**
* Actually reads the point sets from the given file
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
virtual mitk::PointSet::Pointer ReadPoint(mitk::PointSet::Pointer newPointSet,
TiXmlElement* currentTimeSeries, unsigned int currentTimeStep);
/**
* Does nothing in the current implementation
*/
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/**
* Resizes the output-objects according to the given number.
* @param num the new number of output objects.
*/
virtual void ResizeOutputs( const unsigned int& num );
/**
* Checks if the given file has appropriate
* read access.
* @returns true if the file exists and may be read
* or false otherwise.
*/
virtual int CanReadFile (const char *name);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
}
#endif
diff --git a/Modules/LegacyIO/mitkPointSetWriter.h b/Modules/LegacyIO/mitkPointSetWriter.h
index f4e180fdee..7a7d3014e4 100644
--- a/Modules/LegacyIO/mitkPointSetWriter.h
+++ b/Modules/LegacyIO/mitkPointSetWriter.h
@@ -1,273 +1,273 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_POINT_SET_WRITER__H_
#define _MITK_POINT_SET_WRITER__H_
#include <MitkLegacyIOExports.h>
#include <itkProcessObject.h>
#include <mitkFileWriter.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* @brief XML-based writer for mitk::PointSets
*
* XML-based writer for mitk::PointSets. Multiple PointSets can be written in
* a single XML file by simply setting multiple inputs to the filter.
* Writing of multiple XML files according to a given filename pattern is not
* yet supported.
*
* @ingroup MitkLegacyIOModule
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class MITKLEGACYIO_EXPORT PointSetWriter : public mitk::FileWriter
{
public:
mitkClassMacro( PointSetWriter, mitk::FileWriter );
mitkWriterMacro;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::PointSet InputType;
typedef InputType::Pointer InputTypePointer;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( InputType* input );
/**
* Sets the n'th input object for the filter. If num is
* larger than GetNumberOfInputs() the number of inputs is
* resized appropriately.
* @param input the n'th input for the filter.
*/
void SetInput( const unsigned int& num, InputType* input);
/**
* @returns the 0'th input object of the filter.
*/
PointSet* GetInput();
/**
* @param num the index of the desired output object.
* @returns the n'th input object of the filter.
*/
PointSet* GetInput( const unsigned int& num );
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- virtual std::string GetSupportedBaseData() const;
+ virtual std::string GetSupportedBaseData() const override;
/**
* @brief Return the extension to be added to the filename.
*/
- virtual std::string GetFileExtension();
+ virtual std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the
*/
- virtual bool CanWriteDataType( DataNode* );
+ virtual bool CanWriteDataType( DataNode* ) override;
/**
* @brief Return the MimeType of the saved File.
*/
- virtual std::string GetWritenMIMEType();
+ virtual std::string GetWritenMIMEType() override;
using mitk::FileWriter::SetInput;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput( DataNode* );
/**
* @returns whether the last write attempt was successful or not.
*/
bool GetSuccess() const;
protected:
/**
* Constructor.
*/
PointSetWriter();
/**
* Virtual destructor.
*/
virtual ~PointSetWriter();
/**
* Writes the XML file
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/**
* Resizes the number of inputs of the writer.
* The inputs are initialized by empty PointSets
* @param num the new number of inputs
*/
virtual void ResizeInputs( const unsigned int& num );
/**
* Converts an arbitrary type to a string. The type has to
* support the << operator. This works fine at least for integral
* data types as float, int, long etc.
* @param value the value to convert
* @returns the string representation of value
*/
template < typename T>
std::string ConvertToString( T value );
/**
* Writes an XML representation of the given point set to
* an outstream. The XML-Header an root node is not included!
* @param pointSet the point set to be converted to xml
* @param out the stream to write to.
*/
void WriteXML( mitk::PointSet* pointSet, std::ofstream& out );
/**
* Writes an standard xml header to the given stream.
* @param file the stream in which the header is written.
*/
void WriteXMLHeader( std::ofstream &file );
/** Write a start element tag */
void WriteStartElement( const char *const tag, std::ofstream &file );
/**
* Write an end element tag
* End-Elements following character data should pass indent = false.
*/
void WriteEndElement( const char *const tag, std::ofstream &file, const bool& indent = true );
/** Write character data inside a tag. */
void WriteCharacterData( const char *const data, std::ofstream &file );
/** Write a start element tag */
void WriteStartElement( std::string &tag, std::ofstream &file );
/** Write an end element tag */
void WriteEndElement( std::string &tag, std::ofstream &file, const bool& indent = true );
/** Write character data inside a tag. */
void WriteCharacterData( std::string &data, std::ofstream &file );
/** Writes empty spaces to the stream according to m_IndentDepth and m_Indent */
void WriteIndent( std::ofstream& file );
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
unsigned int m_IndentDepth;
unsigned int m_Indent;
bool m_Success;
public:
static const char* XML_POINT_SET;
static const char* XML_TIME_SERIES;
static const char* XML_TIME_SERIES_ID;
static const char* XML_POINT_SET_FILE;
static const char* XML_FILE_VERSION;
static const char* XML_POINT;
static const char* XML_SPEC;
static const char* XML_ID;
static const char* XML_X;
static const char* XML_Y;
static const char* XML_Z;
static const char* VERSION_STRING;
};
}
#endif
diff --git a/Modules/LegacyIO/mitkPointSetWriterFactory.cpp b/Modules/LegacyIO/mitkPointSetWriterFactory.cpp
index ec68cec819..1b976b1439 100644
--- a/Modules/LegacyIO/mitkPointSetWriterFactory.cpp
+++ b/Modules/LegacyIO/mitkPointSetWriterFactory.cpp
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkPointSetWriterFactory.h"
#include "itkCreateObjectFunction.h"
#include "itkVersion.h"
#include "mitkPointSetWriter.h"
namespace mitk
{
template <class T>
class CreatePointSetWriter : public itk::CreateObjectFunctionBase
{
public:
/** Standard class typedefs. */
typedef CreatePointSetWriter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self);
- LightObject::Pointer CreateObject() { typename T::Pointer p = T::New();
+ LightObject::Pointer CreateObject() override { typename T::Pointer p = T::New();
p->Register();
return p.GetPointer();
}
protected:
CreatePointSetWriter() {}
~CreatePointSetWriter() {}
private:
CreatePointSetWriter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
PointSetWriterFactory::PointSetWriterFactory()
{
this->RegisterOverride("IOWriter",
"PointSetWriter",
"Point-Set Writer",
1,
mitk::CreatePointSetWriter<mitk::PointSetWriter>::New());
}
PointSetWriterFactory::~PointSetWriterFactory()
{
}
const char* PointSetWriterFactory::GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
const char* PointSetWriterFactory::GetDescription() const
{
return "PointSetWriterFactory";
}
} // end namespace mitk
diff --git a/Modules/LegacyIO/mitkPointSetWriterFactory.h b/Modules/LegacyIO/mitkPointSetWriterFactory.h
index 22920a72a8..43a9af0962 100644
--- a/Modules/LegacyIO/mitkPointSetWriterFactory.h
+++ b/Modules/LegacyIO/mitkPointSetWriterFactory.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef POINTSETWRITERFACTORY_H_HEADER_INCLUDED
#define POINTSETWRITERFACTORY_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
/**
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class DEPRECATED() MITKLEGACYIO_EXPORT PointSetWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::PointSetWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::PointSetWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
static bool IsRegistered = false;
if ( !IsRegistered )
{
PointSetWriterFactory::Pointer pointSetWriterFactory = PointSetWriterFactory::New();
ObjectFactoryBase::RegisterFactory( pointSetWriterFactory );
IsRegistered = true;
}
}
protected:
PointSetWriterFactory();
~PointSetWriterFactory();
private:
PointSetWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkRawImageFileReader.h b/Modules/LegacyIO/mitkRawImageFileReader.h
index 7cf015f6d5..fd344651f2 100644
--- a/Modules/LegacyIO/mitkRawImageFileReader.h
+++ b/Modules/LegacyIO/mitkRawImageFileReader.h
@@ -1,110 +1,110 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef RawImageFileReader_H_HEADER_INCLUDED
#define RawImageFileReader_H_HEADER_INCLUDED
#include "itkVector.h"
#include <MitkLegacyIOExports.h>
#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 MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT RawImageFileReader : public ImageSource, public FileReader
{
public:
mitkClassMacro(RawImageFileReader, FileReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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();
+ virtual void GenerateData() override;
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<int, 3> m_Dimensions;
};
} // namespace mitk
#endif /* RawImageFileReader_H_HEADER_INCLUDED */
diff --git a/Modules/LegacyIO/mitkSTLFileIOFactory.h b/Modules/LegacyIO/mitkSTLFileIOFactory.h
index 18406d6690..e072c76d3b 100644
--- a/Modules/LegacyIO/mitkSTLFileIOFactory.h
+++ b/Modules/LegacyIO/mitkSTLFileIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkSTLFileIOFactory_h
#define __mitkSTLFileIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of STLFileReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT STLFileIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef STLFileIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static STLFileIOFactory* FactoryNew() { return new STLFileIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(STLFileIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
STLFileIOFactory::Pointer STLFileIOFactory = STLFileIOFactory::New();
ObjectFactoryBase::RegisterFactory(STLFileIOFactory);
}
protected:
STLFileIOFactory();
~STLFileIOFactory();
private:
STLFileIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkSTLFileReader.h b/Modules/LegacyIO/mitkSTLFileReader.h
index 8abafe9c5a..05eb8aabc2 100644
--- a/Modules/LegacyIO/mitkSTLFileReader.h
+++ b/Modules/LegacyIO/mitkSTLFileReader.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef STLFileReader_H_HEADER_INCLUDED
#define STLFileReader_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "mitkSurfaceSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read files in stl-format
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class MITKLEGACYIO_EXPORT STLFileReader : public SurfaceSource
{
public:
mitkClassMacro(STLFileReader, SurfaceSource);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
STLFileReader();
~STLFileReader();
std::string m_FileName, m_FilePrefix, m_FilePattern;
};
} // namespace mitk
#endif /* STLFileReader_H_HEADER_INCLUDED */
diff --git a/Modules/LegacyIO/mitkSurfaceVtkWriter.h b/Modules/LegacyIO/mitkSurfaceVtkWriter.h
index 7508265198..292903d263 100644
--- a/Modules/LegacyIO/mitkSurfaceVtkWriter.h
+++ b/Modules/LegacyIO/mitkSurfaceVtkWriter.h
@@ -1,216 +1,216 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SURFACE_VTK_WRITER__H_
#define _MITK_SURFACE_VTK_WRITER__H_
#include <iomanip>
#include <vtkSTLWriter.h>
#include <vtkPolyDataWriter.h>
#include <vtkXMLPolyDataWriter.h>
#include <MitkLegacyIOExports.h>
#include <itkProcessObject.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkPointSet.h>
#include <mitkSurface.h>
#include <vtkSmartPointer.h>
class vtkTransformPolyDataFilter;
namespace mitk
{
/**
* @brief VTK-based writer for mitk::Surface
*
* The mitk::Surface is written using the VTK-writer-type provided as the
* template argument. If the mitk::Surface contains multiple points of
* time, multiple files are written. The life-span (time-bounds) of each
* each point of time is included in the filename according to the
* following scheme:
* &lt;filename&gt;_S&lt;timebounds[0]&gt;E&lt;timebounds[1]&gt;_T&lt;framenumber&gt;
* (S=start, E=end, T=time).
* Writing of multiple files according to a given filename pattern is not
* yet supported.
* @ingroup MitkLegacyIOModule
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
template <class VTKWRITER>
class MITKLEGACYIO_EXPORT SurfaceVtkWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( SurfaceVtkWriter, mitk::FileWriter );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkWriterMacro;
typedef VTKWRITER VtkWriterType;
/**
* Sets the filename of the file to write.
* @param _arg the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* \brief Explicitly set the extension to be added to the filename.
* @param _arg to be added to the filename, including a "."
* (e.g., ".vtk").
*
* Partial template specialization is used for some vtk-writer types
* to set a default extension.
*/
itkSetStringMacro( Extension );
/**
* \brief Get the extension to be added to the filename.
* @returns the extension to be added to the filename (e.g.,
* ".vtk").
*/
itkGetStringMacro( Extension );
/**
* \brief Set the extension to be added to the filename to the default
*
* Partial template specialization is used for some vtk-writer types
* to define the default extension.
*/
void SetDefaultExtension();
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( mitk::Surface* input );
/**
* @returns the 0'th input object of the filter.
*/
const mitk::Surface* GetInput();
/**
* @brief Return the extension to be added to the filename.
*/
- virtual std::string GetFileExtension();
+ virtual std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the DataTreenode.
*/
- virtual bool CanWriteDataType( DataNode* );
+ virtual bool CanWriteDataType( DataNode* ) override;
/**
* @brief Return the MimeType of the saved File.
*/
- virtual std::string GetWritenMIMEType();
+ virtual std::string GetWritenMIMEType() override;
using Superclass::SetInput;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput( DataNode* );
VtkWriterType* GetVtkWriter()
{
return m_VtkWriter;
}
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
- virtual std::string GetSupportedBaseData() const
+ virtual std::string GetSupportedBaseData() const override
{ return Surface::GetStaticNameOfClass(); }
- virtual const char *GetDefaultFilename();
- virtual const char *GetFileDialogPattern();
- virtual const char *GetDefaultExtension();
- virtual bool CanWriteBaseDataType(BaseData::Pointer data);
- virtual void DoWrite(BaseData::Pointer data);
+ virtual const char *GetDefaultFilename() override;
+ virtual const char *GetFileDialogPattern() override;
+ virtual const char *GetDefaultExtension() override;
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override;
+ virtual void DoWrite(BaseData::Pointer data) override;
protected:
/**
* Constructor.
*/
SurfaceVtkWriter();
/**
* Virtual destructor.
*/
virtual ~SurfaceVtkWriter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
void ExecuteWrite( VtkWriterType* vtkWriter );
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
vtkSmartPointer<VtkWriterType> m_VtkWriter;
bool m_WriterWriteHasReturnValue;
};
#ifndef MitkLegacyIO_EXPORTS
extern template class SurfaceVtkWriter<vtkSTLWriter>;
extern template class SurfaceVtkWriter<vtkPolyDataWriter>;
extern template class SurfaceVtkWriter<vtkXMLPolyDataWriter>;
#endif
}
#endif //_MITK_SURFACE_VTK_WRITER__H_
diff --git a/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.cpp b/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.cpp
index ccc41d00e3..26e14d4c00 100644
--- a/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.cpp
+++ b/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.cpp
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkSurfaceVtkWriterFactory.h"
#include "itkCreateObjectFunction.h"
#include "itkVersion.h"
#include <mitkSurfaceVtkWriter.h>
#include <vtkXMLPolyDataWriter.h>
namespace mitk
{
template <class T>
class CreateSurfaceWriter : public itk::CreateObjectFunctionBase
{
public:
/** Standard class typedefs. */
typedef CreateSurfaceWriter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self);
- LightObject::Pointer CreateObject() { typename T::Pointer p = T::New();
+ LightObject::Pointer CreateObject() override { typename T::Pointer p = T::New();
p->Register();
return p.GetPointer();
}
protected:
CreateSurfaceWriter() {}
~CreateSurfaceWriter() {}
private:
CreateSurfaceWriter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
SurfaceVtkWriterFactory::SurfaceVtkWriterFactory()
{
this->RegisterOverride("IOWriter",
"SurfaceVtkWriter",
"Surface Vtk Writer",
1,
mitk::CreateSurfaceWriter< mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter> >::New());
}
SurfaceVtkWriterFactory::~SurfaceVtkWriterFactory()
{
}
const char* SurfaceVtkWriterFactory::GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
const char* SurfaceVtkWriterFactory::GetDescription() const
{
return "SurfaceVtkWriterFactory";
}
} // end namespace mitk
diff --git a/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.h b/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.h
index 8e7447b383..75667410fe 100644
--- a/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.h
+++ b/Modules/LegacyIO/mitkSurfaceVtkWriterFactory.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SURFACEWRITERFACTORY_H_HEADER_INCLUDED
#define SURFACEWRITERFACTORY_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
/**
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class DEPRECATED() MITKLEGACYIO_EXPORT SurfaceVtkWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::SurfaceVtkWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::SurfaceVtkWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
static bool IsRegistered = false;
if ( !IsRegistered )
{
SurfaceVtkWriterFactory::Pointer surfaceVtkWriterFactory = SurfaceVtkWriterFactory::New();
ObjectFactoryBase::RegisterFactory( surfaceVtkWriterFactory );
IsRegistered = true;
}
}
protected:
SurfaceVtkWriterFactory();
~SurfaceVtkWriterFactory();
private:
SurfaceVtkWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkVtiFileIOFactory.h b/Modules/LegacyIO/mitkVtiFileIOFactory.h
index 87d2d0413d..07da0b06db 100644
--- a/Modules/LegacyIO/mitkVtiFileIOFactory.h
+++ b/Modules/LegacyIO/mitkVtiFileIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkVtiFileIOFactory_h
#define __mitkVtiFileIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of VtiFileReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT VtiFileIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef VtiFileIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static VtiFileIOFactory* FactoryNew() { return new VtiFileIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(VtiFileIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
VtiFileIOFactory::Pointer VtiFileIOFactory = VtiFileIOFactory::New();
ObjectFactoryBase::RegisterFactory(VtiFileIOFactory);
}
protected:
VtiFileIOFactory();
~VtiFileIOFactory();
private:
VtiFileIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkVtiFileReader.h b/Modules/LegacyIO/mitkVtiFileReader.h
index 13621eb367..41db120a1e 100644
--- a/Modules/LegacyIO/mitkVtiFileReader.h
+++ b/Modules/LegacyIO/mitkVtiFileReader.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VtiFileReader_H_HEADER_INCLUDED
#define VtiFileReader_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "mitkFileReader.h"
#include "mitkImageSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read image files in vtk file format
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT VtiFileReader : public ImageSource, public FileReader
{
public:
mitkClassMacro(VtiFileReader, FileReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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();
+ virtual void GenerateData() override;
//##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/Modules/LegacyIO/mitkVtkImageIOFactory.h b/Modules/LegacyIO/mitkVtkImageIOFactory.h
index 2c34511fce..e77a831016 100644
--- a/Modules/LegacyIO/mitkVtkImageIOFactory.h
+++ b/Modules/LegacyIO/mitkVtkImageIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkVtkImageIOFactory_h
#define __mitkVtkImageIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of VtkImageReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT VtkImageIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef VtkImageIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static VtkImageIOFactory* FactoryNew() { return new VtkImageIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(VtkImageIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
VtkImageIOFactory::Pointer VtkImageIOFactory = VtkImageIOFactory::New();
ObjectFactoryBase::RegisterFactory(VtkImageIOFactory);
}
protected:
VtkImageIOFactory();
~VtkImageIOFactory();
private:
VtkImageIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkVtkImageReader.h b/Modules/LegacyIO/mitkVtkImageReader.h
index f379e44c0c..7570b918c3 100644
--- a/Modules/LegacyIO/mitkVtkImageReader.h
+++ b/Modules/LegacyIO/mitkVtkImageReader.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VtkImageReader_H_HEADER_INCLUDED
#define VtkImageReader_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "mitkFileReader.h"
#include "mitkImageSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read image files in vtk file format
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT VtkImageReader : public ImageSource, public FileReader
{
public:
mitkClassMacro(VtkImageReader, FileReader);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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();
+ virtual void GenerateData() override;
//##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/Modules/LegacyIO/mitkVtkSurfaceIOFactory.h b/Modules/LegacyIO/mitkVtkSurfaceIOFactory.h
index 72d86d0ace..700af740d2 100644
--- a/Modules/LegacyIO/mitkVtkSurfaceIOFactory.h
+++ b/Modules/LegacyIO/mitkVtkSurfaceIOFactory.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkVtkSurfaceIOFactory_h
#define __mitkVtkSurfaceIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <MitkLegacyIOExports.h>
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of VtkSurfaceReader objects using an object factory.
//##
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class DEPRECATED() MITKLEGACYIO_EXPORT VtkSurfaceIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef VtkSurfaceIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static VtkSurfaceIOFactory* FactoryNew() { return new VtkSurfaceIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(VtkSurfaceIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
VtkSurfaceIOFactory::Pointer VtkSurfaceIOFactory = VtkSurfaceIOFactory::New();
ObjectFactoryBase::RegisterFactory(VtkSurfaceIOFactory);
}
protected:
VtkSurfaceIOFactory();
~VtkSurfaceIOFactory();
private:
VtkSurfaceIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/LegacyIO/mitkVtkSurfaceReader.h b/Modules/LegacyIO/mitkVtkSurfaceReader.h
index 4aec8bee8d..d117f37388 100644
--- a/Modules/LegacyIO/mitkVtkSurfaceReader.h
+++ b/Modules/LegacyIO/mitkVtkSurfaceReader.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef VtkSurfaceReader_H_HEADER_INCLUDED
#define VtkSurfaceReader_H_HEADER_INCLUDED
#include <MitkLegacyIOExports.h>
#include "mitkSurfaceSource.h"
namespace mitk {
//##Documentation
//## @brief Reader to read surface files in vtk-format
//## @ingroup MitkLegacyIOModule
//## @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
class MITKLEGACYIO_EXPORT VtkSurfaceReader : public SurfaceSource
{
public:
mitkClassMacro(VtkSurfaceReader, SurfaceSource);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(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 GenerateData() override;
VtkSurfaceReader();
~VtkSurfaceReader();
std::string m_FileName, m_FilePrefix, m_FilePattern;
};
} // namespace mitk
#endif /* VtkSurfaceReader_H_HEADER_INCLUDED */
diff --git a/Modules/LegacyIO/vtkPointSetXMLParser.h b/Modules/LegacyIO/vtkPointSetXMLParser.h
index d37088781a..4881651694 100644
--- a/Modules/LegacyIO/vtkPointSetXMLParser.h
+++ b/Modules/LegacyIO/vtkPointSetXMLParser.h
@@ -1,139 +1,139 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _VTK_POINT_SET_XML_READER__H_
#define _VTK_POINT_SET_XML_READER__H_
#include <MitkLegacyIOExports.h>
#include <mitkPointSet.h>
#include <vtkXMLParser.h>
#include <stack>
#include <list>
#include <string>
namespace mitk
{
/**
* @brief Implementation of the vtkXMLParser interface for reading mitk::PointSets.
*
* This class implements the XMLParser interface of the vtkXMLParser which is based
* on expat. It is used by the mitk::PointSetReader and is NOT INTENDED TO BE USED
* FROM THE END-USER. If you want to read point sets, use the mitk::PointSetReader.
* @ingroup MitkLegacyIOModule
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class DEPRECATED() MITKLEGACYIO_EXPORT vtkPointSetXMLParser : public vtkXMLParser
{
public:
vtkTypeMacro(vtkPointSetXMLParser,vtkXMLParser);
static vtkPointSetXMLParser* New();
typedef mitk::PointSet PointSetType;
typedef std::stack< std::string > ParseStack;
typedef std::list< PointSetType::Pointer > PointSetList;
typedef PointSetType::DataType::PointIdentifier PointIdentifier;
typedef PointSetType::PointType PointType;
- virtual int InitializeParser();
- virtual int CleanupParser();
+ virtual int InitializeParser() override;
+ virtual int CleanupParser() override;
/**
* Handler function which is called, when a new xml start-tag
* has been parsed.
*/
- virtual void StartElement (const char *name, const char **atts);
+ virtual void StartElement (const char *name, const char **atts) override;
/**
* Handler function which is called, when a xml end-tag
* has been parsed.
*/
- virtual void EndElement (const char *name);
+ virtual void EndElement (const char *name) override;
/**
* Handler function which is called, if characted data has been
* parsed by expat.
* @param inData a char array containing the parsed string data
* @param inLength the length of the parsed data string.
*/
- virtual void CharacterDataHandler (const char *inData, int inLength);
+ virtual void CharacterDataHandler (const char *inData, int inLength) override;
/**
* Converts the given data to mitk::ScalarType.
*/
virtual mitk::ScalarType ParseScalarType(const std::string &data);
/**
* Converts the given data to an PointIdentifier
*/
virtual PointIdentifier ParsePointIdentifier(const std::string &data);
/**
* @returns the list of point sets which have been read from file.
* NOTE: your have to call the Parse() function, before this function.
*/
virtual PointSetList GetParsedPointSets();
protected:
vtkPointSetXMLParser();
virtual ~vtkPointSetXMLParser();
/**
* A stack containing the parsed start-tags.
* If an end tag is encountered, it is matched with the
* top element of the stack.
*/
ParseStack m_ParseStack;
/**
* Contains the parsed point sets.
*/
PointSetList m_PointSetList;
/**
* The current point set which is processed
* by the parser.
*/
PointSetType::Pointer m_CurrentPointSet;
/**
* The current point which is processed
* by the parser.
*/
PointType m_CurrentPoint;
std::string m_CurId;
std::string m_CurXString;
std::string m_CurYString;
std::string m_CurZString;
/**
* The current point id which is processed
* by the parser.
*/
PointIdentifier m_CurrentPointId;
std::locale m_PreviousLocale;
};
}
#endif // _VTK_POINT_SET_XML_READER__H_
diff --git a/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h b/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
index 8e4c47d998..7a3c40f093 100644
--- a/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
+++ b/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
@@ -1,124 +1,124 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#define MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include "mitkPointSet.h"
#include "mitkVector.h"
class vtkActor;
class vtkAssembly;
class vtkSphereSource;
class vtkCubeSource;
class vtkConeSource;
class vtkCylinderSource;
class vtkTubeFilter;
class vtkProp;
namespace mitk {
/**
* \brief Alternative Vtk-based 3D mapper for mitk::PointSet
*
* This class renders mitk::PointSet objects in 3D views. It resembles the
* standard mitk::PointSetVtkMapper3D, but is designed to enable single
* points to be rendered with individual appearances.
*
* Instead of assembling one vtkPolyData object containing all points,
* a list of VTK source objects (spheres, cubes, cones, ...) is maintained.
* Therefore, the application can change the appearance and/or type of a
* specific point at runtime, without having to rebuild the
*
* You should use this class instead of the standard mapper if you
*
* - change the PointSet very often (by adding or removing points)
* - need different representations for points (+++)
* - want to change the point representation frequently (+++)
*
* Note: the class is still in experimental stage, and the points above
* marked with (+++) are not yet working correctly. Also, drawing lines
* between points (contour mode) is not yet supported. The class will be
* extended so that point representations are stored in a lookup table,
* which is indexed by point data from the rendered PointSet.
*
* \warn This mapper requires the PointData container to be the same size
* as the point container.
*
* \sa PointSetVtkMapper3D
*/
class MITKMAPPEREXT_EXPORT EnhancedPointSetVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(EnhancedPointSetVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::PointSet* GetInput();
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
- virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
+ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
static void SetDefaultProperties(mitk::DataNode* node,
mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
EnhancedPointSetVtkMapper3D();
virtual ~EnhancedPointSetVtkMapper3D();
void RemoveEntryFromSourceMaps( mitk::PointSet::PointIdentifier pointID );
void DeleteVtkObject(vtkObject* o); // functor for stl_each in destructor
// update all vtk sources, mappers, actors with current data and properties
void UpdateVtkObjects();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
- virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
+ virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer* renderer, vtkActor* actor) override;
typedef mitk::PointSet::PointIdentifier PointIdentifier;
typedef std::map<PointIdentifier, vtkSphereSource*> SphereSourceMap;
typedef std::map<PointIdentifier, vtkCubeSource*> CubeSourceMap;
typedef std::map<PointIdentifier, vtkConeSource*> ConeSourceMap;
typedef std::map<PointIdentifier, vtkCylinderSource*> CylinderSourceMap;
typedef std::pair<vtkActor*, mitk::PointSpecificationType> ActorAndPointType;
typedef std::map<PointIdentifier, ActorAndPointType> ActorMap;
SphereSourceMap m_SphereSources; // stores all sphere sources
CubeSourceMap m_CubeSources; // stores all cube sources
ConeSourceMap m_ConeSources; // stores all cone sources
CylinderSourceMap m_CylinderSources; // stores all cylinder sources
ActorMap m_PointActors; // stores an actor for each point(referenced by its ID) and the currently used pointspec = which source type is generating the polydata
vtkActor* m_Contour;
vtkTubeFilter* m_ContourSource;
vtkAssembly* m_PropAssembly; // this contains everything, this will be returned by GetVtkProp()
};
} // namespace mitk
#endif /* MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/Modules/MapperExt/include/mitkGPUVolumeMapper3D.h b/Modules/MapperExt/include/mitkGPUVolumeMapper3D.h
index 1ae0bc69a7..8dc93928ab 100644
--- a/Modules/MapperExt/include/mitkGPUVolumeMapper3D.h
+++ b/Modules/MapperExt/include/mitkGPUVolumeMapper3D.h
@@ -1,196 +1,196 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED
#define MITKGPUVOLUMEMAPPER3D_H_HEADER_INCLUDED
//MITK
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkBaseRenderer.h"
#include "mitkImage.h"
#include "mitkVtkMapper.h"
#include "vtkMitkVolumeTextureMapper3D.h"
//VTK
#include <vtkFixedPointVolumeRayCastMapper.h>
#include <vtkGPUVolumeRayCastMapper.h>
#include <vtkVolumeProperty.h>
#include <vtkImageChangeInformation.h>
#include <vtkSmartPointer.h>
#include <vtkVersionMacros.h>
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
#include "vtkMitkGPUVolumeRayCastMapper.h"
#endif
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 MITKMAPPEREXT_EXPORT GPUVolumeMapper3D : public VtkMapper
{
public:
mitkClassMacro(GPUVolumeMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::Image* GetInput();
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
- virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer);
+ virtual void ApplyProperties(vtkActor* actor, mitk::BaseRenderer* renderer) override;
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 bool IsLODEnabled( BaseRenderer *renderer = NULL ) const override;
bool IsMIPEnabled( BaseRenderer *renderer = NULL );
bool IsGPUEnabled( BaseRenderer *renderer = NULL );
bool IsRAYEnabled( BaseRenderer *renderer = NULL );
- virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer);
+ virtual void MitkRenderVolumetricGeometry(mitk::BaseRenderer* renderer) override;
protected:
GPUVolumeMapper3D();
virtual ~GPUVolumeMapper3D();
bool IsRenderable(mitk::BaseRenderer* renderer);
void InitCommon();
void DeinitCommon();
void InitCPU(mitk::BaseRenderer* renderer);
void DeinitCPU(mitk::BaseRenderer* renderer);
void GenerateDataCPU(mitk::BaseRenderer* renderer);
bool InitGPU(mitk::BaseRenderer* renderer);
void DeinitGPU(mitk::BaseRenderer* renderer);
void GenerateDataGPU(mitk::BaseRenderer* renderer);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
bool InitRAY(mitk::BaseRenderer* renderer);
void DeinitRAY(mitk::BaseRenderer* renderer);
void GenerateDataRAY(mitk::BaseRenderer* renderer);
#endif
void InitVtkMapper(mitk::BaseRenderer* renderer);
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
void CreateDefaultTransferFunctions();
void UpdateTransferFunctions( mitk::BaseRenderer *renderer );
vtkSmartPointer<vtkVolume> m_VolumeNULL;
bool m_commonInitialized;
vtkSmartPointer<vtkImageChangeInformation> m_UnitSpacingImageFilter;
vtkSmartPointer<vtkPiecewiseFunction> m_DefaultOpacityTransferFunction;
vtkSmartPointer<vtkPiecewiseFunction> m_DefaultGradientTransferFunction;
vtkSmartPointer<vtkColorTransferFunction> m_DefaultColorTransferFunction;
vtkSmartPointer<vtkPiecewiseFunction> m_BinaryOpacityTransferFunction;
vtkSmartPointer<vtkPiecewiseFunction> m_BinaryGradientTransferFunction;
vtkSmartPointer<vtkColorTransferFunction> m_BinaryColorTransferFunction;
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
// NO SMARTPOINTER HERE
vtkRenderWindow * m_VtkRenderWindow;
bool m_cpuInitialized;
vtkSmartPointer<vtkVolume> m_VolumeCPU;
vtkSmartPointer<vtkFixedPointVolumeRayCastMapper> m_MapperCPU;
vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyCPU;
bool m_gpuSupported;
bool m_gpuInitialized;
vtkSmartPointer<vtkVolume> m_VolumeGPU;
vtkSmartPointer<vtkMitkVolumeTextureMapper3D> m_MapperGPU;
vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyGPU;
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
bool m_raySupported;
bool m_rayInitialized;
vtkSmartPointer<vtkVolume> m_VolumeRAY;
vtkSmartPointer<vtkGPUVolumeRayCastMapper> m_MapperRAY;
vtkSmartPointer<vtkVolumeProperty> m_VolumePropertyRAY;
#endif
LocalStorage()
{
m_VtkRenderWindow = 0;
m_cpuInitialized = false;
m_gpuInitialized = false;
m_gpuSupported = true; // assume initially gpu slicing is supported
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
m_rayInitialized = false;
m_raySupported = true; // assume initially gpu raycasting is supported
#endif
}
~LocalStorage()
{
if(m_cpuInitialized && m_MapperCPU && m_VtkRenderWindow)
m_MapperCPU->ReleaseGraphicsResources(m_VtkRenderWindow);
if(m_gpuInitialized && m_MapperGPU && m_VtkRenderWindow)
m_MapperGPU->ReleaseGraphicsResources(m_VtkRenderWindow);
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
if(m_rayInitialized && m_MapperRAY && m_VtkRenderWindow)
m_MapperRAY->ReleaseGraphicsResources(m_VtkRenderWindow);
#endif
}
};
mitk::LocalStorageHandler<LocalStorage> m_LSH;
};
} // namespace mitk
#endif /* MITKVOLUMEDATAVTKMAPPER3D_H_HEADER_INCLUDED */
diff --git a/Modules/MapperExt/include/mitkMeshMapper2D.h b/Modules/MapperExt/include/mitkMeshMapper2D.h
index c768327b53..af555328cd 100644
--- a/Modules/MapperExt/include/mitkMeshMapper2D.h
+++ b/Modules/MapperExt/include/mitkMeshMapper2D.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMESHMAPPER2D_H_HEADER_INCLUDED
#define MITKMESHMAPPER2D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkGLMapper.h"
namespace mitk {
class BaseRenderer;
class Mesh;
/**
* \brief OpenGL-based mapper to display a mesh in a 2D window
*
* \todo implement for AbstractTransformGeometry.
* \ingroup Mapper
*/
class MITKMAPPEREXT_EXPORT MeshMapper2D : public GLMapper
{
public:
mitkClassMacro(MeshMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Get the Mesh to map */
const mitk::Mesh *GetInput(void);
- virtual void Paint( mitk::BaseRenderer *renderer );
+ virtual void Paint( mitk::BaseRenderer *renderer ) override;
protected:
MeshMapper2D();
virtual ~MeshMapper2D();
};
} // namespace mitk
#endif /* MITKMESHMapper2D_H_HEADER_INCLUDED */
diff --git a/Modules/MapperExt/include/mitkMeshVtkMapper3D.h b/Modules/MapperExt/include/mitkMeshVtkMapper3D.h
index 51ddf0588f..8ba208213e 100644
--- a/Modules/MapperExt/include/mitkMeshVtkMapper3D.h
+++ b/Modules/MapperExt/include/mitkMeshVtkMapper3D.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
#define MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkVtkMapper.h"
#include "mitkMesh.h"
#include "mitkBaseRenderer.h"
#include <vtkSphereSource.h>
#include <vtkAppendPolyData.h>
#include <vtkPolyData.h>
#include <vtkPoints.h>
#include <vtkPointData.h>
#include <vtkCellArray.h>
#include <vtkFloatArray.h>
#include <vtkTubeFilter.h>
#include <vtkVectorText.h>
#include <vtkTextSource.h>
#include <vtkLinearTransform.h>
#include <vtkTransformPolyDataFilter.h>
class vtkActor;
class vtkAssembly;
class vtkFollower;
class vtkPolyDataMapper;
class vtkPropAssembly;
namespace mitk {
/**
* \brief Vtk-based mapper for PointList
* \ingroup Mapper
*/
class MITKMAPPEREXT_EXPORT MeshVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(MeshVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::Mesh* GetInput();
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer);
- virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer) override;
+ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
MeshVtkMapper3D();
virtual ~MeshVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
- virtual void ResetMapper( BaseRenderer* renderer );
+ virtual void ResetMapper( BaseRenderer* renderer ) override;
vtkPropAssembly* m_PropAssembly;
vtkActor *m_SpheresActor;
vtkActor *m_ContourActor;
vtkPolyDataMapper* m_ContourMapper;
vtkPolyDataMapper* m_SpheresMapper;
vtkPolyDataMapper* m_TextVtkPolyDataMapper;
vtkAppendPolyData *m_Spheres;
vtkPolyData *m_Contour;
};
} // namespace mitk
#endif /* MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED*/
diff --git a/Modules/MapperExt/include/mitkSplineVtkMapper3D.h b/Modules/MapperExt/include/mitkSplineVtkMapper3D.h
index 57cf722292..656c90b0a6 100644
--- a/Modules/MapperExt/include/mitkSplineVtkMapper3D.h
+++ b/Modules/MapperExt/include/mitkSplineVtkMapper3D.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_SPLINE_VTK_MAPPER_3D__H
#define _MITK_SPLINE_VTK_MAPPER_3D__H
#include "mitkPointSetVtkMapper3D.h"
#include "MitkMapperExtExports.h"
class vtkActor;
class vtkAssembly;
namespace mitk
{
//##Documentation
//## @brief Vtk-based mapper for Splines
//##
//## properties looked for:
//## "line width" = with of the spline
//## @ingroup Mapper
/************************************************************************/
/*
* - \b "line width": (FloatProperty) line width of the spline
*/
/************************************************************************/
class MITKMAPPEREXT_EXPORT SplineVtkMapper3D : public PointSetVtkMapper3D
{
public:
mitkClassMacro( SplineVtkMapper3D, PointSetVtkMapper3D );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer);
- virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer *renderer) override;
+ virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
bool SplinesAreAvailable();
vtkPolyData* GetSplinesPolyData();
vtkActor* GetSplinesActor();
virtual void UpdateSpline();
itkSetMacro( SplineResolution, unsigned int );
itkGetMacro( SplineResolution, unsigned int );
protected:
SplineVtkMapper3D();
virtual ~SplineVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer * renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer * renderer) override;
- virtual void ApplyAllProperties(BaseRenderer *renderer, vtkActor *actor);
+ virtual void ApplyAllProperties(BaseRenderer *renderer, vtkActor *actor) override;
vtkActor* m_SplinesActor;
vtkPropAssembly* m_SplineAssembly;
bool m_SplinesAvailable;
bool m_SplinesAddedToAssembly;
unsigned int m_SplineResolution;
itk::TimeStamp m_SplineUpdateTime;
};
} //namespace mitk
#endif
diff --git a/Modules/MapperExt/include/mitkUnstructuredGridMapper2D.h b/Modules/MapperExt/include/mitkUnstructuredGridMapper2D.h
index ab8bb651bc..e349baf651 100644
--- a/Modules/MapperExt/include/mitkUnstructuredGridMapper2D.h
+++ b/Modules/MapperExt/include/mitkUnstructuredGridMapper2D.h
@@ -1,114 +1,114 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MitkPointSetSliceLMapper2D_H
#define MitkPointSetSliceLMapper2D_H
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkGLMapper.h"
#include "mitkTransferFunction.h"
#include "mitkProperties.h"
#include "mitkColorProperty.h"
#include "mitkVtkScalarModeProperty.h"
class vtkPointSetSlicer;
class vtkPlane;
class vtkLookupTable;
class vtkPointSet;
class vtkScalarsToColors;
class vtkPiecewiseFunction;
class vtkAbstractMapper3D;
namespace mitk
{
class BaseRenderer;
/**
* @brief OpenGL-based mapper to display a 2d cut through a poly data
* OpenGL-based mapper to display a 2D cut through a poly data. The result is
* normally a line. This class can be added to any data object, which is
* rendered in 3D via a vtkPolyData.
*/
class MITKMAPPEREXT_EXPORT UnstructuredGridMapper2D : public GLMapper
{
public:
mitkClassMacro( UnstructuredGridMapper2D, GLMapper );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Renders a cut through a pointset by cutting trough the n-cells,
* producing (n-1)-cells.
* @param renderer the render to render in.
*/
- virtual void Paint( mitk::BaseRenderer* renderer );
+ virtual void Paint( mitk::BaseRenderer* renderer ) override;
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
UnstructuredGridMapper2D();
virtual ~UnstructuredGridMapper2D();
- virtual void GenerateDataForRenderer(BaseRenderer*);
+ virtual void GenerateDataForRenderer(BaseRenderer*) override;
/**
* Determines, if the associated BaseData is mapped three-dimensionally (mapper-slot id 2)
* with a class convertable to vtkAbstractMapper3D().
* @returns NULL if it is not convertable or the appropriate Mapper otherwise
*/
virtual vtkAbstractMapper3D* GetVtkAbstractMapper3D(BaseRenderer* renderer);
/**
* Determines the pointset object to be cut.
* returns the pointset if possible, otherwise NULL.
*/
virtual vtkPointSet* GetVtkPointSet(BaseRenderer* renderer, int time = 0 );
/**
* Determines the LookupTable used by the associated vtkMapper.
* returns the LUT if possible, otherwise NULL.
*/
virtual vtkScalarsToColors* GetVtkLUT(BaseRenderer* renderer );
/**
* Checks if this mapper can be used to generate cuts through the associated
* base data.
* @return true if yes or false if not.
*/
virtual bool IsConvertibleToVtkPointSet(BaseRenderer* renderer);
vtkPlane* m_Plane;
vtkPointSetSlicer* m_Slicer;
vtkPointSet* m_VtkPointSet;
vtkScalarsToColors* m_ScalarsToColors;
vtkPiecewiseFunction* m_ScalarsToOpacity;
mitk::ColorProperty::Pointer m_Color;
mitk::IntProperty::Pointer m_LineWidth;
mitk::BoolProperty::Pointer m_Outline;
mitk::BoolProperty::Pointer m_ScalarVisibility;
mitk::VtkScalarModeProperty::Pointer m_ScalarMode;
};
} // namespace mitk
#endif /* MitkPointSetSliceLMapper2D_H */
diff --git a/Modules/MapperExt/include/mitkUnstructuredGridVtkMapper3D.h b/Modules/MapperExt/include/mitkUnstructuredGridVtkMapper3D.h
index dd11868fab..98bdde393c 100644
--- a/Modules/MapperExt/include/mitkUnstructuredGridVtkMapper3D.h
+++ b/Modules/MapperExt/include/mitkUnstructuredGridVtkMapper3D.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_
#define _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkVtkMapper.h"
#include "mitkUnstructuredGrid.h"
#include "mitkBaseRenderer.h"
#include <vtkAssembly.h>
#include <vtkActor.h>
#include <vtkVolume.h>
#include <vtkDataSetTriangleFilter.h>
#include "vtkUnstructuredGridMapper.h"
#include <vtkUnstructuredGridVolumeRayCastMapper.h>
#include <vtkProjectedTetrahedraMapper.h>
#include <vtkUnstructuredGridVolumeZSweepMapper.h>
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for UnstructuredGrid
//##
//## @ingroup Mapper
class MITKMAPPEREXT_EXPORT UnstructuredGridVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(UnstructuredGridVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::UnstructuredGrid* GetInput();
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
- void ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer);
+ void ApplyProperties(vtkActor* /*actor*/, mitk::BaseRenderer* renderer) override;
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
UnstructuredGridVtkMapper3D();
virtual ~UnstructuredGridVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
- virtual void ResetMapper( BaseRenderer* /*renderer*/ );
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
+ virtual void ResetMapper( BaseRenderer* /*renderer*/ ) override;
void SetProperties(mitk::BaseRenderer* renderer);
vtkAssembly* m_Assembly;
vtkActor* m_Actor;
vtkActor* m_ActorWireframe;
vtkVolume* m_Volume;
vtkDataSetTriangleFilter* m_VtkTriangleFilter;
vtkUnstructuredGridMapper* m_VtkDataSetMapper;
vtkUnstructuredGridMapper* m_VtkDataSetMapper2;
vtkUnstructuredGridVolumeRayCastMapper* m_VtkVolumeRayCastMapper;
vtkProjectedTetrahedraMapper* m_VtkPTMapper;
vtkUnstructuredGridVolumeZSweepMapper* m_VtkVolumeZSweepMapper;
};
} // namespace mitk
#endif /* _MITK_UNSTRUCTURED_GRID_VTK_MAPPER_3D_H_ */
diff --git a/Modules/MapperExt/include/mitkVectorImageMapper2D.h b/Modules/MapperExt/include/mitkVectorImageMapper2D.h
index 8b6d0df267..62806c8eeb 100644
--- a/Modules/MapperExt/include/mitkVectorImageMapper2D.h
+++ b/Modules/MapperExt/include/mitkVectorImageMapper2D.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_VECTOR_IMAGE_MAPPER_2D__H_
#define _MITK_VECTOR_IMAGE_MAPPER_2D__H_
#include "MitkMapperExtExports.h"
#include "mitkCommon.h"
#include "mitkGLMapper.h"
#include "mitkImage.h"
class vtkLookupTable;
class vtkScalarsToColors;
class vtkImageReslice;
class vtkPolyData;
class vtkGlyph2D;
class vtkPlane;
class vtkCutter;
namespace mitk
{
class BaseRenderer;
class PlaneGeometry;
class DisplayGeometry;
class MITKMAPPEREXT_EXPORT VectorImageMapper2D : public GLMapper
{
public:
mitkClassMacro( VectorImageMapper2D, GLMapper );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef double vtkScalarType;
/**
* @returns the image held by the associated with the mapper or the image
* which has been explicitly set by SetImage(...)
*/
const mitk::Image * GetInput( void );
- virtual void Paint( mitk::BaseRenderer * renderer );
+ virtual void Paint( mitk::BaseRenderer * renderer ) override;
/**
* Explicitly set an vector image. This image will be used for
* rendering instead of the image returned by GetData()
*/
itkSetConstObjectMacro( Image, mitk::Image );
/**
* Get the explicitly set image
* @returns NULL if no Image has been set instead of GetData();
*/
itkGetConstObjectMacro( Image, mitk::Image );
virtual void PaintCells( vtkPolyData* contour, const PlaneGeometry* worldGeometry, const DisplayGeometry* displayGeometry, vtkLinearTransform* vtktransform, BaseRenderer* renderer, vtkScalarsToColors *lut, mitk::Color color, float lwidth, double *spacing );
protected:
int GetCurrentTimeStep( mitk::BaseData* data, mitk::BaseRenderer* renderer );
VectorImageMapper2D();
virtual ~VectorImageMapper2D();
mitk::Image::ConstPointer m_Image;
vtkLookupTable *m_LUT;
vtkPlane* m_Plane;
vtkCutter* m_Cutter;
};
} // namespace mitk
#endif
diff --git a/Modules/MapperExt/include/vtkMaskedGlyph2D.h b/Modules/MapperExt/include/vtkMaskedGlyph2D.h
index 663ce0b6a4..077c9db30c 100644
--- a/Modules/MapperExt/include/vtkMaskedGlyph2D.h
+++ b/Modules/MapperExt/include/vtkMaskedGlyph2D.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkMaskedGlyph2D_h
#define __vtkMaskedGlyph2D_h
#include "MitkMapperExtExports.h"
#include "vtkGlyph2D.h"
#include "mitkCommon.h"
class vtkMaskPoints;
/**
* This class masked points of the input data set and glyphs
* only the selected poitns. Points may be selected either by
* random or by ratio.
* Additionally, this class allows to set the InputScalars,
* InputVectors and InputNormals by their field name in the
* input dataset.
*/
class MITKMAPPEREXT_EXPORT vtkMaskedGlyph2D : public vtkGlyph2D
{
public:
vtkTypeMacro(vtkMaskedGlyph2D,vtkGlyph2D);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Constructor
*/
static vtkMaskedGlyph2D *New();
/**
* Limit the number of points to glyph
*/
vtkSetMacro(MaximumNumberOfPoints, int);
vtkGetMacro(MaximumNumberOfPoints, int);
/**
* Set the input to this filter.
*/
virtual void SetInput(vtkDataSet *input);
/**
* Set/get whether to mask points
*/
vtkSetMacro(UseMaskPoints, int);
vtkGetMacro(UseMaskPoints, int);
/**
* Set/get flag to cause randomization of which points to mask.
*/
void SetRandomMode(int mode);
int GetRandomMode();
///**
// * If you want to use an arbitrary scalars array, then set its name here.
// * By default this in NULL and the filter will use the active scalar array.
// */
//vtkGetStringMacro(InputScalarsSelection);
//void SelectInputScalars(const char *fieldName)
// {this->SetInputScalarsSelection(fieldName);}
///**
// * If you want to use an arbitrary vectors array, then set its name here.
// * By default this in NULL and the filter will use the active vector array.
// */
//vtkGetStringMacro(InputVectorsSelection);
//void SelectInputVectors(const char *fieldName)
// {this->SetInputVectorsSelection(fieldName);}
///**
// * If you want to use an arbitrary normals array, then set its name here.
// * By default this in NULL and the filter will use the active normal array.
// */
//vtkGetStringMacro(InputNormalsSelection);
//void SelectInputNormals(const char *fieldName)
// {this->SetInputNormalsSelection(fieldName);}
protected:
vtkMaskedGlyph2D();
~vtkMaskedGlyph2D();
- virtual int RequestData(vtkInformation* info,vtkInformationVector** inInfoVec,vtkInformationVector* outInfoVec);
+ virtual int RequestData(vtkInformation* info,vtkInformationVector** inInfoVec,vtkInformationVector* outInfoVec) override;
vtkMaskPoints *MaskPoints;
int MaximumNumberOfPoints;
int UseMaskPoints;
private:
vtkMaskedGlyph2D(const vtkMaskedGlyph2D&); // Not implemented.
void operator=(const vtkMaskedGlyph2D&); // Not implemented.
};
#endif
diff --git a/Modules/MapperExt/include/vtkMaskedGlyph3D.h b/Modules/MapperExt/include/vtkMaskedGlyph3D.h
index 0ee561c783..0900484d8a 100644
--- a/Modules/MapperExt/include/vtkMaskedGlyph3D.h
+++ b/Modules/MapperExt/include/vtkMaskedGlyph3D.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkMaskedGlyph3D_h
#define __vtkMaskedGlyph3D_h
#include "MitkMapperExtExports.h"
#include "vtkGlyph3D.h"
#include "mitkCommon.h"
class vtkMaskPoints;
/**
* This class masked points of the input data set and glyphs
* only the selected poitns. Points may be selected either by
* random or by ratio.
* Additionally, this class allows to set the InputScalars,
* InputVectors and InputNormals by their field name in the
* input dataset.
*/
class MITKMAPPEREXT_EXPORT vtkMaskedGlyph3D : public vtkGlyph3D
{
public:
vtkTypeMacro(vtkMaskedGlyph3D,vtkGlyph3D);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Constructor
*/
static vtkMaskedGlyph3D *New();
/**
* Limit the number of points to glyph
*/
vtkSetMacro(MaximumNumberOfPoints, int);
vtkGetMacro(MaximumNumberOfPoints, int);
/**
* Set the input to this filter.
*/
virtual void SetInput(vtkDataSet *input);
/**
* Set/get whether to mask points
*/
vtkSetMacro(UseMaskPoints, int);
vtkGetMacro(UseMaskPoints, int);
/**
* Set/get flag to cause randomization of which points to mask.
*/
void SetRandomMode(int mode);
int GetRandomMode();
- virtual void SetInputConnection(vtkAlgorithmOutput* input);
+ virtual void SetInputConnection(vtkAlgorithmOutput* input) override;
using vtkGlyph3D::SetInputConnection;
protected:
vtkMaskedGlyph3D();
~vtkMaskedGlyph3D();
- virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
vtkMaskPoints *MaskPoints;
int MaximumNumberOfPoints;
int UseMaskPoints;
private:
vtkMaskedGlyph3D(const vtkMaskedGlyph3D&); // Not implemented.
void operator=(const vtkMaskedGlyph3D&); // Not implemented.
};
#endif
diff --git a/Modules/MapperExt/include/vtkMitkGPUVolumeRayCastMapper.h b/Modules/MapperExt/include/vtkMitkGPUVolumeRayCastMapper.h
index 5c95662cd0..82adcc513a 100644
--- a/Modules/MapperExt/include/vtkMitkGPUVolumeRayCastMapper.h
+++ b/Modules/MapperExt/include/vtkMitkGPUVolumeRayCastMapper.h
@@ -1,311 +1,311 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkMitkGPUVolumeRayCastMapper - Ray casting performed on the GPU.
// .SECTION Description
// vtkMitkGPUVolumeRayCastMapper is a volume mapper that performs ray casting on
// the GPU using fragment programs.
//
#ifndef __vtkMitkGPUVolumeRayCastMapper_h
#define __vtkMitkGPUVolumeRayCastMapper_h
#include "vtkVolumeMapper.h"
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "vtkVersionMacros.h"
// Only with VTK 5.6 or above
#if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
class vtkVolumeProperty;
class vtkRenderWindow;
//class vtkKWAMRVolumeMapper; // friend class.
class MITKMAPPEREXT_EXPORT vtkMitkGPUVolumeRayCastMapper : public vtkVolumeMapper
{
public:
vtkTypeMacro(vtkMitkGPUVolumeRayCastMapper,vtkVolumeMapper);
- void PrintSelf( ostream& os, vtkIndent indent );
+ void PrintSelf( ostream& os, vtkIndent indent ) override;
// Description:
// If AutoAdjustSampleDistances is on, the the ImageSampleDistance
// will be varied to achieve the allocated render time of this
// prop (controlled by the desired update rate and any culling in
// use).
vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
vtkGetMacro( AutoAdjustSampleDistances, int );
vtkBooleanMacro( AutoAdjustSampleDistances, int );
// Description:
// Set/Get the distance between samples used for rendering
// when AutoAdjustSampleDistances is off, or when this mapper
// has more than 1 second allocated to it for rendering.
// Initial value is 1.0.
vtkSetMacro( SampleDistance, float );
vtkGetMacro( SampleDistance, float );
// Description:
// Sampling distance in the XY image dimensions. Default value of 1 meaning
// 1 ray cast per pixel. If set to 0.5, 4 rays will be cast per pixel. If
// set to 2.0, 1 ray will be cast for every 4 (2 by 2) pixels. This value
// will be adjusted to meet a desired frame rate when AutoAdjustSampleDistances
// is on.
vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
vtkGetMacro( ImageSampleDistance, float );
// Description:
// This is the minimum image sample distance allow when the image
// sample distance is being automatically adjusted.
vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
vtkGetMacro( MinimumImageSampleDistance, float );
// Description:
// This is the maximum image sample distance allow when the image
// sample distance is being automatically adjusted.
vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
vtkGetMacro( MaximumImageSampleDistance, float );
// Description:
// Set/Get the window / level applied to the final color.
// This allows brightness / contrast adjustments on the
// final image.
// window is the width of the window.
// level is the center of the window.
// Initial window value is 1.0
// Initial level value is 0.5
// window cannot be null but can be negative, this way
// values will be reversed.
// |window| can be larger than 1.0
// level can be any real value.
vtkSetMacro( FinalColorWindow, float );
vtkGetMacro( FinalColorWindow, float );
vtkSetMacro( FinalColorLevel, float );
vtkGetMacro( FinalColorLevel, float );
// Description:
// Maximum size of the 3D texture in GPU memory.
// Will default to the size computed from the graphics
// card. Can be adjusted by the user.
vtkSetMacro( MaxMemoryInBytes, vtkIdType );
vtkGetMacro( MaxMemoryInBytes, vtkIdType );
// Description:
// Maximum fraction of the MaxMemoryInBytes that should
// be used to hold the texture. Valid values are 0.1 to
// 1.0.
vtkSetClampMacro( MaxMemoryFraction, float, 0.1f, 1.0f );
vtkGetMacro( MaxMemoryFraction, float );
// Description:
// Tells if the mapper will report intermediate progress.
// Initial value is true. As the progress works with a GL blocking
// call (glFinish()), this can be useful for huge dataset but can
// slow down rendering of small dataset. It should be set to true
// for big dataset or complex shading and streaming but to false for
// small datasets.
vtkSetMacro(ReportProgress,bool);
vtkGetMacro(ReportProgress,bool);
// Description:
// Based on hardware and properties, we may or may not be able to
// render using 3D texture mapping. This indicates if 3D texture
// mapping is supported by the hardware, and if the other extensions
// necessary to support the specific properties are available.
virtual int IsRenderSupported(vtkRenderWindow *vtkNotUsed(window),
vtkVolumeProperty *vtkNotUsed(property))
{
return 0;
}
void CreateCanonicalView( vtkRenderer *ren,
vtkVolume *volume,
vtkImageData *image,
int blend_mode,
double viewDirection[3],
double viewUp[3] );
void SetMaskInput(vtkImageData *mask);
vtkGetObjectMacro(MaskInput, vtkImageData);
// Description:
// Tells how much mask color transfer function is used compared to the
// standard color transfer function when the mask is true.
// 0.0 means only standard color transfer function.
// 1.0 means only mask color tranfer function.
// Initial value is 1.0.
vtkSetClampMacro(MaskBlendFactor,float,0.0f,1.0f);
vtkGetMacro(MaskBlendFactor,float);
//BTX
// Description:
// WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
// Initialize rendering for this volume.
- void Render( vtkRenderer *, vtkVolume * );
+ void Render( vtkRenderer *, vtkVolume * ) override;
// Description:
// Handled in the subclass - the actual render method
// \pre input is up-to-date.
virtual void GPURender( vtkRenderer *, vtkVolume *) {}
// Description:
// WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
// Release any graphics resources that are being consumed by this mapper.
// The parameter window could be used to determine which graphic
// resources to release.
// \deprecatedSince{2013_12}
DEPRECATED(void ReleaseGraphicsResources(vtkWindow *))
{
};
// Description:
// Return how much the dataset has to be reduced in each dimension to
// fit on the GPU. If the value is 1.0, there is no need to reduce the
// dataset.
// \pre the calling thread has a current OpenGL context.
// \pre mapper_supported: IsRenderSupported(renderer->GetRenderWindow(),0)
// The computation is based on hardware limits (3D texture indexable size)
// and MaxMemoryInBytes.
// \post valid_i_ratio: ratio[0]>0 && ratio[0]<=1.0
// \post valid_j_ratio: ratio[1]>0 && ratio[1]<=1.0
// \post valid_k_ratio: ratio[2]>0 && ratio[2]<=1.0
virtual void GetReductionRatio(double ratio[3])=0;
//ETX
protected:
vtkMitkGPUVolumeRayCastMapper();
~vtkMitkGPUVolumeRayCastMapper();
// Check to see that the render will be OK
int ValidateRender( vtkRenderer *, vtkVolume * );
// Special version of render called during the creation
// of a canonical view.
void CanonicalViewRender( vtkRenderer *, vtkVolume * );
// Methods called by the AMR Volume Mapper.
virtual void PreRender(vtkRenderer *ren,
vtkVolume *vol,
double datasetBounds[6],
double scalarRange[2],
int numberOfScalarComponents,
unsigned int numberOfLevels)=0;
// \pre input is up-to-date
virtual void RenderBlock(vtkRenderer *ren,
vtkVolume *vol,
unsigned int level)=0;
virtual void PostRender(vtkRenderer *ren,
int numberOfScalarComponents)=0;
// Description:
// Called by the AMR Volume Mapper.
// Set the flag that tells if the scalars are on point data (0) or
// cell data (1).
void SetCellFlag(int cellFlag);
// The distance between sample points along the ray
float SampleDistance;
float ImageSampleDistance;
float MinimumImageSampleDistance;
float MaximumImageSampleDistance;
int AutoAdjustSampleDistances;
int SmallVolumeRender;
double BigTimeToDraw;
double SmallTimeToDraw;
float FinalColorWindow;
float FinalColorLevel;
vtkIdType MaxMemoryInBytes;
float MaxMemoryFraction;
// 1 if we are generating the canonical image, 0 otherwise
int GeneratingCanonicalView;
vtkImageData *CanonicalViewImageData;
// Description:
// Set the mapper in AMR Mode or not. Initial value is false.
// Called only by the vtkKWAMRVolumeMapper
vtkSetClampMacro(AMRMode,int,0,1);
vtkGetMacro(AMRMode,int);
vtkBooleanMacro(AMRMode,int);
int AMRMode;
int CellFlag; // point data or cell data (or field data, not handled) ?
// Description:
// Compute the cropping planes clipped by the bounds of the volume.
// The result is put into this->ClippedCroppingRegionPlanes.
// NOTE: IT WILL BE MOVED UP TO vtkVolumeMapper after bullet proof usage
// in this mapper. Other subclasses will use the ClippedCroppingRegionsPlanes
// members instead of CroppingRegionPlanes.
// \pre volume_exists: this->GetInput()!=0
// \pre valid_cropping: this->Cropping &&
// this->CroppingRegionPlanes[0]<this->CroppingRegionPlanes[1] &&
// this->CroppingRegionPlanes[2]<this->CroppingRegionPlanes[3] &&
// this->CroppingRegionPlanes[4]<this->CroppingRegionPlanes[5])
virtual void ClipCroppingRegionPlanes();
double ClippedCroppingRegionPlanes[6];
bool ReportProgress;
vtkImageData *MaskInput;
float MaskBlendFactor;
vtkGetObjectMacro(TransformedInput, vtkImageData);
void SetTransformedInput(vtkImageData*);
vtkImageData* TransformedInput;
// Description:
// This is needed only to check if the input data has been changed since the last
// Render() call.
vtkImageData* LastInput;
private:
vtkMitkGPUVolumeRayCastMapper(const vtkMitkGPUVolumeRayCastMapper&); // Not implemented.
void operator=(const vtkMitkGPUVolumeRayCastMapper&); // Not implemented.
};
#endif
#endif
diff --git a/Modules/MapperExt/include/vtkMitkOpenGLVolumeTextureMapper3D.h b/Modules/MapperExt/include/vtkMitkOpenGLVolumeTextureMapper3D.h
index 710d1a9efc..8fad22fe87 100644
--- a/Modules/MapperExt/include/vtkMitkOpenGLVolumeTextureMapper3D.h
+++ b/Modules/MapperExt/include/vtkMitkOpenGLVolumeTextureMapper3D.h
@@ -1,150 +1,150 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// .NAME vtkMitkOpenGLVolumeTextureMapper3D - concrete implementation of 3D volume texture mapping
// .SECTION Description
// vtkMitkOpenGLVolumeTextureMapper3D renders a volume using 3D texture mapping.
// See vtkMitkVolumeTextureMapper3D for full description.
// .SECTION see also
// vtkMitkVolumeTextureMapper3D vtkVolumeMapper
#ifndef __vtkMitkOpenGLVolumeTextureMapper3D_h
#define __vtkMitkOpenGLVolumeTextureMapper3D_h
#include "vtkMitkVolumeTextureMapper3D.h"
#include "mitkBaseRenderer.h"
#include "MitkMapperExtExports.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
# include "vtkOpenGL.h" // GLfloat type is used in some method signatures.
#endif
class vtkRenderWindow;
class vtkVolumeProperty;
#include "mitkCommon.h"
class MITKMAPPEREXT_EXPORT vtkMitkOpenGLVolumeTextureMapper3D : public vtkMitkVolumeTextureMapper3D
{
public:
vtkTypeMacro(vtkMitkOpenGLVolumeTextureMapper3D,vtkMitkVolumeTextureMapper3D);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
static vtkMitkOpenGLVolumeTextureMapper3D *New();
// Description:
// Is hardware rendering supported? No if the input data is
// more than one independent component, or if the hardware does
// not support the required extensions
// int IsRenderSupported(vtkVolumeProperty *);
- int IsRenderSupported(vtkRenderer *ren,vtkVolumeProperty *);
+ int IsRenderSupported(vtkRenderer *ren,vtkVolumeProperty *) override;
//BTX
// Description:
// WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
// DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
// Render the volume
- virtual void Render(vtkRenderer *ren, vtkVolume *vol);
+ virtual void Render(vtkRenderer *ren, vtkVolume *vol) override;
//ETX
// Desciption:
// Initialize when we go to render, or go to answer the
// IsRenderSupported question. Don't call unless we have
// a valid OpenGL context!
vtkGetMacro( Initialized, int );
// Description:
// Release any graphics resources that are being consumed by this texture.
// The parameter window could be used to determine which graphic
// resources to release.
// deprecatedSince{2013_12} Use ReleaseGraphicsResources(mitk::BaseRenderer* renderer) instead
DEPRECATED(void ReleaseGraphicsResources(vtkWindow *));
// Description:
// Release any graphics resources that are being consumed by this texture.
// The parameter renderer could be used to determine which graphic
// resources to release.
void ReleaseGraphicsResources(mitk::BaseRenderer * renderer);
protected:
vtkMitkOpenGLVolumeTextureMapper3D();
~vtkMitkOpenGLVolumeTextureMapper3D();
bool RenderPossible;
//BTX
void GetLightInformation(vtkRenderer *ren,
vtkVolume *vol,
GLfloat lightDirection[2][4],
GLfloat lightDiffuseColor[2][4],
GLfloat lightSpecularColor[2][4],
GLfloat halfwayVector[2][4],
GLfloat *ambient );
//ETX
int Initialized;
GLuint Volume1Index;
GLuint Volume2Index;
GLuint Volume3Index;
GLuint ColorLookupIndex;
GLuint AlphaLookupIndex;
GLuint prgOneComponentShade;
GLuint prgRGBAShade;
vtkRenderWindow *RenderWindow;
bool SupportsCompressedTexture;
//void Initialize();
void Initialize(vtkRenderer *r);
virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol);
void SetupOneIndependentTextures( vtkRenderer *ren, vtkVolume *vol );
void RenderOneIndependentShadeFP( vtkRenderer *ren, vtkVolume *vol );
void SetupRGBATextures( vtkRenderer *ren, vtkVolume *vol );
void RenderRGBAShadeFP( vtkRenderer *ren, vtkVolume *vol );
void DeleteTextureIndex( GLuint *index );
void CreateTextureIndex( GLuint *index );
void RenderPolygons( vtkRenderer *ren, vtkVolume *vol, int stages[4] );
void SetupProgramLocalsForShadingFP( vtkRenderer *ren, vtkVolume *vol );
void Setup3DTextureParameters( bool linear );
void ComputeVolumeDimensions();
bool UpdateVolumes( vtkVolume * );
bool UpdateVolumesRGBA( vtkVolume * );
private:
vtkMitkOpenGLVolumeTextureMapper3D(const vtkMitkOpenGLVolumeTextureMapper3D&); // Not implemented.
void operator=(const vtkMitkOpenGLVolumeTextureMapper3D&); // Not implemented.
};
#endif
diff --git a/Modules/MapperExt/include/vtkMitkVolumeTextureMapper3D.h b/Modules/MapperExt/include/vtkMitkVolumeTextureMapper3D.h
index 41d670cd75..37fbecdf47 100644
--- a/Modules/MapperExt/include/vtkMitkVolumeTextureMapper3D.h
+++ b/Modules/MapperExt/include/vtkMitkVolumeTextureMapper3D.h
@@ -1,229 +1,229 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
// .NAME vtkMitkVolumeTextureMapper3D - volume render with 3D texture mapping
// .SECTION Description
// vtkMitkVolumeTextureMapper3D renders a volume using 3D texture mapping.
// This class is actually an abstract superclass - with all the actual
// work done by vtkMitkOpenGLVolumeTextureMapper3D.
//
// This mappers currently supports:
//
// - any data type as input
// - one component, or two or four non-independent components
// - composite blending
// - intermixed opaque geometry
// - multiple volumes can be rendered if they can
// be sorted into back-to-front order (use the vtkFrustumCoverageCuller)
//
// This mapper does not support:
// - more than one independent component
// - maximum intensity projection
//
// Internally, this mapper will potentially change the resolution of the
// input data. The data will be resampled to be a power of two in each
// direction, and also no greater than 128*256*256 voxels (any aspect)
// for one or two component data, or 128*128*256 voxels (any aspect)
// for four component data. The limits are currently hardcoded after
// a check using the GL_PROXY_TEXTURE3D because some graphics drivers
// were always responding "yes" to the proxy call despite not being
// able to allocate that much texture memory.
//
// Currently, calculations are computed using 8 bits per RGBA channel.
// In the future this should be expanded to handle newer boards that
// can support 15 bit float compositing.
//
// This mapper supports two main families of graphics hardware:
// nvidia and ATI. There are two different implementations of
// 3D texture mapping used - one based on nvidia's GL_NV_texture_shader2
// and GL_NV_register_combiners2 extension, and one based on
// ATI's GL_ATI_fragment_shader (supported also by some nvidia boards)
// To use this class in an application that will run on various
// hardware configurations, you should have a back-up volume rendering
// method. You should create a vtkMitkVolumeTextureMapper3D, assign its
// input, make sure you have a current OpenGL context (you've rendered
// at least once), then call IsRenderSupported with a vtkVolumeProperty
// as an argument. This method will return 0 if the input has more than
// one independent component, or if the graphics hardware does not
// support the set of required extensions for using at least one of
// the two implemented methods (nvidia or ati)
//
// .SECTION Thanks
// Thanks to Alexandre Gouaillard at the Megason Lab, Department of Systems
// Biology, Harvard Medical School
// https://wiki.med.harvard.edu/SysBio/Megason/
// for the idea and initial patch to speed-up rendering with compressed
// textures.
//
// .SECTION see also
// vtkVolumeMapper
#ifndef __vtkMitkVolumeTextureMapper3D_h
#define __vtkMitkVolumeTextureMapper3D_h
#include "vtkVolumeMapper.h"
#include "MitkMapperExtExports.h"
class vtkImageData;
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
class vtkVolumeProperty;
#include "mitkCommon.h"
class MITKMAPPEREXT_EXPORT vtkMitkVolumeTextureMapper3D : public vtkVolumeMapper
{
public:
vtkTypeMacro(vtkMitkVolumeTextureMapper3D,vtkVolumeMapper);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// static vtkMitkVolumeTextureMapper3D *New(); //VTK6_TODO
// Description:
// The distance at which to space sampling planes. This
// may not be honored for interactive renders. An interactive
// render is defined as one that has less than 1 second of
// allocated render time.
vtkSetMacro( SampleDistance, float );
vtkGetMacro( SampleDistance, float );
// Description:
// These are the dimensions of the 3D texture
vtkGetVectorMacro( VolumeDimensions, int, 3 );
// Description:
// This is the spacing of the 3D texture
vtkGetVectorMacro( VolumeSpacing, float, 3 );
// Description:
// Based on hardware and properties, we may or may not be able to
// render using 3D texture mapping. This indicates if 3D texture
// mapping is supported by the hardware, and if the other extensions
// necessary to support the specific properties are available.
virtual int IsRenderSupported( vtkRenderer *, vtkVolumeProperty *) =0;
// Description:
// Allow access to the number of polygons used for the
// rendering.
vtkGetMacro( NumberOfPolygons, int );
// Description:
// Allow access to the actual sample distance used to render
// the image.
vtkGetMacro( ActualSampleDistance, float );
//BTX
// Description:
// WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
// DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS
// Render the volume
- virtual void Render(vtkRenderer *, vtkVolume *) {};
+ virtual void Render(vtkRenderer *, vtkVolume *) override {};
// Description:
// Set/Get if the mapper use compressed textures (if supported by the
// hardware). Initial value is false.
// There are two reasons to use compressed textures: 1. rendering can be 4
// times faster. 2. It saves some VRAM.
// There is one reason to not use compressed textures: quality may be lower
// than with uncompressed textures.
vtkSetMacro(UseCompressedTexture,bool);
vtkGetMacro(UseCompressedTexture,bool);
void UpdateMTime();
protected:
vtkMitkVolumeTextureMapper3D();
~vtkMitkVolumeTextureMapper3D();
float *PolygonBuffer;
float *IntersectionBuffer;
int NumberOfPolygons;
int BufferSize;
/*
unsigned char *Volume1;
unsigned char *Volume2;
unsigned char *Volume3;
*/
/*
int VolumeSize;
int VolumeComponents;
*/
int VolumeDimensions[3];
float VolumeSpacing[3];
float SampleDistance;
float ActualSampleDistance;
vtkImageData *SavedTextureInput;
vtkImageData *SavedParametersInput;
vtkColorTransferFunction *SavedRGBFunction;
vtkPiecewiseFunction *SavedGrayFunction;
vtkPiecewiseFunction *SavedScalarOpacityFunction;
vtkPiecewiseFunction *SavedGradientOpacityFunction;
int SavedColorChannels;
float SavedSampleDistance;
float SavedScalarOpacityDistance;
unsigned char ColorLookup[65536*4];
unsigned char AlphaLookup[65536];
float TempArray1[3*4096];
float TempArray2[4096];
int ColorTableSize;
float ColorTableScale;
float ColorTableOffset;
unsigned char DiffuseLookup[65536*4];
unsigned char SpecularLookup[65536*4];
vtkTimeStamp SavedTextureMTime;
vtkTimeStamp SavedParametersMTime;
bool UseCompressedTexture;
bool SupportsNonPowerOfTwoTextures;
// Description:
// For the given viewing direction, compute the set of polygons.
void ComputePolygons( vtkRenderer *ren, vtkVolume *vol, double bounds[6] );
// Description:
// Update the internal RGBA representation of the volume. Return 1 if
// anything change, 0 if nothing changed.
int UpdateColorLookup( vtkVolume * );
// Description:
// Impemented in subclass - check is texture size is OK.
//BTX
virtual int IsTextureSizeSupported(int vtkNotUsed(size)[3],
int vtkNotUsed(components))
{
return 0;
}
//ETX
private:
vtkMitkVolumeTextureMapper3D(const vtkMitkVolumeTextureMapper3D&); // Not implemented.
void operator=(const vtkMitkVolumeTextureMapper3D&); // Not implemented.
};
#endif
diff --git a/Modules/MapperExt/include/vtkUnstructuredGridMapper.h b/Modules/MapperExt/include/vtkUnstructuredGridMapper.h
index 1682eddf18..61526fea76 100644
--- a/Modules/MapperExt/include/vtkUnstructuredGridMapper.h
+++ b/Modules/MapperExt/include/vtkUnstructuredGridMapper.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __vtkUnstructuredGridMapper_h
#define __vtkUnstructuredGridMapper_h
#include "mitkCommon.h"
#include "MitkMapperExtExports.h"
#include "mitkBoundingObject.h"
#include "mitkBaseRenderer.h"
#include "vtkMapper.h"
class vtkPolyDataMapper;
class vtkGeometryFilter;
class vtkUnstructuredGrid;
class MITKMAPPEREXT_EXPORT vtkUnstructuredGridMapper : public vtkMapper
{
public:
static vtkUnstructuredGridMapper *New();
vtkTypeMacro(vtkUnstructuredGridMapper,vtkMapper);
- void PrintSelf(ostream& os, vtkIndent indent);
- void Render(vtkRenderer *ren, vtkActor *act);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
+ void Render(vtkRenderer *ren, vtkActor *act) override;
// Description:
// Get the internal poly data mapper used to map data set to graphics system.
vtkGetObjectMacro(PolyDataMapper, vtkPolyDataMapper);
// Description:
// Release any graphics resources that are being consumed by this mapper.
// The parameter window could be used to determine which graphic
// resources to release.
// deprecatedSince{2013_12} Use ReleaseGraphicsResources(mitk::BaseRenderer* renderer) instead
DEPRECATED(void ReleaseGraphicsResources(vtkWindow *));
// Description:
// Release any graphics resources that are being consumed by this mapper.
// The parameter renderer could be used to determine which graphic
// resources to release.
// deprecatedSince{2013_12} Use ReleaseGraphicsResources(mitk::BaseRenderer* renderer) instead
void ReleaseGraphicsResources(mitk::BaseRenderer * renderer);
// Description:
// Get the mtime also considering the lookup table.
- unsigned long GetMTime();
+ unsigned long GetMTime() override;
// Description:
// Set the Input of this mapper.
void SetInput(vtkUnstructuredGrid *input);
vtkUnstructuredGrid *GetInput();
void SetBoundingObject(mitk::BoundingObject* bo);
protected:
vtkUnstructuredGridMapper();
~vtkUnstructuredGridMapper();
vtkGeometryFilter *GeometryExtractor;
vtkPolyDataMapper *PolyDataMapper;
mitk::BoundingObject::Pointer m_BoundingObject;
- virtual void ReportReferences(vtkGarbageCollector*);
+ virtual void ReportReferences(vtkGarbageCollector*) override;
// see algorithm for more info
- virtual int FillInputPortInformation(int port, vtkInformation* info);
+ virtual int FillInputPortInformation(int port, vtkInformation* info) override;
private:
vtkUnstructuredGridMapper(const vtkUnstructuredGridMapper&); // Not implemented.
void operator=(const vtkUnstructuredGridMapper&); // Not implemented.
};
#endif // __vtkUnstructuredGridMapper_h
diff --git a/Modules/MapperExt/src/vtkPointSetSlicer.h b/Modules/MapperExt/src/vtkPointSetSlicer.h
index bc3405662f..ac991e165f 100644
--- a/Modules/MapperExt/src/vtkPointSetSlicer.h
+++ b/Modules/MapperExt/src/vtkPointSetSlicer.h
@@ -1,116 +1,116 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _VTKPOINTSETSLICER_H_
#define _VTKPOINTSETSLICER_H_
#include <iostream>
#include "vtkVersion.h"
class vtkCutter;
class vtkPlane;
class vtkPointLocator;
class vtkCell;
class vtkDataArray;
class vtkCellArray;
class vtkPointData;
class vtkCellData;
#include "mitkCommon.h"
#include "vtkPolyDataAlgorithm.h"
class vtkPointSetSlicer : public vtkPolyDataAlgorithm
{
public:
vtkTypeMacro(vtkPointSetSlicer,vtkPolyDataAlgorithm);
- void PrintSelf(std::ostream& os, vtkIndent indent);
+ void PrintSelf(std::ostream& os, vtkIndent indent) override;
// Description:
// Construct with user-specified implicit function; initial value of 0.0; and
// generating cut scalars turned off.
static vtkPointSetSlicer *New();
// Description:
// Override GetMTime because we delegate to vtkContourValues and refer to
// vtkImplicitFunction.
- unsigned long GetMTime();
+ unsigned long GetMTime() override;
// Description
// Specify the implicit function to perform the cutting.
virtual void SetSlicePlane(vtkPlane*);
vtkGetObjectMacro(SlicePlane,vtkPlane);
// Description:
// If this flag is enabled, then the output scalar values will be
// interpolated from the implicit function values, and not the input scalar
// data.
vtkSetMacro(GenerateCutScalars,int);
vtkGetMacro(GenerateCutScalars,int);
vtkBooleanMacro(GenerateCutScalars,int);
// Description:
// Specify a spatial locator for merging points. By default,
// an instance of vtkMergePoints is used.
void SetLocator(vtkPointLocator *locator);
vtkGetObjectMacro(Locator,vtkPointLocator);
// Description:
// Create default locator. Used to create one when none is specified. The
// locator is used to merge coincident points.
void CreateDefaultLocator();
protected:
vtkPointSetSlicer(vtkPlane* cf = 0);
~vtkPointSetSlicer();
- virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
- virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
- virtual int FillInputPortInformation(int port, vtkInformation *info);
+ virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
+ virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;
+ virtual int FillInputPortInformation(int port, vtkInformation *info) override;
void UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output);
void ContourUnstructuredGridCell(vtkCell* cell,
vtkDataArray* cellScalars, vtkPointLocator* locator,
vtkCellArray* verts, vtkCellArray* lines,
vtkCellArray* polys, vtkPointData* inPd,
vtkPointData* outPd, vtkCellData* inCd,
vtkIdType cellId, vtkCellData* outCd);
vtkPlane *SlicePlane;
vtkCutter *Cutter;
vtkPointLocator *Locator;
int GenerateCutScalars;
private:
vtkPointSetSlicer(const vtkPointSetSlicer&); // Not implemented.
void operator=(const vtkPointSetSlicer&); // Not implemented.
static int edges[12][2];
typedef int EDGE_LIST;
typedef struct {
EDGE_LIST edges[8];
} POLY_CASES;
static POLY_CASES polyCases[256];
};
#endif /* _VTKPOINTSETSLICER_H_ */
diff --git a/Modules/Multilabel/Testing/mitkLabelSetImageIOTest.cpp b/Modules/Multilabel/Testing/mitkLabelSetImageIOTest.cpp
index 23a8846b35..22d5b2cc71 100644
--- a/Modules/Multilabel/Testing/mitkLabelSetImageIOTest.cpp
+++ b/Modules/Multilabel/Testing/mitkLabelSetImageIOTest.cpp
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkIOUtil.h>
#include <mitkLabelSetImage.h>
#include <mitkLabelSetImageIO.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
std::string pathToImage;
class mitkLabelSetImageIOTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLabelSetImageIOTestSuite);
MITK_TEST(TestGetWriteConfidenceLevel);
MITK_TEST(TestWriteLabelSetImage);
MITK_TEST(TestGetReadConfidenceLevel);
MITK_TEST(TestReadLabelSetImage);
CPPUNIT_TEST_SUITE_END();
private:
mitk::Image::Pointer regularImage;
mitk::LabelSetImage::Pointer multilabelImage;
mitk::LabelSetImageIO* lsetIO;
public:
- void setUp()
+ void setUp() override
{
regularImage = mitk::Image::New();
unsigned int dimensions[3] = {256,256,312};
regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
multilabelImage = mitk::LabelSetImage::New();
multilabelImage->Initialize(regularImage);
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
newlayer->SetLayer(1);
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
// TODO assert that the layer od labelset and labels is correct - TEST
multilabelImage->AddLayer(newlayer);
lsetIO = new mitk::LabelSetImageIO();
}
- void tearDown()
+ void tearDown() override
{
regularImage = 0;
multilabelImage = 0;
delete lsetIO;
}
void TestGetWriteConfidenceLevel()
{
dynamic_cast<mitk::IFileWriter*>(lsetIO)->SetInput(regularImage);
CPPUNIT_ASSERT_MESSAGE("LabelSetImageIO returned wrong writer confidence level", lsetIO->GetWriterConfidenceLevel() == mitk::IFileIO::Unsupported);
dynamic_cast<mitk::IFileWriter*>(lsetIO)->SetInput(multilabelImage);
CPPUNIT_ASSERT_MESSAGE("LabelSetImageIO returned wrong writer confidence level", lsetIO->GetWriterConfidenceLevel() == mitk::IFileIO::Supported);
}
void TestWriteLabelSetImage()
{
pathToImage = mitk::IOUtil::CreateTemporaryDirectory();
pathToImage.append("/LabelSetTestImage.nrrd");
dynamic_cast<mitk::IFileWriter*>(lsetIO)->SetInput(multilabelImage);
dynamic_cast<mitk::IFileWriter*>(lsetIO)->SetOutputLocation(pathToImage);
dynamic_cast<mitk::IFileWriter*>(lsetIO)->Write();
}
void TestGetReadConfidenceLevel()
{
dynamic_cast<mitk::IFileReader*>(lsetIO)->SetInput(GetTestDataFilePath("Pic3D.nrrd"));
CPPUNIT_ASSERT_MESSAGE("LabelSetImageIO returned wrong reader confidence level", lsetIO->GetReaderConfidenceLevel() == mitk::IFileIO::Unsupported);
std::string path = GetTestDataFilePath("Multilabel/Pic3DAsMultilabelImage.nrrd");
dynamic_cast<mitk::IFileReader*>(lsetIO)->SetInput(path);
CPPUNIT_ASSERT_MESSAGE("LabelSetImageIO returned wrong reader confidence level", lsetIO->GetReaderConfidenceLevel() == mitk::IFileIO::Supported);
}
void TestReadLabelSetImage()
{
dynamic_cast<mitk::IFileReader*>(lsetIO)->SetInput(pathToImage);
std::vector<mitk::BaseData::Pointer> data = dynamic_cast<mitk::IFileReader*>(lsetIO)->Read();
CPPUNIT_ASSERT_MESSAGE("Too many images have been read", data.size() == 1);
mitk::LabelSetImage::Pointer loadedImage = dynamic_cast<mitk::LabelSetImage*>(data.at(0).GetPointer());
// This information is currently not serialized but also checked within the Equals function
loadedImage->SetActiveLayer(multilabelImage->GetActiveLayer());
CPPUNIT_ASSERT_MESSAGE("Error reading label set image", loadedImage.IsNotNull());
CPPUNIT_ASSERT_MESSAGE("Error reading label set image", mitk::Equal(*multilabelImage, *loadedImage, 0.0001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLabelSetImageIO)
diff --git a/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp b/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
index 22c72ee73e..597efef47f 100644
--- a/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
+++ b/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
@@ -1,414 +1,414 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImageStatisticsHolder.h>
#include <mitkIOUtil.h>
#include <mitkLabelSetImage.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkLabelSetImageTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLabelSetImageTestSuite);
MITK_TEST(TestInitialize);
MITK_TEST(TestAddLayer);
MITK_TEST(TestGetActiveLabelSet);
MITK_TEST(TestGetActiveLabel);
MITK_TEST(TestInitializeByLabeledImage);
MITK_TEST(TestGetLabelSet);
MITK_TEST(TestGetLabel);
MITK_TEST(TestSetExteriorLabel);
MITK_TEST(TestGetTotalNumberOfLabels);
MITK_TEST(TestExistsLabel);
MITK_TEST(TestExistsLabelSet);
MITK_TEST(TestSetActiveLayer);
MITK_TEST(TestRemoveLayer);
MITK_TEST(TestRemoveLabels);
MITK_TEST(TestMergeLabel);
// TODO check it these functionalities can be moved into a process object
// MITK_TEST(TestMergeLabels);
// MITK_TEST(TestConcatenate);
// MITK_TEST(TestClearBuffer);
// MITK_TEST(TestUpdateCenterOfMass);
// MITK_TEST(TestGetVectorImage);
// MITK_TEST(TestSetVectorImage);
// MITK_TEST(TestGetLayerImage);
CPPUNIT_TEST_SUITE_END();
private:
mitk::LabelSetImage::Pointer m_LabelSetImage;
public:
- void setUp()
+ void setUp() override
{
// Create a new labelset image
m_LabelSetImage = mitk::LabelSetImage::New();
mitk::Image::Pointer regularImage = mitk::Image::New();
unsigned int dimensions[3] = {256,256,312};
regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
m_LabelSetImage->Initialize(regularImage);
}
- void tearDown()
+ void tearDown() override
{
// Delete LabelSetImage
m_LabelSetImage = 0;
}
// Reduce contours with nth point
void TestInitialize()
{
// LabelSet image should always has the pixel type mitk::Label::PixelType
CPPUNIT_ASSERT_MESSAGE("LabelSetImage has wrong pixel type",
m_LabelSetImage->GetPixelType() == mitk::MakeScalarPixelType<mitk::Label::PixelType>());
mitk::Image::Pointer regularImage = mitk::Image::New();
unsigned int dimensions[3] = {256,256,312};
regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
mitk::BaseGeometry::Pointer regularImageGeo = regularImage->GetGeometry();
mitk::BaseGeometry::Pointer labelImageGeo = m_LabelSetImage->GetGeometry();
MITK_ASSERT_EQUAL(labelImageGeo, regularImageGeo, "LabelSetImage has wrong geometry");
// By default one layer containing the exterior label should be added
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - number of layers is not one",m_LabelSetImage->GetNumberOfLayers() == 1);
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - active layer has wrong ID",m_LabelSetImage->GetActiveLayer() == 0);
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - active label is not the exterior label",m_LabelSetImage->GetActiveLabel()->GetValue() == 0);
}
void TestAddLayer()
{
CPPUNIT_ASSERT_MESSAGE("Number of layers is not zero",m_LabelSetImage->GetNumberOfLayers() == 1);
m_LabelSetImage->AddLayer();
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - number of layers is not one",m_LabelSetImage->GetNumberOfLayers() == 2);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active layer has wrong ID", m_LabelSetImage->GetActiveLayer() == 1);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is not the exterior label",m_LabelSetImage->GetActiveLabel()->GetValue() == 0);
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - number of layers is not two",m_LabelSetImage->GetNumberOfLayers() == 3);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active layer has wrong ID",m_LabelSetImage->GetActiveLayer() == layerID);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",m_LabelSetImage->GetActiveLabel(layerID)->GetValue() == 200);
}
void TestGetActiveLabelSet()
{
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
mitk::LabelSet::Pointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
CPPUNIT_ASSERT_MESSAGE("Wrong layer ID was returned", layerID == 1);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *activeLayer, 0.00001, true));
}
void TestGetActiveLabel()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label2);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(1);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",m_LabelSetImage->GetActiveLabel()->GetValue() == value1);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(value2);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",m_LabelSetImage->GetActiveLabel()->GetValue() == value2);
}
void TestInitializeByLabeledImage()
{
mitk::Image::Pointer image = mitk::IOUtil::LoadImage(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6",m_LabelSetImage->GetNumberOfLabels() == 6);
}
void TestGetLabelSet()
{
// Test get non existing lset
mitk::LabelSet::ConstPointer lset = m_LabelSetImage->GetLabelSet(10000);
CPPUNIT_ASSERT_MESSAGE("Non existing labelset is not NULL", lset.IsNull());
lset = m_LabelSetImage->GetLabelSet(0);
CPPUNIT_ASSERT_MESSAGE("Existing labelset is NULL", lset.IsNotNull());
}
void TestGetLabel()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label2);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for active layer", mitk::Equal(*m_LabelSetImage->GetLabel(1), *label1, 0.0001, true));
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1", mitk::Equal(*m_LabelSetImage->GetLabel(200, 1), *label2, 0.0001, true));
// Try to get a non existing label
mitk::Label* label3 = m_LabelSetImage->GetLabel(1000);
CPPUNIT_ASSERT_MESSAGE("Non existing label should be NULL", label3 == NULL);
// Try to get a label from a non existing layer
label3 = m_LabelSetImage->GetLabel(200, 1000);
CPPUNIT_ASSERT_MESSAGE("Label from non existing layer should be NULL", label3 == NULL);
}
void TestSetExteriorLabel()
{
mitk::Label::Pointer exteriorLabel = mitk::Label::New();
exteriorLabel->SetName("MyExteriorSpecialLabel");
mitk::Label::PixelType value1 = 10000;
exteriorLabel->SetValue(value1);
m_LabelSetImage->SetExteriorLabel(exteriorLabel);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1", mitk::Equal(*m_LabelSetImage->GetExteriorLabel(), *exteriorLabel, 0.0001, true));
// Exterior label should be set automatically for each new layer
m_LabelSetImage->AddLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1", mitk::Equal(*m_LabelSetImage->GetLabel(10000, 1), *exteriorLabel, 0.0001, true));
}
void TestGetTotalNumberOfLabels()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label2);
CPPUNIT_ASSERT_MESSAGE("Wrong total number of labels", m_LabelSetImage->GetTotalNumberOfLabels() == 4); // added 2 labels + 2 exterior default labels
}
void TestExistsLabel()
{
mitk::Label::Pointer label = mitk::Label::New();
label->SetName("Label2");
mitk::Label::PixelType value = 200;
label->SetValue(value);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label);
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Existing label was not found", m_LabelSetImage->ExistLabel(value) == true);
CPPUNIT_ASSERT_MESSAGE("Non existing label was found", m_LabelSetImage->ExistLabel(10000) == false);
}
void TestExistsLabelSet()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layer
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(0) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(1) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(20) == false);
}
void TestSetActiveLayer()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layer
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
// Set initial layer as active layer
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*activeLayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set previously added layer as active layer
m_LabelSetImage->SetActiveLayer(layerID);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set a non existing layer as active layer - nothing should change
m_LabelSetImage->SetActiveLayer(10000);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
}
void TestRemoveLayer()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layers
m_LabelSetImage->AddLayer();
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed", m_LabelSetImage->GetNumberOfLayers() == 2);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(2) == false);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(1) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(0) == true);
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed", m_LabelSetImage->GetNumberOfLayers() == 1);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(1) == false);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(0) == true);
CPPUNIT_ASSERT_MESSAGE("Wrong active layer", mitk::Equal(*activeLayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed", m_LabelSetImage->GetNumberOfLayers() == 0);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed",m_LabelSetImage->ExistLabelSet(0) == false);
CPPUNIT_ASSERT_MESSAGE("Active layers is not NULL although all layer have been removed", m_LabelSetImage->GetActiveLabelSet() == 0);
}
void TestRemoveLabels()
{
mitk::Image::Pointer image = mitk::IOUtil::LoadImage(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6",m_LabelSetImage->GetNumberOfLabels() == 6);
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 1);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 7);
CPPUNIT_ASSERT_MESSAGE("Label with ID 3 does not exists after initialization",m_LabelSetImage->ExistLabel(3) == true);
CPPUNIT_ASSERT_MESSAGE("Label with ID 7 does not exists after initialization",m_LabelSetImage->ExistLabel(7) == true);
std::vector<mitk::Label::PixelType> labelsToBeRemoved;
labelsToBeRemoved.push_back(1);
labelsToBeRemoved.push_back(3);
labelsToBeRemoved.push_back(7);
m_LabelSetImage->RemoveLabels(labelsToBeRemoved);
CPPUNIT_ASSERT_MESSAGE("Wrong number of labels after some have been removed", m_LabelSetImage->GetNumberOfLabels() == 3);
// Values within the image are 0, 1, 3, 5, 6, 7 - New Min/Max value should be 5 / 6
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 5);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 6);
}
void TestMergeLabel()
{
mitk::Image::Pointer image = mitk::IOUtil::LoadImage(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage = 0;
m_LabelSetImage = mitk::LabelSetImage::New();
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6",m_LabelSetImage->GetNumberOfLabels() == 6);
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Wrong MIN value", m_LabelSetImage->GetStatistics()->GetScalarValueMin() == 0);
CPPUNIT_ASSERT_MESSAGE("Wrong MAX value", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 7);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(6);
// Merge label 7 with label 0. Result should be that label 7 is not present any more
m_LabelSetImage->MergeLabel(7);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 6);
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMax();
// Count all pixels with value 7 = 823
// Count all pixels with value 6 = 507
// Check if merge label has 507 + 823 = 1330 pixels
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetCountOfMaxValuedVoxels() == 1330);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLabelSetImage)
diff --git a/Modules/Multilabel/Testing/mitkLabelSetTest.cpp b/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
index d0ae50ba89..39db4827a2 100644
--- a/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
+++ b/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
@@ -1,181 +1,181 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkLabelSet.h>
#include <mitkLabelSetImage.h>
#include <mitkStringProperty.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkLabelSetTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLabelSetTestSuite);
MITK_TEST(TestSetLayer);
MITK_TEST(TestSetActiveLabel);
MITK_TEST(TestRemoveLabel);
MITK_TEST(TestAddLabel);
MITK_TEST(TestRenameLabel);
MITK_TEST(TestSetAllLabelsVisible);
MITK_TEST(TestSetAllLabelsLocked);
MITK_TEST(TestRemoveAllLabels);
CPPUNIT_TEST_SUITE_END();
private:
mitk::LabelSet::Pointer m_LabelSet;
mitk::LabelSet::PixelType m_InitialNumberOfLabels;
void AddLabels(mitk::LabelSet::PixelType numOfLabels)
{
for (mitk::Label::PixelType i = 0; i < numOfLabels; ++i)
{
mitk::Label::Pointer label = mitk::Label::New();
std::stringstream nameStream;
nameStream << "Label_";
nameStream << i;
label->SetName(nameStream.str());
label->SetValue(i);
label->SetVisible( (i%20 == 0) );
label->SetLayer( i%5);
mitk::Color color;
color.Set(0.3f, 0.25f, 1.0f);
label->SetColor(color);
m_LabelSet->AddLabel(label);
}
}
public:
- void setUp()
+ void setUp() override
{
m_InitialNumberOfLabels = 200;
m_LabelSet = mitk::LabelSet::New();
this->AddLabels(m_InitialNumberOfLabels);
m_LabelSet->SetLayer(0);
m_LabelSet->SetActiveLabel(0);
}
- void tearDown()
+ void tearDown() override
{
// Reset label set
m_LabelSet = 0;
}
void TestSetLayer()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial layer", m_LabelSet->GetLayer() == 0);
m_LabelSet->SetLayer(3);
CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetLayer() == 3);
}
void TestSetActiveLabel()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial active label", m_LabelSet->GetActiveLabel()->GetValue() == 0);
m_LabelSet->SetActiveLabel(145);
CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 145);
}
void TestRemoveLabel()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", static_cast<unsigned short>(m_LabelSet->GetNumberOfLabels()) == m_InitialNumberOfLabels);
// Remove a label that is not the active label
m_LabelSet->SetActiveLabel(12);
m_LabelSet->RemoveLabel(56);
unsigned int numLabels = m_InitialNumberOfLabels-1;
CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(56) == false);
CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
CPPUNIT_ASSERT_MESSAGE("Wrong active label", m_LabelSet->GetActiveLabel()->GetValue() == 12);
// Remove active label - now the succeeding label should be active
m_LabelSet->RemoveLabel(12);
CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 13);
CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(12) == false);
numLabels = m_InitialNumberOfLabels-2;
CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
}
void TestAddLabel()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == m_InitialNumberOfLabels);
mitk::Label::Pointer newLabel = mitk::Label::New();
newLabel->SetValue(199);
m_LabelSet->AddLabel(newLabel);
// Since label with value 199 already exists the new label will get the value 200
CPPUNIT_ASSERT_MESSAGE("Wrong label value", m_LabelSet->GetActiveLabel()->GetValue() == 200);
unsigned int numLabels = m_InitialNumberOfLabels+1;
CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
// Add new labels until the maximum number of labels is reached.
// Adding more labels should have no effect.
this->AddLabels(mitk::Label::MAX_LABEL_VALUE);
CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == 65536);
mitk::Label* activeLabel = m_LabelSet->GetActiveLabel();
CPPUNIT_ASSERT_MESSAGE("Wrong value of active label", activeLabel->GetValue() == mitk::Label::MAX_LABEL_VALUE);
}
void TestRenameLabel()
{
mitk::Color color;
color.Set(1.0f,1.0f,1.0f);
std::string name("MyAwesomeLabel");
m_LabelSet->RenameLabel(0, name, color);
mitk::Label* label = m_LabelSet->GetLabel(0);
CPPUNIT_ASSERT_MESSAGE("Wrong label name", label->GetName().compare("MyAwesomeLabel") == 0);
mitk::Color color2 = label->GetColor();
CPPUNIT_ASSERT_MESSAGE("Wrong color", (color2.GetBlue() == 1.0f && color2.GetGreen() == 1.0f && color2.GetRed() == 1.0f));
}
void TestSetAllLabelsVisible()
{
m_LabelSet->SetAllLabelsVisible(true);
for(mitk::LabelSet::PixelType i=0; i < m_LabelSet->GetNumberOfLabels(); ++i)
{
CPPUNIT_ASSERT_MESSAGE("Label not visible", m_LabelSet->GetLabel(i)->GetVisible() == true);
}
m_LabelSet->SetAllLabelsVisible(false);
for(mitk::LabelSet::PixelType i=0; i < m_LabelSet->GetNumberOfLabels(); ++i)
{
CPPUNIT_ASSERT_MESSAGE("Label visible", m_LabelSet->GetLabel(i)->GetVisible() == false);
}
}
void TestSetAllLabelsLocked()
{
m_LabelSet->SetAllLabelsLocked(true);
for(mitk::LabelSet::PixelType i=0; i < m_LabelSet->GetNumberOfLabels(); ++i)
{
CPPUNIT_ASSERT_MESSAGE("Label not locked", m_LabelSet->GetLabel(i)->GetLocked() == true);
}
m_LabelSet->SetAllLabelsLocked(false);
for(mitk::LabelSet::PixelType i=0; i < m_LabelSet->GetNumberOfLabels(); ++i)
{
CPPUNIT_ASSERT_MESSAGE("Label locked", m_LabelSet->GetLabel(i)->GetLocked() == false);
}
}
void TestRemoveAllLabels()
{
m_LabelSet->RemoveAllLabels();
CPPUNIT_ASSERT_MESSAGE("Not all labels were removed", m_LabelSet->GetNumberOfLabels() == 0);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLabelSet)
diff --git a/Modules/Multilabel/mitkLabel.h b/Modules/Multilabel/mitkLabel.h
index fc9ec05c63..07387216e6 100644
--- a/Modules/Multilabel/mitkLabel.h
+++ b/Modules/Multilabel/mitkLabel.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabel_H_
#define __mitkLabel_H_
#include "MitkMultilabelExports.h"
#include <mitkColorProperty.h>
#include <mitkVector.h>
#include <mitkPropertyList.h>
class TiXmlDocument;
class TiXmlElement;
namespace mitk
{
//##
//##Documentation
//## @brief A data structure describing a label.
//## @ingroup Data
//##
class MITKMULTILABEL_EXPORT Label : public PropertyList
{
public:
mitkClassMacro( Label, mitk::PropertyList );
itkNewMacro( Self );
typedef unsigned short PixelType;
/// The maximum value a label can get: Since the value is of type unsigned short MAX_LABEL_VALUE = 65535
static const PixelType MAX_LABEL_VALUE;
void SetLocked(bool locked);
bool GetLocked() const;
void SetVisible(bool visible);
bool GetVisible() const;
void SetOpacity(float opacity);
float GetOpacity() const;
void SetName(const std::string &name);
std::string GetName() const;
void SetCenterOfMassIndex(const mitk::Point3D& center);
mitk::Point3D GetCenterOfMassIndex() const;
void SetCenterOfMassCoordinates(const mitk::Point3D& center);
mitk::Point3D GetCenterOfMassCoordinates() const;
void SetColor(const mitk::Color&);
const mitk::Color& GetColor() const;
void SetValue(PixelType pixelValue);
PixelType GetValue() const;
void SetLayer(unsigned int layer);
unsigned int GetLayer() const;
void SetProperty(const std::string &propertyKey, BaseProperty *property);
using itk::Object::Modified;
void Modified(){Superclass::Modified();}
Label();
virtual ~Label();
protected:
- void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ void PrintSelf(std::ostream &os, itk::Indent indent) const override;
Label(const Label& other);
private:
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
/**
* @brief Equal A function comparing two labels for beeing equal in data
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - Lebel equality via Equal-PropetyList
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKMULTILABEL_EXPORT bool Equal( const mitk::Label& leftHandSide, const mitk::Label& rightHandSide, ScalarType eps, bool verbose );
} // namespace mitk
#endif // __mitkLabel_H_
diff --git a/Modules/Multilabel/mitkLabelSet.h b/Modules/Multilabel/mitkLabelSet.h
index dd7c9d3810..117116171f 100644
--- a/Modules/Multilabel/mitkLabelSet.h
+++ b/Modules/Multilabel/mitkLabelSet.h
@@ -1,237 +1,237 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSet_H_
#define __mitkLabelSet_H_
#include "MitkMultilabelExports.h"
#include <mitkMessage.h>
#include <mitkLookupTable.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <mitkLabel.h>
namespace mitk
{
//
//Documentation
// @brief LabelSet containing the labels corresponding to a segmentation session.
// @ingroup Data
//
class MITKMULTILABEL_EXPORT LabelSet : public itk::Object
{
public:
- mitkClassMacro( LabelSet, itk::Object );
+ mitkClassMacroItkParent( LabelSet, itk::Object );
itkNewMacro(Self);
typedef mitk::Label::PixelType PixelType;
typedef std::map <PixelType, Label::Pointer> LabelContainerType;
typedef LabelContainerType::const_iterator LabelContainerConstIteratorType;
typedef LabelContainerType::iterator LabelContainerIteratorType;
/**
* \brief AddLabelEvent is emitted whenever a new label has been added to the LabelSet.
*
* Observers should register to this event by calling myLabelSet->AddLabelEvent.AddListener(myObject, MyObject::MyMethod).
* After registering, myObject->MyMethod() will be called every time a new label has been added to the LabelSet.
* Observers should unregister by calling myLabelSet->AddLabelEvent.RemoveListener(myObject, MyObject::MyMethod).
*
* member variable is not needed to be locked in multi-threaded scenarios since the LabelSetEvent is a typedef for
* a Message1 object which is thread safe
*/
Message<> AddLabelEvent;
/**
* \brief RemoveLabelEvent is emitted whenever a new label has been removed from the LabelSet.
*
* Observers should register to this event by calling myLabelSet->RemoveLabelEvent.AddListener(myObject, MyObject::MyMethod).
* After registering, myObject->MyMethod() will be called every time a new label has been removed from the LabelSet.
* Observers should unregister by calling myLabelSet->RemoveLabelEvent.RemoveListener(myObject, MyObject::MyMethod).
*
* member variable is not needed to be locked in multi-threaded scenarios since the LabelSetEvent is a typedef for
* a Message object which is thread safe
*/
Message<> RemoveLabelEvent;
/**
* \brief ModifyLabelEvent is emitted whenever a label has been modified from the LabelSet.
*
* Observers should register to this event by calling myLabelSet->ModifyLabelEvent.AddListener(myObject, MyObject::MyMethod).
* After registering, myObject->MyMethod() will be called every time a new label has been removed from the LabelSet.
* Observers should unregister by calling myLabelSet->ModifyLabelEvent.RemoveListener(myObject, MyObject::MyMethod).
*
* member variable is not needed to be locked in multi-threaded scenarios since the LabelSetEvent is a typedef for
* a Message object which is thread safe
*/
Message<> ModifyLabelEvent;
/**
* \brief ActiveLabelEvent is emitted whenever a label has been set as active in the LabelSet.
*/
Message1<PixelType> ActiveLabelEvent;
/**
* \brief AllLabelsModifiedEvent is emitted whenever a new label has been removed from the LabelSet.
*
* Observers should register to this event by calling myLabelSet->AllLabelsModifiedEvent.AddListener(myObject, MyObject::MyMethod).
* After registering, myObject->MyMethod() will be called every time a new label has been removed from the LabelSet.
* Observers should unregister by calling myLabelSet->AllLabelsModifiedEvent.RemoveListener(myObject, MyObject::MyMethod).
*
* member variable is not needed to be locked in multi-threaded scenarios since the LabelSetEvent is a typedef for
* a Message object which is thread safe
*/
Message<> AllLabelsModifiedEvent;
/** \brief Returns a const iterator poiting to the begining of the container.
*/
LabelContainerConstIteratorType IteratorConstBegin() const;
/** \brief Returns a const iterator pointing to the end of the container.
*/
LabelContainerConstIteratorType IteratorConstEnd() const;
/** \brief Returns a iterator poiting to the begining of the container.
*/
LabelContainerIteratorType IteratorBegin();
/** \brief Returns a iterator pointing to the end of the container.
*/
LabelContainerIteratorType IteratorEnd();
/** \brief
* Recall itk::Object::Modified event from a label and send a ModifyLabelEvent
*/
void OnLabelModified();
/** \brief
*/
void SetLayer(unsigned int);
/** \brief
*/
void SetActiveLabel(PixelType);
/** \brief
*/
void RemoveLabel(PixelType);
/** \brief
*/
bool ExistLabel(PixelType);
/** \brief
*/
void AddLabel(mitk::Label * label);
/** \brief
*/
void AddLabel(const std::string& name, const Color& color);
/** \brief
*/
void RenameLabel(PixelType, const std::string&, const Color&);
/** \brief
*/
unsigned int GetNumberOfLabels() const;
/** \brief
*/
void SetAllLabelsVisible(bool);
/** \brief
*/
void SetAllLabelsLocked(bool);
/** \brief
*/
void RemoveAllLabels();
/** \brief
*/
Label* GetActiveLabel() { return GetLabel(m_ActiveLabelValue); }
/** \brief
*/
const Label* GetActiveLabel() const { return GetLabel(m_ActiveLabelValue); }
/** \brief
*/
Label* GetLabel(PixelType pixelValue);
/** \brief
*/
const Label* GetLabel(PixelType pixelValue) const;
itkGetMacro(Layer,int)
itkGetConstMacro(Layer,int)
itkGetModifiableObjectMacro(LookupTable,mitk::LookupTable)
/** \brief
*/
void SetLookupTable( LookupTable* lut );
/** \brief
*/
void UpdateLookupTable(PixelType pixelValue);
protected:
LabelSet();
LabelSet(const LabelSet &);
mitkCloneMacro(Self)
virtual ~LabelSet();
- void PrintSelf(std::ostream &os, itk::Indent indent) const;
+ void PrintSelf(std::ostream &os, itk::Indent indent) const override;
LabelContainerType m_LabelContainer;
LookupTable::Pointer m_LookupTable;
PixelType m_ActiveLabelValue;
unsigned int m_Layer;
};
/**
* @brief Equal A function comparing two label sets for beeing equal in data
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - LabelSetmembers
* - Label container (map)
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKMULTILABEL_EXPORT bool Equal( const mitk::LabelSet& leftHandSide, const mitk::LabelSet& rightHandSide, ScalarType eps, bool verbose );
} // namespace mitk
#endif // __mitkLabelSet_H_
diff --git a/Modules/Multilabel/mitkLabelSetImage.h b/Modules/Multilabel/mitkLabelSetImage.h
index 03e56cfb77..50173c4632 100644
--- a/Modules/Multilabel/mitkLabelSetImage.h
+++ b/Modules/Multilabel/mitkLabelSetImage.h
@@ -1,341 +1,341 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSetImage_H_
#define __mitkLabelSetImage_H_
#include "mitkImage.h"
#include "MitkMultilabelExports.h"
#include <mitkLabelSet.h>
#include <mitkSurface.h>
#include <itkImage.h>
#include <itkVectorImage.h>
#include <itkVectorImageToImageAdaptor.h>
namespace mitk
{
//##Documentation
//## @brief LabelSetImage class for handling labels and layers in a segmentation session.
//##
//## Handles operations for adding, removing, erasing and editing labels and layers.
//## @ingroup Data
class MITKMULTILABEL_EXPORT LabelSetImage : public Image
{
public:
mitkClassMacro(LabelSetImage, Image)
itkNewMacro(Self)
typedef mitk::Label::PixelType PixelType;
typedef itk::Image< PixelType, 3 > LabelSetImageType;
typedef itk::VariableLengthVector< PixelType > VariableVectorType;
typedef itk::VectorImage< PixelType, 3 > VectorImageType;
typedef itk::VectorImageToImageAdaptor< PixelType, 3 > ImageAdaptorType;
/**
* \brief BeforeChangeLayerEvent (e.g. used for GUI integration)
* As soon as active labelset should be changed, the signal emits.
* Emitted by SetActiveLayer(int layer);
*/
Message<> BeforeChangeLayerEvent;
/**
* \brief AfterchangeLayerEvent (e.g. used for GUI integration)
* As soon as active labelset was changed, the signal emits.
* Emitted by SetActiveLayer(int layer);
*/
Message<> AfterchangeLayerEvent;
/**
* @brief Initialize an empty mitk::LabelSetImage using the information
* of an mitk::Image
* @param image the image which is used for initializing the mitk::LabelSetImage
*/
using mitk::Image::Initialize;
- virtual void Initialize(const mitk::Image* image);
+ virtual void Initialize(const mitk::Image* image) override;
/**
* \brief */
void Concatenate(mitk::LabelSetImage* image);
/**
* \brief */
void ClearBuffer();
/**
* @brief Merges the mitk::Label with a given target value with the active label
* @param targetPixelValue the value of the mitk::Label that should be merged with the active one
* @param layer the layer in which the merge should be performed
*/
void MergeLabel(PixelType targetPixelValue, unsigned int layer = 0);
/**
* @brief Merges a list of mitk::Labels with the mitk::Label that has a specific value
* @param VectorOfLablePixelValues the list of labels that should be merge with the specified one
* @param index the value of the label into which the other should be merged
* @param layer the layer in which the merge should be performed
*/
void MergeLabels(std::vector<PixelType>& VectorOfLablePixelValues, PixelType index, unsigned int layer = 0);
/**
* \brief */
void UpdateCenterOfMass(PixelType pixelValue, unsigned int layer =0);
/**
* @brief Removes labels from the mitk::LabelSet of given layer.
* Calls mitk::LabelSetImage::EraseLabels() which also removes the labels from within the image.
* @param VectorOfLabelPixelValues a list of labels to be removed
* @param layer the layer in which the labels should be removed
*/
void RemoveLabels(std::vector<PixelType>& VectorOfLabelPixelValues, unsigned int layer = 0);
/**
* @brief Erases the label with the given value in the given layer from the underlying image.
* The label itself will not be erased from the respective mitk::LabelSet. In order to
* remove the label itself use mitk::LabelSetImage::RemoveLabels()
* @param pixelValue the label which will be remove from the image
* @param layer the layer in which the label should be removed
*/
void EraseLabel(PixelType pixelValue, unsigned int layer = 0);
/**
* @brief Similar to mitk::LabelSetImage::EraseLabel() this funtion erase a list of labels from the image
* @param VectorOfLabelPixelValues the list of labels that should be remove
* @param layer the layer for which the labels should be removed
*/
void EraseLabels(std::vector<PixelType>& VectorOfLabelPixelValues, unsigned int layer = 0);
/**
* \brief Returns true if the value exists in one of the labelsets*/
bool ExistLabel(PixelType pixelValue) const;
/**
* @brief Checks if a label exists in a certain layer
* @param pixelValue the label value
* @param layer the layer in which should be searched for the label
* @return true if the label exists otherwise false
*/
bool ExistLabel(PixelType pixelValue, unsigned int layer) const;
/**
* \brief Returns true if the labelset exists*/
bool ExistLabelSet(unsigned int layer) const;
/**
* @brief Returns the active label of a specific layer
* @param layer the layer ID for which the active label should be returned
* @return the active label of the specified layer
*/
mitk::Label* GetActiveLabel(unsigned int layer = 0);
/**
* @brief Returns the mitk::Label with the given pixelValue and for the given layer
* @param pixelValue the pixel value of the label
* @param layer the layer in which the labels should be located
* @return the mitk::Label if available otherwise NULL
*/
mitk::Label* GetLabel(PixelType pixelValue, unsigned int layer = 0) const;
/**
* @brief Returns the currently active mitk::LabelSet
* @return the mitk::LabelSet of the active layer or NULL if non is present
*/
mitk::LabelSet* GetActiveLabelSet();
/**
* @brief Gets the mitk::LabelSet for the given layer
* @param layer the layer for which the mitk::LabelSet should be retrieved
* @return the respective mitk::LabelSet or NULL if non exists for the given layer
*/
mitk::LabelSet * GetLabelSet(unsigned int layer = 0);
const mitk::LabelSet * GetLabelSet(unsigned int layer = 0) const;
/**
* @brief Gets the ID of the currently active layer
* @return the ID of the active layer
*/
unsigned int GetActiveLayer() const;
/**
* @brief Get the number of all existing mitk::Labels for a given layer
* @param layer the layer ID for which the active mitk::Labels should be retrieved
* @return the number of all existing mitk::Labels for the given layer
*/
unsigned int GetNumberOfLabels(unsigned int layer = 0) const;
/**
* @brief Returns the number of all labels summed up across all layers
* @return the overall number of labels across all layers
*/
unsigned int GetTotalNumberOfLabels() const;
/**
* \brief */
void SurfaceStamp(mitk::Surface* surface, bool forceOverwrite);
/**
* \brief */
mitk::Image::Pointer CreateLabelMask(PixelType index);
/**
* @brief Initialize a new mitk::LabelSetImage by an given image.
* For all distinct pixel values of the parameter image new labels will
* be created. If the number of distinct pixel values exceeds mitk::Label::MAX_LABEL_VALUE
* a new layer will be created
* @param image the image which is used for initialization
*/
void InitializeByLabeledImage(mitk::Image::Pointer image);
/**
* \brief */
void MaskStamp(mitk::Image* mask, bool forceOverwrite);
/**
* \brief */
void SetActiveLayer(unsigned int layer);
/**
* \brief */
unsigned int GetNumberOfLayers() const;
/**
* \brief */
VectorImageType::Pointer GetVectorImage(bool forceUpdate) const;
/**
* \brief */
void SetVectorImage(VectorImageType::Pointer image );
/**
* @brief Adds a new layer to the LabelSetImage. The new layer will be set as the active one
* @param layer a mitk::LabelSet which will be set as new layer.
* @return the layer ID of the new layer
*/
unsigned int AddLayer(mitk::LabelSet::Pointer layer =0);
/**
* @brief Removes the active layer and the respective mitk::LabelSet and image information.
* The new active layer is the one below, if exists
*/
void RemoveLayer();
/**
* \brief */
mitk::Image* GetLayerImage(unsigned int layer);
const mitk::Image* GetLayerImage(unsigned int layer) const;
void OnLabelSetModified();
/**
* @brief Sets the label which is used as default exterior label when creating a new layer
* @param label the label which will be used as new exterior label
*/
void SetExteriorLabel(mitk::Label * label);
/**
* @brief Gets the mitk::Label which is used as default exterior label
* @return the exterior mitk::Label
*/
mitk::Label* GetExteriorLabel();
const mitk::Label* GetExteriorLabel() const;
protected:
mitkCloneMacro(Self)
LabelSetImage();
LabelSetImage(const LabelSetImage & other);
virtual ~LabelSetImage();
template < typename ImageType1, typename ImageType2 >
void ChangeLayerProcessing( ImageType1* source, ImageType2* target );
template < typename ImageType >
void LayerContainerToImageProcessing( ImageType* source, unsigned int layer);
template < typename ImageType >
void ImageToLayerContainerProcessing( ImageType* source, unsigned int layer) const;
template < typename ImageType >
void CalculateCenterOfMassProcessing( ImageType* input, PixelType index, unsigned int layer);
template < typename ImageType >
void ClearBufferProcessing( ImageType* input);
template < typename ImageType >
void EraseLabelProcessing( ImageType* input, PixelType index, unsigned int layer);
// template < typename ImageType >
// void ReorderLabelProcessing( ImageType* input, int index, int layer);
template < typename ImageType >
void MergeLabelProcessing( ImageType* input, PixelType pixelValue, PixelType index);
template < typename ImageType >
void ConcatenateProcessing( ImageType* input, mitk::LabelSetImage* other);
template < typename ImageType >
void MaskStampProcessing( ImageType* input, mitk::Image* mask, bool forceOverwrite);
template < typename ImageType >
void CreateLabelMaskProcessing( ImageType* input, mitk::Image* mask, PixelType index);
template < typename ImageType1, typename ImageType2 >
void InitializeByLabeledImageProcessing( ImageType1* input, ImageType2* other);
std::vector< LabelSet::Pointer > m_LabelSetContainer;
std::vector< Image::Pointer > m_LayerContainer;
int m_ActiveLayer;
mitk::Label::Pointer m_ExteriorLabel;
};
/**
* @brief Equal A function comparing two label set images for beeing equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - LabelSetImage members
* - working image data
* - layer image data
* - labels in label set
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKMULTILABEL_EXPORT bool Equal( const mitk::LabelSetImage& leftHandSide, const mitk::LabelSetImage& rightHandSide, ScalarType eps, bool verbose );
} // namespace mitk
#endif // __mitkLabelSetImage_H_
diff --git a/Modules/Multilabel/mitkLabelSetImageIO.h b/Modules/Multilabel/mitkLabelSetImageIO.h
index 01351bc914..749486cf41 100644
--- a/Modules/Multilabel/mitkLabelSetImageIO.h
+++ b/Modules/Multilabel/mitkLabelSetImageIO.h
@@ -1,81 +1,81 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSetImageWriter_h
#define __mitkLabelSetImageWriter_h
#include "MitkMultilabelExports.h"
#include <mitkAbstractFileIO.h>
#include <mitkLabelSetImage.h>
namespace mitk
{
/**
* Writes a LabelSetImage to a file
* @ingroup Process
*/
// The export macro should be removed. Currently, the unit
// tests directly instantiate this class.
class MITKMULTILABEL_EXPORT LabelSetImageIO : public mitk::AbstractFileIO
{
public:
typedef LabelSetImage::PixelType PixelType;
typedef LabelSetImage::LabelSetImageType ImageType;
typedef LabelSetImage::VectorImageType VectorImageType;
typedef mitk::LabelSetImage InputType;
LabelSetImageIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
/**
* @brief Reads a number of mitk::LabelSetImages from the file system
* @return a vector of mitk::LabelSetImages
* @throws throws an mitk::Exception if an error ocurrs during parsing the nrrd header
*/
- virtual std::vector<BaseData::Pointer> Read();
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual std::vector<BaseData::Pointer> Read() override;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual void Write() override;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
// -------------- LabelSetImageIO specific functions -------------
static bool SaveLabelSetImagePreset(const std::string & presetFilename, mitk::LabelSetImage::Pointer & inputImage);
int GetIntByKey(const itk::MetaDataDictionary &dic, const std::string &str);
std::string GetStringByKey(const itk::MetaDataDictionary &dic, const std::string &str);
static Label::Pointer LoadLabelFromTiXmlDocument(TiXmlElement *labelElem);
static void LoadLabelSetImagePreset(const std::string &presetFilename, mitk::LabelSetImage::Pointer &inputImage);
private:
- LabelSetImageIO* IOClone() const;
+ LabelSetImageIO* IOClone() const override;
static TiXmlElement *GetLabelAsTiXmlElement(Label *label);
static TiXmlElement * PropertyToXmlElem( const std::string& key, const BaseProperty* property );
static bool PropertyFromXmlElem(std::string& key, mitk::BaseProperty::Pointer& prop, TiXmlElement* elem);
};
} // end of namespace mitk
#endif // __mitkLabelSetImageWriter_h
diff --git a/Modules/Multilabel/mitkLabelSetImageSerializer.h b/Modules/Multilabel/mitkLabelSetImageSerializer.h
index 649a7b07f4..cafe0fa3cf 100644
--- a/Modules/Multilabel/mitkLabelSetImageSerializer.h
+++ b/Modules/Multilabel/mitkLabelSetImageSerializer.h
@@ -1,40 +1,40 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkLabelSetImageSerializer_h_included
#define mitkLabelSetImageSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::LabelSetImage for mitk::SceneIO
*/
class LabelSetImageSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( LabelSetImageSerializer, BaseDataSerializer );
itkNewMacro(Self);
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
LabelSetImageSerializer();
virtual ~LabelSetImageSerializer();
};
} // namespace
#endif
diff --git a/Modules/Multilabel/mitkLabelSetImageSource.h b/Modules/Multilabel/mitkLabelSetImageSource.h
index 34e3fcbf4d..e0df5f00c7 100644
--- a/Modules/Multilabel/mitkLabelSetImageSource.h
+++ b/Modules/Multilabel/mitkLabelSetImageSource.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSetImageSource_H_
#define __mitkLabelSetImageSource_H_
#include "mitkImageSource.h"
#include "MitkMultilabelExports.h"
namespace mitk {
class LabelSetImage;
//##Documentation
//## @brief Superclass of all classes generating labelset images (instances
//## of class LabelSetImage) as output.
//##
//## @ingroup Process
class MITKMULTILABEL_EXPORT LabelSetImageSource : public ImageSource
{
public:
mitkClassMacro(LabelSetImageSource, ImageSource);
itkNewMacro(Self);
typedef LabelSetImage OutputType;
typedef itk::DataObject::Pointer DataObjectPointer;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
protected:
LabelSetImageSource();
virtual ~LabelSetImageSource();
};
} // namespace mitk
//#include "mitkLabelSetImageSource.cpp"
#endif // __mitkLabelSetImageSource_H_
diff --git a/Modules/Multilabel/mitkLabelSetImageToSurfaceFilter.h b/Modules/Multilabel/mitkLabelSetImageToSurfaceFilter.h
index f486818101..31f9c3c831 100644
--- a/Modules/Multilabel/mitkLabelSetImageToSurfaceFilter.h
+++ b/Modules/Multilabel/mitkLabelSetImageToSurfaceFilter.h
@@ -1,165 +1,165 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkLabelSetImageToSurfaceFilter_H_
#define _mitkLabelSetImageToSurfaceFilter_H_
#include <mitkSurfaceSource.h>
#include "MitkMultilabelExports.h"
#include "mitkLabelSetImage.h"
#include "mitkSurface.h"
#include <vtkMatrix4x4.h>
#include <itkImage.h>
#include <map>
namespace mitk
{
/**
* Generates surface meshes from a labelset image.
* If you want to calculate a surface representation for all available labels,
* you may call GenerateAllLabelsOn().
*/
class MITKMULTILABEL_EXPORT LabelSetImageToSurfaceFilter : public SurfaceSource
{
public:
mitkClassMacro( LabelSetImageToSurfaceFilter, SurfaceSource );
itkNewMacro( Self );
typedef LabelSetImage::PixelType LabelType;
typedef std::map<LabelType, unsigned long> LabelMapType;
typedef std::map<unsigned int, LabelType> IndexToLabelMapType;
/**
* Returns a const pointer to the labelset image set as input
*/
const mitk::Image* GetInput(void);
/**
* Set the labelset image to create a surface from.
*/
using ProcessObject::SetInput;
virtual void SetInput(const mitk::Image *image);
// virtual void SetObserver(mitk::ProcessObserver::Pointer observer);
/**
* Set whether you want to extract all labesl (true) or a single one.
*/
itkSetMacro( GenerateAllLabels, bool );
/**
* @returns if all labels or only a specific label should be
* extracted.
*/
itkGetMacro( GenerateAllLabels, bool );
itkBooleanMacro( GenerateAllLabels );
/**
* Set the label you want to extract. This method only has an effect,
* if GenerateAllLabels() is set to false
* @param _arg the label to extract, by default 1
*/
itkSetMacro( RequestedLabel, int );
/**
* Returns the label you want to extract. This method only has an effect,
* if GenerateAllLabels() is set to false
* @returns _arg the label to extract, by default 1
*/
itkGetMacro( RequestedLabel, int );
/**
* Sets the label value of the background. No surface will be generated for this label.
* @param _arg the label of the background, by default 0
*/
itkSetMacro( BackgroundLabel, int );
/**
* Gets the label value of the background. No surface will be generated for this label.
* @param _arg the label of the background, by default 0
*/
itkGetMacro( BackgroundLabel, int );
/**
* Sets whether to provide a smoothed surface
*/
itkSetMacro( UseSmoothing, int );
/**
* Sets the Sigma used in the gaussian smoothing
*/
itkSetMacro( Sigma, float );
protected:
LabelSetImageToSurfaceFilter();
virtual ~LabelSetImageToSurfaceFilter();
/**
* Transforms a point by a 4x4 matrix
*/
template <class T1, class T2, class T3>
inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
{
T3 x = matrix[0][0]*in[0]+matrix[0][1]*in[1]+matrix[0][2]*in[2]+matrix[0][3];
T3 y = matrix[1][0]*in[0]+matrix[1][1]*in[1]+matrix[1][2]*in[2]+matrix[1][3];
T3 z = matrix[2][0]*in[0]+matrix[2][1]*in[1]+matrix[2][2]*in[2]+matrix[2][3];
out[0] = x;
out[1] = y;
out[2] = z;
}
mitk::Image::Pointer m_ResultImage;
template < typename TPixel, unsigned int VImageDimension >
void InternalProcessing( const itk::Image<TPixel, VImageDimension>* input, mitk::Surface* surface );
bool m_GenerateAllLabels;
int m_RequestedLabel;
int m_BackgroundLabel;
int m_UseSmoothing;
float m_Sigma;
LabelMapType m_AvailableLabels;
IndexToLabelMapType m_IndexToLabels;
mitk::Vector3D m_InputImageSpacing;
- virtual void GenerateData();
+ virtual void GenerateData() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
// mitk::ProcessObserver::Pointer m_Observer;
};
} // end of namespace mitk
#endif //_mitkLabelSetImageToSurfaceFilter_H_
diff --git a/Modules/Multilabel/mitkLabelSetImageToSurfaceThreadedFilter.h b/Modules/Multilabel/mitkLabelSetImageToSurfaceThreadedFilter.h
index 4828693dd6..cafee37fbd 100644
--- a/Modules/Multilabel/mitkLabelSetImageToSurfaceThreadedFilter.h
+++ b/Modules/Multilabel/mitkLabelSetImageToSurfaceThreadedFilter.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSetImageToSurfaceThreadedFilter_H_
#define __mitkLabelSetImageToSurfaceThreadedFilter_H_
#include <MitkMultilabelExports.h>
#include "mitkSegmentationSink.h"
#include "mitkSurface.h"
namespace mitk
{
class MITKMULTILABEL_EXPORT LabelSetImageToSurfaceThreadedFilter : public SegmentationSink
{
public:
mitkClassMacro( LabelSetImageToSurfaceThreadedFilter, SegmentationSink )
mitkAlgorithmNewMacro( LabelSetImageToSurfaceThreadedFilter );
protected:
LabelSetImageToSurfaceThreadedFilter(); // use smart pointers
virtual ~LabelSetImageToSurfaceThreadedFilter();
- virtual void Initialize(const NonBlockingAlgorithm* other = NULL);
- virtual bool ReadyToRun();
+ virtual void Initialize(const NonBlockingAlgorithm* other = NULL) override;
+ virtual bool ReadyToRun() override;
- virtual bool ThreadedUpdateFunction(); // will be called from a thread after calling StartAlgorithm
+ virtual bool ThreadedUpdateFunction() override; // will be called from a thread after calling StartAlgorithm
- virtual void ThreadedUpdateSuccessful(); // will be called from a thread after calling StartAlgorithm
+ virtual void ThreadedUpdateSuccessful() override; // will be called from a thread after calling StartAlgorithm
private:
int m_RequestedLabel;
Surface::Pointer m_Result;
};
} // namespace
#endif // __mitkLabelSetImageToSurfaceThreadedFilter_H_
diff --git a/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h b/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
index 3ce725ab4e..78ef9f772c 100644
--- a/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
+++ b/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
@@ -1,244 +1,244 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkLabelSetImageVtkMapper2D_H_
#define __mitkLabelSetImageVtkMapper2D_H_
//MITK
#include "mitkCommon.h"
#include "MitkMultilabelExports.h"
//MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkLabelSetImage.h"
#include "mitkExtractSliceFilter.h"
//VTK
#include <vtkSmartPointer.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageReslice;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkLevelWindowFilter;
class vtkNeverTranslucentTexture;
namespace mitk {
/** \brief Mapper to resample and display 2D slices of a 3D labelset image.
*
* Properties that can be set for labelset images and influence this mapper are:
*
* - \b "labelset.contour.all": (BoolProperty) whether to show all labels as contours or not
* - \b "labelset.contour.active": (BoolProperty) whether to show only the active label as a contour or not
* - \b "labelset.contour.width": (FloatProperty) line width of the contour
* The default properties are:
* - \b "labelset.contour.all", mitk::BoolProperty::New( false ), renderer, overwrite )
* - \b "labelset.contour.active", mitk::BoolProperty::New( false ), renderer, overwrite )
* - \b "labelset.contour.width", mitk::FloatProperty::New( 2.0 ), renderer, overwrite )
* \ingroup Mapper
*/
class MITKMULTILABEL_EXPORT LabelSetImageVtkMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( LabelSetImageVtkMapper2D,VtkMapper );
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** \brief Get the Image to map */
const mitk::Image *GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
- virtual void Update(mitk::BaseRenderer * renderer);
+ virtual void Update(mitk::BaseRenderer * renderer) override;
//### methods of MITK-VTK rendering pipeline
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transveral, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKMULTILABEL_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkSmartPointer<vtkPropAssembly> m_Actors;
std::vector< vtkSmartPointer<vtkActor> > m_LayerActorVector;
std::vector< vtkSmartPointer<vtkPolyDataMapper> > m_LayerMapperVector;
std::vector< vtkSmartPointer<vtkImageData> > m_ReslicedImageVector;
std::vector< vtkSmartPointer<vtkNeverTranslucentTexture> > m_LayerTextureVector;
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
vtkSmartPointer<vtkPlaneSource> m_Plane;
std::vector< mitk::ExtractSliceFilter::Pointer > m_ReslicerVector;
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief An actor for the outline */
vtkSmartPointer<vtkActor> m_OutlineActor;
/** \brief An actor for the outline shadow*/
vtkSmartPointer<vtkActor> m_OutlineShadowActor;
/** \brief A mapper for the outline */
vtkSmartPointer<vtkPolyDataMapper> m_OutlineMapper;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastDataUpdateTime;
/** \brief Timestamp of last update of a property. */
itk::TimeStamp m_LastPropertyUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType* m_mmPerPixel;
int m_NumberOfLayers;
/** \brief This filter is used to apply the level window to Grayvalue and RBG(A) images. */
//vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
std::vector< vtkSmartPointer<vtkMitkLevelWindowFilter> > m_LevelWindowFilterVector;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief This method switches between different rendering modes (e.g. use a lookup table or a transfer function).
* Detailed documentation about the modes can be found here: \link mitk::RenderingerModeProperty \endlink
*/
void ApplyRenderingMode(mitk::BaseRenderer *renderer);
protected:
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer* renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
*
* \image html texturedPlane.png
*
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer* renderer, double planeBounds[6]);
/** \brief Generates a vtkPolyData object containing the outline of a given binary slice.
\param renderer: Pointer to the renderer containing the needed information
\note This code is based on code from the iil library.
*/
vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer* renderer, vtkImageData* image, int pixelValue = 1);
/** Default constructor */
LabelSetImageVtkMapper2D();
/** Default deconstructor */
virtual ~LabelSetImageVtkMapper2D();
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
- virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer* renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer* renderer, int layer);
/** \brief This method applies a color transfer function.
* Internally, a vtkColorTransferFunction is used. This is usefull for coloring continous
* images (e.g. float)
* \warning To use the color transfer function, the property 'Image Rendering.Transfer Function' must be set and a 'Image Rendering.Mode' which uses the color transfer function must be set.
*/
void ApplyColorTransferFunction(mitk::BaseRenderer* renderer);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses the level window must be set.
* @param renderer Level window for which renderer?
*/
void ApplyLevelWindow(mitk::BaseRenderer* renderer);
/** \brief Set the color of the image/polydata */
void ApplyColor( mitk::BaseRenderer* renderer, const mitk::Color& color );
/** \brief Set the opacity of the actor. */
void ApplyOpacity( mitk::BaseRenderer* renderer, int layer );
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given Geometry2D intersects the given
* SlicedGeometry3D. It calculates the distance of the Geometry2D to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
**/
bool RenderingGeometryIntersectsImage( const PlaneGeometry* renderingGeometry, SlicedGeometry3D* imageGeometry );
};
} // namespace mitk
#endif // __mitkLabelSetImageVtkMapper2D_H_
diff --git a/Modules/Multilabel/mitkMultilabelActivator.cpp b/Modules/Multilabel/mitkMultilabelActivator.cpp
index 9f28f4d2e3..8e4cddde48 100644
--- a/Modules/Multilabel/mitkMultilabelActivator.cpp
+++ b/Modules/Multilabel/mitkMultilabelActivator.cpp
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usGetModuleContext.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usModule.h>
#include "mitkLabelSetImageIO.h"
namespace mitk
{
/**
\brief Registers services for multilabel module.
*/
class MultilabelModuleActivator : public us::ModuleActivator
{
std::vector<AbstractFileIO*> m_FileIOs;
-
+
public:
- void Load(us::ModuleContext* /*context*/)
+ void Load(us::ModuleContext* /*context*/) override
{
m_FileIOs.push_back(new LabelSetImageIO());
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
for(std::vector<mitk::AbstractFileIO*>::iterator iter = m_FileIOs.begin(),
endIter = m_FileIOs.end(); iter != endIter; ++iter)
{
delete *iter;
}
}
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::MultilabelModuleActivator)
diff --git a/Modules/Multilabel/mitkMultilabelObjectFactory.h b/Modules/Multilabel/mitkMultilabelObjectFactory.h
index 2cb6f297d6..47aa1a0bce 100644
--- a/Modules/Multilabel/mitkMultilabelObjectFactory.h
+++ b/Modules/Multilabel/mitkMultilabelObjectFactory.h
@@ -1,55 +1,55 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MULTILABELOBJECTFACTORY_H_INCLUDED
#define MULTILABELOBJECTFACTORY_H_INCLUDED
#include "mitkCoreObjectFactoryBase.h"
#include <mitkAbstractFileIO.h>
namespace mitk {
class MultilabelObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(MultilabelObjectFactory, CoreObjectFactoryBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
- virtual void SetDefaultProperties(mitk::DataNode* node);
- virtual const char* GetFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
- virtual const char* GetSaveFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
+ virtual const char* GetFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
+ virtual const char* GetSaveFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
protected:
MultilabelObjectFactory();
~MultilabelObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
private:
itk::ObjectFactoryBase::Pointer m_LabelSetImageIOFactory;
itk::ObjectFactoryBase::Pointer m_LabelSetImageWriterFactory;
std::vector<mitk::AbstractFileIO*> m_FileIOs;
};
}
#endif
diff --git a/Modules/OpenCL/mitkOclBaseData.h b/Modules/OpenCL/mitkOclBaseData.h
index fadecfdee7..af492c716a 100644
--- a/Modules/OpenCL/mitkOclBaseData.h
+++ b/Modules/OpenCL/mitkOclBaseData.h
@@ -1,78 +1,78 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkOclBaseData_h
#define __mitkOclBaseData_h
#include "MitkOpenCLExports.h"
#include "mitkOclUtils.h"
#include "mitkOpenCL.h"
#include <mitkCommon.h>
#include <itkObjectFactory.h>
#include <itkObject.h>
namespace mitk
{
class MITKOPENCL_EXPORT OclBaseData : public itk::Object
{
public:
- mitkClassMacro(OclBaseData, itk::Object);
+ mitkClassMacroItkParent(OclBaseData, itk::Object);
/*! \brief Copies the RAM-stored data to GPU-MEM.
* This method has to be implemented for each data type.
*/
virtual int TransferDataToGPU(cl_command_queue) = 0;
/*! \brief Copies the in GPU-MEM stored data to RAM
* This method has to be implemented for each data type.
*/
virtual void* TransferDataToCPU(cl_command_queue) = 0;
/** \brief Set the modified flag for one of the GPU buffer */
void GPUModified();
/** \brief Set the modified flag for one of the CPU buffer */
void CPUModified();
/** \brief Get the pointer to the buffer on the device (GPU) */
virtual cl_mem GetGPUBuffer();
protected:
/** \brief Default constructor. */
OclBaseData();
/** \brief Default destructor. */
virtual ~OclBaseData();
private:
/** \brief Size of the data buffer. CPU size equals GPU size. */
size_t m_BufferSize;
/** \brief Pointer to the buffer on the device (GPU) */
cl_mem m_GPUBuffer;
/** \brief Pointer to the buffer on the host (CPU) */
void* m_CPUBuffer;
};
}
#endif // __mitkOclBaseData_h
diff --git a/Modules/OpenCL/mitkOclImageFormats.h b/Modules/OpenCL/mitkOclImageFormats.h
index 1f6d8287e1..166092d8fb 100644
--- a/Modules/OpenCL/mitkOclImageFormats.h
+++ b/Modules/OpenCL/mitkOclImageFormats.h
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkOclImageFormats_h
#define __mitkOclImageFormats_h
//mitk
#include <mitkCommon.h>
#include <mitkLogMacros.h>
//itk
#include <itkLightObject.h>
#include <itkObjectFactory.h>
//ocl
#include "mitkOclUtils.h"
#include <MitkOpenCLExports.h>
#define MAX_FORMATS 10
#define MAX_DATA_TYPES 12
namespace mitk
{
/**
@class oclImageFormats
@brief A class handling the (un)supported OpenCL Image formats.
This class checks whether a format is supported or not and acts accordingly.
*/
class MITKOPENCL_EXPORT OclImageFormats : public itk::LightObject
{
public:
- mitkClassMacro(OclImageFormats, itk::LightObject);
+ mitkClassMacroItkParent(OclImageFormats, itk::LightObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** @brief Checks if format supported.
@param format The image format to be checked for support.
@return True if the parameter is supported.
*/
bool IsFormatSupported(cl_image_format* format);
/** @brief Finds one supported image format similar to the given format.
In case the input format is supported, the output format will contain the same value.
@param inputformat The (unsupported) image format
@param outputformat A supported image format
@return True if a supported format was changed.
*/
bool GetNearestSupported(cl_image_format* inputformat, cl_image_format* outputformat);
/**
* @brief SetGPUContext Set the GPU context. Must be called before using this class!
* @param context GPU context in cl format.
*/
void SetGPUContext( cl_context context );
protected:
/** @brief Get and store all available infos
* @throw Throws an mitk::Exception if the GPU context was not defined.
*/
void CollectAvailableFormats();
/**
* @brief OclImageFormats Constructor
*/
OclImageFormats();
/** @brief Destructor (default) */
virtual ~OclImageFormats();
private:
/** @brief Store the given format into the table
* Todo: what table? Where? Why is it called sort?
@param formats A pointer to an array of image formats
Todo: What formats?
@param count Size of the formats array (i.e. how many formats are to be sorted).
@param val an intern value to distinguish between read/write/readwrite type
Todo: what is val?
@param dim Specifies the target image dimension (default IMAGE_2D).
*/
void SortFormats( cl_image_format* formats, cl_uint count, int val=1 , int dims = 2);
/** @brief Get the byte offset to the image support fields.
Todo: What means support field? What is this offset used for? In what unit is it returned?*/
unsigned int GetOffset( cl_image_format format );
/** @brief Print all supported formats (in a table) for both 2D and 3D IMAGE */
void PrintSelf();
/** An array to hold the information about IMAGE_2D supported formats. */
unsigned char* m_Image2DSupport;
/** An array to hold the information about IMAGE_3D supported formats. */
unsigned char* m_Image3DSupport;
/** the OpenCL context */
cl_context m_GpuContext;
};
}
#endif // __mitkOclImageFormats_h
diff --git a/Modules/OpenCVVideoSupport/Commands/mitkAbstractOpenCVImageFilter.h b/Modules/OpenCVVideoSupport/Commands/mitkAbstractOpenCVImageFilter.h
index 32c3357150..3eafe267f8 100644
--- a/Modules/OpenCVVideoSupport/Commands/mitkAbstractOpenCVImageFilter.h
+++ b/Modules/OpenCVVideoSupport/Commands/mitkAbstractOpenCVImageFilter.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCropOpenCVImageFilter_h
#define mitkCropOpenCVImageFilter_h
#include <MitkOpenCVVideoSupportExports.h>
#include <mitkCommon.h>
//itk headers
#include <itkMacro.h>
namespace cv {
class Mat;
}
namespace mitk {
/**
* \brief Interface for image filters on OpenCV images.
*
* Every concrete filter has to implement the pure virual
* mitk::AbstractOpenCVImageFilter::filterImage() method.
*
*/
class MITKOPENCVVIDEOSUPPORT_EXPORT AbstractOpenCVImageFilter : public itk::Object
{
public:
static int INVALID_IMAGE_ID;
- mitkClassMacro(AbstractOpenCVImageFilter, itk::Object);
+ mitkClassMacroItkParent(AbstractOpenCVImageFilter, itk::Object);
virtual bool FilterImage( cv::Mat& image, int id = INVALID_IMAGE_ID );
/**
* \brief Pure virtual method for filtering an image.
*
* \param image OpenCV image which is supposed to be manipulated.
* \return true if filtering was successfull, false otherwise
*/
virtual bool OnFilterImage( cv::Mat& image ) = 0;
protected:
AbstractOpenCVImageFilter();
int GetCurrentImageId();
int m_CurrentImageId;
};
} // namespace mitk
#endif // mitkCropOpenCVImageFilter_h
diff --git a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
index fd6ab2061a..df20103652 100644
--- a/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
+++ b/Modules/OpenCVVideoSupport/mitkImageToOpenCVImageFilter.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkImageToOpenCVImageFilter_h
#define mitkImageToOpenCVImageFilter_h
#include <mitkCommon.h>
#include <mitkImage.h>
#include <mitkWeakPointer.h>
#include <itkOpenCVImageBridge.h>
#include <MitkOpenCVVideoSupportExports.h>
#include "mitkImageSliceSelector.h"
namespace mitk
{
///
/// \brief A pseudo-Filter for creating OpenCV images from MITK images with the option of copying data or referencing it
///
class MITKOPENCVVIDEOSUPPORT_EXPORT ImageToOpenCVImageFilter : public itk::Object
{
public:
typedef itk::RGBPixel< unsigned char > UCRGBPixelType;
typedef itk::RGBPixel< unsigned short > USRGBPixelType;
typedef itk::RGBPixel< float > FloatRGBPixelType;
typedef itk::RGBPixel< double > DoubleRGBPixelType;
- mitkClassMacro(ImageToOpenCVImageFilter, itk::Object);
+ mitkClassMacroItkParent(ImageToOpenCVImageFilter, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
///
/// \brief set the input MITK image
///
void SetImage( mitk::Image* _Image );
///
/// \brief get the input MITK image
///
itkGetMacro(Image, mitk::Image*);
///
/// \brief get the input MITK image
///
bool CheckImage(mitk::Image* image);
///
/// RUNS the conversion and returns the produced OpenCVImage.
/// !!!ATTENTION!!! Do not forget to release this image again with cvReleaseImage().
/// \return the produced OpenCVImage or 0 if an error occured!
///
IplImage* GetOpenCVImage();
///
/// RUNS the conversion and returns the produced image as cv::Mat.
/// \return the produced OpenCVImage or an empty image if an error occured
///
cv::Mat GetOpenCVMat();
//##Documentation
//## @brief Convenient method to set a certain slice of a 3D or 4D mitk::Image as input to convert it to an openCV image
//##
//## This methods sets the input. Call GetOpenCVMat() or GetOpenCVImage() to get the image.
//##
//## @param mitkImage - the image that should be converted to an openCVImage
//## @param timeStep - the time step, which is converted to openCV
//## @param slice - the slice which is converted to openCV
void SetInputFromTimeSlice(Image::Pointer mitkImage, int timeStep, int slice);
protected:
///
/// the actual templated conversion method
///
template<typename TPixel, unsigned int VImageDimension>
void ItkImageProcessing( itk::Image<TPixel,VImageDimension>* image );
ImageToOpenCVImageFilter();
~ImageToOpenCVImageFilter();
///
/// Saves if the filter should copy the data or just reference it
///
mitk::WeakPointer<mitk::Image> m_Image;
IplImage* m_OpenCVImage;
private:
ImageSliceSelector::Pointer m_sliceSelector;
};
} // namespace
#endif // mitkImageToOpenCVImageFilter_h
diff --git a/Modules/OpenCVVideoSupport/mitkOpenCVImageSource.h b/Modules/OpenCVVideoSupport/mitkOpenCVImageSource.h
index 476f7f81ca..25ef0e9d91 100644
--- a/Modules/OpenCVVideoSupport/mitkOpenCVImageSource.h
+++ b/Modules/OpenCVVideoSupport/mitkOpenCVImageSource.h
@@ -1,42 +1,42 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKOPENCVIMAGESOURCE_H
#define MITKOPENCVIMAGESOURCE_H
#include <cv.h>
#include <mitkCommon.h>
namespace mitk
{
///
/// interface for a class providing opencv images
///
class OpenCVImageSource: virtual public itk::Object
{
public:
///
/// provide smart pointer defs
///
- mitkClassMacro( OpenCVImageSource, itk::Object );
+ mitkClassMacroItkParent( OpenCVImageSource, itk::Object );
///
/// \return a image as opencv 2 Mat
///
virtual cv::Mat GetImage() = 0;
};
}
#endif // MITKOPENCVIMAGESOURCE_H
diff --git a/Modules/OpenCVVideoSupport/mitkUndistortCameraImage.h b/Modules/OpenCVVideoSupport/mitkUndistortCameraImage.h
index 27d79e995a..67c80ac069 100644
--- a/Modules/OpenCVVideoSupport/mitkUndistortCameraImage.h
+++ b/Modules/OpenCVVideoSupport/mitkUndistortCameraImage.h
@@ -1,128 +1,128 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkUndistortCameraImage_h
#define __mitkUndistortCameraImage_h
#include "mitkCommon.h"
#include <MitkOpenCVVideoSupportExports.h>
#include "itkObject.h"
#include "mitkPoint.h"
#include "cv.h"
/*!
\brief UndistortCameraImage
This class is used to undistort camera images. Before any undistortion the class has to be initialized using the functions:
SetFocalLength(),SetPrinzipalPoint() and SetCameraDistortion().
After this you can either use UndistortPixel() to undistort a single pixel's coordinates or UndistortImage() to undistort an
OpenCV image.
A faster version of UndistortImage() is UndistortImageFast(), however, it has to be initialized once with SetUndistortImageFastInfo()
instead of the Set... methods before use.
\sa QmitkFunctionality
\ingroup Functionalities
*/
namespace mitk
{
class MITKOPENCVVIDEOSUPPORT_EXPORT UndistortCameraImage : public itk::Object
{
public:
- mitkClassMacro(UndistortCameraImage,itk::Object);
+ mitkClassMacroItkParent(UndistortCameraImage,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/// Initialization ///
/*
* Set the camera's intrinsic focal length
*/
void SetFocalLength(float fc_x, float fc_y)
{
m_fcX = fc_x; m_fcY = fc_y;
}
/*
* Set the camera's intrinsic principal point
*/
void SetPrincipalPoint(float cc_x, float cc_y)
{
m_ccX = cc_x; m_ccY = cc_y;
}
/*
* Set the camera's intrinsic distortion parameters
*/
void SetCameraDistortion(float kc1, float kc2, float kc3, float kc4)
{
m_distortionMatrixData[0] = kc1; m_distortionMatrixData[1] = kc2;
m_distortionMatrixData[2] = kc3; m_distortionMatrixData[3] = kc4;
}
/*
* Pre-Calculates matrices for the later use of UndistortImageFast()
*/
void InitRemapUndistortion(int sizeX, int sizeY);
/// USAGE ///
/*
* Undistort a single pixel, returns undistorted pixel
*/
mitk::Point2D UndistortPixel(const mitk::Point2D& src);
/*
* Complete undistortion of an OpenCV image, including all calculations
*/
void UndistortImage(IplImage* src, IplImage* dst);
/*
* Complete undistortion of an OpenCV image, using pre-calculated matrices from SetUndistortImageFastInfo()
* The use of only a source parameter will cause the source to be overwritten.
* NOTE: Using the Fast undistortion methods does not require a initialization via the Set... methods.
*/
void UndistortImageFast( IplImage * src, IplImage* dst = NULL );
void SetUndistortImageFastInfo(float in_dF1, float in_dF2,
float in_dPrincipalX, float in_dPrincipalY,
float in_Dist[4], float ImageSizeX, float ImageSizeY);
UndistortCameraImage();
virtual ~UndistortCameraImage();
protected:
// principal point and focal length parameters
float m_ccX, m_ccY, m_fcX, m_fcY;
// undistortion parameters
float m_distortionMatrixData[4];
// intrinsic camera parameters
float m_intrinsicMatrixData[9];
// precalculated matrices for fast image undistortion with UndistortImageFast()
CvMat * m_mapX, * m_mapY;
// intrinsic and undistortion camera matrices
CvMat m_intrinsicMatrix, m_distortionMatrix;
// temp image
IplImage * m_tempImage;
CvMat *m_DistortionCoeffs;
CvMat *m_CameraMatrix;
};
}
#endif
diff --git a/Modules/OpenIGTLink/mitkIGTLDevice.h b/Modules/OpenIGTLink/mitkIGTLDevice.h
index 6184f45b27..b98cbea86b 100644
--- a/Modules/OpenIGTLink/mitkIGTLDevice.h
+++ b/Modules/OpenIGTLink/mitkIGTLDevice.h
@@ -1,384 +1,384 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLDEVICE_H
#define MITKIGTLDEVICE_H
#include "mitkCommon.h"
//itk
#include "itkObject.h"
#include "itkFastMutexLock.h"
#include "itkMultiThreader.h"
//igtl
#include "igtlSocket.h"
#include "igtlMessageBase.h"
#include "igtlTransformMessage.h"
//mitkIGTL
#include "MitkOpenIGTLinkExports.h"
#include "mitkIGTLMessageFactory.h"
#include "mitkIGTLMessageQueue.h"
#include "mitkIGTLMessage.h"
namespace mitk {
/**
* \brief Interface for all OpenIGTLink Devices
*
* Defines the methods that are common for all devices using OpenIGTLink. It
* can open/close a connection, start/stop a communication and send/receive
* messages.
*
* It uses message queues to store the incoming and outgoing mails. They are
* configurable, you can set buffering on and off.
*
* The device is in one of three different states: Setup, Ready or Running.
* Setup is the initial state. From this state on you can call
* OpenConnection() and arrive in the Ready state. From the Ready state you
* call StartCommunication() to arrive in the Running state. Now the device
* is continuosly checking for new connections, receiving messages and
* sending messages. This runs in a seperate thread. To stop the communication
* call StopCommunication() (to arrive in Ready state) or CloseConnection()
* (to arrive in the Setup state).
*
* \ingroup OpenIGTLink
*
*/
class MITKOPENIGTLINK_EXPORT IGTLDevice : public itk::Object
{
public:
- mitkClassMacro(IGTLDevice, itk::Object)
+ mitkClassMacroItkParent(IGTLDevice, itk::Object)
/**
* \brief Type for state variable.
* The IGTLDevice is always in one of these states.
*
*/
enum IGTLDeviceState {Setup, Ready, Running};
/**
* \brief Opens a connection to the device
*
* This may only be called if there is currently no connection to the
* device. If OpenConnection() is successful, the object will change from
* Setup state to Ready state.
*/
virtual bool OpenConnection() = 0;
/**
* \brief Closes the connection to the device
*
* This may only be called if there is currently a connection to the
* device, but device is not running (e.g. object is in Ready state)
*/
virtual bool CloseConnection();
/**
* \brief Stops the communication between the two devices
*
* This may only be called if the device is in Running state.
*/
virtual bool StopCommunication();
/**
* \brief Starts the communication between the two devices
*
* This may only be called if the device is in Ready state.
*/
bool StartCommunication();
/**
* \brief Continuously checks for new connections, receives messages and
* sends messages.
*
* This may only be called if the device is in Running state and only from
* a seperate thread.
*/
void RunCommunication();
/**
* \brief Adds the given message to the sending queue
*
* This may only be called after the connection to the device has been
* established with a call to OpenConnection(). Note that the message
* is not send directly. This method just adds it to the send queue.
* \param msg The message to be added to the sending queue
*/
void SendMessage(igtl::MessageBase::Pointer msg);
/**
* \brief Adds the given message to the sending queue
*
* Convenience function to work with mitk::IGTLMessage directly.
* \param msg The message to be added to the sending queue
*/
void SendMessage(const IGTLMessage* msg);
/**
* \brief Returns current object state (Setup, Ready or Running)
*/
IGTLDeviceState GetState() const;
/**
* \brief Returns the oldest message in the command queue
* \return The oldest message from the command queue.
*/
igtl::MessageBase::Pointer GetNextCommand();
/**
* \brief Returns the oldest message in the receive queue
* \return The oldest message from the receive queue
*/
igtl::MessageBase::Pointer GetNextMessage();
/**
* \brief Sets the port number of the device
*/
itkSetMacro(PortNumber,int);
/**
* \brief Returns the port number of the device
*/
itkGetMacro(PortNumber,int);
/**
* \brief Sets the ip/hostname of the device
*/
itkSetMacro(Hostname,std::string);
/**
* \brief Returns the ip/hostname of the device
*/
itkGetMacro(Hostname,std::string);
/**
* \brief Returns the name of this device
*/
itkGetConstMacro(Name, std::string);
/**
* \brief Sets the name of this device
*/
itkSetMacro(Name, std::string);
/**
* \brief Returns a const reference to the receive queue
*/
itkGetConstMacro(ReceiveQueue, mitk::IGTLMessageQueue::Pointer);
/**
* \brief Returns a const reference to the command queue
*/
itkGetConstMacro(CommandQueue, mitk::IGTLMessageQueue::Pointer);
/**
* \brief Returns a const reference to the send queue
*/
itkGetConstMacro(SendQueue, mitk::IGTLMessageQueue::Pointer);
/**
* \brief Returns the message factory
*/
itkGetMacro(MessageFactory, mitk::IGTLMessageFactory::Pointer);
/**
* \brief static start method for the tracking thread.
* \param data a void pointer to the IGTLDevice object.
*/
static ITK_THREAD_RETURN_TYPE ThreadStartCommunication(void* data);
/**
* \brief TestConnection() tries to connect to a IGTL device on the current
* ip and port
*
* \todo Implement this method. Send a status message and check the answer.
*
* TestConnection() tries to connect to a IGTL server on the current
* ip and port and returns which device it has found.
* \return It returns the type of the device that answers. Throws an
* exception
* if no device is available on that ip/port.
* @throw mitk::Exception Throws an exception if there are errors
* while connecting to the device.
*/
virtual bool TestConnection();
/**
* \brief Send RTS message of given type
*/
bool SendRTSMessage(const char* type);
/**
* \brief Sets the buffering mode of the given queue
*/
void EnableInfiniteBufferingMode(mitk::IGTLMessageQueue::Pointer queue,
bool enable = true);
/**
* \brief Returns the number of connections of this device
*/
virtual unsigned int GetNumberOfConnections() = 0;
protected:
/**
* \brief Sends a message.
*
* This may only be called after the connection to the device has been
* established with a call to OpenConnection(). This method uses the given
* socket to send the given MessageReceivedEvent
*
* \param msg the message to be sent
* \param socket the socket used to communicate with the other device
*
* \retval IGTL_STATUS_OK the message was sent
* \retval IGTL_STATUS_UNKONWN_ERROR the message was not sent because an
* unknown error occurred
*/
unsigned int SendMessagePrivate(igtl::MessageBase::Pointer msg,
igtl::Socket::Pointer socket);
/**
* \brief Call this method to receive a message.
*
* The message will be saved in the receive queue.
*/
virtual void Receive() = 0;
/**
* \brief Call this method to receive a message from the given device.
*
* The message will be saved in the receive queue.
*
* \param device the socket that connects this device with the other one.
*
* \retval IGTL_STATUS_OK a message or a command was received
* \retval IGTL_STATUS_NOT_PRESENT the socket is not connected anymore
* \retval IGTL_STATUS_TIME_OUT the socket timed out
* \retval IGTL_STATUS_CHECKSUM_ERROR the checksum of the received msg was
* incorrect
* \retval IGTL_STATUS_UNKNOWN_ERROR an unknown error occurred
*/
unsigned int ReceivePrivate(igtl::Socket* device);
/**
* \brief Call this method to send a message. The message will be read from
* the queue.
*/
virtual void Send() = 0;
/**
* \brief Call this method to check for other devices that want to connect
* to this one.
*
* In case of a client this method is doing nothing. In case of a server it
* is checking for other devices and if there is one it establishes a
* connection.
*/
virtual void Connect();
/**
* \brief Stops the communication with the given socket
*
*/
virtual void StopCommunicationWithSocket(igtl::Socket* socket) = 0;
/**
* \brief change object state
*/
void SetState(IGTLDeviceState state);
IGTLDevice();
virtual ~IGTLDevice();
/** current object state (Setup, Ready or Running) */
IGTLDeviceState m_State;
/** the name of this device */
std::string m_Name;
/** signal used to stop the thread*/
bool m_StopCommunication;
/** mutex to control access to m_StopCommunication */
itk::FastMutexLock::Pointer m_StopCommunicationMutex;
/** mutex used to make sure that the thread is just started once */
itk::FastMutexLock::Pointer m_CommunicationFinishedMutex;
/** mutex to control access to m_State */
itk::FastMutexLock::Pointer m_StateMutex;
/** the hostname or ip of the device */
std::string m_Hostname;
/** the port number of the device */
int m_PortNumber;
/** the socket used to communicate with other IGTL devices */
igtl::Socket::Pointer m_Socket;
/** The message receive queue */
mitk::IGTLMessageQueue::Pointer m_ReceiveQueue;
/** The message send queue */
mitk::IGTLMessageQueue::Pointer m_SendQueue;
/** A queue that stores just command messages received by this device */
mitk::IGTLMessageQueue::Pointer m_CommandQueue;
/** A message factory that provides the New() method for all msg types */
mitk::IGTLMessageFactory::Pointer m_MessageFactory;
private:
/** creates worker thread that continuously polls interface for new
messages */
itk::MultiThreader::Pointer m_MultiThreader;
/** ID of polling thread */
int m_ThreadID;
};
/**
* \brief connect to this Event to get noticed when a message was received
*
* \note Check if you can invoke this events like this or if you have to make
* it thread-safe. They are not invoked in the main thread!!!
* */
itkEventMacro( MessageReceivedEvent , itk::AnyEvent );
/**
* \brief connect to this Event to get noticed when a command was received
*
* \note Check if you can invoke this events like this or if you have to make
* it thread-safe. They are not invoked in the main thread!!!
* */
itkEventMacro( CommandReceivedEvent , itk::AnyEvent );
/**
* \brief connect to this Event to get noticed when another igtl device
* connects with this device.
*
* \note Check if you can invoke this events like this or if you have to make
* it thread-safe. They are not invoked in the main thread!!!
* */
itkEventMacro( NewClientConnectionEvent , itk::AnyEvent );
/**
* \brief connect to this Event to get noticed when this device looses the
* connection to a socket.
*
* \note Check if you can invoke this events like this or if you have to make
* it thread-safe. They are not invoked in the main thread!!!
* */
itkEventMacro( LostConnectionEvent , itk::AnyEvent );
} // namespace mitk
#endif /* MITKIGTLDEVICE_H */
diff --git a/Modules/OpenIGTLink/mitkIGTLMessage.h b/Modules/OpenIGTLink/mitkIGTLMessage.h
index 8ff385eb36..bcadd3bc99 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessage.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessage.h
@@ -1,197 +1,197 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLMESSAGEH_HEADER_INCLUDED_
#define MITKIGTLMESSAGEH_HEADER_INCLUDED_
#include <itkDataObject.h>
#include "MitkOpenIGTLinkExports.h"
#include <mitkNumericTypes.h>
#include <mitkCommon.h>
#include "igtlMessageBase.h"
namespace mitk {
/**Documentation
* \brief A wrapper for the OpenIGTLink message type
*
* This class represents the data object that is passed through the
* MITK-OpenIGTLink filter pipeline. It wraps the OpenIGTLink message type.
* Additionally, it contains a data structure that contains error/plausibility
* information.
*
*/
class MITKOPENIGTLINK_EXPORT IGTLMessage : public itk::DataObject
{
public:
- mitkClassMacro(IGTLMessage, itk::DataObject);
+ mitkClassMacroItkParent(IGTLMessage, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkNewMacro2Param(Self, igtl::MessageBase::Pointer,std::string);
/**
* \brief type that holds the time at which the data was recorded
*/
typedef double TimeStampType;
/**
* \brief Sets the OpenIGTLink message
*/
void SetMessage(igtl::MessageBase::Pointer msg);
/**
* \brief returns the OpenIGTLink message
*/
itkGetConstMacro(Message, igtl::MessageBase::Pointer);
/**
* \brief returns true if the object contains valid data
*/
virtual bool IsDataValid() const;
/**
* \brief sets the dataValid flag of the IGTLMessage object indicating if
* the object contains valid data
*/
itkSetMacro(DataValid, bool);
/**
* \brief gets the IGT timestamp of the IGTLMessage object
*/
itkGetConstMacro(IGTTimeStamp, TimeStampType);
/**
* \brief set the name of the IGTLMessage object
*/
itkSetStringMacro(Name);
/**
* \brief returns the name of the IGTLMessage object
*/
itkGetStringMacro(Name);
/**
* \brief Graft the data and information from one IGTLMessage to another.
*
* Copies the content of data into this object.
* This is a convenience method to setup a second IGTLMessage object with
* all the meta information of another IGTLMessage object.
* Note that this method is different than just using two
* SmartPointers to the same IGTLMessage object since separate DataObjects
* are still maintained.
*/
virtual void Graft(const DataObject *data);
/**
* \brief copy meta data of a IGTLMessage object
*
* copies all meta data from IGTLMessage data to this object
*/
virtual void CopyInformation(const DataObject* data);
/**
* \brief Prints the object information to the given stream os.
* \param os The stream which is used to print the output.
* \param indent Defines the indentation of the output.
*/
void PrintSelf(std::ostream& os, itk::Indent indent) const;
/** Compose with another IGTLMessage
*
* This method composes self with another IGTLMessage of the
* same dimension, 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. */
void Compose(const mitk::IGTLMessage::Pointer n, const bool pre = false);
/** Returns the OpenIGTL Message type
**/
const char* GetIGTLMessageType() const;
template < typename IGTLMessageType > IGTLMessageType* GetMessage() const;
protected:
mitkCloneMacro(Self);
IGTLMessage();
/**
* Copy constructor internally used.
*/
IGTLMessage(const mitk::IGTLMessage& toCopy);
/**
* Creates a IGTLMessage object from an igtl::MessageBase and a given name.
*/
IGTLMessage(igtl::MessageBase::Pointer message, std::string name = "");
virtual ~IGTLMessage();
/**
* \brief holds the actual OpenIGTLink message
*/
igtl::MessageBase::Pointer m_Message;
/**
* \brief defines if the object contains valid values
*/
bool m_DataValid;
/**
* \brief contains the time at which the tracking data was recorded
*/
TimeStampType m_IGTTimeStamp;
/**
* \brief name of the navigation data
*/
std::string m_Name;
private:
// pre = false
static mitk::IGTLMessage::Pointer getComposition(
const mitk::IGTLMessage::Pointer nd1,
const mitk::IGTLMessage::Pointer nd2);
/**
* \brief sets the IGT timestamp of the IGTLMessage object
*/
itkSetMacro(IGTTimeStamp, TimeStampType);
};
/**
* @brief Equal A function comparing two OpenIGTLink message objects for
* being equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - TBD
*
* @param rightHandSide An IGTLMessage to be compared
* @param leftHandSide An IGTLMessage to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output
* or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKOPENIGTLINK_EXPORT bool Equal( const mitk::IGTLMessage& leftHandSide,
const mitk::IGTLMessage& rightHandSide,
ScalarType eps = mitk::eps,
bool verbose = false );
} // namespace mitk
#endif /* MITKIGTLMESSAGEH_HEADER_INCLUDED_ */
diff --git a/Modules/OpenIGTLink/mitkIGTLMessageCloneHandler.h b/Modules/OpenIGTLink/mitkIGTLMessageCloneHandler.h
index c27cde179a..547ca49db6 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessageCloneHandler.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessageCloneHandler.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLMESSAGECLONE_H_
#define MITKIGTLMESSAGECLONE_H_
#include "itkObject.h"
#include "mitkCommon.h"
#include "igtlObject.h"
#include "igtlMacro.h"
#include "igtlSocket.h"
#include "igtlMessageBase.h"
#include "MitkOpenIGTLinkExports.h"
namespace mitk
{
/**Documentation
* \brief Base class for clone handlers for igtl::MessageBase derived message
* types
*
* To enable new message types a clone function must be defined and added to the
* message factory.
*
*/
class MITKOPENIGTLINK_EXPORT IGTLMessageCloneHandler: public itk::Object
{
public:
- mitkClassMacro(IGTLMessageCloneHandler, itk::Object);
+ mitkClassMacroItkParent(IGTLMessageCloneHandler, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
public:
virtual igtl::MessageBase::Pointer Clone(igtl::MessageBase*) { return 0; }
protected:
IGTLMessageCloneHandler() {}
~IGTLMessageCloneHandler() {}
};
/**
* Description:
* The mitkIGTMessageCloneClassMacro() macro is to help developers to
* define message clone handler classes. It generates a chlid class of
* mitk::IGTLMessageCloneHandler.
* The developer only needs to implement Clone() after calling this macro.
* The following code shows how to define a handler that processes IMAGE message:
*
* mitkIGTMessageCloneClassMacro(igtl::ImageMessage, TestImageMessageHandler);
* igtl::MessageBase::Pointer
* TestImageMessageHandler::Clone(igtl::MessageBase * message)
* {
* // do something
* }
**/
#define mitkIGTMessageCloneClassMacro(messagetype, classname) \
class classname : public ::mitk::IGTLMessageCloneHandler \
{ \
public: \
mitkClassMacro(classname, mitk::IGTLMessageCloneHandler); \
itkFactorylessNewMacro(Self); \
itkCloneMacro(Self); \
public: \
virtual igtl::MessageBase::Pointer Clone(igtl::MessageBase*); \
protected: \
classname(){} \
~classname() {} \
};
} // namespace mitk
#endif // MITKIGTLMESSAGECLONE_H_
diff --git a/Modules/OpenIGTLink/mitkIGTLMessageCommon.h b/Modules/OpenIGTLink/mitkIGTLMessageCommon.h
index 99da21714a..cef48d304a 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessageCommon.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessageCommon.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLMESSAGECOMMONH_HEADER_INCLUDED_
#define MITKIGTLMESSAGECOMMONH_HEADER_INCLUDED_
#include <itkDataObject.h>
#include "MitkOpenIGTLinkExports.h"
#include <mitkNumericTypes.h>
#include <mitkCommon.h>
#include "igtlMessageBase.h"
#include "igtlTransformMessage.h"
namespace mitk {
/**Documentation
* \brief Helper class for copying OpenIGTLink messages.
*
* This class is a helper class for copying OpenIGTLink messages.
*
*/
class MITKOPENIGTLINK_EXPORT IGTLMessageCommon : public itk::DataObject
{
public:
- mitkClassMacro(IGTLMessageCommon, itk::DataObject);
+ mitkClassMacroItkParent(IGTLMessageCommon, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* \brief Clones the input message and returns a igtl::MessageBase::Pointer
* to the clone
*/
// static igtl::MessageBase::Pointer Clone(igtl::TransformMessage::Pointer original);
/**
* \brief Clones the input message and returns a igtl::MessageBase::Pointer
* to the clone
*/
// static igtl::MessageBase::Pointer Clone(igtl::MessageBase::Pointer original);
protected:
IGTLMessageCommon();
/**
* Copy constructor internally used.
*/
// IGTLMessageCommon(const mitk::IGTLMessageCommon& toCopy);
virtual ~IGTLMessageCommon();
private:
};
} // namespace mitk
#endif /* MITKIGTLMESSAGECOMMONH_HEADER_INCLUDED_ */
diff --git a/Modules/OpenIGTLink/mitkIGTLMessageFactory.h b/Modules/OpenIGTLink/mitkIGTLMessageFactory.h
index dc8f1807f8..9cf1a81ee3 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessageFactory.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessageFactory.h
@@ -1,152 +1,152 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLMESSAGEFACTORYH_HEADER_INCLUDED_
#define MITKIGTLMESSAGEFACTORYH_HEADER_INCLUDED_
#include "MitkOpenIGTLinkExports.h"
#include "mitkCommon.h"
#include "igtlMessageBase.h"
#include "igtlMessageHeader.h"
#include "mitkIGTLMessageCloneHandler.h"
namespace mitk {
/**
* \brief Factory class of supported OpenIGTLink message types
*
* This class is a factory for the creation of OpenIGTLink messages. It stores
* pairs of type and pointer to the message new method. Available standard types
* are already added but you can also add your custom types at runtime.
*
*/
class MITKOPENIGTLINK_EXPORT IGTLMessageFactory : public itk::Object
{
public:
- mitkClassMacro(IGTLMessageFactory, itk::Object)
+ mitkClassMacroItkParent(IGTLMessageFactory, itk::Object)
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* \brief Function pointer for storing New() static methods of
* igtl::MessageBase classes
*/
typedef igtl::MessageBase::Pointer (*PointerToMessageBaseNew)();
/**
* \brief Add message type name and pointer to IGTL message new function and
* the clone handler
* \param messageTypeName The name of the message type
* \param messageTypeNewPointer Function pointer to the message type new
* function (e.g. (PointerToMessageBaseNew)&igtl::ImageMessage::New )
* \param cloneHandler pointer to the message clone object
*/
void AddMessageType(std::string messageTypeName,
IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer,
mitk::IGTLMessageCloneHandler::Pointer cloneHandler);
/**
* \brief Add message type name and pointer to IGTL message new function
* Usage:
* AddMessageType("IMAGE", (PointerToMessageBaseNew)&igtl::ImageMessage::New);
* \param messageTypeName The name of the message type
* \param messageTypeNewPointer Function pointer to the message type new
* function (e.g. (PointerToMessageBaseNew)&igtl::ImageMessage::New )
*/
virtual void AddMessageNewMethod(std::string messageTypeName,
IGTLMessageFactory::PointerToMessageBaseNew messageTypeNewPointer);
/**
* \brief Get pointer to message type new function, or NULL if the message
* type not registered
* Usage:
* igtl::MessageBase::Pointer message = GetMessageTypeNewPointer("IMAGE")();
*/
virtual IGTLMessageFactory::PointerToMessageBaseNew GetMessageTypeNewPointer(
std::string messageTypeName);
/**
* \brief Creates a new message instance fitting to the given type.
*
* If this type is not registered it returns NULL
* Usage:
* igtl::MessageBase::Pointer message = CreateInstance("IMAGE");
*/
igtl::MessageBase::Pointer CreateInstance(std::string messageTypeName);
/**
* \brief Creates a new message according to the given header
* \param msg The message header that defines the type of the message
* This method checks the data type and creates a new message according to the
* type.
*/
igtl::MessageBase::Pointer CreateInstance(igtl::MessageHeader::Pointer msg);
/**
* \brief Adds a clone function for the specified message type
* \param msgTypeName The name of the message type
* \param msgCloneHandler Function pointer to the message clone function
* (e.g. TBD )
*/
virtual void AddMessageCloneHandler(std::string msgTypeName,
mitk::IGTLMessageCloneHandler::Pointer msgCloneHandler);
/**
* \brief Get pointer to message type clone function, or NULL if the message
* type is not registered
* Usage:
* igtl::TransformMessage::Pointer original = igtl::TransformMessage::New();
* igtl::MessageBase::Pointer message =
* GetCloneHandler("IMAGE")->Clone(original);
*/
virtual mitk::IGTLMessageCloneHandler::Pointer
GetCloneHandler(std::string messageTypeName);
/**
* \brief Clones the given message according to the available clone methods
* \param msg The message that has to be cloned
* This method checks the data type and clones the message according to this
* type.
*/
igtl::MessageBase::Pointer Clone(igtl::MessageBase::Pointer msg);
/**
* \brief Returns available get messages
*/
std::list<std::string> GetAvailableMessageRequestTypes();
protected:
IGTLMessageFactory();
virtual ~IGTLMessageFactory();
/**
* \brief Map igt message types and the Clone() methods
*/
std::map<std::string,mitk::IGTLMessageCloneHandler::Pointer> m_CloneHandlers;
/**
* \brief Map igt message types and the New() static methods of igtl::MessageBase
* classes
*/
std::map<std::string, PointerToMessageBaseNew> m_NewMethods;
private:
IGTLMessageFactory(const IGTLMessageFactory&);
};
}
#endif
diff --git a/Modules/OpenIGTLink/mitkIGTLMessageQueue.h b/Modules/OpenIGTLink/mitkIGTLMessageQueue.h
index 8caccc6c5f..023f84fe32 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessageQueue.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessageQueue.h
@@ -1,118 +1,118 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IGTLMessageQueue_H
#define IGTLMessageQueue_H
#include "MitkOpenIGTLinkExports.h"
#include "itkObject.h"
#include "itkFastMutexLock.h"
#include "mitkCommon.h"
#include <deque>
#include "igtlMessageBase.h"
namespace mitk {
/**
* \class IGTLMessageQueue
* \brief Thread safe message queue to store OpenIGTLink messages.
*
* \ingroup OpenIGTLink
*/
class MITKOPENIGTLINK_EXPORT IGTLMessageQueue : public itk::Object
{
public:
- mitkClassMacro(mitk::IGTLMessageQueue, itk::Object)
+ mitkClassMacroItkParent(mitk::IGTLMessageQueue, itk::Object)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Different buffering types
* Infinit buffering means that you can push as many messages as you want
* NoBuffering means that the queue just stores a single message
*/
enum BufferingType {Infinit, NoBuffering};
/**
* \brief Adds the message to the queue
*/
void PushMessage( igtl::MessageBase::Pointer message );
/**
* \brief Returns and removes the oldest message from the queue
*/
igtl::MessageBase::Pointer PullMessage();
/**
* \brief Get the number of messages in the queue
*/
int GetSize();
/**
* \brief Returns a string with information about the oldest message in the
* queue
*/
std::string GetNextMsgInformationString();
/**
* \brief Returns the device type of the oldest message in the queue
*/
std::string GetNextMsgDeviceType();
/**
* \brief Returns a string with information about the oldest message in the
* queue
*/
std::string GetLatestMsgInformationString();
/**
* \brief Returns the device type of the oldest message in the queue
*/
std::string GetLatestMsgDeviceType();
/**
* \brief Sets infinite buffering on/off.
* Initiale value is enabled.
*/
void EnableInfiniteBuffering(bool enable);
protected:
IGTLMessageQueue();
virtual ~IGTLMessageQueue();
protected:
/**
* \brief Mutex to take car of the queue
*/
itk::FastMutexLock::Pointer m_Mutex;
/**
* \brief the queue that stores pointer to the inserted messages
*/
std::deque< igtl::MessageBase::Pointer > m_Queue;
/**
* \brief defines the kind of buffering
*/
BufferingType m_BufferingType;
};
}
#endif
diff --git a/Modules/OpenIGTLink/mitkIGTLMessageSource.h b/Modules/OpenIGTLink/mitkIGTLMessageSource.h
index 656c07239d..bdc192d6cc 100644
--- a/Modules/OpenIGTLink/mitkIGTLMessageSource.h
+++ b/Modules/OpenIGTLink/mitkIGTLMessageSource.h
@@ -1,212 +1,212 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIGTLMESSAGESOURCE_H_HEADER_INCLUDED_
#define MITKIGTLMESSAGESOURCE_H_HEADER_INCLUDED_
#include <itkProcessObject.h>
#include "mitkPropertyList.h"
#include "MitkOpenIGTLinkExports.h"
#include "mitkIGTLMessage.h"
// Microservices
#include <mitkServiceInterface.h>
#include <usServiceRegistration.h>
//itk
#include <itkFastMutexLock.h>
namespace mitk {
/**
* \brief OpenIGTLink message source
*
* Base class for all OpenIGTLink filters that produce OpenIGTLink message
* objects as output. This class defines the output-interface for
* OpenIGTLinkMessageFilters.
* \warning: if Update() is called on any output object, all IGTLMessage filters
* will generate new output data for all outputs, not just the one on which
* Update() was called.
*
*/
class MITKOPENIGTLINK_EXPORT IGTLMessageSource : public itk::ProcessObject
{
public:
- mitkClassMacro(IGTLMessageSource, itk::ProcessObject);
+ mitkClassMacroItkParent(IGTLMessageSource, itk::ProcessObject);
/** @return Returns a human readable name of this source. There will be a
* default name, or you can set the name with the method SetName() if you
* want to change it.
*/
itkGetMacro(Name,std::string);
/** @brief Sets the human readable name of this source. There is also a
* default name, but you can use this method if you need to define it on your
* own.
*/
itkSetMacro(Name,std::string);
/** @return Returns a human readable type of this source. There will be a
* default type, or you can set the name with the method SetType(). You have
* to set this parameter otherwise it will not be found by the message
* provider.
*/
itkGetMacro(Type,std::string);
/** @return Returns a human readable type of this source. There will be a
* default type, or you can set the name with the method SetType(). You have
* to set this parameter otherwise it will not be found by the message
* provider.
*/
itkSetMacro(Type,std::string);
/**
*\brief return the output (output with id 0) of the filter
*/
IGTLMessage* GetOutput(void);
/**
*\brief return the output with id idx of the filter
*/
IGTLMessage* GetOutput(DataObjectPointerArraySizeType idx);
/**
*\brief return the output with name messageName of the filter
*/
IGTLMessage* GetOutput(const std::string& messageName);
/**
*\brief return the index of the output with name messageName, -1 if no output
* with that name was found
*
* \warning if a subclass has outputs that have different data type than
* igtl::MessageBase, they have to overwrite this method
*/
DataObjectPointerArraySizeType GetOutputIndex(std::string messageName);
/**
*\brief Registers this object as a Microservice, making it available to every
* module and/or plugin. To unregister, call UnregisterMicroservice().
*/
virtual void RegisterAsMicroservice();
/**
*\brief Registers this object as a Microservice, making it available to every
* module and/or plugin.
*/
virtual void UnRegisterMicroservice();
/**
*\brief Returns the id that this device is registered with. The id will only
* be valid, if the IGTLMessageSource has been registered using
* RegisterAsMicroservice().
*/
std::string GetMicroserviceID();
/**
*\brief These Constants are used in conjunction with Microservices
*/
static const std::string US_INTERFACE_NAME;
static const std::string US_PROPKEY_DEVICENAME;
static const std::string US_PROPKEY_DEVICETYPE;
static const std::string US_PROPKEY_ID;
static const std::string US_PROPKEY_ISACTIVE; //NOT IMPLEMENTED YET!
/**
*\brief Graft the specified DataObject onto this ProcessObject's output.
*
* See itk::ImageSource::GraftNthOutput for details
*/
virtual void GraftNthOutput(unsigned int idx, itk::DataObject *graft);
/**
* \brief Graft the specified DataObject onto this ProcessObject's output.
*
* See itk::ImageSource::Graft Output for details
*/
virtual void GraftOutput(itk::DataObject *graft);
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
/**
* \brief Set all filter parameters as the PropertyList p
*
* This method allows to set all parameters of a filter with one
* method call. For the names of the parameters, take a look at
* the GetParameters method of the filter
* This method has to be overwritten by each MITK-IGT filter.
*/
virtual void SetParameters(const mitk::PropertyList*){};
/**
* \brief Get all filter parameters as a PropertyList
*
* This method allows to get all parameters of a filter with one
* method call. The returned PropertyList must be assigned to a
* SmartPointer immediately, or else it will get destroyed.
* Every filter must overwrite this method to create a filter-specific
* PropertyList. Note that property names must be unique over all
* MITK-IGT filters. Therefore each filter should use its name as a prefix
* for each property name.
* Secondly, each filter should list the property names and data types
* in the method documentation.
*/
virtual mitk::PropertyList::ConstPointer GetParameters() const;
/**
*\brief Sets the fps used for streaming this source
*/
void SetFPS(unsigned int fps);
/**
*\brief Gets the fps used for streaming this source
*/
unsigned int GetFPS();
protected:
IGTLMessageSource();
virtual ~IGTLMessageSource();
std::string m_Name;
std::string m_Type;
/** mutex to control access to m_StreamingFPS */
itk::FastMutexLock::Pointer m_StreamingFPSMutex;
/** The frames per second used for streaming */
unsigned int m_StreamingFPS;
us::ServiceRegistration<Self> m_ServiceRegistration;
};
} // namespace mitk
// This is the microservice declaration. Do not meddle!
MITK_DECLARE_SERVICE_INTERFACE(mitk::IGTLMessageSource, "org.mitk.services.IGTLMessageSource")
#endif /* MITKIGTLMESSAGESOURCE_H_HEADER_INCLUDED_ */
diff --git a/Modules/OpenViewCore/QVTKInteractor.h b/Modules/OpenViewCore/QVTKInteractor.h
index fb6fb16e1b..27c1105e0a 100644
--- a/Modules/OpenViewCore/QVTKInteractor.h
+++ b/Modules/OpenViewCore/QVTKInteractor.h
@@ -1,140 +1,140 @@
/*=========================================================================
Program: Visualization Toolkit
Module: QVTKInteractor.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Copyright 2004 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.
=========================================================================*/
/*========================================================================
For general information about using VTK and Qt, see:
http://www.trolltech.com/products/3rdparty/vtksupport.html
=========================================================================*/
// .NAME QVTKInteractor - Handle Qt events.
// .SECTION Description
// QVTKInteractor handles relaying Qt events to VTK.
#ifndef Q_VTK_INTERACTOR_H
#define Q_VTK_INTERACTOR_H
#include <vtkRenderWindowInteractor.h>
#include <vtkCommand.h>
#include <QtCore/QObject>
#include "vtkTDxConfigure.h" // defines VTK_USE_TDX
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
class vtkTDxWinDevice;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
class vtkTDxMacDevice;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
class vtkTDxDevice;
class vtkTDxUnixDevice;
#endif
#include <MitkOpenViewCoreExports.h>
class QVTKInteractorInternal;
// .NAME QVTKInteractor - An interactor for the QVTKWidget.
// .SECTION Description
// QVTKInteractor is an interactor for a QVTKWiget.
class MITKOPENVIEWCORE_EXPORT QVTKInteractor : public vtkRenderWindowInteractor
{
public:
static QVTKInteractor* New();
vtkTypeMacro(QVTKInteractor,vtkRenderWindowInteractor);
// Description:
// Enum for additional event types supported.
// These events can be picked up by command observers on the interactor
enum vtkCustomEvents
{
ContextMenuEvent = vtkCommand::UserEvent + 100,
DragEnterEvent,
DragMoveEvent,
DragLeaveEvent,
DropEvent
};
// Description:
// Overloaded terminiate app, which does nothing in Qt.
// Use qApp->exit() instead.
- virtual void TerminateApp();
+ virtual void TerminateApp() override;
// Description:
// Overloaded start method does nothing.
// Use qApp->exec() instead.
- virtual void Start();
- virtual void Initialize();
+ virtual void Start() override;
+ virtual void Initialize() override;
// Description:
// Start listening events on 3DConnexion device.
virtual void StartListening();
// Description:
// Stop listening events on 3DConnexion device.
virtual void StopListening();
// timer event slot
virtual void TimerEvent(int timerId);
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
virtual vtkTDxUnixDevice *GetDevice();
virtual void SetDevice(vtkTDxDevice *device);
#endif
protected:
// constructor
QVTKInteractor();
// destructor
~QVTKInteractor();
// create a Qt Timer
- virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
+ virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
// destroy a Qt Timer
- virtual int InternalDestroyTimer(int platformTimerId);
+ virtual int InternalDestroyTimer(int platformTimerId) override;
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
vtkTDxWinDevice *Device;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
vtkTDxMacDevice *Device;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
vtkTDxUnixDevice *Device;
#endif
private:
QVTKInteractorInternal* Internal;
// unimplemented copy
QVTKInteractor(const QVTKInteractor&);
// unimplemented operator=
void operator=(const QVTKInteractor&);
};
#endif
diff --git a/Modules/OpenViewCore/QVTKQuickItem.h b/Modules/OpenViewCore/QVTKQuickItem.h
index 8cab56009e..2e21c33721 100644
--- a/Modules/OpenViewCore/QVTKQuickItem.h
+++ b/Modules/OpenViewCore/QVTKQuickItem.h
@@ -1,108 +1,108 @@
/*========================================================================
OpenView -- http://openview.kitware.com
Copyright 2012 Kitware, Inc.
Licensed under the BSD license. See LICENSE file for details.
========================================================================*/
#ifndef QVTKQuickItem_h
#define QVTKQuickItem_h
#include <QQuickItem>
#include <QOpenGLShaderProgram>
#include "vtkSmartPointer.h"
#include "vtkNew.h"
#include <QMutex>
#include <MitkOpenViewCoreExports.h>
class QOpenGLContext;
class QOpenGLFramebufferObject;
class QVTKInteractorAdapter;
class QVTKInteractor;
class vtkEventQtSlotConnect;
class vtkGenericOpenGLRenderWindow;
class vtkObject;
class vtkContextView;
class MITKOPENVIEWCORE_EXPORT QVTKQuickItem : public QQuickItem
{
Q_OBJECT
public:
QVTKQuickItem(QQuickItem* parent = 0);
// Description:
// destructor
~QVTKQuickItem();
- void itemChange(ItemChange change, const ItemChangeData &);
+ void itemChange(ItemChange change, const ItemChangeData &) override;
// Description:
// set the render window to use with this item
void SetRenderWindow(vtkGenericOpenGLRenderWindow* win);
// Description:
// get the render window used with this item
vtkGenericOpenGLRenderWindow* GetRenderWindow() const;
// Description:
// get the render window interactor used with this item
// this item enforces its own interactor
QVTKInteractor* GetInteractor() const;
public slots:
virtual void paint();
protected slots:
// slot to make this vtk render window current
virtual void MakeCurrent();
// slot called when vtk render window starts to draw
virtual void Start();
// slot called when vtk render window is done drawing
virtual void End();
// slot called when vtk wants to know if the context is current
virtual void IsCurrent(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
// slot called when vtk wants to know if a window is direct
virtual void IsDirect(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
// slot called when vtk wants to know if a window supports OpenGL
virtual void SupportsOpenGL(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data);
protected:
virtual void init();
virtual void prepareForRender();
virtual void cleanupAfterRender();
// handle item key events
- virtual void keyPressEvent(QKeyEvent* e);
- virtual void keyReleaseEvent(QKeyEvent* e);
+ virtual void keyPressEvent(QKeyEvent* e) override;
+ virtual void keyReleaseEvent(QKeyEvent* e) override;
// handle item mouse events
- virtual void mousePressEvent(QMouseEvent* e);
- virtual void mouseReleaseEvent(QMouseEvent* e);
- virtual void mouseDoubleClickEvent(QMouseEvent* e);
- virtual void mouseMoveEvent(QMouseEvent* e);
- virtual void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry);
- virtual void wheelEvent(QWheelEvent* e);
- virtual void hoverEnterEvent(QHoverEvent* e);
- virtual void hoverLeaveEvent(QHoverEvent* e);
- virtual void hoverMoveEvent(QHoverEvent* e);
-
- virtual QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData* updatePaintNodeData);
+ virtual void mousePressEvent(QMouseEvent* e) override;
+ virtual void mouseReleaseEvent(QMouseEvent* e) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent* e) override;
+ virtual void mouseMoveEvent(QMouseEvent* e) override;
+ virtual void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) override;
+ virtual void wheelEvent(QWheelEvent* e) override;
+ virtual void hoverEnterEvent(QHoverEvent* e) override;
+ virtual void hoverLeaveEvent(QHoverEvent* e) override;
+ virtual void hoverMoveEvent(QHoverEvent* e) override;
+
+ virtual QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData* updatePaintNodeData) override;
QMutex m_viewLock;
private:
QOpenGLContext* m_context;
vtkSmartPointer<vtkGenericOpenGLRenderWindow> m_win;
vtkSmartPointer<QVTKInteractor> m_interactor;
QVTKInteractorAdapter* m_interactorAdapter;
vtkSmartPointer<vtkEventQtSlotConnect> m_connect;
bool m_InitCalledOnce;
};
#endif
diff --git a/Modules/OpenViewCore/vtkEventQtSlotConnect.h b/Modules/OpenViewCore/vtkEventQtSlotConnect.h
index db335f6d07..c262ee0802 100644
--- a/Modules/OpenViewCore/vtkEventQtSlotConnect.h
+++ b/Modules/OpenViewCore/vtkEventQtSlotConnect.h
@@ -1,103 +1,103 @@
/*=========================================================================
Copyright 2004 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.
=========================================================================*/
/*========================================================================
For general information about using VTK and Qt, see:
http://www.trolltech.com/products/3rdparty/vtksupport.html
=========================================================================*/
/*========================================================================
!!! WARNING for those who want to contribute code to this file.
!!! If you use a commercial edition of Qt, you can modify this code.
!!! If you use an open source version of Qt, you are free to modify
!!! and use this code within the guidelines of the GPL license.
!!! Unfortunately, you cannot contribute the changes back into this
!!! file. Doing so creates a conflict between the GPL and BSD-like VTK
!!! license.
=========================================================================*/
// .NAME vtkEventQtSlotConnect - Manage connections between VTK events and Qt slots.
// .SECTION Description
// vtkEventQtSlotConnect provides a way to manage connections between VTK events
// and Qt slots.
// Qt slots to connect with must have one of the following signatures:
// - MySlot()
// - MySlot(vtkObject* caller)
// - MySlot(vtkObject* caller, unsigned long vtk_event)
// - MySlot(vtkObject* caller, unsigned long vtk_event, void* client_data)
// - MySlot(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data)
// - MySlot(vtkObject* caller, unsigned long vtk_event, void* client_data, void* call_data, vtkCommand*)
#ifndef VTK_EVENT_QT_SLOT_CONNECT
#define VTK_EVENT_QT_SLOT_CONNECT
#include "vtkObject.h"
#include "vtkCommand.h" // for event defines
#include <QObject> // for version info
#include <MitkOpenViewCoreExports.h>
class QObject;
class vtkQtConnections;
class vtkQtConnection;
// manage connections between VTK object events and Qt slots
class MITKOPENVIEWCORE_EXPORT vtkEventQtSlotConnect : public vtkObject
{
public:
static vtkEventQtSlotConnect* New();
vtkTypeMacro(vtkEventQtSlotConnect, vtkObject)
// Description:
// Print the current connections between VTK and Qt
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description:
// Connect a vtk object's event with a Qt object's slot. Multiple
// connections which are identical are treated as separate connections.
virtual void Connect(vtkObject* vtk_obj, unsigned long event,
const QObject* qt_obj, const char* slot,
void* client_data=NULL, float priority=0.0
,Qt::ConnectionType type = Qt::AutoConnection);
// Description:
// Disconnect a vtk object from a qt object.
// Passing no arguments will disconnect all slots maintained by this object.
// Passing in only a vtk object will disconnect all slots from it.
// Passing only a vtk object and event, will disconnect all slots matching
// the vtk object and event.
// Passing all information in will match all information.
virtual void Disconnect(
vtkObject* vtk_obj=NULL, unsigned long event=vtkCommand::NoEvent,
const QObject* qt_obj=NULL, const char* slot = 0, void* client_data=NULL);
// Description:
// Allow to query vtkEventQtSlotConnect to know if some Connect() have been
// setup and how many.
virtual int GetNumberOfConnections() const;
protected:
vtkQtConnections* Connections;
friend class vtkQtConnection;
void RemoveConnection(vtkQtConnection*);
vtkEventQtSlotConnect();
~vtkEventQtSlotConnect();
private:
// unimplemented
vtkEventQtSlotConnect(const vtkEventQtSlotConnect&);
void operator=(const vtkEventQtSlotConnect&);
};
#endif
diff --git a/Modules/Overlays/mitkColorBarOverlay.h b/Modules/Overlays/mitkColorBarOverlay.h
index e02a4e8868..ff3b63dea9 100644
--- a/Modules/Overlays/mitkColorBarOverlay.h
+++ b/Modules/Overlays/mitkColorBarOverlay.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef COLORBAROVERLAY_H
#define COLORBAROVERLAY_H
#include <mitkVtkOverlay.h>
#include <mitkLocalStorageHandler.h>
#include <vtkSmartPointer.h>
#include <vtkLookupTable.h>
#include "MitkOverlaysExports.h"
class vtkScalarBarActor;
namespace mitk {
/** \brief Displays configurable scales on the renderwindow. The scale is determined by the image spacing. */
class MITKOVERLAYS_EXPORT ColorBarOverlay : public mitk::VtkOverlay {
public:
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkScalarBarActor> m_ScalarBarActor;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(ColorBarOverlay, mitk::VtkOverlay);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetDrawAnnotations(bool annotations);
bool GetDrawAnnotations() const;
void SetOrientationToHorizontal();
void SetOrientationToVertical();
void SetOrientation(int orientation);
int GetOrientation() const;
void SetMaxNumberOfColors(int numberOfColors);
int GetMaxNumberOfColors() const;
void SetNumberOfLabels(int numberOfLabels);
int GetNumberOfLabels() const;
void SetLookupTable(vtkSmartPointer<vtkLookupTable> table);
vtkSmartPointer<vtkLookupTable> GetLookupTable() const;
void SetDrawTickLabels(bool ticks);
bool GetDrawTickLabels() const;
void SetAnnotationTextScaling(bool scale);
bool GetAnnotationTextScaling() const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const override;
+ virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit ColorBarOverlay();
/** \brief virtual destructor in order to derive from this class */
virtual ~ColorBarOverlay();
private:
/** \brief copy constructor */
ColorBarOverlay( const ColorBarOverlay &);
/** \brief assignment operator */
ColorBarOverlay &operator=(const ColorBarOverlay &);
};
} // namespace mitk
#endif // COLORBAROVERLAY_H
diff --git a/Modules/Overlays/mitkLabelOverlay3D.h b/Modules/Overlays/mitkLabelOverlay3D.h
index b96a1dec7b..ffd748da12 100644
--- a/Modules/Overlays/mitkLabelOverlay3D.h
+++ b/Modules/Overlays/mitkLabelOverlay3D.h
@@ -1,116 +1,116 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LabelOverlay3D_H
#define LabelOverlay3D_H
#include <mitkVtkOverlay3D.h>
#include <mitkLocalStorageHandler.h>
#include "MitkOverlaysExports.h"
#include <vtkSmartPointer.h>
class vtkStringArray;
class vtkPolyDataMapper;
class vtkPolyData;
class vtkActor2D;
class vtkProperty2D;
class vtkPointSetToLabelHierarchy;
class vtkLabelPlacementMapper;
class vtkIntArray;
namespace mitk {
class PointSet;
/** \brief Can display a high amount of 3D labels to a PointSet */
class MITKOVERLAYS_EXPORT LabelOverlay3D : public mitk::VtkOverlay3D {
public:
/** \brief Internal class holding the vtkActor, etc. for each of the render windows */
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
vtkSmartPointer<vtkPolyData> m_Points;
vtkSmartPointer<vtkActor2D> m_LabelsActor;
vtkSmartPointer<vtkIntArray> m_Sizes;
vtkSmartPointer<vtkStringArray> m_Labels;
vtkSmartPointer<vtkLabelPlacementMapper> m_LabelMapper;
vtkSmartPointer<vtkPointSetToLabelHierarchy> m_PointSetToLabelHierarchyFilter;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(LabelOverlay3D, mitk::VtkOverlay3D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Set the vector of labels that are shown to each corresponding point3D. The size has to be equal to the provided LabelCoordinates. */
void SetLabelVector(const std::vector<std::string>& LabelVector);
/** \brief Optional: Provide a vector of priorities. The labels with higher priorities will be visible in lower LOD */
void SetPriorityVector(const std::vector<int>& PriorityVector);
/** \brief Coordinates of the labels */
void SetLabelCoordinates(itk::SmartPointer<PointSet> LabelCoordinates);
void PointSetModified(const itk::Object *, const itk::EventObject &);
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
+ void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit LabelOverlay3D();
/** \brief virtual destructor in order to derive from this class */
virtual ~LabelOverlay3D();
private:
/** \brief The char arrays in this vector are displayed at the corresponding coordinates.*/
std::vector<std::string> m_LabelVector;
/** \brief values in this array set a priority to each label. Higher priority labels are not covert by labels with lower priority.*/
std::vector<int> m_PriorityVector;
/** \brief The coordinates of the labels. Indices must match the labelVector and the priorityVector.*/
itk::SmartPointer<PointSet> m_LabelCoordinates;
unsigned long m_PointSetModifiedObserverTag;
/** \brief copy constructor */
LabelOverlay3D( const LabelOverlay3D &);
/** \brief assignment operator */
LabelOverlay3D &operator=(const LabelOverlay3D &);
};
} // namespace mitk
#endif // LabelOverlay3D_H
diff --git a/Modules/Overlays/mitkLogoOverlay.h b/Modules/Overlays/mitkLogoOverlay.h
index aeafe22842..fed232bbe2 100644
--- a/Modules/Overlays/mitkLogoOverlay.h
+++ b/Modules/Overlays/mitkLogoOverlay.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef LOGOOVERLAY_H
#define LOGOOVERLAY_H
#include <mitkVtkOverlay.h>
#include <mitkLocalStorageHandler.h>
#include <vtkSmartPointer.h>
#include "MitkOverlaysExports.h"
class mitkVtkLogoRepresentation;
class vtkImageData;
class vtkImageReader2Factory;
class vtkImageImport;
namespace mitk {
/** \brief Displays a logo on the renderwindow */
class MITKOVERLAYS_EXPORT LogoOverlay : public mitk::VtkOverlay {
public:
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkImageData> m_LogoImage;
vtkSmartPointer<mitkVtkLogoRepresentation> m_LogoRep;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(LogoOverlay, mitk::VtkOverlay);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
vtkSmartPointer<vtkImageReader2Factory> m_readerFactory;
void SetLogoImagePath(std::string text);
std::string GetLogoImagePath() const;
/** \brief The relative offset to the corner position */
void SetOffsetVector(const Point2D& OffsetVector, BaseRenderer* renderer = NULL);
Point2D GetOffsetVector(mitk::BaseRenderer* renderer = NULL) const;
/** \brief The corner where the logo is displayed.
0 = Bottom left
1 = Bottom right
2 = Top right
3 = Top left
4 = Center*/
void SetCornerPosition(const int& corner, BaseRenderer* renderer = NULL);
int GetCornerPosition(mitk::BaseRenderer* renderer = NULL) const;
void SetRelativeSize(const float &size, BaseRenderer* renderer = NULL);
float GetRelativeSize(mitk::BaseRenderer* renderer = NULL) const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
+ void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
vtkImageData* CreateMbiLogo();
/** \brief explicit constructor which disallows implicit conversions */
explicit LogoOverlay();
/** \brief virtual destructor in order to derive from this class */
virtual ~LogoOverlay();
private:
vtkSmartPointer <vtkImageImport> m_VtkImageImport;
/** \brief copy constructor */
LogoOverlay( const LogoOverlay &);
/** \brief assignment operator */
LogoOverlay &operator=(const LogoOverlay &);
};
} // namespace mitk
#endif // LOGOOVERLAY_H
diff --git a/Modules/Overlays/mitkOverlay2DLayouter.h b/Modules/Overlays/mitkOverlay2DLayouter.h
index 41a4553937..ffa7f9b1d7 100644
--- a/Modules/Overlays/mitkOverlay2DLayouter.h
+++ b/Modules/Overlays/mitkOverlay2DLayouter.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKOVERLAY2DLAYOUTER_H
#define MITKOVERLAY2DLAYOUTER_H
#include <MitkOverlaysExports.h>
#include <mitkAbstractOverlayLayouter.h>
namespace mitk {
/** @brief A simple implementation of a layouter for 2D Overlays
*/
class MITKOVERLAYS_EXPORT Overlay2DLayouter : public mitk::AbstractOverlayLayouter {
public:
enum Alignment{TopLeft, Top, TopRight, BottomLeft, Bottom, BottomRight};
mitkClassMacro(Overlay2DLayouter, mitk::AbstractOverlayLayouter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
static std::string STANDARD_2D_TOPLEFT();
static std::string STANDARD_2D_TOP();
static std::string STANDARD_2D_TOPRIGHT();
static std::string STANDARD_2D_BOTTOMLEFT();
static std::string STANDARD_2D_BOTTOM();
static std::string STANDARD_2D_BOTTOMRIGHT();
/** \brief Factory method for the different kinds of Layouters */
/** Create a Layouter that, depending on the identifier sorts the Overlays in one corner of the Renderwindow*/
static Overlay2DLayouter::Pointer CreateLayouter(Alignment alignment, BaseRenderer* renderer);
/** \brief Factory method for the different kinds of Layouters */
/** Create a Layouter that, depending on the identifier sorts the Overlays in one corner of the Renderwindow*/
static Overlay2DLayouter::Pointer CreateLayouter(const std::string& identifier, BaseRenderer* renderer);
- void PrepareLayout();
+ void PrepareLayout() override;
protected:
/** \brief explicit constructor which disallows implicit conversions */
explicit Overlay2DLayouter();
/** \brief virtual destructor in order to derive from this class */
virtual ~Overlay2DLayouter();
Alignment m_Alignment;
double m_Margin;
private:
/** \brief copy constructor */
Overlay2DLayouter( const Overlay2DLayouter &);
/** \brief assignment operator */
Overlay2DLayouter &operator=(const Overlay2DLayouter &);
};
} // namespace mitk
#endif // MITKOVERLAY2DLAYOUTER_H
diff --git a/Modules/Overlays/mitkScaleLegendOverlay.h b/Modules/Overlays/mitkScaleLegendOverlay.h
index 718b9b5f54..eea6e6c132 100644
--- a/Modules/Overlays/mitkScaleLegendOverlay.h
+++ b/Modules/Overlays/mitkScaleLegendOverlay.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SCALELEGENDOVERLAY_H
#define SCALELEGENDOVERLAY_H
#include <mitkVtkOverlay.h>
#include <mitkLocalStorageHandler.h>
#include <vtkSmartPointer.h>
#include "MitkOverlaysExports.h"
class vtkLegendScaleActor;
namespace mitk {
/** \brief Displays configurable scales on the renderwindow. The scale is determined by the image spacing. */
class MITKOVERLAYS_EXPORT ScaleLegendOverlay : public mitk::VtkOverlay {
public:
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkLegendScaleActor> m_legendScaleActor;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(ScaleLegendOverlay, mitk::VtkOverlay);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetRightAxisVisibility(bool visibility);
bool GetRightAxisVisibility() const;
void SetLeftAxisVisibility(bool visibility);
bool GetLeftAxisVisibility() const;
void SetTopAxisVisibility(bool visibility);
bool GetTopAxisVisibility() const;
void SetBottomAxisVisibility(bool visibility);
bool GetBottomAxisVisibility() const;
void SetLegendVisibility(bool visibility);
bool GetLegendVisibility() const;
void SetRightBorderOffset(int offset);
int GetRightBorderOffset() const;
void SetCornerOffsetFactor(float offsetFactor);
float GetCornerOffsetFactor() const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const override;
+ virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit ScaleLegendOverlay();
/** \brief virtual destructor in order to derive from this class */
virtual ~ScaleLegendOverlay();
private:
/** \brief copy constructor */
ScaleLegendOverlay( const ScaleLegendOverlay &);
/** \brief assignment operator */
ScaleLegendOverlay &operator=(const ScaleLegendOverlay &);
};
} // namespace mitk
#endif // SCALELEGENDOVERLAY_H
diff --git a/Modules/Overlays/mitkTextOverlay2D.h b/Modules/Overlays/mitkTextOverlay2D.h
index a0a6b301ac..e45e1634e2 100644
--- a/Modules/Overlays/mitkTextOverlay2D.h
+++ b/Modules/Overlays/mitkTextOverlay2D.h
@@ -1,92 +1,92 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TEXTOVERLAY2D_H
#define TEXTOVERLAY2D_H
#include <mitkVtkOverlay2D.h>
#include <mitkLocalStorageHandler.h>
#include <vtkSmartPointer.h>
#include "MitkOverlaysExports.h"
class vtkTextActor;
class vtkPropAssembly;
namespace mitk {
/** \brief Displays text on the renderwindow */
class MITKOVERLAYS_EXPORT TextOverlay2D : public mitk::VtkOverlay2D {
public:
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkTextActor> m_TextActor;
vtkSmartPointer<vtkTextProperty> m_TextProp;
vtkSmartPointer<vtkTextActor> m_STextActor;
vtkSmartPointer<vtkTextProperty> m_STextProp;
vtkSmartPointer<vtkPropAssembly> m_Assembly;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(TextOverlay2D, mitk::VtkOverlay2D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const;
- virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds& bounds);
+ virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
+ virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds& bounds) override;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- vtkProp* GetVtkProp(BaseRenderer *renderer) const;
- virtual vtkActor2D* GetVtkActor2D(BaseRenderer *renderer) const;
- void UpdateVtkOverlay2D(mitk::BaseRenderer *renderer);
+ vtkProp* GetVtkProp(BaseRenderer *renderer) const override;
+ virtual vtkActor2D* GetVtkActor2D(BaseRenderer *renderer) const override;
+ void UpdateVtkOverlay2D(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit TextOverlay2D();
/** \brief virtual destructor in order to derive from this class */
virtual ~TextOverlay2D();
private:
/** \brief copy constructor */
TextOverlay2D( const TextOverlay2D &);
/** \brief assignment operator */
TextOverlay2D &operator=(const TextOverlay2D &);
};
} // namespace mitk
#endif // TEXTOVERLAY2D_H
diff --git a/Modules/Overlays/mitkTextOverlay3D.h b/Modules/Overlays/mitkTextOverlay3D.h
index faa35b7752..9075e7ebc7 100644
--- a/Modules/Overlays/mitkTextOverlay3D.h
+++ b/Modules/Overlays/mitkTextOverlay3D.h
@@ -1,90 +1,90 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TextOverlay3D_H
#define TextOverlay3D_H
#include <mitkVtkOverlay3D.h>
#include <mitkLocalStorageHandler.h>
#include "MitkOverlaysExports.h"
class vtkFollower;
class vtkVectorText;
class vtkTextActor3D;
namespace mitk {
/** \brief Displays at 3D position, always facing the camera */
class MITKOVERLAYS_EXPORT TextOverlay3D : public mitk::VtkOverlay3D {
public:
/** \brief Internal class holding the mapper, actor, etc. for each of the render windows */
/**
* To render the Overlay on transveral, coronal, and sagittal, the update method
* is called for each renderwindow. For performance reasons, the corresponding data
* for each view is saved in the internal helper class LocalStorage.
* This allows rendering n views with just 1 mitkOverlay using n vtkMapper.
* */
class LocalStorage : public mitk::Overlay::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkFollower> m_follower;
vtkSmartPointer<vtkVectorText> m_textSource;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
mitkClassMacro(TextOverlay3D, mitk::VtkOverlay3D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler<LocalStorage> m_LSH;
- virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer);
+ virtual vtkProp* GetVtkProp(BaseRenderer *renderer) const override;
+ void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
explicit TextOverlay3D();
/** \brief virtual destructor in order to derive from this class */
virtual ~TextOverlay3D();
private:
/** \brief copy constructor */
TextOverlay3D( const TextOverlay3D &);
/** \brief assignment operator */
TextOverlay3D &operator=(const TextOverlay3D &);
};
} // namespace mitk
#endif // TextOverlay3D_H
diff --git a/Modules/Overlays/mitkVtkLogoRepresentation.h b/Modules/Overlays/mitkVtkLogoRepresentation.h
index 021be6c943..9bdf7dc4d7 100644
--- a/Modules/Overlays/mitkVtkLogoRepresentation.h
+++ b/Modules/Overlays/mitkVtkLogoRepresentation.h
@@ -1,56 +1,56 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkVtkLogoRepresentation_h
#define __mitkVtkLogoRepresentation_h
#include "vtkLogoRepresentation.h"
class mitkVtkLogoRepresentation : public vtkLogoRepresentation
{
public:
// Description:
// Instantiate this class.
static mitkVtkLogoRepresentation *New();
// Description:
// Standard VTK class methods.
vtkTypeMacro(mitkVtkLogoRepresentation,vtkLogoRepresentation);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description:
// Satisfy the superclasses' API.
- virtual void BuildRepresentation();
+ virtual void BuildRepresentation() override;
void SetCornerPosition(int corner){cornerPosition = corner;}
protected:
mitkVtkLogoRepresentation();
~mitkVtkLogoRepresentation();
// Helper methods
void AdjustImageSize(double o[2], double borderSize[2], double imageSize[2]);
int cornerPosition;
private:
mitkVtkLogoRepresentation(const mitkVtkLogoRepresentation&); //Not implemented
void operator=(const mitkVtkLogoRepresentation&); //Not implemented
};
#endif
diff --git a/Modules/Persistence/Testing/mitkPersistenceTest.cpp b/Modules/Persistence/Testing/mitkPersistenceTest.cpp
index 82dff9c73c..ce50c37582 100644
--- a/Modules/Persistence/Testing/mitkPersistenceTest.cpp
+++ b/Modules/Persistence/Testing/mitkPersistenceTest.cpp
@@ -1,172 +1,172 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkCommon.h>
#include <usModuleContext.h>
#include <usServiceReference.h>
#include <usGetModuleContext.h>
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
#include <mitkIPersistenceService.h>
#include <mitkPersistenceService.h>
#include <mitkSceneIO.h>
#include <mitkIOUtil.h>
#include <itksys/SystemTools.hxx>
struct PersistenceTestClass
{
PersistenceTestClass()
: id(""), param1(1), param2(2), param3(false)
{
}
std::string id;
int param1;
double param2;
bool param3;
PERSISTENCE_CREATE3(PersistenceTestClass, id, param1, param2, param3)
};
struct TestPropertyListReplacedObserver: public mitk::PropertyListReplacedObserver
{
TestPropertyListReplacedObserver(): counter(0) {}
- virtual void BeforePropertyListReplaced( const std::string& id, mitk::PropertyList* propertyList )
+ virtual void BeforePropertyListReplaced( const std::string& id, mitk::PropertyList* propertyList ) override
{
if( id == m_Id )
counter++;
}
- virtual void AfterPropertyListReplaced( const std::string& id, mitk::PropertyList* propertyList )
+ virtual void AfterPropertyListReplaced( const std::string& id, mitk::PropertyList* propertyList ) override
{
if( id == m_Id )
counter++;
}
int counter;
std::string m_Id;
};
class mitkPersistenceTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPersistenceTestSuite);
MITK_TEST(PersistenceTest);
CPPUNIT_TEST_SUITE_END();
private:
// private test members that are initialized by setUp()
std::string testClassId;
int param1;
double param2;
bool param3;
public:
- void setUp()
+ void setUp() override
{
testClassId = "testClass";
param1 = 100;
param2 = 201.56;
param3 = true;
}
void PersistenceTest()
{
// dummy load of SceneIO, otherwise PersistenceService won't be available
mitk::PersistenceService::LoadModule();
PERSISTENCE_GET_SERVICE_MACRO
CPPUNIT_ASSERT_MESSAGE("Testing availability of the PersistenceService.", persistenceService != NULL);
// Initialize testable parameter values
std::string defaultPersistenceFile = persistenceService->GetDefaultPersistenceFile();
PersistenceTestClass autoLoadTestClass;
autoLoadTestClass.id = testClassId;
if( itksys::SystemTools::FileExists(defaultPersistenceFile.c_str(), true) && persistenceService->GetAutoLoadAndSave() )
{
/// Test auto load/save of the PersistenceService.
itksys::SystemTools::RemoveFile(defaultPersistenceFile.c_str());
autoLoadTestClass.FromPropertyList();
testParams( autoLoadTestClass, "autoLoadTestClass" );
}
std::string testTempFile = mitk::IOUtil::CreateTemporaryFile("XXXXXX.mitk");
std::string testXmlTempFile = mitk::IOUtil::CreateTemporaryFile("PersistenceTestFileXXXXXX.xml");
MITK_INFO << "Testing standard write to scene file/xml file.";
PersistenceTestClass testClass;
testClass.id = testClassId;
testClass.param1 = param1;
testClass.param2 = param2;
testClass.param3 = param3;
CPPUNIT_ASSERT_MESSAGE( "Testing to save a scene file", testClass.Save(testTempFile));
CPPUNIT_ASSERT_MESSAGE( "testing to save an xml file", testClass.Save(testXmlTempFile));
CPPUNIT_ASSERT_MESSAGE( "Testing read from scene file: persistenceService->RemovePropertyList(testClassId)", persistenceService->RemovePropertyList(testClassId));
PersistenceTestClass testClass2;
testClass2.id = testClassId;
CPPUNIT_ASSERT_MESSAGE( "Testing read from scene file: testClass2.Load(testTempFile.path())", testClass2.Load(testTempFile));
testParams( testClass2, "testClass2" );
CPPUNIT_ASSERT_MESSAGE( "Testing read from xml file: persistenceService->RemovePropertyList(testClassId)", persistenceService->RemovePropertyList(testClassId));
PersistenceTestClass testClass3;
testClass3.id = testClassId;
CPPUNIT_ASSERT_MESSAGE( "Testing read from xml file: testClass3.Load(testXmlTempFile.path())", testClass3.Load(testXmlTempFile));
testParams( testClass3, "testClass3" );
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with scene load/write: persistenceService->RemovePropertyList(testClassId)", persistenceService->RemovePropertyList(testClassId));
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with scene load/write: persistenceService->Save(testTempFile.path())",persistenceService->Save(testTempFile, true));
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with scene load/write: persistenceService->Load(testTempFile.path())", persistenceService->Load(testTempFile));
PersistenceTestClass testClass4;
testClass4.id = testClassId;
testClass4.FromPropertyList();
testParams( testClass4, "testClass4" );
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with xml load/write: persistenceService->RemovePropertyList(testClassId)", persistenceService->RemovePropertyList(testClassId));
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with xml load/write: persistenceService->Save(testXmlTempFile.path())", persistenceService->Save(testXmlTempFile, true));
CPPUNIT_ASSERT_MESSAGE( "Testing appendChanges functionality with xml load/write: persistenceService->Load(testXmlTempFile.path())", persistenceService->Load(testXmlTempFile));
PersistenceTestClass testClass5;
testClass5.id = testClassId;
testClass5.FromPropertyList();
testParams( testClass5, "testClass5" );
// Test Observer Functionality
TestPropertyListReplacedObserver testObserver;
testObserver.m_Id = testClassId;
persistenceService->AddPropertyListReplacedObserver( &testObserver );
persistenceService->Load(testTempFile);
CPPUNIT_ASSERT_MESSAGE( "Testing observer functionality: testObserver.counter == 2, testObserver.counter is " + testObserver.counter, testObserver.counter == 2 );
autoLoadTestClass.param1 = param1;
autoLoadTestClass.param2 = param2;
autoLoadTestClass.param3 = param3;
autoLoadTestClass.ToPropertyList();
}
/**
* Helper Method that compares the returned class to its base values
*/
void testParams( const PersistenceTestClass& testClass, const std::string& testClassName )
{
CPPUNIT_ASSERT_MESSAGE( "Parameter of TestClass not equal to reference value: testClass.id", testClass.id == testClassId );
CPPUNIT_ASSERT_MESSAGE( "Parameter of TestClass not equal to reference value: testClass.param1" , testClass.param1 == param1);
CPPUNIT_ASSERT_MESSAGE( "Parameter of TestClass not equal to reference value: testClass.param2" , testClass.param2 == param2);
CPPUNIT_ASSERT_MESSAGE( "Parameter of TestClass not equal to reference value: testClass.param3" , testClass.param3 == param3);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPersistence)
\ No newline at end of file
diff --git a/Modules/Persistence/mitkPersistenceActivator.h b/Modules/Persistence/mitkPersistenceActivator.h
index 3f2036aa2c..99ca23e124 100644
--- a/Modules/Persistence/mitkPersistenceActivator.h
+++ b/Modules/Persistence/mitkPersistenceActivator.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPersistenceActivator_h
#define mitkPersistenceActivator_h
#define MBILOG_ENABLE_DEBUG
// Microservices
#include <usModuleActivator.h>
#include "mitkPersistenceService.h"
#include <usServiceRegistration.h>
namespace mitk
{
///
/// installs the PersistenceService
/// runs all initial commands (setting env paths etc)
///
class PersistenceActivator : public us::ModuleActivator
{
public:
PersistenceActivator();
- void Load(us::ModuleContext* context);
- void Unload(us::ModuleContext* context);
+ void Load(us::ModuleContext* context) override;
+ void Unload(us::ModuleContext* context) override;
virtual ~PersistenceActivator();
private:
itk::SmartPointer<mitk::PersistenceService> m_PersistenceService;
us::ServiceRegistration<mitk::IPersistenceService> m_PersistenceServiceRegistration;
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::PersistenceActivator)
#endif
diff --git a/Modules/Persistence/mitkPersistenceService.h b/Modules/Persistence/mitkPersistenceService.h
index b3f346abf8..f4a4304e53 100644
--- a/Modules/Persistence/mitkPersistenceService.h
+++ b/Modules/Persistence/mitkPersistenceService.h
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPersistenceService_h
#define mitkPersistenceService_h
#include "mitkIPersistenceService.h"
#include "mitkPropertyListsXmlFileReaderAndWriter.h"
#include <itkLightObject.h>
#include "mitkSceneIO.h"
#include <MitkPersistenceExports.h>
namespace mitk
{
///
/// implementation of the IPersistenceService
/// \see IPersistenceService
class MITKPERSISTENCE_EXPORT PersistenceService: public itk::LightObject, public mitk::IPersistenceService
{
public:
static std::string GetPersistencePropertyName();
static std::string GetPersistencePropertyListName();
static void LoadModule();
static us::ModuleContext* GetModuleContext();
PersistenceService();
~PersistenceService();
- std::string GetDefaultPersistenceFile();
+ std::string GetDefaultPersistenceFile() override;
- mitk::PropertyList::Pointer GetPropertyList( std::string& id, bool* existed=0 );
+ mitk::PropertyList::Pointer GetPropertyList( std::string& id, bool* existed=0 ) override;
- bool RemovePropertyList( std::string& id );
+ bool RemovePropertyList( std::string& id ) override;
- std::string GetPersistenceNodePropertyName();
+ std::string GetPersistenceNodePropertyName() override;
- DataStorage::SetOfObjects::Pointer GetDataNodes(DataStorage* ds=0);
+ DataStorage::SetOfObjects::Pointer GetDataNodes(DataStorage* ds=0) override;
- bool Save(const std::string& fileName="", bool appendChanges=false);
+ bool Save(const std::string& fileName="", bool appendChanges=false) override;
- bool Load(const std::string& fileName="", bool enforeReload=true);
+ bool Load(const std::string& fileName="", bool enforeReload=true) override;
- void SetAutoLoadAndSave(bool autoLoadAndSave);
+ void SetAutoLoadAndSave(bool autoLoadAndSave) override;
- bool GetAutoLoadAndSave();
+ bool GetAutoLoadAndSave() override;
- void AddPropertyListReplacedObserver( PropertyListReplacedObserver* observer );
+ void AddPropertyListReplacedObserver( PropertyListReplacedObserver* observer ) override;
- void RemovePropertyListReplacedObserver( PropertyListReplacedObserver* observer );
+ void RemovePropertyListReplacedObserver( PropertyListReplacedObserver* observer ) override;
- bool RestorePropertyListsFromPersistentDataNodes(const DataStorage* storage);
+ bool RestorePropertyListsFromPersistentDataNodes(const DataStorage* storage) override;
void Clear();
void Unitialize();
private:
void ClonePropertyList( mitk::PropertyList* from, mitk::PropertyList* to ) const;
void Initialize();
std::map<std::string, mitk::PropertyList::Pointer> m_PropertyLists;
bool m_AutoLoadAndSave;
std::set<PropertyListReplacedObserver*> m_PropertyListReplacedObserver;
SceneIO::Pointer m_SceneIO;
PropertyListsXmlFileReaderAndWriter::Pointer m_PropertyListsXmlFileReaderAndWriter;
std::map<std::string, long int> m_FileNamesToModifiedTimes;
bool m_Initialized;
bool m_InInitialized;
};
}
#endif
diff --git a/Modules/Persistence/mitkPropertyListsXmlFileReaderAndWriter.h b/Modules/Persistence/mitkPropertyListsXmlFileReaderAndWriter.h
index e381ee6f9d..4054f37ed0 100644
--- a/Modules/Persistence/mitkPropertyListsXmlFileReaderAndWriter.h
+++ b/Modules/Persistence/mitkPropertyListsXmlFileReaderAndWriter.h
@@ -1,52 +1,52 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkXmlSceneIO_h_included
#define mitkXmlSceneIO_h_included
#include "mitkDataStorage.h"
class TiXmlElement;
namespace mitk
{
class PropertyListsXmlFileReaderAndWriter;
class PropertyListsXmlFileReaderAndWriter : public itk::Object
{
public:
static const char* GetPropertyListIdElementName();
- mitkClassMacro( PropertyListsXmlFileReaderAndWriter, itk::Object );
+ mitkClassMacroItkParent( PropertyListsXmlFileReaderAndWriter, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
bool WriteLists( const std::string& fileName, const std::map<std::string, mitk::PropertyList::Pointer>& _PropertyLists ) const;
bool ReadLists( const std::string& fileName, std::map<std::string, mitk::PropertyList::Pointer>& _PropertyLists ) const;
protected:
PropertyListsXmlFileReaderAndWriter();
virtual ~PropertyListsXmlFileReaderAndWriter();
bool PropertyFromXmlElem(std::string& name, mitk::BaseProperty::Pointer& prop, TiXmlElement* elem) const;
bool PropertyToXmlElem(const std::string& name, const mitk::BaseProperty* prop, TiXmlElement* elem) const;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkExtrudePlanarFigureFilter.h b/Modules/PlanarFigure/include/mitkExtrudePlanarFigureFilter.h
index 1adc3afcf5..4306e56f7b 100644
--- a/Modules/PlanarFigure/include/mitkExtrudePlanarFigureFilter.h
+++ b/Modules/PlanarFigure/include/mitkExtrudePlanarFigureFilter.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkExtrudePlanarFigureFilter_h
#define mitkExtrudePlanarFigureFilter_h
#include <mitkCommon.h>
#include <mitkVector.h>
#include <itkProcessObject.h>
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlanarFigure;
class Surface;
class MITKPLANARFIGURE_EXPORT ExtrudePlanarFigureFilter : public itk::ProcessObject
{
public:
- mitkClassMacro(ExtrudePlanarFigureFilter, itk::ProcessObject);
+ mitkClassMacroItkParent(ExtrudePlanarFigureFilter, itk::ProcessObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro(Length, ScalarType);
itkSetMacro(Length, ScalarType);
itkGetMacro(NumberOfSegments, unsigned int);
itkSetMacro(NumberOfSegments, unsigned int);
itkGetMacro(TwistAngle, ScalarType);
itkSetMacro(TwistAngle, ScalarType);
itkGetMacro(BendAngle, ScalarType);
itkSetClampMacro(BendAngle, ScalarType, -360, 360);
itkGetMacro(BendDirection, Vector2D);
mitkSetConstReferenceMacro(BendDirection, Vector2D);
itkGetMacro(FlipDirection, bool);
itkSetMacro(FlipDirection, bool);
itkGetMacro(FlipNormals, bool);
itkSetMacro(FlipNormals, bool);
- virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
- virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType& name);
+ virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
+ virtual DataObjectPointer MakeOutput(const DataObjectIdentifierType& name) override;
using Superclass::SetInput;
void SetInput(mitk::PlanarFigure* planarFigure);
using Superclass::GetOutput;
mitk::Surface* GetOutput();
protected:
ExtrudePlanarFigureFilter();
virtual ~ExtrudePlanarFigureFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
- void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
+ void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
ScalarType m_Length;
unsigned int m_NumberOfSegments;
ScalarType m_TwistAngle;
ScalarType m_BendAngle;
Vector2D m_BendDirection;
bool m_FlipDirection;
bool m_FlipNormals;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkImageToPlanarFigureFilter.h b/Modules/PlanarFigure/include/mitkImageToPlanarFigureFilter.h
index 39a19005e6..2b279940f4 100644
--- a/Modules/PlanarFigure/include/mitkImageToPlanarFigureFilter.h
+++ b/Modules/PlanarFigure/include/mitkImageToPlanarFigureFilter.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef IMAGETOPLANARFIGUREFILTER_H_HEADER_INCLUDED_C1E5E869
#define IMAGETOPLANARFIGUREFILTER_H_HEADER_INCLUDED_C1E5E869
#include "mitkCommon.h"
#include "mitkPlanarFigureSource.h"
#include "mitkImage.h"
namespace mitk {
//##Documentation
//## @brief Superclass of all classes having one or more Images as input and
//## generating PlanarFigures as output
//## @ingroup MitkPlanarFigureModule
class MITKPLANARFIGURE_EXPORT ImageToPlanarFigureFilter : public PlanarFigureSource
{
public:
mitkClassMacro(ImageToPlanarFigureFilter,PlanarFigureSource);
//itkFactorylessNewMacro(Self)
//itkCloneMacro(Self)
/** 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. */
using Superclass::SetInput;
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:
ImageToPlanarFigureFilter();
~ImageToPlanarFigureFilter();
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
/** 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();
+ virtual void GenerateInputRequestedRegion() override;
private:
void operator=(const Self&); //purposely not implemented
};
} // namespace mitk
#endif /* IMAGETOPLANARFIGUREFILTER_H_HEADER_INCLUDED_C1E5E869 */
diff --git a/Modules/PlanarFigure/include/mitkPlanarAngle.h b/Modules/PlanarFigure/include/mitkPlanarAngle.h
index 50ebae0d09..f31672bd99 100644
--- a/Modules/PlanarFigure/include/mitkPlanarAngle.h
+++ b/Modules/PlanarFigure/include/mitkPlanarAngle.h
@@ -1,90 +1,90 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_ANGLE_H_
#define _MITK_PLANAR_ANGLE_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure to display an angle
* through three control points
*/
class MITKPLANARFIGURE_EXPORT PlanarAngle : public PlanarFigure
{
public:
mitkClassMacro( PlanarAngle, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
public:
// Feature identifiers
const unsigned int FEATURE_ID_ANGLE;
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
/** \brief Angle has 3 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 3;
}
/** \brief Angle has 3 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 3;
}
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarAngle();
virtual ~PlanarAngle();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_ANGLE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarArrow.h b/Modules/PlanarFigure/include/mitkPlanarArrow.h
index d7d9a4ffdc..eb3b3aed69 100644
--- a/Modules/PlanarFigure/include/mitkPlanarArrow.h
+++ b/Modules/PlanarFigure/include/mitkPlanarArrow.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_ARROW_H_
#define _MITK_PLANAR_ARROW_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing an arrow
* through two control points
*/
class MITKPLANARFIGURE_EXPORT PlanarArrow : public PlanarFigure
{
public:
mitkClassMacro( PlanarArrow, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
/** \brief Line has 2 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 2;
}
/** \brief Line has 2 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 2;
}
void SetArrowTipScaleFactor( float scale );
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarArrow();
virtual ~PlanarArrow();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
// Feature identifiers
const unsigned int FEATURE_ID_LENGTH;
// ScaleFactor defining size of helper-lines in relation to display size
float m_ArrowTipScaleFactor;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_ARROW_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarBezierCurve.h b/Modules/PlanarFigure/include/mitkPlanarBezierCurve.h
index 0bb1fb776f..f15f649e7e 100644
--- a/Modules/PlanarFigure/include/mitkPlanarBezierCurve.h
+++ b/Modules/PlanarFigure/include/mitkPlanarBezierCurve.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarBezierCurve_h
#define mitkPlanarBezierCurve_h
#include <mitkPlanarFigure.h>
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class MITKPLANARFIGURE_EXPORT PlanarBezierCurve : public PlanarFigure
{
public:
mitkClassMacro(PlanarBezierCurve, PlanarFigure)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
unsigned int GetNumberOfSegments() const;
void SetNumberOfSegments(unsigned int numSegments);
- virtual unsigned int GetMaximumNumberOfControlPoints() const;
- virtual unsigned int GetMinimumNumberOfControlPoints() const;
- virtual bool IsHelperToBePainted(unsigned int index);
+ virtual unsigned int GetMaximumNumberOfControlPoints() const override;
+ virtual unsigned int GetMinimumNumberOfControlPoints() const override;
+ virtual bool IsHelperToBePainted(unsigned int index) override;
const unsigned int FEATURE_ID_LENGTH;
- virtual bool Equals(const mitk::PlanarFigure& other)const;
+ virtual bool Equals(const mitk::PlanarFigure& other)const override;
protected:
PlanarBezierCurve();
virtual ~PlanarBezierCurve();
mitkCloneMacro(Self)
- virtual void EvaluateFeaturesInternal();
- virtual void GenerateHelperPolyLine(double, unsigned int);
- virtual void GeneratePolyLine();
+ virtual void EvaluateFeaturesInternal() override;
+ virtual void GenerateHelperPolyLine(double, unsigned int) override;
+ virtual void GeneratePolyLine() override;
private:
Point2D ComputeDeCasteljauPoint(ScalarType t);
std::vector<mitk::Point2D> m_DeCasteljauPoints;
unsigned int m_NumberOfSegments;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarCircle.h b/Modules/PlanarFigure/include/mitkPlanarCircle.h
index f1f42e5a85..8522cc9d87 100644
--- a/Modules/PlanarFigure/include/mitkPlanarCircle.h
+++ b/Modules/PlanarFigure/include/mitkPlanarCircle.h
@@ -1,139 +1,139 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_CIRCLE_H_
#define _MITK_PLANAR_CIRCLE_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a circle
* through two control points
*/
class MITKPLANARFIGURE_EXPORT PlanarCircle : public PlanarFigure
{
public:
mitkClassMacro( PlanarCircle, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
- bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = false );
+ bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = false ) override;
/** \brief Circle has 2 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 2;
}
/** \brief Circle has 2 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 2;
}
/** \brief Sets the minimum radius
*/
void SetMinimumRadius( double radius )
{
m_MinRadius = radius;
}
/** \brief Gets the minimum radius
*/
double GetMinimumRadius()
{
return m_MinRadius;
}
/** \brief Sets the maximum radius
*/
void SetMaximumRadius( double radius )
{
m_MaxRadius = radius;
}
/** \brief Gets the minimum radius
*/
double GetMaximumRadius()
{
return m_MaxRadius;
}
void ActivateMinMaxRadiusContstraints( bool active )
{
m_MinMaxRadiusContraintsActive = active;
}
- virtual bool SetCurrentControlPoint( const Point2D& point );
+ virtual bool SetCurrentControlPoint( const Point2D& point ) override;
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarCircle();
virtual ~PlanarCircle();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Spatially constrain control points of second (orthogonal) line */
- virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point );
+ virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point ) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
// Feature identifiers
const unsigned int FEATURE_ID_RADIUS;
const unsigned int FEATURE_ID_DIAMETER;
const unsigned int FEATURE_ID_AREA;
//Member variables:
double m_MinRadius;
double m_MaxRadius;
bool m_MinMaxRadiusContraintsActive;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_CIRCLE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarCross.h b/Modules/PlanarFigure/include/mitkPlanarCross.h
index 1e7ef5abe7..917b3c6979 100644
--- a/Modules/PlanarFigure/include/mitkPlanarCross.h
+++ b/Modules/PlanarFigure/include/mitkPlanarCross.h
@@ -1,133 +1,133 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_CROSS_H_
#define _MITK_PLANAR_CROSS_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure modeling a cross with two orthogonal lines
* on a plane.
*
* The cross consists of two two orthogonal lines, which are defined by four control points
* lying on a plane. The two control points of the first line are freely placable within
* the bounds of the underlying 2D geometry, while the two control points of the second line
* are ensured to meet the following constraints:
*
* 1.) The lines must be orthogonal to each other
* 2.) The second line must lie within the 2D area defined by the first line
* 3.) The two lines must intersect (at least with their boundaries)
*
* When placing the second line interactively, a graphical helper polyline is provided to the
* user to indicate the position and orthogonal orientation of the line if it would be placed
* at the current mouse position.
*
* When modifying one of the lines by interactively moving its control points, the respective
* other line is deleted and the user is prompted to draw it again.
*
* The class provide a special mode for drawing single lines (SingleLineModeOn/Off); in this
* case, interaction stops after the first line has been placed.
*
* The class provides the lengths of both lines via the "feature" interface, ordered by size.
*
* \sa PlanarFigureMapper2D
*/
class MITKPLANARFIGURE_EXPORT PlanarCross : public PlanarFigure
{
public:
mitkClassMacro( PlanarCross, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Indicates whether the PlanarFigure shall represent only a single line instead of an
* orthogonal cross. */
void SetSingleLineMode( bool singleLineMode );
/** \brief Indicates whether the PlanarFigure shall represent only a single line instead of an
* orthogonal cross. */
bool GetSingleLineMode() const;
/** \brief Indicates whether the PlanarFigure shall represent only a single line instead of an
* orthogonal cross. */
itkBooleanMacro( SingleLineMode ); // No need to reimplement; calls SetSingleLineMode()
/** \brief PlanarCross has either two or four control points, depending on the operation mode. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return this->GetSingleLineMode() ? 2 : 4;
}
/** \brief PlanarCross has either two or four control points, depending on the operation mode. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return this->GetSingleLineMode() ? 2 : 4;
}
/** \brief The cross shall be reset to a single line when a control point is selected. */
- virtual bool ResetOnPointSelect();
+ virtual bool ResetOnPointSelect() override;
/** \brief Returns the number of features available for this PlanarCross (1 or 2). */
- virtual unsigned int GetNumberOfFeatures() const;
+ virtual unsigned int GetNumberOfFeatures() const override;
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarCross();
virtual ~PlanarCross();
mitkCloneMacro(Self);
/** \brief Spatially constrain control points of second (orthogonal) line */
- virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point );
+ virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point ) override;
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
// Feature identifiers
const unsigned int FEATURE_ID_LONGESTDIAMETER;
const unsigned int FEATURE_ID_SHORTAXISDIAMETER;
private:
/** Internal method for applying spatial constraints. */
virtual Point2D InternalApplyControlPointConstraints( unsigned int index, const Point2D& point );
};
} // namespace mitk
#endif //_MITK_PLANAR_CROSS_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarDoubleEllipse.h b/Modules/PlanarFigure/include/mitkPlanarDoubleEllipse.h
index f6a0f10298..839dbf7a54 100644
--- a/Modules/PlanarFigure/include/mitkPlanarDoubleEllipse.h
+++ b/Modules/PlanarFigure/include/mitkPlanarDoubleEllipse.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarDoubleEllipse_h
#define mitkPlanarDoubleEllipse_h
#include <mitkPlanarFigure.h>
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class MITKPLANARFIGURE_EXPORT PlanarDoubleEllipse : public PlanarFigure
{
public:
mitkClassMacro(PlanarDoubleEllipse, PlanarFigure);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
unsigned int GetNumberOfSegments() const;
void SetNumberOfSegments(unsigned int numSegments);
- virtual unsigned int GetMaximumNumberOfControlPoints() const;
- virtual unsigned int GetMinimumNumberOfControlPoints() const;
- virtual bool SetControlPoint(unsigned int index, const Point2D& point, bool createIfDoesNotExist = true);
+ virtual unsigned int GetMaximumNumberOfControlPoints() const override;
+ virtual unsigned int GetMinimumNumberOfControlPoints() const override;
+ virtual bool SetControlPoint(unsigned int index, const Point2D& point, bool createIfDoesNotExist = true) override;
const unsigned int FEATURE_ID_MAJOR_AXIS;
const unsigned int FEATURE_ID_MINOR_AXIS;
const unsigned int FEATURE_ID_THICKNESS;
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarDoubleEllipse();
virtual ~PlanarDoubleEllipse();
mitkCloneMacro(Self)
- virtual mitk::Point2D ApplyControlPointConstraints(unsigned int index, const Point2D& point);
- virtual void EvaluateFeaturesInternal();
- virtual void GenerateHelperPolyLine(double, unsigned int);
- virtual void GeneratePolyLine();
+ virtual mitk::Point2D ApplyControlPointConstraints(unsigned int index, const Point2D& point) override;
+ virtual void EvaluateFeaturesInternal() override;
+ virtual void GenerateHelperPolyLine(double, unsigned int) override;
+ virtual void GeneratePolyLine() override;
private:
unsigned int m_NumberOfSegments;
bool m_ConstrainCircle;
bool m_ConstrainThickness;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarEllipse.h b/Modules/PlanarFigure/include/mitkPlanarEllipse.h
index 4efc43a641..9ea8b59c89 100644
--- a/Modules/PlanarFigure/include/mitkPlanarEllipse.h
+++ b/Modules/PlanarFigure/include/mitkPlanarEllipse.h
@@ -1,142 +1,142 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_ELLIPSE_H_
#define _MITK_PLANAR_ELLIPSE_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a circle
* through two control points
*/
class MITKPLANARFIGURE_EXPORT PlanarEllipse : public PlanarFigure
{
public:
mitkClassMacro( PlanarEllipse, PlanarFigure )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
- virtual void PlaceFigure( const Point2D &point );
+ virtual void PlaceFigure( const Point2D &point ) override;
- bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = true );
+ bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = true ) override;
/** \brief Ellipse has 3 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 4;
}
/** \brief Ellipse has 3 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 4;
}
/** \brief Sets the minimum radius
*/
void SetMinimumRadius( double radius )
{
m_MinRadius = radius;
}
/** \brief Gets the minimum radius
*/
double GetMinimumRadius()
{
return m_MinRadius;
}
/** \brief Sets the maximum radius
*/
void SetMaximumRadius( double radius )
{
m_MaxRadius = radius;
}
/** \brief Gets the minimum radius
*/
double GetMaximumRadius()
{
return m_MaxRadius;
}
void ActivateMinMaxRadiusContstraints( bool active )
{
m_MinMaxRadiusContraintsActive = active;
}
/** \brief Treat ellipse as circle (equal radii)
*/
void SetTreatAsCircle( bool active )
{
m_TreatAsCircle = active;
}
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
const unsigned int FEATURE_ID_MAJOR_AXIS;
const unsigned int FEATURE_ID_MINOR_AXIS;
protected:
PlanarEllipse();
virtual ~PlanarEllipse();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Spatially constrain control points of second (orthogonal) line */
- virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point );
+ virtual Point2D ApplyControlPointConstraints( unsigned int index, const Point2D& point ) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
//Member variables:
double m_MinRadius;
double m_MaxRadius;
bool m_MinMaxRadiusContraintsActive;
bool m_TreatAsCircle;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_ELLIPSE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigure.h b/Modules/PlanarFigure/include/mitkPlanarFigure.h
index 159eb3fd51..11f6a31963 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigure.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigure.h
@@ -1,406 +1,406 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_FIGURE_H_
#define _MITK_PLANAR_FIGURE_H_
#include <MitkPlanarFigureExports.h>
#include "mitkBaseData.h"
#include "mitkCommon.h"
#include <deque>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Base-class for geometric planar (2D) figures, such as
* lines, circles, rectangles, polygons, etc.
*
* \warning Currently does not support time-resolved data handling
*
* Behavior and appearance of PlanarFigures are controlled by various properties; for a detailed
* list of appearance properties see mitk::PlanarFigureMapper2D
*
* The following properties control general PlanarFigure behavior:
*
* <ul>
* <li>"selected": true if the planar figure is selected
* <li>"planarfigure.ishovering": true if the mouse "hovers" over the planar figure
* <li>"planarfigure.iseditable": true if the planar figure can be edited (otherwise,
* it can only be picked/selected, but its control points cannot be edited); default is true
* <li>"planarfigure.isextendable": true if new control points can be inserted into the list of control points;
* default is false
* </ul>
*
*
* TODO: Implement local 2D transform (including center of rotation...)
*
*/
class MITKPLANARFIGURE_EXPORT PlanarFigure : public BaseData
{
public:
mitkClassMacro( PlanarFigure, BaseData )
itkCloneMacro( Self )
typedef Point2D PolyLineElement;
typedef itk::VectorContainer< unsigned long, bool> BoolContainerType;
typedef std::deque< Point2D > ControlPointListType;
typedef std::vector< PolyLineElement > PolyLineType;
/** \brief Sets the 2D geometry on which this figure will be placed.
*
* In most cases, this is a Geometry already owned by another object, e.g.
* describing the slice of the image on which measurements will be
* performed.
*/
virtual void SetPlaneGeometry( mitk::PlaneGeometry *geometry );
/** \brief Returns (previously set) 2D geometry of this figure. */
virtual const PlaneGeometry *GetPlaneGeometry() const;
/** \brief True if the planar figure is closed.
*
* Default is false. The "closed" boolean property must be set in sub-classes. */
virtual bool IsClosed() const;
/** \brief True if the planar figure has been placed (and can be
* displayed/interacted with). */
virtual bool IsPlaced() const { return m_FigurePlaced; };
/** \brief Place figure at the given point (in 2D index coordinates) onto
* the given 2D geometry.
*
* By default, the first two control points of the figure are set to the
* passed point. Further points can be set via AddControlPoint(), if the
* current number of control points is below the maximum number of control
* points.
*
* Can be re-implemented in sub-classes as needed.
*/
virtual void PlaceFigure( const Point2D& point );
/**
* \brief Adds / inserts new control-points
*
* This method adds a new control-point with the coordinates defined by point at the given index.
* If 'index' == -1 or index is greater than the number of control-points the new point is appended
* to the back of the list of control points.
* If a control-point already exists for 'index', an additional point is inserted at that position.
* It is not possible to add more points if the maximum number of control-points (GetMaximumNumberOfControlPoints())
* has been reached.
*/
virtual bool AddControlPoint( const Point2D& point, int index = -1 );
virtual bool SetControlPoint( unsigned int index, const Point2D& point, bool createIfDoesNotExist = false);
virtual bool SetCurrentControlPoint( const Point2D& point );
/** \brief Returns the current number of 2D control points defining this figure. */
unsigned int GetNumberOfControlPoints() const;
/** \brief Returns the minimum number of control points needed to represent
* this figure.
*
* Must be implemented in sub-classes.
*/
virtual unsigned int GetMinimumNumberOfControlPoints() const = 0;
/** \brief Returns the maximum number of control points allowed for
* this figure (e.g. 3 for triangles).
*
* Must be implemented in sub-classes.
*/
virtual unsigned int GetMaximumNumberOfControlPoints() const = 0;
/** \brief Selects currently active control points. */
virtual bool SelectControlPoint( unsigned int index );
/** \brief Deselect control point; no control point active. */
virtual bool DeselectControlPoint();
/** \brief Return currently selected control point. */
virtual int GetSelectedControlPoint() const { return m_SelectedControlPoint; }
/** \brief Returns specified control point in 2D world coordinates. */
Point2D GetControlPoint( unsigned int index ) const;
/** \brief Returns specified control point in world coordinates. */
Point3D GetWorldControlPoint( unsigned int index ) const;
/** \brief Returns the polyline representing the planar figure
* (for rendering, measurements, etc.). */
const PolyLineType GetPolyLine(unsigned int index);
/** \brief Returns the polyline representing the planar figure
* (for rendering, measurments, etc.). */
const PolyLineType GetPolyLine(unsigned int index) const;
/** \brief Returns the polyline that should be drawn the same size at every scale
* (for text, angles, etc.). */
const PolyLineType GetHelperPolyLine( unsigned int index, double mmPerDisplayUnit, unsigned int displayHeight );
/** \brief Sets the position of the PreviewControlPoint. Automatically sets it visible.*/
void SetPreviewControlPoint( const Point2D& point );
/** \brief Marks the PreviewControlPoint as invisible.*/
void ResetPreviewContolPoint();
/** \brief Returns whether or not the PreviewControlPoint is visible.*/
bool IsPreviewControlPointVisible();
/** \brief Returns the coordinates of the PreviewControlPoint. */
Point2D GetPreviewControlPoint();
/** \brief Returns the number of features available for this PlanarFigure
* (such as, radius, area, ...). */
virtual unsigned int GetNumberOfFeatures() const;
/** \brief Returns the name (identifier) of the specified features. */
const char *GetFeatureName( unsigned int index ) const;
/** \brief Returns the physical unit of the specified features. */
const char *GetFeatureUnit( unsigned int index ) const;
/** Returns quantity of the specified feature (e.g., length, radius,
* area, ... ) */
double GetQuantity( unsigned int index ) const;
/** \brief Returns true if the feature with the specified index exists and
* is active (an inactive feature may e.g. be the area of a non-closed
* polygon. */
bool IsFeatureActive( unsigned int index ) const;
/** \brief Returns true if the feature with the specified index exists and is set visible */
bool IsFeatureVisible( unsigned int index ) const;
/** \brief Defines if the feature with the specified index will be shown as an
* overlay in the RenderWindow */
void SetFeatureVisible( unsigned int index, bool visible );
/** \brief Calculates quantities of all features of this planar figure. */
virtual void EvaluateFeatures();
/** \brief Intherited from parent */
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
/** \brief Intherited from parent */
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
/** \brief Intherited from parent */
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/** \brief Intherited from parent */
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
/** \brief Intherited from parent */
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
/** \brief Returns the current number of polylines */
virtual unsigned short GetPolyLinesSize();
/** \brief Returns the current number of helperpolylines */
virtual unsigned short GetHelperPolyLinesSize();
/** \brief Returns whether a helper polyline should be painted or not */
virtual bool IsHelperToBePainted(unsigned int index);
/** \brief Returns true if the planar figure is reset to "add points" mode
* when a point is selected.
*
* Default return value is false. Subclasses can overwrite this method and
* execute any reset / initialization statements required. */
virtual bool ResetOnPointSelect();
/** \brief removes the point with the given index from the list of controlpoints. */
virtual void RemoveControlPoint( unsigned int index );
/** \brief Removes last control point */
virtual void RemoveLastControlPoint();
/** \brief Allow sub-classes to apply constraints on control points.
*
* Sub-classes can define spatial constraints to certain control points by
* overwriting this method and returning a constrained point. By default,
* the points are constrained by the image bounds. */
virtual Point2D ApplyControlPointConstraints( unsigned int /*index*/, const Point2D& point );
/**
* \brief Compare two PlanarFigure objects
* Note: all subclasses have to implement the method on their own.
*/
virtual bool Equals(const mitk::PlanarFigure& other) const;
protected:
PlanarFigure();
virtual ~PlanarFigure();
PlanarFigure(const Self& other);
/** \brief Set the initial number of control points of the planar figure */
void ResetNumberOfControlPoints( int numberOfControlPoints );
/** Adds feature (e.g., circumference, radius, angle, ...) to feature vector
* of a planar figure object and returns integer ID for the feature element.
* Should be called in sub-class constructors. */
virtual unsigned int AddFeature( const char *featureName, const char *unitName );
/** Sets the name of the specified feature. INTERNAL METHOD. */
void SetFeatureName( unsigned int index, const char *featureName );
/** Sets the physical unit of the specified feature. INTERNAL METHOD. */
void SetFeatureUnit( unsigned int index, const char *unitName );
/** Sets quantity of the specified feature. INTERNAL METHOD. */
void SetQuantity( unsigned int index, double quantity );
/** Sets the specified feature as active. INTERAL METHOD. */
void ActivateFeature( unsigned int index );
/** Sets the specified feature as active. INTERAL METHOD. */
void DeactivateFeature( unsigned int index );
/** \brief Generates the poly-line representation of the planar figure.
* Must be implemented in sub-classes. */
virtual void GeneratePolyLine() = 0;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.
* Must be implemented in sub-classes. */
virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) = 0;
/** \brief Calculates quantities of all features of this planar figure.
* Must be implemented in sub-classes. */
virtual void EvaluateFeaturesInternal() = 0;
/** \brief Initializes the TimeGeometry describing the (time-resolved)
* geometry of this figure. Note that each time step holds one PlaneGeometry.
*/
- virtual void InitializeTimeGeometry( unsigned int timeSteps = 1 );
+ virtual void InitializeTimeGeometry( unsigned int timeSteps = 1 ) override;
/** \brief defines the number of PolyLines that will be available */
void SetNumberOfPolyLines( unsigned int numberOfPolyLines );
/** \brief Append a point to the PolyLine # index */
void AppendPointToPolyLine( unsigned int index, PolyLineElement element );
/** \brief clears the list of PolyLines. Call before re-calculating a new Polyline. */
void ClearPolyLines();
/** \brief defines the number of HelperPolyLines that will be available */
void SetNumberOfHelperPolyLines( unsigned int numberOfHelperPolyLines );
/** \brief Append a point to the HelperPolyLine # index */
void AppendPointToHelperPolyLine( unsigned int index, PolyLineElement element );
/** \brief clears the list of HelperPolyLines. Call before re-calculating a new HelperPolyline. */
void ClearHelperPolyLines();
- virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const override;
ControlPointListType m_ControlPoints;
unsigned int m_NumberOfControlPoints;
// Currently selected control point; -1 means no point selected
int m_SelectedControlPoint;
std::vector<PolyLineType> m_PolyLines;
std::vector<PolyLineType> m_HelperPolyLines;
BoolContainerType::Pointer m_HelperPolyLinesToBePainted;
// this point is used to store the coordiantes an additional 'ControlPoint' that is rendered
// when the mouse cursor is above the figure (and not a control-point) and when the
// property 'planarfigure.isextendable' is set to true
Point2D m_PreviewControlPoint;
bool m_PreviewControlPointVisible;
bool m_FigurePlaced;
private:
// not implemented to prevent PlanarFigure::New() calls which would create an itk::Object.
static Pointer New();
struct Feature
{
Feature( const char *name, const char *unit )
: Name( name ), Unit( unit ), Quantity( 0.0 ), Active( true ), Visible( true )
{
}
std::string Name;
std::string Unit;
double Quantity;
bool Active;
bool Visible;
};
virtual itk::LightObject::Pointer InternalClone() const = 0;
PlaneGeometry *m_PlaneGeometry;
bool m_PolyLineUpToDate;
bool m_HelperLinesUpToDate;
bool m_FeaturesUpToDate;
// Vector of features available for this geometric figure
typedef std::vector< Feature > FeatureVectorType;
FeatureVectorType m_Features;
unsigned long m_FeaturesMTime;
// this pair is used to store the mmInDisplayUnits (m_DisplaySize.first) and the displayHeight (m_DisplaySize.second)
// that the helperPolyLines have been calculated for.
// It's used to determine whether or not GetHelperPolyLine() needs to recalculate the HelperPolyLines.
std::pair<double, unsigned int> m_DisplaySize;
};
MITKPLANARFIGURE_EXPORT bool Equal( const mitk::PlanarFigure& leftHandSide, const mitk::PlanarFigure& rightHandSide, ScalarType eps, bool verbose );
} // namespace mitk
#endif //_MITK_PLANAR_FIGURE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureControlPointStyleProperty.h b/Modules/PlanarFigure/include/mitkPlanarFigureControlPointStyleProperty.h
index 8661f1e370..a0f100b4d0 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureControlPointStyleProperty.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureControlPointStyleProperty.h
@@ -1,96 +1,96 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarFigureControlPointStyleProperty_h
#define mitkPlanarFigureControlPointStyleProperty_h
#include "mitkEnumerationProperty.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
/**
* \brief Defines the rendering style of control points for PlanarFigure objects.
* \sa mitk::PlanarFigureMapper2D
* @ingroup MitkPlanarFigureModule
*
* Used by PlanarFigureMapper2D to determine which of several control point shapes to use.
* Currently this is basically the choice between squares and circles. If more options
* are implemented, this class should be enhanced.
*
* After construction, the default shape is a square.
*
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureControlPointStyleProperty : public EnumerationProperty
{
public:
mitkClassMacro( PlanarFigureControlPointStyleProperty, EnumerationProperty );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(PlanarFigureControlPointStyleProperty, const IdType&);
mitkNewMacro1Param(PlanarFigureControlPointStyleProperty, const std::string&);
typedef enum
{
Square, Circle
} Shape;
virtual Shape GetShape();
virtual void SetShape( Shape );
protected:
PlanarFigureControlPointStyleProperty( );
PlanarFigureControlPointStyleProperty( const IdType &value );
/**
* Constructor. Sets the decoration type to the given value. If it is not
* valid, the representation is set to none
*/
PlanarFigureControlPointStyleProperty( const std::string &value );
/**
* this function is overridden as protected, so that the user may not add
* additional invalid types.
*/
- virtual bool AddEnum( const std::string &name, const IdType &id );
+ virtual bool AddEnum( const std::string &name, const IdType &id ) override;
/**
* Adds the standard enumeration types with corresponding strings.
*/
virtual void AddEnumTypes();
private:
// purposely not implemented
PlanarFigureControlPointStyleProperty& operator=(const PlanarFigureControlPointStyleProperty&);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
} // end of namespace mitk
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureInteractor.h b/Modules/PlanarFigure/include/mitkPlanarFigureInteractor.h
index c14db8f8c3..728de743dc 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureInteractor.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureInteractor.h
@@ -1,207 +1,207 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED
#define MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED
#include <MitkPlanarFigureExports.h>
#include "mitkCommon.h"
#include "mitkNumericTypes.h"
#include "mitkDataInteractor.h"
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
namespace mitk
{
class DataNode;
class PlaneGeometry;
class DisplayGeometry;
class PlanarFigure;
class PositionEvent;
class BaseRenderer;
class InteractionPositionEvent;
class StateMachineAction;
#pragma GCC visibility push(default)
// Define events for PlanarFigure interaction notifications
itkEventMacro( PlanarFigureEvent, itk::AnyEvent );
itkEventMacro( StartPlacementPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( EndPlacementPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( SelectPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( StartInteractionPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( EndInteractionPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( StartHoverPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( EndHoverPlanarFigureEvent, PlanarFigureEvent );
itkEventMacro( ContextMenuPlanarFigureEvent, PlanarFigureEvent );
#pragma GCC visibility pop
/**
* \brief Interaction with mitk::PlanarFigure objects via control-points
*
* @ingroup MitkPlanarFigureModule
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureInteractor : public DataInteractor
{
public:
mitkClassMacro(PlanarFigureInteractor, DataInteractor);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Sets the amount of precision */
void SetPrecision( ScalarType precision );
/** \brief Sets the minimal distance between two control points. */
void SetMinimumPointDistance( ScalarType minimumDistance );
protected:
PlanarFigureInteractor();
virtual ~PlanarFigureInteractor();
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
//////// Conditions ////////
bool CheckFigurePlaced( const InteractionEvent* interactionEvent );
bool CheckFigureHovering( const InteractionEvent* interactionEvent );
bool CheckControlPointHovering( const InteractionEvent* interactionEvent );
bool CheckSelection( const InteractionEvent* interactionEvent );
bool CheckPointValidity( const InteractionEvent* interactionEvent );
bool CheckFigureFinished( const InteractionEvent* interactionEvent );
bool CheckResetOnPointSelect( const InteractionEvent* interactionEvent );
bool CheckFigureOnRenderingGeometry( const InteractionEvent* interactionEvent );
bool CheckMinimalFigureFinished( const InteractionEvent* interactionEvent );
bool CheckFigureIsExtendable( const InteractionEvent* interactionEvent );
//////// Actions ////////
bool FinalizeFigure( StateMachineAction*, InteractionEvent* interactionEvent );
bool MoveCurrentPoint(StateMachineAction*, InteractionEvent* interactionEvent);
bool DeselectPoint(StateMachineAction*, InteractionEvent* interactionEvent);
bool AddPoint(StateMachineAction*, InteractionEvent* interactionEvent);
bool AddInitialPoint(StateMachineAction*, InteractionEvent* interactionEvent);
bool StartHovering( StateMachineAction*, InteractionEvent* interactionEvent );
bool EndHovering( StateMachineAction*, InteractionEvent* interactionEvent );
bool DeleteFigure( StateMachineAction*, InteractionEvent* interactionEvent );
bool SetPreviewPointPosition( StateMachineAction*, InteractionEvent* interactionEvent );
bool HidePreviewPoint( StateMachineAction*, InteractionEvent* interactionEvent );
bool HideControlPoints( StateMachineAction*, InteractionEvent* interactionEvent );
bool RemoveSelectedPoint(StateMachineAction*, InteractionEvent* interactionEvent);
bool RequestContextMenu(StateMachineAction*, InteractionEvent* interactionEvent);
bool SelectFigure( StateMachineAction*, InteractionEvent* interactionEvent );
bool SelectPoint( StateMachineAction*, InteractionEvent* interactionEvent );
bool EndInteraction( StateMachineAction*, InteractionEvent* interactionEvent );
/**
\brief Used when clicking to determine if a point is too close to the previous point.
*/
bool IsMousePositionAcceptableAsNewControlPoint( const mitk::InteractionPositionEvent* positionEvent, const PlanarFigure* );
bool TransformPositionEventToPoint2D( const InteractionPositionEvent* positionEvent,
const PlaneGeometry *planarFigureGeometry,
Point2D &point2D );
bool TransformObjectToDisplay( const mitk::Point2D &point2D,
mitk::Point2D &displayPoint,
const mitk::PlaneGeometry *objectGeometry,
const mitk::PlaneGeometry *rendererGeometry,
const mitk::DisplayGeometry *displayGeometry ) const;
/** \brief Returns true if the first specified point is in proximity of the line defined
* the other two point; false otherwise.
*
* Proximity is defined as the rectangle around the line with pre-defined distance
* from the line. */
bool IsPointNearLine( const mitk::Point2D& point,
const mitk::Point2D& startPoint, const mitk::Point2D& endPoint, mitk::Point2D& projectedPoint ) const;
/** \brief Returns true if the point contained in the passed event (in display coordinates)
* is over the planar figure (with a pre-defined tolerance range); false otherwise. */
int IsPositionOverFigure(
const InteractionPositionEvent* positionEvent,
PlanarFigure *planarFigure,
const PlaneGeometry *planarFigureGeometry,
const PlaneGeometry *rendererGeometry,
const DisplayGeometry *displayGeometry,
Point2D& pointProjectedOntoLine) const;
/** \brief Returns the index of the marker (control point) over which the point contained
* in the passed event (in display coordinates) currently is; -1 if the point is not over
* a marker. */
int IsPositionInsideMarker(
const InteractionPositionEvent* positionEvent,
const PlanarFigure *planarFigure,
const PlaneGeometry *planarFigureGeometry,
const PlaneGeometry *rendererGeometry,
const DisplayGeometry *displayGeometry ) const;
void LogPrintPlanarFigureQuantities( const PlanarFigure *planarFigure );
- virtual void ConfigurationChanged();
+ virtual void ConfigurationChanged() override;
private:
/** \brief to store the value of precision to pick a point */
ScalarType m_Precision;
/** \brief Store the minimal distance between two control points. */
ScalarType m_MinimumPointDistance;
/** \brief True if the mouse is currently hovering over the image. */
bool m_IsHovering;
bool m_LastPointWasValid;
//mitk::PlanarFigure::Pointer m_PlanarFigure;
};
}
#endif // MITKPLANARFIGUREINTERACTOR_H_HEADER_INCLUDED
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureMapper2D.h b/Modules/PlanarFigure/include/mitkPlanarFigureMapper2D.h
index b60f0ea6f4..03d02c14ed 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureMapper2D.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureMapper2D.h
@@ -1,314 +1,314 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_PLANAR_FIGURE_MAPPER_2D_H_
#define MITK_PLANAR_FIGURE_MAPPER_2D_H_
#include "mitkCommon.h"
#include <MitkPlanarFigureExports.h>
#include "mitkGLMapper.h"
#include "mitkPlanarFigure.h"
#include "mitkPlanarFigureControlPointStyleProperty.h"
namespace mitk {
class BaseRenderer;
class Contour;
class TextOverlay2D;
/**
* \brief OpenGL-based mapper to render display sub-class instances of mitk::PlanarFigure
*
* The appearance of planar figures can be configured through properties. If no properties are specified,
* default values will be used. There are four elements a planar figure consists of:
*
* <ol>
* <li>"line": the main line segments of the planar figure (note: text is drawn in the same style)
* <li>"helperline": additional line segments of planar figures, such as arrow tips, arches of angles, etc.
* <li>"outline": background which is drawn behind the lines and helperlines of the planar figure (optional)
* <li>"marker": the markers (control points) of a planar figure
* <li>"markerline": the lines by which markers (control points) are surrounded
* </ol>
*
* In the following, all appearance-related planar figure properties are listed:
*
* <ol>
* <li>General properties for the planar figure
* <ul>
* <li>"planarfigure.drawoutline": if true, the "outline" lines is drawn
* <li>"planarfigure.drawquantities": if true, the quantities (text) associated with the planar figure is drawn
* <li>"planarfigure.drawname": if true, the name specified by the dataNode is drawn
* <li>"planarfigure.drawshadow": if true, a black shadow is drawn around the planar figure
* <li>"planarfigure.controlpointshape": style of the control points (enum)
* </ul>
* <li>Line widths of planar figure elements
* <ul>
* <li>"planarfigure.line.width": width of "line" segments (float value, in mm)
* <li>"planarfigure.shadow.widthmodifier": the width of the shadow is defined by width of the "line" * this modifier
* <li>"planarfigure.outline.width": width of "outline" segments (float value, in mm)
* <li>"planarfigure.helperline.width": width of "helperline" segments (float value, in mm)
* </ul>
* <li>Color/opacity of planar figure elements in normal mode (unselected)
* <ul>
* <li>"planarfigure.default.line.color"
* <li>"planarfigure.default.line.opacity"
* <li>"planarfigure.default.outline.color"
* <li>"planarfigure.default.outline.opacity"
* <li>"planarfigure.default.helperline.color"
* <li>"planarfigure.default.helperline.opacity"
* <li>"planarfigure.default.markerline.color"
* <li>"planarfigure.default.markerline.opacity"
* <li>"planarfigure.default.marker.color"
* <li>"planarfigure.default.marker.opacity"
* </ul>
* <li>Color/opacity of planar figure elements in hover mode (mouse-over)
* <ul>
* <li>"planarfigure.hover.line.color"
* <li>"planarfigure.hover.line.opacity"
* <li>"planarfigure.hover.outline.color"
* <li>"planarfigure.hover.outline.opacity"
* <li>"planarfigure.hover.helperline.color"
* <li>"planarfigure.hover.helperline.opacity"
* <li>"planarfigure.hover.markerline.color"
* <li>"planarfigure.hover.markerline.opacity"
* <li>"planarfigure.hover.marker.color"
* <li>"planarfigure.hover.marker.opacity"
* </ul>
* <li>Color/opacity of planar figure elements in selected mode
* <ul>
* <li>"planarfigure.selected.line.color"
* <li>"planarfigure.selected.line.opacity"
* <li>"planarfigure.selected.outline.color"
* <li>"planarfigure.selected.outline.opacity"
* <li>"planarfigure.selected.helperline.color"
* <li>"planarfigure.selected.helperline.opacity"
* <li>"planarfigure.selected.markerline.color;"
* <li>"planarfigure.selected.markerline.opacity"
* <li>"planarfigure.selected.marker.color"
* <li>"planarfigure.selected.marker.opacity"
* </ul>
* </ol>
*
* @ingroup MitkPlanarFigureModule
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureMapper2D : public GLMapper
{
public:
mitkClassMacro(PlanarFigureMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* reimplemented from Baseclass
*/
- virtual void Paint(BaseRenderer * renderer);
+ virtual void Paint(BaseRenderer * renderer) override;
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
protected:
enum PlanarFigureDisplayMode
{
PF_DEFAULT = 0,
PF_HOVER = 1,
PF_SELECTED = 2,
PF_COUNT = 3 //helper variable
};
PlanarFigureMapper2D();
virtual ~PlanarFigureMapper2D();
/**
* \brief Renders all the lines defined by the PlanarFigure.
*
* This method renders all the lines that are defined by the PlanarFigure.
* That includes the mainlines and helperlines as well as their shadows
* and the outlines.
*
* This method already takes responsibility for the setting of the relevant
* openGL attributes to reduce unnecessary setting of these attributes.
* (e.g. no need to set color twice if it's the same)
*/
void RenderLines( PlanarFigureDisplayMode lineDisplayMode,
mitk::PlanarFigure * planarFigure,
mitk::Point2D &anchorPoint,
mitk::PlaneGeometry * planarFigurePlaneGeometry,
const mitk::PlaneGeometry * rendererPlaneGeometry,
mitk::DisplayGeometry * displayGeometry );
/**
* \brief Renders the quantities of the figure below the text annotations.
*/
void RenderQuantities( mitk::PlanarFigure * planarFigure,
mitk::BaseRenderer * renderer,
mitk::Point2D anchorPoint,
double &annotationOffset,
float globalOpacity,
PlanarFigureDisplayMode lineDisplayMode );
/**
* \brief Renders the text annotations.
*/
void RenderAnnotations( mitk::BaseRenderer * renderer,
std::string name,
mitk::Point2D anchorPoint,
float globalOpacity,
PlanarFigureDisplayMode lineDisplayMode,
double &annotationOffset );
/**
* \brief Renders the control-points.
*/
void RenderControlPoints( mitk::PlanarFigure * planarFigure,
PlanarFigureDisplayMode lineDisplayMode,
mitk::PlaneGeometry * planarFigurePlaneGeometry,
const mitk::PlaneGeometry * rendererPlaneGeometry,
mitk::DisplayGeometry * displayGeometry );
void TransformObjectToDisplay(
const mitk::Point2D &point2D,
mitk::Point2D &displayPoint,
const mitk::PlaneGeometry *objectGeometry,
const mitk::PlaneGeometry *rendererGeometry,
const mitk::DisplayGeometry *displayGeometry );
void DrawMarker(
const mitk::Point2D &point,
float* lineColor,
float lineOpacity,
float* markerColor,
float markerOpacity,
float lineWidth,
PlanarFigureControlPointStyleProperty::Shape shape,
const mitk::PlaneGeometry *objectGeometry,
const mitk::PlaneGeometry *rendererGeometry,
const mitk::DisplayGeometry *displayGeometry );
/**
* \brief Actually paints the polyline defined by the figure.
*/
void PaintPolyLine( mitk::PlanarFigure::PolyLineType vertices,
bool closed,
Point2D& anchorPoint,
const PlaneGeometry* planarFigurePlaneGeometry,
const PlaneGeometry* rendererPlaneGeometry,
const DisplayGeometry* displayGeometry);
/**
* \brief Internally used by RenderLines() to draw the mainlines using
* PaintPolyLine().
*/
void DrawMainLines( mitk::PlanarFigure* figure,
Point2D& anchorPoint,
const PlaneGeometry* planarFigurePlaneGeometry,
const PlaneGeometry* rendererPlaneGeometry,
const DisplayGeometry* displayGeometry) ;
/**
* \brief Internally used by RenderLines() to draw the helperlines using
* PaintPolyLine().
*/
void DrawHelperLines( mitk::PlanarFigure* figure,
Point2D& anchorPoint,
const PlaneGeometry* planarFigurePlaneGeometry,
const PlaneGeometry* rendererPlaneGeometry,
const DisplayGeometry* displayGeometry) ;
void InitializeDefaultPlanarFigureProperties();
void InitializePlanarFigurePropertiesFromDataNode( const mitk::DataNode* node );
void SetColorProperty( float property[3][3], PlanarFigureDisplayMode mode, float red, float green, float blue )
{
property[mode][0] = red;
property[mode][1] = green;
property[mode][2] = blue;
}
void SetFloatProperty( float* property, PlanarFigureDisplayMode mode, float value )
{
property[mode] = value;
}
/**
* \brief Callback that sets m_NodeModified to true.
*
* This method set the bool flag m_NodeModified to true. It's a callback
* that is executed when a itk::ModifiedEvet is invoked on our
* DataNode.
*/
void OnNodeModified();
private:
bool m_IsSelected;
bool m_IsHovering;
bool m_DrawOutline;
bool m_DrawQuantities;
bool m_DrawShadow;
bool m_DrawControlPoints;
bool m_DrawName;
bool m_DrawDashed;
bool m_DrawHelperDashed;
// the width of the shadow is defined as 'm_LineWidth * m_ShadowWidthFactor'
float m_LineWidth;
float m_ShadowWidthFactor;
float m_OutlineWidth;
float m_HelperlineWidth;
//float m_PointWidth;
PlanarFigureControlPointStyleProperty::Shape m_ControlPointShape;
float m_LineColor[3][3];
float m_LineOpacity[3];
float m_OutlineColor[3][3];
float m_OutlineOpacity[3];
float m_HelperlineColor[3][3];
float m_HelperlineOpacity[3];
float m_MarkerlineColor[3][3];
float m_MarkerlineOpacity[3];
float m_MarkerColor[3][3];
float m_MarkerOpacity[3];
// Bool flag that represents whether or not the DataNode has been modified.
bool m_NodeModified;
// Observer-tag for listening to itk::ModifiedEvents on the DataNode
unsigned long m_NodeModifiedObserverTag;
// Bool flag that indicates if a node modified observer was added
bool m_NodeModifiedObserverAdded;
itk::SmartPointer<mitk::TextOverlay2D> m_AnnotationOverlay;
itk::SmartPointer<mitk::TextOverlay2D> m_QuantityOverlay;
};
} // namespace mitk
#endif /* MITK_PLANAR_FIGURE_MAPPER_2D_H_ */
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureObjectFactory.h b/Modules/PlanarFigure/include/mitkPlanarFigureObjectFactory.h
index 4c441aabcc..764d01e884 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureObjectFactory.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureObjectFactory.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PLANARFIGUREOBJECTFACTORY_H_INCLUDED
#define PLANARFIGUREOBJECTFACTORY_H_INCLUDED
#include "mitkCoreObjectFactoryBase.h"
#include <MitkPlanarFigureExports.h>
namespace mitk {
class MITKPLANARFIGURE_EXPORT PlanarFigureObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(PlanarFigureObjectFactory,CoreObjectFactoryBase)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
~PlanarFigureObjectFactory();
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
- virtual void SetDefaultProperties(mitk::DataNode* node);
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
- virtual const char* GetFileExtensions();
+ virtual const char* GetFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
- virtual const char* GetSaveFileExtensions();
+ virtual const char* GetSaveFileExtensions() override;
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
DEPRECATED(void RegisterIOFactories());
protected:
PlanarFigureObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
private:
itk::ObjectFactoryBase::Pointer m_PlanarFigureIOFactory;
itk::ObjectFactoryBase::Pointer m_PlanarFigureWriterFactory;
};
}
#endif // PLANARFIGUREOBJECTFACTORY_H_INCLUDED
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureReader.h b/Modules/PlanarFigure/include/mitkPlanarFigureReader.h
index b5de856340..391098dc9b 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureReader.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureReader.h
@@ -1,156 +1,156 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PlanarFigureReader__H_
#define _MITK_PlanarFigureReader__H_
#include "mitkPlanarFigureSource.h"
#include <MitkPlanarFigureExports.h>
#include "mitkFileReader.h"
#include <list>
class TiXmlElement;
namespace mitk
{
/**
* @brief reads xml representations of mitk::PlanarFigure from a file
*
* Reader for xml files containing one or multiple xml represenations of
* mitk::PlanarFigure. If multiple mitk::PlanarFigure are stored in one file,
* these are assigned to multiple outputs of the filter.
* @ingroup MitkPlanarFigureModule
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureReader: public PlanarFigureSource, public FileReader
{
public:
mitkClassMacro( PlanarFigureReader, FileReader );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* @brief Sets the filename of the file to be read
* @param _arg the filename of the point set xml-file
*/
itkSetStringMacro( FileName );
/**
* @brief Returns the filename of the point set xml-file.
* @returns the filename of the point set xml-file.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple load not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple load not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple load not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple load not (yet) supported
*/
itkGetStringMacro( FilePattern );
static bool CanReadFile(const std::string filename, const std::string filePrefix, const std::string filePattern);
/**
* @returns whether the last read attempt was successful or not.
*/
itkGetConstMacro(Success, bool);
protected:
typedef std::list< double > DoubleList;
/**
* Constructor
*/
PlanarFigureReader();
/**
* Virtual destructor
*/
virtual ~PlanarFigureReader();
/**
* Actually reads the point sets from the given file
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/**
* Does nothing in the current implementation
*/
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/**
* Resizes the output-objects according to the given number.
* @param num the new number of output objects.
*/
virtual void ResizeOutputs( const unsigned int& num );
/**
* Checks if the given file has appropriate
* read access.
* @returns true if the file exists and may be read
* or false otherwise.
*/
virtual int CanReadFile (const char *name);
/**
* \brief parses the element for the attributes x,y,z and returns a mitk::Vector3D filled with these values
* \param[in] e the TiXmlElement that will be parsed
* \return returns a mitk::Vector3D with the values x,y,z
*/
mitk::Vector3D GetVectorFromXMLNode(TiXmlElement* e);
/**
* \brief parses the element for the attributes x,y,z and returns a mitk::Point3D filled with these values
* \param[in] e the TiXmlElement that will be parsed
* \return returns a mitk::Point3D with the values x,y,z
*/
mitk::Point3D GetPointFromXMLNode(TiXmlElement* e);
/**
* \brief parses the element for the attributes name0 to nameN, where "name" and the number of attributes
* to read are passed as argument. Returns a list of double vales.
* \param[in] e the TiXmlElement that will be parsed
* \param[in] attributeNameBase the basic name of the parameters
* \param[in] count the number of parameters
* \return returns a mitk::Point3D with the values x,y,z
*/
DoubleList GetDoubleAttributeListFromXMLNode(TiXmlElement* e, const char *attributeNameBase, unsigned int count);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
bool m_Success;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureSource.h b/Modules/PlanarFigure/include/mitkPlanarFigureSource.h
index a77a42266a..c6f3e243f4 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureSource.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureSource.h
@@ -1,78 +1,78 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPlanarFigureSOURCE_H_HEADER_INCLUDED
#define MITKPlanarFigureSOURCE_H_HEADER_INCLUDED
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
#include "mitkCommon.h"
#include "mitkBaseDataSource.h"
namespace mitk
{
/**
* @brief Base class for all filters which have an object of type
* mitk::PlanarFigure as output
*
* Base class for all filters which have an object of type mitk::PlanarFigure
* as output. mitk::PlanarFigureSources do not provide support
* for streaming, that is, that the requested region is always the largest
* possible region.
* @ingroup MitkPlanarFigureModule
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureSource : public mitk::BaseDataSource
{
public:
mitkClassMacro( PlanarFigureSource, BaseDataSource )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::PlanarFigure OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef itk::DataObject::Pointer DataObjectPointer;
mitkBaseDataSourceGetOutputDeclarations
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
/**
* Generates the input requested region simply by calling the equivalent
* method of the superclass.
*/
- void GenerateInputRequestedRegion();
+ void GenerateInputRequestedRegion() override;
protected:
PlanarFigureSource();
virtual ~PlanarFigureSource();
};
} // namespace mitk
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureVtkMapper3D.h b/Modules/PlanarFigure/include/mitkPlanarFigureVtkMapper3D.h
index ed6a4a8bd7..2c790a16d3 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureVtkMapper3D.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureVtkMapper3D.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarFigureVtkMapper3D_h
#define mitkPlanarFigureVtkMapper3D_h
#include <mitkVtkMapper.h>
#include <vtkSmartPointer.h>
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class MITKPLANARFIGURE_EXPORT PlanarFigureVtkMapper3D : public VtkMapper
{
class LocalStorage
{
public:
LocalStorage();
~LocalStorage();
vtkSmartPointer<vtkActor> m_Actor;
unsigned long m_LastMTime;
private:
LocalStorage(const LocalStorage&);
LocalStorage& operator=(const LocalStorage&);
};
public:
static void SetDefaultProperties(DataNode*, BaseRenderer* = NULL, bool = false);
mitkClassMacro(PlanarFigureVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- void ApplyColorAndOpacityProperties(BaseRenderer* renderer, vtkActor* actor);
+ void ApplyColorAndOpacityProperties(BaseRenderer* renderer, vtkActor* actor) override;
void ApplyPlanarFigureProperties(BaseRenderer* renderer, vtkActor* actor);
- vtkProp* GetVtkProp(BaseRenderer* renderer);
- void UpdateVtkTransform(BaseRenderer*);
+ vtkProp* GetVtkProp(BaseRenderer* renderer) override;
+ void UpdateVtkTransform(BaseRenderer*) override;
private:
PlanarFigureVtkMapper3D();
~PlanarFigureVtkMapper3D();
PlanarFigureVtkMapper3D(const Self&);
Self& operator=(const Self&);
- void GenerateDataForRenderer(BaseRenderer* renderer);
+ void GenerateDataForRenderer(BaseRenderer* renderer) override;
LocalStorageHandler<LocalStorage> m_LocalStorageHandler;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarFigureWriter.h b/Modules/PlanarFigure/include/mitkPlanarFigureWriter.h
index f2198e11e9..851c004c44 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFigureWriter.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFigureWriter.h
@@ -1,208 +1,208 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PlanarFigure_WRITER__H_
#define _MITK_PlanarFigure_WRITER__H_
#include <itkProcessObject.h>
#include <MitkPlanarFigureExports.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkPlanarFigure.h>
class TiXmlElement;
namespace mitk
{
/**
* @brief XML-based writer for mitk::PlanarFigures
*
* XML-based writer for mitk::PlanarFigures.
* @ingroup MitkPlanarFigureModule
*/
class MITKPLANARFIGURE_EXPORT PlanarFigureWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro( PlanarFigureWriter, mitk::FileWriter );
mitkWriterMacro;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef mitk::PlanarFigure InputType;
typedef InputType::Pointer InputTypePointer;
/**
* Sets the filename of the file to write.
* @param FileName the name of the file to write.
*/
itkSetStringMacro( FileName );
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro( FileName );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePrefix );
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro( FilePattern );
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro( FilePattern );
using Superclass::SetInput;
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput( InputType* input );
/**
* Sets the n'th input object for the filter. If num is
* larger than GetNumberOfInputs() the number of inputs is
* resized appropriately.
* @param input the n'th input for the filter.
*/
void SetInput( const unsigned int& num, InputType* input);
/**
* @returns the 0'th input object of the filter.
*/
PlanarFigure* GetInput();
/**
* @param num the index of the desired output object.
* @returns the n'th input object of the filter.
*/
PlanarFigure* GetInput( const unsigned int& num );
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
- virtual std::vector<std::string> GetPossibleFileExtensions();
+ virtual std::vector<std::string> GetPossibleFileExtensions() override;
/**
* @brief Return the extension to be added to the filename.
*/
- virtual std::string GetFileExtension();
+ virtual std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the
*/
- virtual bool CanWriteDataType( DataNode* );
+ virtual bool CanWriteDataType( DataNode* ) override;
/**
* @brief Return the MimeType of the saved File.
*/
- virtual std::string GetWritenMIMEType();
+ virtual std::string GetWritenMIMEType() override;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput( DataNode* );
- virtual std::string GetSupportedBaseData() const;
+ virtual std::string GetSupportedBaseData() const override;
/**
* @returns whether the last write attempt was successful or not.
*/
itkGetConstMacro(Success, bool);
- virtual const char * GetDefaultFilename() { return "PlanarFigure.pf"; }
- virtual const char * GetFileDialogPattern() { return "Planar Figure Files (*.pf)"; }
- virtual const char * GetDefaultExtension() { return ".pf"; }
- virtual bool CanWriteBaseDataType(BaseData::Pointer data)
+ virtual const char * GetDefaultFilename() override { return "PlanarFigure.pf"; }
+ virtual const char * GetFileDialogPattern() override { return "Planar Figure Files (*.pf)"; }
+ virtual const char * GetDefaultExtension() override { return ".pf"; }
+ virtual bool CanWriteBaseDataType(BaseData::Pointer data) override
{
return dynamic_cast<mitk::PlanarFigure*>( data.GetPointer() );
}
- virtual void DoWrite(BaseData::Pointer data) {
+ virtual void DoWrite(BaseData::Pointer data) override {
if (CanWriteBaseDataType(data)) {
this->SetInput(dynamic_cast<mitk::PlanarFigure*>(data.GetPointer()));
this->Update();
}
}
/**
@brief CAUTION: It's up to the user to call this function to release the
memory buffer after use in case the file writer has written to its memory array.
See mitkFileWriter base class. */
- virtual void ReleaseMemory();
+ virtual void ReleaseMemory() override;
protected:
/**
* Constructor.
*/
PlanarFigureWriter();
/**
* Virtual destructor.
*/
virtual ~PlanarFigureWriter();
/**
* Writes the a .pf file in xml format that contains all input planar figures
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
/**
* Resizes the number of inputs of the writer.
* The inputs are initialized by empty PlanarFigures
* @param num the new number of inputs
*/
virtual void ResizeInputs( const unsigned int& num );
/**Documentation
* \brief creates a TinyXML element that contains x, y, and z values
*
* \param[in] name the name of the XML element
* \param[in] v the vector or point that contains the x, y and z values
* \return returns a TiXmlElement named name and three attributes x, y and z.
*/
TiXmlElement* CreateXMLVectorElement(const char* name, itk::FixedArray<mitk::ScalarType, 3> v);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
bool m_Success;
};
}
#endif
diff --git a/Modules/PlanarFigure/include/mitkPlanarFourPointAngle.h b/Modules/PlanarFigure/include/mitkPlanarFourPointAngle.h
index 1e8433543d..0a5fa94f8a 100644
--- a/Modules/PlanarFigure/include/mitkPlanarFourPointAngle.h
+++ b/Modules/PlanarFigure/include/mitkPlanarFourPointAngle.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_FOURPOINTANGLE_H_
#define _MITK_PLANAR_FOURPOINTANGLE_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a four point
* angle, which is defined by two non-intersecting lines in 2D. Each of those lines
* is defined by two control points.
*/
class MITKPLANARFIGURE_EXPORT PlanarFourPointAngle : public PlanarFigure
{
public:
mitkClassMacro( PlanarFourPointAngle, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
public:
// Feature identifiers
const unsigned int FEATURE_ID_ANGLE;
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
/** \brief Four point angle has 4 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 4;
}
/** \brief Four point angle has 4 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 4;
}
- virtual bool Equals(const mitk::PlanarFigure& other) const ;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override ;
protected:
PlanarFourPointAngle();
virtual ~PlanarFourPointAngle();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_FOURPOINTANGLE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarLine.h b/Modules/PlanarFigure/include/mitkPlanarLine.h
index c331dd28a4..bab961fe2c 100644
--- a/Modules/PlanarFigure/include/mitkPlanarLine.h
+++ b/Modules/PlanarFigure/include/mitkPlanarLine.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_LINE_H_
#define _MITK_PLANAR_LINE_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a line
* through two control points
*/
class MITKPLANARFIGURE_EXPORT PlanarLine : public PlanarFigure
{
public:
mitkClassMacro( PlanarLine, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
/** \brief Line has 2 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 2;
}
/** \brief Line has 2 control points per definition. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 2;
}
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarLine();
virtual ~PlanarLine();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
// Feature identifiers
const unsigned int FEATURE_ID_LENGTH;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_LINE_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarPolygon.h b/Modules/PlanarFigure/include/mitkPlanarPolygon.h
index 88c6ebcf90..a3a1e5afa6 100644
--- a/Modules/PlanarFigure/include/mitkPlanarPolygon.h
+++ b/Modules/PlanarFigure/include/mitkPlanarPolygon.h
@@ -1,104 +1,104 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_POLYGON_H_
#define _MITK_PLANAR_POLYGON_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a polygon
* with two or more control points
*/
class MITKPLANARFIGURE_EXPORT PlanarPolygon : public PlanarFigure
{
public:
mitkClassMacro( PlanarPolygon, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Set whether the polygon should be closed between first and last control point or not. */
virtual void SetClosed( bool closed );
itkBooleanMacro( Closed ); // Calls SetClosed(); no need to re-implement
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
/** \brief Polygon has 3 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 3;
}
/** \brief Polygon maximum number of control points is principally not limited. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 1000;
}
std::vector<mitk::Point2D> CheckForLineIntersection( const Point2D& p1, const Point2D& p2 ) const;
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarPolygon();
virtual ~PlanarPolygon();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
bool CheckForLineIntersection(const mitk::Point2D& p1, const mitk::Point2D& p2, const mitk::Point2D& p3, const mitk::Point2D& p4, Point2D& intersection) const ;
bool CheckForLineIntersection( const mitk::Point2D& p1, const mitk::Point2D& p2, const mitk::Point2D& p3, const mitk::Point2D& p4 ) const;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
const unsigned int FEATURE_ID_CIRCUMFERENCE;
const unsigned int FEATURE_ID_AREA;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_POLYGON_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarRectangle.h b/Modules/PlanarFigure/include/mitkPlanarRectangle.h
index 5ef4d43510..d5d82d539f 100644
--- a/Modules/PlanarFigure/include/mitkPlanarRectangle.h
+++ b/Modules/PlanarFigure/include/mitkPlanarRectangle.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_RECTANGLE_H_
#define _MITK_PLANAR_RECTANGLE_H_
#include "mitkPlanarPolygon.h"
#include <MitkPlanarFigureExports.h>
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a polygon
* with two or more control points
*/
class MITKPLANARFIGURE_EXPORT PlanarRectangle : public PlanarFigure
{
public:
mitkClassMacro( PlanarRectangle, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Place figure in its minimal configuration (a point at least)
* onto the given 2D geometry.
*
* Must be implemented in sub-classes.
*/
//virtual void Initialize();
- virtual void PlaceFigure( const Point2D &point );
+ virtual void PlaceFigure( const Point2D &point ) override;
/** \brief Polygon has 2 control points per definition. */
- virtual unsigned int GetMinimumNumberOfControlPoints() const
+ virtual unsigned int GetMinimumNumberOfControlPoints() const override
{
return 4;
}
/** \brief Polygon maximum number of control points is principally not limited. */
- virtual unsigned int GetMaximumNumberOfControlPoints() const
+ virtual unsigned int GetMaximumNumberOfControlPoints() const override
{
return 4;
}
- virtual bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = false);
+ virtual bool SetControlPoint( unsigned int index, const Point2D &point, bool createIfDoesNotExist = false) override;
protected:
PlanarRectangle();
virtual ~PlanarRectangle();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
/** \brief Generates the poly-lines that should be drawn the same size regardless of zoom.*/
- virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight);
+ virtual void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
/** \brief Calculates feature quantities of the planar figure. */
- virtual void EvaluateFeaturesInternal();
+ virtual void EvaluateFeaturesInternal() override;
- virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const;
+ virtual void PrintSelf( std::ostream &os, itk::Indent indent ) const override;
const unsigned int FEATURE_ID_CIRCUMFERENCE;
const unsigned int FEATURE_ID_AREA;
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_POLYGON_H_
diff --git a/Modules/PlanarFigure/include/mitkPlanarSubdivisionPolygon.h b/Modules/PlanarFigure/include/mitkPlanarSubdivisionPolygon.h
index 18d20eedb9..917aaede51 100644
--- a/Modules/PlanarFigure/include/mitkPlanarSubdivisionPolygon.h
+++ b/Modules/PlanarFigure/include/mitkPlanarSubdivisionPolygon.h
@@ -1,109 +1,109 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PLANAR_SUBDIVISION_POLYGON_H_
#define _MITK_PLANAR_SUBDIVISION_POLYGON_H_
#include "mitkPlanarFigure.h"
#include <MitkPlanarFigureExports.h>
#include "mitkPlanarPolygon.h"
namespace mitk
{
class PlaneGeometry;
/**
* \brief Implementation of PlanarFigure representing a polygon
* with two or more control points
*/
class MITKPLANARFIGURE_EXPORT PlanarSubdivisionPolygon : public PlanarPolygon
{
public:
mitkClassMacro( PlanarSubdivisionPolygon, PlanarFigure );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Subdivision Polygon has 3 control points per definition. */
- unsigned int GetMinimumNumberOfControlPoints() const
+ unsigned int GetMinimumNumberOfControlPoints() const override
{
return 3;
}
/** \brief Polygon maximum number of control points is principally not limited. */
- unsigned int GetMaximumNumberOfControlPoints() const
+ unsigned int GetMaximumNumberOfControlPoints() const override
{
return 1000;
}
/** \brief How many times should we generate a round of subdivisions? */
unsigned int GetSubdivisionRounds() const
{
return m_SubdivisionRounds;
}
void SetSubdivisionRounds( int subdivisionRounds )
{
m_SubdivisionRounds = subdivisionRounds;
}
/** \brief Parameter w_tension defines the tension.
* the higher w_tension, the lower the "tension" on points.
* Rule: 0 < w_tension < 0.1
* 0.0625 (1 / 16) seems to be a good value.
*/
float GetTensionParameter() const
{
return m_TensionParameter;
}
void SetTensionParameter(float tensionParameter )
{
m_TensionParameter = tensionParameter;
}
std::vector<mitk::Point2D> CheckForLineIntersection( const Point2D& p1, const Point2D& p2 ) const;
void IncreaseSubdivisions();
void DecreaseSubdivisions();
- virtual bool Equals(const mitk::PlanarFigure& other) const;
+ virtual bool Equals(const mitk::PlanarFigure& other) const override;
protected:
PlanarSubdivisionPolygon();
virtual ~PlanarSubdivisionPolygon();
mitkCloneMacro(Self);
/** \brief Generates the poly-line representation of the planar figure. */
- virtual void GeneratePolyLine();
+ virtual void GeneratePolyLine() override;
float m_TensionParameter;
int m_SubdivisionRounds;
private:
};
} // namespace mitk
#endif //_MITK_PLANAR_SUBDIVISION_POLYGON_H_
diff --git a/Modules/PlanarFigure/src/IO/mitkPlanarFigureIOFactory.h b/Modules/PlanarFigure/src/IO/mitkPlanarFigureIOFactory.h
index 8a73bc630f..ce22a9a721 100644
--- a/Modules/PlanarFigure/src/IO/mitkPlanarFigureIOFactory.h
+++ b/Modules/PlanarFigure/src/IO/mitkPlanarFigureIOFactory.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkPlanarFigureIOFactory_h
#define __mitkPlanarFigureIOFactory_h
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
//##Documentation
//## @brief Create instances of PlanarFigureReader objects using an object factory.
//##
//## @ingroup MitkPlanarFigureModule
class PlanarFigureIOFactory : public itk::ObjectFactoryBase
{
public:
/** Standard class typedefs. */
typedef PlanarFigureIOFactory Self;
typedef itk::ObjectFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
static PlanarFigureIOFactory* FactoryNew() { return new PlanarFigureIOFactory;}
/** Run-time type information (and related methods). */
itkTypeMacro(PlanarFigureIOFactory, ObjectFactoryBase);
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void))
{
PlanarFigureIOFactory::Pointer PlanarFigureIOFactory = PlanarFigureIOFactory::New();
ObjectFactoryBase::RegisterFactory(PlanarFigureIOFactory);
}
protected:
PlanarFigureIOFactory();
~PlanarFigureIOFactory();
private:
PlanarFigureIOFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
} // end namespace mitk
#endif
diff --git a/Modules/PlanarFigure/src/IO/mitkPlanarFigureSerializer.h b/Modules/PlanarFigure/src/IO/mitkPlanarFigureSerializer.h
index c91c352bd6..2376b16074 100644
--- a/Modules/PlanarFigure/src/IO/mitkPlanarFigureSerializer.h
+++ b/Modules/PlanarFigure/src/IO/mitkPlanarFigureSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarFigureSerializer_h_included
#define mitkPlanarFigureSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class PlanarFigureSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( PlanarFigureSerializer, BaseDataSerializer )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
PlanarFigureSerializer();
virtual ~PlanarFigureSerializer();
};
} // namespace
#endif
diff --git a/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.cpp b/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.cpp
index 7970b1b6db..b48e3029a8 100644
--- a/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.cpp
+++ b/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.cpp
@@ -1,96 +1,96 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkPlanarFigureWriterFactory.h"
#include "itkCreateObjectFunction.h"
#include "itkVersion.h"
#include <mitkPlanarFigureWriter.h>
namespace mitk
{
template <class T>
class CreatePlanarFigureWriter : public itk::CreateObjectFunctionBase
{
public:
/** Standard class typedefs. */
typedef CreatePlanarFigureWriter Self;
typedef itk::SmartPointer<Self> Pointer;
/** Methods from itk:LightObject. */
itkFactorylessNewMacro(Self)
- LightObject::Pointer CreateObject()
+ LightObject::Pointer CreateObject() override
{
typename T::Pointer p = T::New();
p->Register();
return p.GetPointer();
}
protected:
CreatePlanarFigureWriter() {}
~CreatePlanarFigureWriter() {}
private:
CreatePlanarFigureWriter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
};
PlanarFigureWriterFactory::PlanarFigureWriterFactory()
{
this->RegisterOverride("IOWriter",
"PlanarFigureWriter",
"PlanarFigure xml Writer",
1,
mitk::CreatePlanarFigureWriter< mitk::PlanarFigureWriter >::New());
}
PlanarFigureWriterFactory::~PlanarFigureWriterFactory()
{
}
itk::ObjectFactoryBase::Pointer PlanarFigureWriterFactory::GetInstance()
{
static itk::ObjectFactoryBase::Pointer factory(mitk::PlanarFigureWriterFactory::New().GetPointer());
return factory;
}
void PlanarFigureWriterFactory::RegisterOneFactory(void)
{
if ( GetInstance()->GetReferenceCount() == 1 )
{
ObjectFactoryBase::RegisterFactory( GetInstance().GetPointer() );
}
}
void PlanarFigureWriterFactory::UnRegisterOneFactory(void)
{
ObjectFactoryBase::UnRegisterFactory( GetInstance().GetPointer() );
}
const char* PlanarFigureWriterFactory::GetITKSourceVersion() const
{
return ITK_SOURCE_VERSION;
}
const char* PlanarFigureWriterFactory::GetDescription() const
{
return "PlanarFigureWriterFactory";
}
} // end namespace mitk
diff --git a/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.h b/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.h
index 1fdc64178f..ff2489d766 100644
--- a/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.h
+++ b/Modules/PlanarFigure/src/IO/mitkPlanarFigureWriterFactory.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef PLANARFIGURE_WRITERFACTORY_H_HEADER_INCLUDED
#define PLANARFIGURE_WRITERFACTORY_H_HEADER_INCLUDED
#include "itkObjectFactoryBase.h"
#include "mitkBaseData.h"
namespace mitk
{
class PlanarFigureWriterFactory : public itk::ObjectFactoryBase
{
public:
- mitkClassMacro( mitk::PlanarFigureWriterFactory, itk::ObjectFactoryBase )
+ mitkClassMacroItkParent( mitk::PlanarFigureWriterFactory, itk::ObjectFactoryBase )
/** Class methods used to interface with the registered factories. */
- virtual const char* GetITKSourceVersion(void) const;
- virtual const char* GetDescription(void) const;
+ virtual const char* GetITKSourceVersion(void) const override;
+ virtual const char* GetDescription(void) const override;
/** Method for class instantiation. */
itkFactorylessNewMacro(Self)
/**
* Register one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void RegisterOneFactory(void));
/**
* UnRegister one factory of this type
* \deprecatedSince{2013_09}
*/
DEPRECATED(static void UnRegisterOneFactory(void));
protected:
PlanarFigureWriterFactory();
~PlanarFigureWriterFactory();
private:
PlanarFigureWriterFactory(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
static itk::ObjectFactoryBase::Pointer GetInstance();
};
} // end namespace mitk
#endif // PLANARFIGURE_WRITERFACTORY_H_HEADER_INCLUDED
diff --git a/Modules/PlanarFigureSegmentation/include/mitkPlanarFigureSegmentationController.h b/Modules/PlanarFigureSegmentation/include/mitkPlanarFigureSegmentationController.h
index 7c57025771..bf6ed3e6b6 100644
--- a/Modules/PlanarFigureSegmentation/include/mitkPlanarFigureSegmentationController.h
+++ b/Modules/PlanarFigureSegmentation/include/mitkPlanarFigureSegmentationController.h
@@ -1,159 +1,159 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlanarFigureSegmentationController_h_Included
#define mitkPlanarFigureSegmentationController_h_Included
#include "mitkCommon.h"
#include <MitkPlanarFigureSegmentationExports.h>
#include "mitkImage.h"
#include "mitkPlanarFigure.h"
#include <mitkSurface.h>
#include "mitkReduceContourSetFilter.h"
#include <mitkComputeContourSetNormalsFilter.h>
#include <mitkCreateDistanceImageFromSurfaceFilter.h>
namespace mitk
{
/**
* \brief This class creates a binary image from a set of PlanarFigures.
*
* The class offers a convenient way to create a binary image from a
* variable number of contours that are represented by PlanarFigures.
*
* The first step is to create a mitkSurface for each PlanarFigure.
*
* The actual segmentation is done by interpolating these surfaces
* by means of the mitkCreateDistanceImageFromSurfaceFilter.
*
* Using the vtkMarchingCubes a surface is created from the resulting
* distance-image. This surface is then turned into a binary image using the
* mitkSurfaceToImageFilter.
*/
class MITKPLANARFIGURESEGMENTATION_EXPORT PlanarFigureSegmentationController : public itk::Object
{
public:
- mitkClassMacro(PlanarFigureSegmentationController, itk::Object);
+ mitkClassMacroItkParent(PlanarFigureSegmentationController, itk::Object);
itkFactorylessNewMacro(PlanarFigureSegmentationController) /// specify the segmentation image that should be interpolated
itkCloneMacro(Self)
virtual ~PlanarFigureSegmentationController();
typedef std::vector<PlanarFigure::Pointer> PlanarFigureListType;
typedef std::vector<Surface::Pointer> SurfaceListType;
/**
* \brief Setter for the reference image.
*
* The reference image is the image on which the segmentation is
* performed. It's needed to set the correct geometry information
* on the segmentation result (pixel-spacing, slice-thickness, etc.).
*/
void SetReferenceImage( Image::Pointer referenceImage );
/**
* \brief Adds a new PlanarFigure to be considered in the interpolation.
*
* This method can be used to add a new contour, represented by a
* PlanarFigure, to be considered in the interpolation.
*
* It is not possible to add the same PlanarFigure twice.
*
* \warn The method does NOT check if there are two PlanarFigures on
* the same slice. Doing this will lead to wrong segmentation results.
*/
void AddPlanarFigure( PlanarFigure::Pointer planarFigure );
void RemovePlanarFigure( mitk::PlanarFigure::Pointer planarFigure );
/**
* \brief Performs the interpolation and returns the result
* as binary image.
*
* This method updates the CreateDistanceImageFromSurfaceFilter
* and creates a binary image from the resulting distance-image.
*
* This is done by creating an intermediate mitk::Surface that
* represents the interpolated 3D contour using the vtkMarchingCubes.
*
* The binary image is then extracted from the surface by means of
* the mitkSurfaceToImageFilter.
*/
Image::Pointer GetInterpolationResult();
/**
* \brief Method to create a surface from a PlanarFigure
*
* This method takes any kind of PlanarFigure and creates a
* surface-representation.
* The resulting surface contains of only ONE vtkPolygon that contains
* all points of the PlanarFigure's polyline.
*/
static Surface::Pointer CreateSurfaceFromPlanarFigure( PlanarFigure::Pointer figure );
PlanarFigureListType GetAllPlanarFigures();
void SetReferenceDirectionVector( mitk::Vector3D vector );
protected:
PlanarFigureSegmentationController();
void InitializeFilters();
template<typename TPixel, unsigned int VImageDimension>
void GetImageBase(itk::Image<TPixel, VImageDimension>* input, itk::ImageBase<3>::Pointer& result);
PlanarFigureListType m_PlanarFigureList;
SurfaceListType m_SurfaceList;
/**
* \brief Filter to reduce the number of control points.
*/
ReduceContourSetFilter::Pointer m_ReduceFilter;
/**
* \brief Filter to compute the normals for the created surface
*/
ComputeContourSetNormalsFilter::Pointer m_NormalsFilter;
/**
* \brief Filter to create "distance-image" from contours.
*/
CreateDistanceImageFromSurfaceFilter::Pointer m_DistanceImageCreator;
Image::Pointer m_ReferenceImage;
Image::Pointer m_SegmentationAsImage;
mitk::Vector3D m_ReferenceDirectionVector;
};
} // namespace
#endif
diff --git a/Modules/QmlItems/QmlMitkBigRenderLock.h b/Modules/QmlItems/QmlMitkBigRenderLock.h
index 8c2bad7f91..53cc316533 100644
--- a/Modules/QmlItems/QmlMitkBigRenderLock.h
+++ b/Modules/QmlItems/QmlMitkBigRenderLock.h
@@ -1,33 +1,33 @@
#ifndef QmlMitkBigRenderLock_h
#define QmlMitkBigRenderLock_h
#include <QtCore>
#include "MitkQmlItemsExports.h"
/**
\brief Workaround lock around MITK rendering.
QtQuick renders in a thread, MITK datastructures do not
tolerate this well. The current work-around is a big
lock that delays signal delivery while rendering is in
progress.
The proper solution would be to make data structures
in rendering thread safe. This solution is much more
work though, so it will come later.
*/
class MITKQMLITEMS_EXPORT QmlMitkBigRenderLock : public QObject
{
Q_OBJECT
public:
static QMutex& GetMutex();
QmlMitkBigRenderLock(QObject* parent = 0);
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
};
#endif
diff --git a/Modules/QmlItems/QmlMitkRenderWindowItem.h b/Modules/QmlItems/QmlMitkRenderWindowItem.h
index 2a9298ccc6..0395a0dec8 100644
--- a/Modules/QmlItems/QmlMitkRenderWindowItem.h
+++ b/Modules/QmlItems/QmlMitkRenderWindowItem.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmlMitkRenderWindowItem_h
#define QmlMitkRenderWindowItem_h
#include <QVTKQuickItem.h>
#include "mitkRenderWindowBase.h"
#include <QTimer>
#include "MitkQmlItemsExports.h"
/**
\brief QML replacement for QmitkRenderWindow.
A proof-of-concept render window. Currently exclusively
for use in the QuickRender demo application.
\warning Subject to change.
*/
class MITKQMLITEMS_EXPORT QmlMitkRenderWindowItem : public QVTKQuickItem, public mitk::RenderWindowBase
{
Q_OBJECT
public:
static QmlMitkRenderWindowItem* GetInstanceForVTKRenderWindow( vtkRenderWindow* rw );
QmlMitkRenderWindowItem(QQuickItem* parent = 0,
const QString& name = "QML render window",
mitk::VtkPropRenderer* renderer = NULL,
mitk::RenderingManager* renderingManager = NULL);
- virtual vtkRenderWindow* GetVtkRenderWindow();
- virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor();
+ virtual vtkRenderWindow* GetVtkRenderWindow() override;
+ virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() override;
void SetDataStorage(mitk::DataStorage::Pointer storage);
void InitView( mitk::BaseRenderer::MapperSlotId mapperID,
mitk::SliceNavigationController::ViewDirection viewDirection );
void SetPlaneNodeParent( mitk::DataNode::Pointer node );
void SetCrossHairPositioningOnClick(bool enabled);
signals:
public slots:
protected slots:
protected:
- virtual void init();
- virtual void prepareForRender();
- virtual void cleanupAfterRender();
+ virtual void init() override;
+ virtual void prepareForRender() override;
+ virtual void cleanupAfterRender() override;
mitk::Point2D GetMousePosition(QMouseEvent* me) const;
mitk::Point2D GetMousePosition(QWheelEvent* we) const;
mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent* me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent* me) const;
mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent* me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QWheelEvent* we) const;
- void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry); // !?
+ void geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) override; // !?
- virtual void mousePressEvent(QMouseEvent* e);
- virtual void mouseReleaseEvent(QMouseEvent* e);
- virtual void mouseMoveEvent(QMouseEvent* e);
- virtual void wheelEvent(QWheelEvent* e);
+ virtual void mousePressEvent(QMouseEvent* e) override;
+ virtual void mouseReleaseEvent(QMouseEvent* e) override;
+ virtual void mouseMoveEvent(QMouseEvent* e) override;
+ virtual void wheelEvent(QWheelEvent* e) override;
private slots:
private:
mitk::DataStorage::Pointer m_DataStorage;
mitk::DataNode::Pointer m_PlaneNodeParent;
mitk::BaseRenderer::MapperSlotId m_MapperID;
mitk::SliceNavigationController::ViewDirection m_ViewDirection;
QTimer m_Animation;
vtkSmartPointer<vtkEventQtSlotConnect> m_connect;
static QMap<vtkRenderWindow*, QmlMitkRenderWindowItem*>& GetInstances();
};
#endif
diff --git a/Modules/QmlItems/QmlMitkRenderingManager.h b/Modules/QmlItems/QmlMitkRenderingManager.h
index d63d8c6afa..275c5ad4e7 100644
--- a/Modules/QmlItems/QmlMitkRenderingManager.h
+++ b/Modules/QmlItems/QmlMitkRenderingManager.h
@@ -1,85 +1,85 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmlMitkRenderingManager_h
#define QmlMitkRenderingManager_h
#include <MitkQmlItemsExports.h>
#include "mitkRenderingManager.h"
#include <QObject>
#include <QEvent>
class QmlMitkRenderingManagerFactory;
/**
* \ingroup QmlMitkModule
* \brief Qt/Qml specific implementation of mitk::RenderingManager.
*
* This implementation defines a QmlMitkRenderingRequestEvent to realize the
* rendering request process. The event is put into Qt's event loop to
* receive it back in the GUI thread where we are allowed to do rendering.
*
*/
class MITKQMLITEMS_EXPORT QmlMitkRenderingManager : public QObject, public mitk::RenderingManager
{
Q_OBJECT
public:
mitkClassMacro( QmlMitkRenderingManager, mitk::RenderingManager );
virtual ~QmlMitkRenderingManager();
- virtual bool event( QEvent *event );
+ virtual bool event( QEvent *event ) override;
protected:
itkFactorylessNewMacro(Self);
QmlMitkRenderingManager();
- virtual void GenerateRenderingRequestEvent();
+ virtual void GenerateRenderingRequestEvent() override;
- virtual void StartOrResetTimer();
+ virtual void StartOrResetTimer() override;
int pendingTimerCallbacks;
protected slots:
void TimerCallback();
private:
friend class QmlMitkRenderingManagerFactory;
void MyUpdateExecutePendingRequests();
};
class QmlMitkRenderingRequestEvent : public QEvent
{
public:
enum Type
{
RenderingRequest = QEvent::MaxUser - 1024
};
QmlMitkRenderingRequestEvent()
: QEvent( (QEvent::Type) RenderingRequest ) {};
};
#endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */
diff --git a/Modules/QmlItems/QmlMitkRenderingManagerFactory.h b/Modules/QmlItems/QmlMitkRenderingManagerFactory.h
index 94166d382d..bf79599985 100644
--- a/Modules/QmlItems/QmlMitkRenderingManagerFactory.h
+++ b/Modules/QmlItems/QmlMitkRenderingManagerFactory.h
@@ -1,48 +1,48 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmlMitkRenderingManagerFactory_h
#define QmlMitkRenderingManagerFactory_h
#include <MitkQmlItemsExports.h>
#include "mitkRenderingManagerFactory.h"
/**
* \ingroup QmlMitkModule
* \brief Qt specific implementation of mitk::RenderingManagerFactory.
*
* This class create QmlMitkRenderingManager instances via
* CreateRenderingManager().
*
*/
class MITKQMLITEMS_EXPORT QmlMitkRenderingManagerFactory : public mitk::RenderingManagerFactory
{
public:
QmlMitkRenderingManagerFactory();
~QmlMitkRenderingManagerFactory();
- virtual mitk::RenderingManager::Pointer CreateRenderingManager() const;
+ virtual mitk::RenderingManager::Pointer CreateRenderingManager() const override;
private:
};
#endif
diff --git a/Modules/QtOverlays/QmitkCustomWidgetOverlay.h b/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
index 607bdf956d..6645a030d2 100644
--- a/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
+++ b/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB
#define QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB
// MITK
#include "QmitkOverlay.h"
#include <MitkQtOverlaysExports.h>
/** \class QmitkCustomWidgetOverlay
* \brief object representing a custom widget that is handled and positioned
* as an overlay.
*
* A QmitkCustomWidgetOverlay is a generic sub-class of QmitkOverlay. It
* offers the possibility to set the internal m_Widget from the outside.
*
* This offers the possibility to position custom widgets 'on top of' other
* widgets using the positioning mechanism of all overlays.
*
* \warn The custom widgets need to be configured and connected manually.
* Properties cannot be set.
*
* \ingroup Overlays
*/
class MITKQTOVERLAYS_EXPORT QmitkCustomWidgetOverlay : public QmitkOverlay
{
public:
/**
* @brief Default Constructor
**/
QmitkCustomWidgetOverlay( const char* id );
/**
* @brief Default Destructor
**/
virtual ~QmitkCustomWidgetOverlay();
void SetWidget( QWidget* widget );
- QSize GetNeededSize();
+ QSize GetNeededSize() override;
};
#endif /* QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtOverlays/QmitkScalarBar.h b/Modules/QtOverlays/QmitkScalarBar.h
index 11a697c597..a63716c43f 100644
--- a/Modules/QtOverlays/QmitkScalarBar.h
+++ b/Modules/QtOverlays/QmitkScalarBar.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSCALARBAR_H_HEADER_INCLUDED_C10DC4EB
#define MITKSCALARBAR_H_HEADER_INCLUDED_C10DC4EB
#include <mitkCommon.h>
#include <MitkQtOverlaysExports.h>
#include <QPen>
#include <QWidget>
class MITKQTOVERLAYS_EXPORT QmitkScalarBar : public QWidget
{
Q_OBJECT
public:
enum alignment
{
vertical = 0,
horizontal = 1
};
/**
* @brief Default Constructor
**/
QmitkScalarBar( QWidget *parent = 0 );
/**
* @brief Default Destructor
**/
virtual ~QmitkScalarBar();
virtual void SetScaleFactor( double scale );
virtual void SetAlignment( alignment align );
void SetPen( const QPen& pen );
void SetNumberOfSubdivisions( unsigned int subs );
unsigned int GetNumberOfSubdivisions();
protected:
- void paintEvent(QPaintEvent* event);
+ void paintEvent(QPaintEvent* event) override;
void SetupGeometry( alignment align );
void CleanUpLines();
//void moveEvent(QMoveEvent*);
alignment m_Alignment;
double m_ScaleFactor;
QLine* m_MainLine;
std::vector<QLine*> m_SubDivisionLines;
QPen m_Pen;
unsigned int m_NumberOfSubDivisions;
};
#endif /* MITKSCALARBAR_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtOverlays/QmitkScalarBarOverlay.h b/Modules/QtOverlays/QmitkScalarBarOverlay.h
index fd6ca848ed..3d53d889ee 100644
--- a/Modules/QtOverlays/QmitkScalarBarOverlay.h
+++ b/Modules/QtOverlays/QmitkScalarBarOverlay.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB
#define MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB
#include <MitkQtOverlaysExports.h>
// MITK-Stuff
#include "mitkCommon.h"
#include "mitkPropertyList.h"
#include "QmitkOverlay.h"
#include <QmitkScalarBar.h>
/** \class QmitkScalarBarOverlay
* \brief object representing a text that is drawn as an overlay
*
* \ingroup Qmitk
*/
class MITKQTOVERLAYS_EXPORT QmitkScalarBarOverlay : public QmitkOverlay
{
Q_OBJECT
public:
/**
* @brief Default Constructor
**/
QmitkScalarBarOverlay( const char* id );
/**
* @brief Default Destructor
**/
virtual ~QmitkScalarBarOverlay();
/**
* \brief Setup the QLabel with overlay specific information
*
* First, this method sets text-overlay specific properties as described in the class docu above.
* Secondly, the actual text of the label is set.
*
* \WARNING No error will be issued if the property containing the text is not found, the TextOverlay
* will show an empty string!
*/
- virtual void GenerateData( mitk::PropertyList::Pointer );
+ virtual void GenerateData( mitk::PropertyList::Pointer ) override;
- QSize GetNeededSize();
+ QSize GetNeededSize() override;
protected:
/**
* \brief internal helper class to determine text-properties
*
* This method is only used internally to apply the text specific properties that can be set
* using a mitk::PropertyList. If a property cannot be found, a default value is used.
*
* The values of these properties are then attributed to the label using QFont and QPalette.
*/
void GetProperties( mitk::PropertyList::Pointer );
void SetupCallback( mitk::BaseProperty::Pointer prop );
void SetScaleFactor();
/** \brief QWidget internally representing the TextOverlay */
QmitkScalarBar* m_ScalarBar;
mitk::BaseProperty::Pointer m_ObservedProperty;
mitk::PropertyList::Pointer m_PropertyList;
unsigned long m_ObserverTag;
};
#endif /* MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtOverlays/QmitkTextOverlay.h b/Modules/QtOverlays/QmitkTextOverlay.h
index f5799df7c0..e2a1ea3a9e 100644
--- a/Modules/QtOverlays/QmitkTextOverlay.h
+++ b/Modules/QtOverlays/QmitkTextOverlay.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB
#define MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB
// MITK
#include "mitkCommon.h"
#include "mitkPropertyList.h"
#include "QmitkOverlay.h"
// Qt
#include <QLabel>
#include <MitkQtOverlaysExports.h>
/** \class QmitkTextOverlay
* \brief object representing a text that is drawn as an overlay
*
* A QmitkTextOverlay is a text-specific implementation of QmitkOverlay.
* It can be used whenever a simple text is to be rendered as an overlay in
* a QmitkRenderWindow.
*
* Instead of a QWidget (as in QmitkOverlay) a QmitkTextOverlay is internally
* represented by a QLabel. You can access it via GetWidget().
*
* Calling GenerateData( mitk::PropertyList::Pointer ) will setup the textoverlay.
* This includes setting of the actual text (that must be stored in the property
* with the name that is given the overlay as ID).
*
* e.g. mitk::StringProperty::Pointer nameProp = mitk::StringProperty::New( "overlay.text.patientName", "Max" );
* --
* QmitkTextOverlay* nameOverlay = new QmitkTextOverlay( "overlay.text.patientName" );
*
* In order to customize the look of the textoverlays, a number of additional properties can be set
* (default values in square brackets):
*
* overlay.color : defines the text-color (mitk::ColorProperty)
* overlay.fontSize : defines the fontSize of the text (mitk::IntProperty)
* overlay.kerning : defines if kerning is to be used (mitk::BoolProperty)
* overlay.fontFamily : defines the fon family that is to be used (mitk::StringProperty)
*
* \ingroup Qmitk
*/
class MITKQTOVERLAYS_EXPORT QmitkTextOverlay : public QmitkOverlay
{
public:
/**
* @brief Default Constructor
**/
QmitkTextOverlay( const char* id );
/**
* @brief Default Destructor
**/
virtual ~QmitkTextOverlay();
/**
* \brief Setup the QLabel with overlay specific information
*
* First, this method sets text-overlay specific properties as described in the class docu above.
* Secondly, the actual text of the label is set.
*
* \WARNING No error will be issued if the property containing the text is not found, the TextOverlay
* will show an empty string!
*/
- void GenerateData( mitk::PropertyList::Pointer );
+ void GenerateData( mitk::PropertyList::Pointer ) override;
- QSize GetNeededSize();
+ QSize GetNeededSize() override;
protected:
/**
* \brief internal helper class to determine text-properties
*
* This method is only used internally to apply the font specific properties that can be set
* using a mitk::PropertyList. If a property cannot be found, a default value is used.
*
* The values of these properties are then attributed to the QLabel using QFont and QPalette.
*/
void UpdateFontProperties( mitk::PropertyList::Pointer );
void SetupCallback( mitk::BaseProperty::Pointer prop );
void UpdateDisplayedTextFromProperties();
/** \brief QLabel internally representing the TextOverlay */
QLabel* m_Label;
mitk::PropertyList::Pointer m_PropertyList;
mitk::BaseProperty::Pointer m_ObservedProperty;
unsigned long m_ObserverTag;
};
#endif /* MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtWidgets/include/QmitkApplicationCursor.h b/Modules/QtWidgets/include/QmitkApplicationCursor.h
index 16a287206f..25543d536d 100644
--- a/Modules/QtWidgets/include/QmitkApplicationCursor.h
+++ b/Modules/QtWidgets/include/QmitkApplicationCursor.h
@@ -1,49 +1,49 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_APPLICATION_CURSOR_H_INCLUDED
#define QMITK_APPLICATION_CURSOR_H_INCLUDED
#include <MitkQtWidgetsExports.h>
#include "mitkApplicationCursor.h"
/*!
\ingroup QmitkModule
\brief Qt specific implementation of ApplicationCursorImplementation
This class very simply calls the QApplication's methods setOverrideCursor() and
restoreOverrideCursor().
*/
class MITKQTWIDGETS_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 PushCursor(std::istream&, int hotspotX, int hotspotY);
- virtual void PopCursor();
- virtual const mitk::Point2I GetCursorPosition();
- virtual void SetCursorPosition(const mitk::Point2I&);
+ virtual void PushCursor(const char* XPM[], int hotspotX, int hotspotY) override;
+ virtual void PushCursor(std::istream&, int hotspotX, int hotspotY) override;
+ virtual void PopCursor() override;
+ virtual const mitk::Point2I GetCursorPosition() override;
+ virtual void SetCursorPosition(const mitk::Point2I&) override;
protected:
private:
};
#endif
diff --git a/Modules/QtWidgets/include/QmitkDataStorageComboBoxWithSelectNone.h b/Modules/QtWidgets/include/QmitkDataStorageComboBoxWithSelectNone.h
index 66911a5513..85dc304f45 100644
--- a/Modules/QtWidgets/include/QmitkDataStorageComboBoxWithSelectNone.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageComboBoxWithSelectNone.h
@@ -1,149 +1,149 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) University College London (UCL).
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkDataStorageComboBoxWithSelectNone_h
#define QmitkDataStorageComboBoxWithSelectNone_h
#include <MitkQtWidgetsExports.h>
#include "QmitkDataStorageComboBox.h"
#include "QmitkCustomVariants.h"
#include "mitkDataNode.h"
/**
* \class QmitkDataStorageComboBoxWithSelectNone
* \brief Displays all or a subset (defined by a predicate) of nodes of the Data Storage,
* and additionally, index 0 is always "please select", indicating no selection, and will
* hence always return a NULL mitk::DataNode* if asked for the node at index 0.
*
* \author Matt Clarkson (m.clarkson@ucl.ac.uk)
* \ingroup org_mitk_gui_qt_cmdlinemodules_internal
* \sa QmitkDataStorageComboBox
*/
class MITKQTWIDGETS_EXPORT QmitkDataStorageComboBoxWithSelectNone : public QmitkDataStorageComboBox
{
Q_OBJECT
Q_PROPERTY(mitkDataNodePtr SelectedNode READ GetSelectedNode WRITE SetSelectedNode)
Q_PROPERTY(QString currentValue READ currentValue WRITE setCurrentValue)
public:
/**
* \brief Calls base class constructor.
* \see QmitkDataStorageComboBox
*/
QmitkDataStorageComboBoxWithSelectNone(QWidget* parent = 0, bool autoSelectNewNodes=false);
/**
* \brief Calls base class constructor.
* \see QmitkDataStorageComboBox
*/
QmitkDataStorageComboBoxWithSelectNone( mitk::DataStorage* _DataStorage,
const mitk::NodePredicateBase* predicate,
QWidget* parent = 0,
bool autoSelectNewNodes=false);
/**
* \brief Nothing to do.
* \see QmitkDataStorageComboBox
*/
~QmitkDataStorageComboBoxWithSelectNone();
/**
* \brief Stores the string that will be present on index 0, currently equal to "please select".
*/
static const QString ZERO_ENTRY_STRING;
/**
* \brief Searches for a given node, returning the index if found.
* \param dataNode an mitk::DataNode, can be NULL.
* \return int -1 if not found, and compared to base class, will add 1 onto the retrieved index.
*/
- virtual int Find( const mitk::DataNode* dataNode ) const;
+ virtual int Find( const mitk::DataNode* dataNode ) const override;
/**
* \brief Retrieves the node at a given index, where if index is zero, will always return NULL.
* \param index An integer between 0 and n = number of nodes.
* \return mitk::DataNode::Pointer NULL or a data node pointer.
*/
- virtual mitk::DataNode::Pointer GetNode(int index) const;
+ virtual mitk::DataNode::Pointer GetNode(int index) const override;
/**
* \brief Returns the selected DataNode or NULL if there is none, or the current index is zero.
*/
- virtual mitk::DataNode::Pointer GetSelectedNode() const;
+ virtual mitk::DataNode::Pointer GetSelectedNode() const override;
/**
* \brief Sets the combo box to the index that contains the specified node, or 0 if the node cannot be found.
*/
virtual void SetSelectedNode(const mitk::DataNode::Pointer& node);
/**
* \brief 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);
+ virtual void RemoveNode(int index) override;
/**
* \brief Set a DataNode in the ComboBox at the specified index (if the index exists).
* Internally the method just calls InsertNode(unsigned int)
*/
- virtual void SetNode(int index, const mitk::DataNode* dataNode);
+ virtual void SetNode(int index, const mitk::DataNode* dataNode) override;
/**
* \brief Get the current file path.
*/
virtual QString currentValue() const;
/**
* \brief Set the current file path.
*/
virtual void setCurrentValue(const QString& path);
/**
* \brief Set the string that will be present on index 0.
*/
void SetZeroEntryText(const QString& zeroEntryString);
protected:
/**
* \brief Checks if the given index is within range.
*/
bool HasIndex(unsigned int index) const;
/**
* \brief Inserts a new node at the given index, unless index is 0, which is silently ignored.
*/
- virtual void InsertNode(int index, const mitk::DataNode* dataNode);
+ virtual void InsertNode(int index, const mitk::DataNode* dataNode) override;
/**
* \brief Reset function whenever datastorage or predicate changes.
*/
- virtual void Reset();
+ virtual void Reset() override;
private:
/**
* \brief This should store the current file path of the current image.
*
*
* The reason is so that we can store and retrieve a temporary file name.
*/
QString m_CurrentPath;
};
#endif // QmitkDataStorageComboBoxWithSelectNone_h
diff --git a/Modules/QtWidgets/include/QmitkDataStorageFilterProxyModel.h b/Modules/QtWidgets/include/QmitkDataStorageFilterProxyModel.h
index 70e9eabc98..7f32c19be7 100644
--- a/Modules/QtWidgets/include/QmitkDataStorageFilterProxyModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageFilterProxyModel.h
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKDATASTORAGEFILTERPROXYMODEL_H_
#define QMITKDATASTORAGEFILTERPROXYMODEL_H_
#include <MitkQtWidgetsExports.h>
#include <mitkDataStorage.h>
#include <mitkNodePredicateBase.h>
#include <QSortFilterProxyModel>
#include <set>
/// \ingroup QmitkModule
class MITKQTWIDGETS_EXPORT QmitkDataStorageFilterProxyModel : public QSortFilterProxyModel
{
//# CTORS,DTOR
public:
QmitkDataStorageFilterProxyModel(QObject* parent = 0);
~QmitkDataStorageFilterProxyModel();
public:
///
/// If the predicate pred returns true, the node will be hidden in the data manager view
///
void AddFilterPredicate(mitk::NodePredicateBase::Pointer pred);
///
/// Remove a predicate from the list of filters. Returns true if pred was found and removed.
///
bool RemoveFilterPredicate(mitk::NodePredicateBase::Pointer pred);
///
/// Check if predicate is present in the list of filtering predicates.
///
bool HasFilterPredicate(mitk::NodePredicateBase::Pointer pred);
//#
protected:
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
protected:
typedef std::set<mitk::NodePredicateBase::Pointer> FilterPredicatesCollection;
FilterPredicatesCollection m_Predicates;
};
#endif /* QMITKDATASTORAGEFILTERPROXYMODEL_H_ */
diff --git a/Modules/QtWidgets/include/QmitkDataStorageListModel.h b/Modules/QtWidgets/include/QmitkDataStorageListModel.h
index 416d3aadf4..afdf7d1076 100755
--- a/Modules/QtWidgets/include/QmitkDataStorageListModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageListModel.h
@@ -1,126 +1,126 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKDATASTORAGELISTMODEL_H_
#define QMITKDATASTORAGELISTMODEL_H_
#include <MitkQtWidgetsExports.h>
//# Own includes
// mitk
#include "mitkDataStorage.h"
#include "mitkNodePredicateBase.h"
// Qmitk
//# Toolkit includes
// Qt
#include <QAbstractListModel>
// stl
#include <vector>
/// \ingroup QmitkModule
class MITKQTWIDGETS_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<mitk::DataNode*> 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;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
///
/// 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<mitk::DataNode*> m_DataNodes;
///
/// \brief Holds the tags of the node-modified observers.
///
std::vector<unsigned long> 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/Modules/QtWidgets/include/QmitkDataStorageTableModel.h b/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
index b9f5502dd5..95e537aff8 100644
--- a/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
@@ -1,229 +1,229 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkDataStorageTableModel_h
#define QmitkDataStorageTableModel_h
#include <MitkQtWidgetsExports.h>
/// Own includes.
#include "mitkDataStorage.h"
#include "mitkBaseProperty.h"
#include "mitkWeakPointer.h"
#include "mitkNodePredicateBase.h"
/// Toolkit includes.
#include <QAbstractTableModel>
/// Forward declarations.
///
/// \ingroup QmitkModule
/// \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 MITKQTWIDGETS_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;
+ int role) const override;
///
/// Overridden from QAbstractTableModel. Returns what can be done
/// with an item.
///
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
///
/// Overridden from QAbstractTableModel. Returns the node count.
///
- virtual int rowCount(const QModelIndex &parent) const;
+ virtual int rowCount(const QModelIndex &parent) const override;
///
/// Overridden from QAbstractTableModel. Returns the number of features (columns) to display.
///
- virtual int columnCount(const QModelIndex &parent) const;
+ virtual int columnCount(const QModelIndex &parent) const override;
///
/// Overridden from QAbstractTableModel. Returns the data at index for given role.
///
- virtual QVariant data(const QModelIndex &index, int role) const;
+ virtual QVariant data(const QModelIndex &index, int role) const override;
//# Public SETTERS
public:
///
/// Sets the DataStorage.
///
void SetDataStorage(mitk::DataStorage::Pointer _DataStorage);
///
/// Sets the predicate. <b>QmitkDataStorageTableModel is owner of the predicate!</b>
///
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<mitk::DataNode*> 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);
+ int role) override;
///
/// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
///
- void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
+ void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ) override;
//#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<mitk::DataNode::Pointer, mitk::DataNode::Pointer, bool>
{
///
/// \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<mitk::DataStorage> 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<mitk::DataNode*> m_NodeSet;
///
/// \brief Maps a property to an observer tag.
///
std::map<mitk::BaseProperty*, unsigned long> m_NamePropertyModifiedObserverTags;
///
/// \brief Maps a property to an observer tag.
///
std::map<mitk::BaseProperty*, unsigned long> 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/Modules/QtWidgets/include/QmitkDataStorageTreeModel.h b/Modules/QtWidgets/include/QmitkDataStorageTreeModel.h
index f4995b5bca..7a4d99ae76 100644
--- a/Modules/QtWidgets/include/QmitkDataStorageTreeModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageTreeModel.h
@@ -1,261 +1,261 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKDATASTORAGETREEMODEL_H_
#define QMITKDATASTORAGETREEMODEL_H_
#include <MitkQtWidgetsExports.h>
#include <mitkDataStorage.h>
#include <mitkNodePredicateBase.h>
#include <mitkWeakPointer.h>
#include <QAbstractListModel>
#include "QmitkEnums.h"
#include "QmitkCustomVariants.h"
#include <vector>
#include <string>
#include <QList>
/// \ingroup QmitkModule
class MITKQTWIDGETS_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
, 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 QList<mitk::DataNode::Pointer> GetNodeSet() const;
///
/// Get the DataStorage.
///
const mitk::DataStorage::Pointer GetDataStorage() const;
///
/// Get the top placement flag
///
bool GetPlaceNewNodesOnTopFlag()
{
return m_PlaceNewNodesOnTop;
}
///
/// 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;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
+ QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int rowCount ( const QModelIndex & parent = QModelIndex() ) const override;
+ int columnCount ( const QModelIndex & parent = QModelIndex() ) const override;
//# 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;
+ QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const override;
+ QModelIndex parent ( const QModelIndex & index ) const override;
//# 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;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
+ Qt::DropActions supportedDragActions() const override;
+ QStringList mimeTypes() const override;
+ QMimeData * mimeData(const QModelIndexList & indexes) const override;
static QMimeData* mimeDataFromModelIndexList(const QModelIndexList& indexes);
//# 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;
//# 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;
///
/// \return 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<TreeItem*> 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<TreeItem*> m_Children;
mitk::DataNode::Pointer m_DataNode;
};
QList<TreeItem*> ToTreeItemPtrList(const QMimeData* mimeData);
QList<TreeItem*> ToTreeItemPtrList(const QByteArray& ba);
///
/// 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<TreeItem*>& vec) const;
///
/// Adds all Childs in parent to vec. Before a child is added the function is called recursively
///
void TreeToNodeSet(TreeItem* parent, QList<mitk::DataNode::Pointer> &vec) const;
///
/// Update Tree Model
///
void Update();
//# ATTRIBUTES
protected:
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
mitk::NodePredicateBase::Pointer m_Predicate;
bool m_PlaceNewNodesOnTop;
TreeItem* m_Root;
private:
void AddNodeInternal(const mitk::DataNode*);
void RemoveNodeInternal(const mitk::DataNode*);
///
/// Checks if dicom properties patient name, study names and series name exists
///
bool DicomPropertiesExists(const mitk::DataNode&) const;
};
#endif /* QMITKDATASTORAGETREEMODEL_H_ */
diff --git a/Modules/QtWidgets/include/QmitkFileReaderOptionsDialog.h b/Modules/QtWidgets/include/QmitkFileReaderOptionsDialog.h
index fc7ebc7043..2858de5ca0 100644
--- a/Modules/QtWidgets/include/QmitkFileReaderOptionsDialog.h
+++ b/Modules/QtWidgets/include/QmitkFileReaderOptionsDialog.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKFILEREADEROPTIONSDIALOG_H
#define QMITKFILEREADEROPTIONSDIALOG_H
#include "mitkIOUtil.h"
#include <QDialog>
namespace Ui {
class QmitkFileReaderOptionsDialog;
}
class QmitkFileReaderWriterOptionsWidget;
class QmitkFileReaderOptionsDialog : public QDialog
{
Q_OBJECT
public:
explicit QmitkFileReaderOptionsDialog(mitk::IOUtil::LoadInfo& loadInfo,
QWidget *parent = 0);
~QmitkFileReaderOptionsDialog();
bool ReuseOptions() const;
- virtual void accept();
+ virtual void accept() override;
private:
Ui::QmitkFileReaderOptionsDialog* ui;
mitk::IOUtil::LoadInfo& m_LoadInfo;
std::vector<mitk::FileReaderSelector::Item> m_ReaderItems;
};
#endif // QMITKFILEREADEROPTIONSDIALOG_H
diff --git a/Modules/QtWidgets/include/QmitkFileReaderWriterOptionsWidget.h b/Modules/QtWidgets/include/QmitkFileReaderWriterOptionsWidget.h
index 8ac89ce93f..1d767ff88a 100644
--- a/Modules/QtWidgets/include/QmitkFileReaderWriterOptionsWidget.h
+++ b/Modules/QtWidgets/include/QmitkFileReaderWriterOptionsWidget.h
@@ -1,167 +1,167 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKFILEREADERWRITEROPTIONSWIDGET_H
#define QMITKFILEREADERWRITEROPTIONSWIDGET_H
#include <QWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QLabel>
#include <usAny.h>
struct QmitkAnyAdapter
{
QmitkAnyAdapter(const std::string& name)
: m_Name(name)
{}
virtual ~QmitkAnyAdapter() {}
virtual us::Any GetAny() const = 0;
std::string GetName() const
{
return m_Name;
}
private:
std::string m_Name;
};
class QmitkAnyStringWidget : public QLineEdit, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyStringWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyVectorWidget : public QComboBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyVectorWidget(const std::string& name, const us::Any& any, const QString& defaultValue, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyBoolWidget : public QCheckBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyBoolWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyShortWidget : public QSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyShortWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyUShortWidget : public QSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyUShortWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyIntWidget : public QSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyIntWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyUIntWidget : public QSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyUIntWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyFloatWidget : public QDoubleSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyFloatWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkAnyDoubleWidget : public QDoubleSpinBox, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkAnyDoubleWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkInvalidAnyWidget : public QLabel, public QmitkAnyAdapter
{
Q_OBJECT
public:
QmitkInvalidAnyWidget(const std::string& name, const us::Any& any, QWidget* parent = 0);
- us::Any GetAny() const;
+ us::Any GetAny() const override;
};
class QmitkFileReaderWriterOptionsWidget : public QWidget
{
Q_OBJECT
public:
typedef std::map<std::string, us::Any> Options;
QmitkFileReaderWriterOptionsWidget(const Options& options, QWidget* parent = NULL);
Options GetOptions() const;
private:
Q_DISABLE_COPY(QmitkFileReaderWriterOptionsWidget)
};
#endif // QMITKFILEREADERWRITEROPTIONSWIDGET_H
diff --git a/Modules/QtWidgets/include/QmitkFileWriterOptionsDialog.h b/Modules/QtWidgets/include/QmitkFileWriterOptionsDialog.h
index 31538a1d59..5031d0c194 100644
--- a/Modules/QtWidgets/include/QmitkFileWriterOptionsDialog.h
+++ b/Modules/QtWidgets/include/QmitkFileWriterOptionsDialog.h
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKFILEWRITEROPTIONSDIALOG_H
#define QMITKFILEWRITEROPTIONSDIALOG_H
#include <mitkIOUtil.h>
#include <QDialog>
namespace Ui {
class QmitkFileWriterOptionsDialog;
}
class QmitkFileReaderWriterOptionsWidget;
class QmitkFileWriterOptionsDialog : public QDialog
{
Q_OBJECT
public:
explicit QmitkFileWriterOptionsDialog(mitk::IOUtil::SaveInfo& saveInfo, QWidget *parent = 0);
~QmitkFileWriterOptionsDialog();
bool ReuseOptions() const;
- virtual void accept();
+ virtual void accept() override;
private:
Ui::QmitkFileWriterOptionsDialog* ui;
mitk::IOUtil::SaveInfo& m_SaveInfo;
std::vector<mitk::FileWriterSelector::Item> m_WriterItems;
};
#endif // QMITKFILEREADEROPTIONSDIALOG_H
diff --git a/Modules/QtWidgets/include/QmitkLevelWindowPresetDefinitionDialog.h b/Modules/QtWidgets/include/QmitkLevelWindowPresetDefinitionDialog.h
index 05cd233eb2..ae5d197768 100644
--- a/Modules/QtWidgets/include/QmitkLevelWindowPresetDefinitionDialog.h
+++ b/Modules/QtWidgets/include/QmitkLevelWindowPresetDefinitionDialog.h
@@ -1,108 +1,108 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_
#define QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_
#include <MitkQtWidgetsExports.h>
#include "ui_QmitkLevelWindowPresetDefinition.h"
#include <QDialog>
#include <QSortFilterProxyModel>
#include <map>
#include <string>
/// \ingroup QmitkModule
class MITKQTWIDGETS_EXPORT QmitkLevelWindowPresetDefinitionDialog : public QDialog, public Ui::QmitkLevelWindowPresetDefinition
{
Q_OBJECT
public:
QmitkLevelWindowPresetDefinitionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
~QmitkLevelWindowPresetDefinitionDialog();
void setPresets(std::map<std::string, double>& level, std::map<std::string, double>& window, QString initLevel, QString initWindow);
std::map<std::string, double> getLevelPresets();
std::map<std::string, double> 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<std::string, double>& levels,
std::map<std::string, double>& windows,
QObject* parent = 0);
- int rowCount(const QModelIndex&) const;
- int columnCount(const QModelIndex&) const;
- QVariant data(const QModelIndex& index, int) const;
+ int rowCount(const QModelIndex&) const override;
+ int columnCount(const QModelIndex&) const override;
+ QVariant data(const QModelIndex& index, int) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int) const override;
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<std::string, double>& levels);
void getWindows(std::map<std::string, double>& windows);
bool contains(std::string& name);
Entry getPreset(const QModelIndex&) const;
private:
std::vector<Entry> m_Entries;
};
- void resizeEvent(QResizeEvent* event);
- void showEvent(QShowEvent* event);
+ void resizeEvent(QResizeEvent* event) override;
+ void showEvent(QShowEvent* event) override;
void resizeColumns();
PresetTableModel* m_TableModel;
QSortFilterProxyModel m_SortModel;
};
#endif /*QMITKLEVELWINDOWPRESETDEFINITIONDIALOG_H_*/
diff --git a/Modules/QtWidgets/include/QmitkLineEditLevelWindowWidget.h b/Modules/QtWidgets/include/QmitkLineEditLevelWindowWidget.h
index bef8b18898..53ec22341f 100644
--- a/Modules/QtWidgets/include/QmitkLineEditLevelWindowWidget.h
+++ b/Modules/QtWidgets/include/QmitkLineEditLevelWindowWidget.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKLINEEDITLEVELWINDOWWIDGET
#define QMITKLINEEDITLEVELWINDOWWIDGET
#include <MitkQtWidgetsExports.h>
#include <QWidget>
#include <mitkLevelWindowManager.h>
class QmitkLevelWindowWidgetContextMenu;
class QLineEdit;
/**
* \ingroup QmitkModule
* \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 MITKQTWIDGETS_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 * );
+ void contextMenuEvent ( QContextMenuEvent * ) override;
/// change notifications from the mitkLevelWindowManager
void OnPropertyModified(const itk::EventObject& e);
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/Modules/QtWidgets/include/QmitkProgressBar.h b/Modules/QtWidgets/include/QmitkProgressBar.h
index 0d967e7825..9968bab0d7 100644
--- a/Modules/QtWidgets/include/QmitkProgressBar.h
+++ b/Modules/QtWidgets/include/QmitkProgressBar.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKPROGRESSBAR_H
#define QMITKPROGRESSBAR_H
#include <MitkQtWidgetsExports.h>
#include <mitkProgressBarImplementation.h>
#include <QProgressBar>
/**
* \ingroup QmitkModule
* \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 MITKQTWIDGETS_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);
+ virtual void SetPercentageVisible(bool visible) override;
//##Documentation
//## @brief Adds steps to totalSteps.
- virtual void AddStepsToDo(unsigned int steps);
+ virtual void AddStepsToDo(unsigned int steps) override;
//##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);
+ virtual void Progress(unsigned int steps) override;
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();
+ void Reset() override;
unsigned int m_TotalSteps;
unsigned int m_Progress;
};
#endif /* define QMITKPROGRESSBAR_H */
diff --git a/Modules/QtWidgets/include/QmitkPropertiesTableModel.h b/Modules/QtWidgets/include/QmitkPropertiesTableModel.h
index cf10dbe88a..bdb9555e60 100644
--- a/Modules/QtWidgets/include/QmitkPropertiesTableModel.h
+++ b/Modules/QtWidgets/include/QmitkPropertiesTableModel.h
@@ -1,252 +1,252 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/// Header guard.
#ifndef QmitkPropertiesTableModel_h
#define QmitkPropertiesTableModel_h
#include <MitkQtWidgetsExports.h>
//# Own includes
#include "mitkDataNode.h"
#include "mitkWeakPointer.h"
//# Toolkit includes
#include <QAbstractTableModel>
#include <vector>
#include <string>
//# Forward declarations
/**
* \ingroup QmitkModule
* \brief A table model for showing and editing mitk::Properties.
*
* \see QmitkPropertyDelegate
*/
class MITKQTWIDGETS_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<std::string, mitk::BaseProperty::Pointer> PropertyDataSet;
///
/// Constructs a new QmitkDataStorageTableModel
/// and sets the DataNode for this TableModel.
QmitkPropertiesTableModel(QObject* parent = 0, mitk::PropertyList::Pointer _PropertyList=0);
///
/// Standard dtor. Nothing to do here.
virtual ~QmitkPropertiesTableModel();
//# PUBLIC GETTER
public:
///
/// Returns the property list of this table model.
///
mitk::PropertyList::Pointer GetPropertyList() const;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
- Qt::ItemFlags flags(const QModelIndex& index) const;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
///
/// 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;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
///
/// 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;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
///
/// Overwritten from QAbstractTableModel. Returns the flags what can be done with the items (view, edit, ...)
- int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
///
/// 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;
+ int columnCount(const QModelIndex &parent) const override;
//# 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);
+ int role) override;
///
/// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
///
- void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
+ void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ) override;
//#PROTECTED INNER CLASSES
protected:
///
/// \struct PropertyDataSetCompareFunction
/// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the property list elements.
///
struct PropertyDataSetCompareFunction
: public std::binary_function<PropertyDataSet, PropertyDataSet, bool>
{
///
/// \brief Specifies field of the property with which it will be sorted.
///
enum CompareCriteria {
CompareByName = 0,
CompareByValue
};
///
/// \brief Specifies Ascending/descending ordering.
///
enum CompareOperator {
Less = 0,
Greater
};
///
/// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given.
///
PropertyDataSetCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less);
///
/// \brief The reimplemented compare function.
///
bool operator()(const PropertyDataSet& _Left
, const PropertyDataSet& _Right) const;
protected:
CompareCriteria m_CompareCriteria;
CompareOperator m_CompareOperator;
};
///
/// An unary function for selecting Properties in a vector by a key word.
///
struct PropertyListElementFilterFunction
: public std::unary_function<PropertyDataSet, bool>
{
PropertyListElementFilterFunction(const std::string& m_FilterKeyWord);
///
/// \brief The reimplemented compare function.
///
bool operator()(const PropertyDataSet& _Elem) const;
protected:
std::string m_FilterKeyWord;
};
//# PROTECTED GETTER
protected:
///
/// \brief Searches for the specified property and returns the row of the element in this QTableModel.
/// If any errors occur, the function returns -1.
///
int FindProperty(const mitk::BaseProperty* _Property) const;
//# PROTECTED SETTER
protected:
///
/// Adds a property dataset to the current selection.
/// When a property is added a modified and delete listener
/// is appended.
///
void AddSelectedProperty(PropertyDataSet& _PropertyDataSet);
///
/// Removes a property dataset from the current selection.
/// When a property is removed the modified and delete listener
/// are also removed.
///
void RemoveSelectedProperty(unsigned int _Index);
///
/// Reset is called when a new filter keyword is set or a new
/// PropertyList is set. First of all, all priorly selected
/// properties are removed. Then all properties to be
/// selected (specified by the keyword) are added to the selection.
///
void Reset();
//# PROTECTED MEMBERS
protected:
///
/// Holds the pointer to the properties list. Dont use smart pointers here. Instead: Listen
/// to the delete event.
mitk::WeakPointer<mitk::PropertyList> m_PropertyList;
///
/// Store the properties in a vector so that they may be sorted
std::vector<PropertyDataSet > m_SelectedProperties;
///
/// \brief Holds all tags of Modified Event Listeners. We need it to remove them again.
///
std::vector<unsigned long> m_PropertyModifiedObserverTags;
///
/// \brief Holds all tags of Modified Event Listeners. We need it to remove them again.
///
std::vector<unsigned long> m_PropertyDeleteObserverTags;
///
/// \brief Indicates if this class should neglect all incoming events because
/// the class itself triggered the event (e.g. when a property was edited).
///
bool m_BlockEvents;
///
/// \brief The property is true when the property list is sorted in descending order.
///
bool m_SortDescending;
///
/// \brief If set to any value, only properties containing the specified keyword in their name will be shown.
///
std::string m_FilterKeyWord;
};
#endif /* QMITKPROPERTIESTABLEMODEL_H_ */
diff --git a/Modules/QtWidgets/include/QmitkPropertyDelegate.h b/Modules/QtWidgets/include/QmitkPropertyDelegate.h
index 245cfba2e9..0baa27f06d 100644
--- a/Modules/QtWidgets/include/QmitkPropertyDelegate.h
+++ b/Modules/QtWidgets/include/QmitkPropertyDelegate.h
@@ -1,89 +1,89 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkPropertyDelegate_h
#define QmitkPropertyDelegate_h
#include <MitkQtWidgetsExports.h>
/// Own includes.
#include "mitkBaseProperty.h"
/// Toolkit includes.
#include <QStyledItemDelegate>
/// Forward declarations.
/**
* \ingroup QmitkModule
* \brief An item delegate for rendering and editing mitk::Properties in a QTableView.
*
* \see QmitkPropertiesTableModel
*/
class MITKQTWIDGETS_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;
+ , const QModelIndex &index) const override;
///
/// Create an editor for a specific property (overwritten from QItemDelegate)
///
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option
- , const QModelIndex &index) const;
+ , const QModelIndex &index) const override;
///
/// Create an editor for a specific property (overwritten from QItemDelegate)
///
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
///
/// 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;
+ , const QModelIndex &index) const override;
///
/// \brief Fit an editor to some geometry (overwritten from QItemDelegate)
///
- void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
- bool eventFilter( QObject *o, QEvent *e );
+ bool eventFilter( QObject *o, QEvent *e ) override;
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/Modules/QtWidgets/include/QmitkRenderWindow.h b/Modules/QtWidgets/include/QmitkRenderWindow.h
index 80b14106f1..544797833b 100644
--- a/Modules/QtWidgets/include/QmitkRenderWindow.h
+++ b/Modules/QtWidgets/include/QmitkRenderWindow.h
@@ -1,180 +1,180 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66
#define QMITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66
#include "mitkRenderWindowBase.h"
#include <MitkQtWidgetsExports.h>
#include "QVTKWidget.h"
#include <vtkGenericOpenGLRenderWindow.h>
#include "QmitkRenderWindowMenu.h"
#include "mitkInteractionEventConst.h"
#include "mitkBaseRenderer.h"
class QmitkStdMultiWidget;
class QDragEnterEvent;
class QDropEvent;
class QInputEvent;
/**
* \ingroup QmitkModule
* \brief MITK implementation of the QVTKWidget
*/
class MITKQTWIDGETS_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,mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard);
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.
*QmitkStdMultiWidget
* 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, QmitkStdMultiWidget* stdMultiWidget = 0);
bool GetActivateMenuWidgetFlag()
{
return m_MenuWidgetActivated;
}
// Get it from the QVTKWidget parent
- virtual vtkRenderWindow* GetVtkRenderWindow()
+ virtual vtkRenderWindow* GetVtkRenderWindow() override
{
return GetRenderWindow();
}
- virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor()
+ virtual vtkRenderWindowInteractor* GetVtkRenderWindowInteractor() override
{
return NULL;
}
void FullScreenMode(bool state);
protected:
// overloaded move handler
- virtual void moveEvent(QMoveEvent* event);
+ virtual void moveEvent(QMoveEvent* event) override;
// overloaded show handler
- void showEvent(QShowEvent* event);
+ void showEvent(QShowEvent* event) override;
// overloaded resize handler
- virtual void resizeEvent(QResizeEvent* event);
+ virtual void resizeEvent(QResizeEvent* event) override;
// overloaded paint handler
- virtual void paintEvent(QPaintEvent* event);
+ virtual void paintEvent(QPaintEvent* event) override;
// overloaded mouse press handler
- virtual void mousePressEvent(QMouseEvent* event);
+ virtual void mousePressEvent(QMouseEvent* event) override;
// overloaded mouse double-click handler
- virtual void mouseDoubleClickEvent( QMouseEvent *event );
+ virtual void mouseDoubleClickEvent( QMouseEvent *event ) override;
// overloaded mouse move handler
- virtual void mouseMoveEvent(QMouseEvent* event);
+ virtual void mouseMoveEvent(QMouseEvent* event) override;
// overloaded mouse release handler
- virtual void mouseReleaseEvent(QMouseEvent* event);
+ virtual void mouseReleaseEvent(QMouseEvent* event) override;
// overloaded key press handler
- virtual void keyPressEvent(QKeyEvent* event);
+ virtual void keyPressEvent(QKeyEvent* event) override;
// overloaded enter handler
- virtual void enterEvent(QEvent*);
+ virtual void enterEvent(QEvent*) override;
// overloaded leave handler
- virtual void leaveEvent(QEvent*);
+ virtual void leaveEvent(QEvent*) override;
/// \brief Simply says we accept the event type.
- virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual void dragEnterEvent(QDragEnterEvent *event) override;
/// \brief If the dropped type is application/x-mitk-datanodes we process the request by converting to mitk::DataNode pointers and emitting the NodesDropped signal.
- virtual void dropEvent(QDropEvent * event);
+ virtual void dropEvent(QDropEvent * event) override;
#ifndef QT_NO_WHEELEVENT
// overload wheel mouse event
- virtual void wheelEvent(QWheelEvent*);
+ virtual void wheelEvent(QWheelEvent*) override;
#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();
/// \brief Emits a signal to say that this window has had the following nodes dropped on it.
void NodesDropped(QmitkRenderWindow *thisWindow, std::vector<mitk::DataNode*> nodes);
protected slots:
void OnChangeLayoutDesign(int layoutDesignIndex);
void OnWidgetPlaneModeChanged(int);
void DeferredHideMenu();
private:
// Helper Functions to Convert Qt-Events to Mitk-Events
mitk::Point2D GetMousePosition(QMouseEvent* me) const;
mitk::Point2D GetMousePosition(QWheelEvent* we) const;
mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent* me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent* me) const;
mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent* me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QWheelEvent* we) const;
std::string GetKeyLetter(QKeyEvent* ke) const;
int GetDelta(QWheelEvent* we) const;
bool m_ResendQtEvents;
QmitkRenderWindowMenu* m_MenuWidget;
bool m_MenuWidgetActivated;
unsigned int m_LayoutIndex;
};
#endif
diff --git a/Modules/QtWidgets/include/QmitkRenderWindowMenu.h b/Modules/QtWidgets/include/QmitkRenderWindowMenu.h
index e9e60fa736..92f3239b06 100644
--- a/Modules/QtWidgets/include/QmitkRenderWindowMenu.h
+++ b/Modules/QtWidgets/include/QmitkRenderWindowMenu.h
@@ -1,333 +1,333 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkRenderWindowMenu_h
#define QmitkRenderWindowMenu_h
#if defined(_WIN32) || defined(__APPLE__)
#define QMITK_USE_EXTERNAL_RENDERWINDOW_MENU
#endif
#include <MitkQtWidgetsExports.h>
#include "mitkBaseRenderer.h"
#include <QWidget>
#include <QEvent>
#include <QPushButton>
#include <QMenuBar>
#include <QAction>
#include <QLabel>
#include <QTimer>
class QmitkStdMultiWidget;
/**
* \ingroup QmitkModule
* \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.
*
* \sa QmitkRenderWindow
* \sa QmitkStdMultiWidget
*
*/
class MITKQTWIDGETS_EXPORT QmitkRenderWindowMenu : public QWidget
{
Q_OBJECT
public:
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QmitkRenderWindowMenu( QWidget* parent = 0, Qt::WindowFlags f = 0, mitk::BaseRenderer * b = 0, QmitkStdMultiWidget* mw = 0 );
#else
QmitkRenderWindowMenu( QWidget* parent = 0, Qt::WFlags f = 0, mitk::BaseRenderer * b = 0, QmitkStdMultiWidget* mw = 0 );
#endif
virtual ~QmitkRenderWindowMenu();
/*! Return visibility of settings menu. The menu is connected with m_SettingsButton and includes
layout direction (axial, 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 (axial, coronal, sagital or threeD) of the parent. */
void SetLayoutIndex( unsigned int layoutIndex );
/*! Return layout direction of parent (axial, 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);
+ void paintEvent(QPaintEvent *event) override;
/*! Update list of layout direction (axial, 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 enterEvent( QEvent* /*e*/ ) override;
+ void leaveEvent( QEvent* /*e*/ ) override;
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 (axial, 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 Axial 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 Axial 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 Axial 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
{
AXIAL,
SAGITTAL,
CORONAL,
THREE_D
};
/*! enum for layout design */
enum
{
LAYOUT_DEFAULT,
LAYOUT_2DIMAGEUP,
LAYOUT_2DIMAGELEFT,
LAYOUT_BIG3D,
LAYOUT_AXIAL,
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 axial 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 axial n sagittal left, 3D right layout design */
QAction* m_2x2Dand3DWidgetLayoutAction;
/*! QAction for axial 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: axial; 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_AXIAL; 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;
QmitkStdMultiWidget* m_MultiWidget;
///
/// a timer for the auto rotate action
///
QTimer m_AutoRotationTimer;
QWidget* m_Parent;
};
#endif // QmitkRenderWindowMenu_H
diff --git a/Modules/QtWidgets/include/QmitkRenderingManager.h b/Modules/QtWidgets/include/QmitkRenderingManager.h
index e7e127b99c..f8d27c0494 100644
--- a/Modules/QtWidgets/include/QmitkRenderingManager.h
+++ b/Modules/QtWidgets/include/QmitkRenderingManager.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#define QMITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#include <MitkQtWidgetsExports.h>
#include "mitkRenderingManager.h"
#include <QObject>
#include <QEvent>
class QmitkRenderingManagerInternal;
class QmitkRenderingManagerFactory;
/**
* \ingroup QmitkModule
* \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.
*
*/
class MITKQTWIDGETS_EXPORT QmitkRenderingManager : public QObject, public mitk::RenderingManager
{
Q_OBJECT
public:
mitkClassMacro( QmitkRenderingManager, mitk::RenderingManager );
virtual ~QmitkRenderingManager();
- virtual void DoMonitorRendering();
- virtual void DoFinishAbortRendering();
+ virtual void DoMonitorRendering() override;
+ virtual void DoFinishAbortRendering() override;
- virtual bool event( QEvent *event );
+ virtual bool event( QEvent *event ) override;
protected:
itkFactorylessNewMacro(Self);
QmitkRenderingManager();
- virtual void GenerateRenderingRequestEvent();
+ virtual void GenerateRenderingRequestEvent() override;
- virtual void StartOrResetTimer();
+ virtual void StartOrResetTimer() override;
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/Modules/QtWidgets/include/QmitkRenderingManagerFactory.h b/Modules/QtWidgets/include/QmitkRenderingManagerFactory.h
index 7ec3a97c91..76775a53fa 100644
--- a/Modules/QtWidgets/include/QmitkRenderingManagerFactory.h
+++ b/Modules/QtWidgets/include/QmitkRenderingManagerFactory.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197
#define QMITKRENDERINGMANAGERFACTORY_H_HEADER_INCLUDED_C135A197
#include <MitkQtWidgetsExports.h>
#include "mitkRenderingManagerFactory.h"
/**
* \ingroup QmitkModule
* \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.
*/
class MITKQTWIDGETS_EXPORT QmitkRenderingManagerFactory : public mitk::RenderingManagerFactory
{
public:
QmitkRenderingManagerFactory();
~QmitkRenderingManagerFactory();
- virtual mitk::RenderingManager::Pointer CreateRenderingManager() const;
+ virtual mitk::RenderingManager::Pointer CreateRenderingManager() const override;
private:
};
#endif
diff --git a/Modules/QtWidgets/include/QmitkSliderLevelWindowWidget.h b/Modules/QtWidgets/include/QmitkSliderLevelWindowWidget.h
index 4623e7a0ac..19bad9dc82 100644
--- a/Modules/QtWidgets/include/QmitkSliderLevelWindowWidget.h
+++ b/Modules/QtWidgets/include/QmitkSliderLevelWindowWidget.h
@@ -1,195 +1,195 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKSLIDERLEVELWINDOW_WIDGET
#define QMITKSLIDERLEVELWINDOW_WIDGET
#include <MitkQtWidgetsExports.h>
#include <QWidget>
#include <mitkLevelWindowManager.h>
class QmitkLevelWindowWidgetContextMenu;
/**
* \ingroup QmitkModule
*
* \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 MITKQTWIDGETS_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 * );
+ void contextMenuEvent ( QContextMenuEvent * ) override;
/// 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 );
+ void paintEvent( QPaintEvent* e ) override;
/*!
* 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 mouseMoveEvent( QMouseEvent* mouseEvent ) override;
- void enterEvent ( QEvent * event );
+ void enterEvent ( QEvent * event ) override;
/*!
* 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 );
+ void mousePressEvent( QMouseEvent* mouseEvent ) override;
/*!
* sets the variable m_MouseDown to false
*/
- void mouseReleaseEvent( QMouseEvent* mouseEvent );
+ void mouseReleaseEvent( QMouseEvent* mouseEvent ) override;
/*!
* causes an update of the sliderbar when resizing the window
*/
- void virtual resizeEvent ( QResizeEvent * event );
+ void virtual resizeEvent ( QResizeEvent * event ) override;
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/Modules/QtWidgets/include/QmitkStdMultiWidget.h b/Modules/QtWidgets/include/QmitkStdMultiWidget.h
index 6763383df7..277e8c2859 100644
--- a/Modules/QtWidgets/include/QmitkStdMultiWidget.h
+++ b/Modules/QtWidgets/include/QmitkStdMultiWidget.h
@@ -1,445 +1,445 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkStdMultiWidget_h
#define QmitkStdMultiWidget_h
#include "MitkQtWidgetsExports.h"
#include <mitkPositionTracker.h>
#include <mitkSlicesRotator.h>
#include <mitkSlicesSwiveller.h>
#include <mitkRenderWindowFrame.h>
#include <mitkLogoOverlay.h>
#include <mitkGradientBackground.h>
#include <mitkCoordinateSupplier.h>
#include <mitkDataStorage.h>
#include <mitkMouseModeSwitcher.h>
#include <qwidget.h>
#include <qsplitter.h>
#include <QFrame>
#include <QmitkRenderWindow.h>
#include <QmitkLevelWindowWidget.h>
#include <vtkTextProperty.h>
#include <vtkCornerAnnotation.h>
#include <mitkBaseRenderer.h>
class QHBoxLayout;
class QVBoxLayout;
class QGridLayout;
class QSpacerItem;
class QmitkLevelWindowWidget;
class QmitkRenderWindow;
namespace mitk {
class RenderingManager;
}
/// \ingroup QmitkModule
class MITKQTWIDGETS_EXPORT QmitkStdMultiWidget : public QWidget
{
Q_OBJECT
public:
QmitkStdMultiWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, mitk::RenderingManager* renderingManager = 0, mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard, const QString& name = "stdmulti");
virtual ~QmitkStdMultiWidget();
mitk::SliceNavigationController*
GetTimeNavigationController();
void RequestUpdate();
void ForceImmediateUpdate();
mitk::MouseModeSwitcher* GetMouseModeSwitcher();
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;
bool GetGradientBackgroundFlag() const;
/*!
\brief Access node of widget plane 1
\return DataNode holding widget plane 1
*/
mitk::DataNode::Pointer GetWidgetPlane1();
/*!
\brief Access node of widget plane 2
\return DataNode holding widget plane 2
*/
mitk::DataNode::Pointer GetWidgetPlane2();
/*!
\brief Access node of widget plane 3
\return DataNode holding widget plane 3
*/
mitk::DataNode::Pointer GetWidgetPlane3();
/*!
\brief Convenience method to access node of widget planes
\param id number of widget plane to be returned
\return DataNode holding widget plane 3
*/
mitk::DataNode::Pointer GetWidgetPlane(int id);
bool IsColoredRectanglesEnabled() const;
bool IsDepartmentLogoEnabled() const;
bool IsCrosshairNavigationEnabled() 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 );
bool IsMenuWidgetEnabled() const;
void SetCornerAnnotationVisibility(bool visibility);
protected:
void UpdateAllWidgets();
void HideAllWidgetToolbars();
mitk::DataNode::Pointer GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes);
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 wheelEvent( QWheelEvent * e ) override;
- void mousePressEvent(QMouseEvent * e);
+ void mousePressEvent(QMouseEvent * e) override;
- void moveEvent( QMoveEvent* e );
+ void moveEvent( QMoveEvent* e ) override;
- void leaveEvent ( QEvent * e );
+ void leaveEvent ( QEvent * e ) override;
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();
void MouseModeSelected( mitk::MouseModeSwitcher::MouseMode mouseMode );
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 {
AXIAL,
SAGITTAL,
CORONAL,
THREE_D
};
/**
* @brief SetCornerAnnotation Create a corner annotation for a widget.
* @param text The text of the annotation.
* @param color The color.
* @param widgetNumber The widget (0-3).
*/
void SetCornerAnnotation(std::string text, mitk::Color color, int widgetNumber);
/**
* @brief GetRenderWindow convinience method to get a widget.
* @param number of the widget (0-3)
* @return The renderwindow widget.
*/
QmitkRenderWindow *GetRenderWindow(unsigned int number);
/**
* @brief SetGradientBackgroundColorForRenderWindow background for a widget.
*
* If two different input colors are, a gradient background is generated.
*
* @param upper Upper color of the gradient background.
* @param lower Lower color of the gradient background.
* @param widgetNumber The widget (0-3).
*/
void SetGradientBackgroundColorForRenderWindow(const mitk::Color &upper, const mitk::Color &lower, unsigned int widgetNumber);
/**
* @brief GetDecorationColorForWidget Get the color for annotation, crosshair and rectangle.
* @param widgetNumber Number of the renderwindow (0-3).
* @return Color in mitk format.
*/
mitk::Color GetDecorationColor(unsigned int widgetNumber);
/**
* @brief SetDecorationColor Set the color of the decoration of the 4 widgets.
*
* This is used to color the frame of the renderwindow and the corner annatation.
* For the first 3 widgets, this color is a property of the helper object nodes
* which contain the respective plane geometry. For widget 4, this is a member,
* since there is no data node for this widget.
*/
void SetDecorationColor(unsigned int widgetNumber, mitk::Color color);
/**
* @brief GetCornerAnnotationText Getter for corner annotation text.
* @param widgetNumber the widget number (0-3).
* @return The text in the corner annotation.
*/
std::string GetCornerAnnotationText(unsigned int widgetNumber);
/**
* @brief GetGradientColors Getter for gradientbackground colors.
* @param widgetNumber the widget number (0-3).
* @return A pair of colors. First: upper, second: lower.
*/
std::pair<mitk::Color, mitk::Color> GetGradientColors(unsigned int widgetNumber);
protected:
QHBoxLayout* QmitkStdMultiWidgetLayout;
int m_Layout;
int m_PlaneMode;
mitk::RenderingManager* m_RenderingManager;
/**
* @brief m_RectangleRendering1 the 4 frames of the renderwindow.
*/
mitk::RenderWindowFrame::Pointer m_RectangleRendering[4];
mitk::LogoOverlay::Pointer m_LogoRendering;
mitk::GradientBackground::Pointer m_GradientBackground[4];
bool m_GradientBackgroundFlag;
mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher;
mitk::CoordinateSupplier::Pointer m_LastLeftClickPositionSupplier;
mitk::PositionTracker::Pointer m_PositionTracker;
mitk::SliceNavigationController* m_TimeNavigationController;
mitk::SlicesRotator::Pointer m_SlicesRotator;
mitk::SlicesSwiveller::Pointer m_SlicesSwiveller;
mitk::DataNode::Pointer m_PositionTrackerNode;
mitk::DataStorage::Pointer m_DataStorage;
/**
* @brief m_PlaneNode1 the 3 helper objects which contain the plane geometry.
*/
mitk::DataNode::Pointer m_PlaneNode1;
mitk::DataNode::Pointer m_PlaneNode2;
mitk::DataNode::Pointer m_PlaneNode3;
/**
* @brief m_ParentNodeForGeometryPlanes This helper object is added to the datastorage
* and contains the 3 planes for displaying the image geometry (crosshair and 3D planes).
*/
mitk::DataNode::Pointer m_ParentNodeForGeometryPlanes;
/**
* @brief m_DecorationColorWidget4 color for annotation and rectangle of widget 4.
*
* For other widgets1-3, the color is a property of the respective data node.
* There is no node for widget 4, hence, we need an extra member.
*/
mitk::Color m_DecorationColorWidget4;
/**
* @brief m_GradientBackgroundColors Contains the colors of the gradient background.
*
*/
std::pair<mitk::Color, mitk::Color> m_GradientBackgroundColors[4];
QSplitter *m_MainSplit;
QSplitter *m_LayoutSplit;
QSplitter *m_SubSplit1;
QSplitter *m_SubSplit2;
QWidget *mitkWidget1Container;
QWidget *mitkWidget2Container;
QWidget *mitkWidget3Container;
QWidget *mitkWidget4Container;
/**
* @brief The CornerAnnotation struct to hold the 4 corner annotations.
*/
struct CornerAnnotation
{
vtkSmartPointer<vtkCornerAnnotation> cornerText;
vtkSmartPointer<vtkTextProperty> textProp;
vtkSmartPointer<vtkRenderer> ren;
} m_CornerAnnotations[4];
bool m_PendingCrosshairPositionEvent;
bool m_CrosshairNavigationEnabled;
/**
* @brief CreateCornerAnnotation helper method to create a corner annotation.
* @param text of the annotation.
* @param color of the annotation.
* @return the complete struct.
*/
CornerAnnotation CreateCornerAnnotation(std::string text, mitk::Color color);
/**
* @brief FillGradientBackgroundWithBlack Internal helper method to initialize the
* gradient background colors with black.
*/
void FillGradientBackgroundWithBlack();
};
#endif /*QmitkStdMultiWidget_h*/
diff --git a/Modules/QtWidgets/src/QmitkIOUtil.cpp b/Modules/QtWidgets/src/QmitkIOUtil.cpp
index 3f226b78d9..7bfdfb0a48 100644
--- a/Modules/QtWidgets/src/QmitkIOUtil.cpp
+++ b/Modules/QtWidgets/src/QmitkIOUtil.cpp
@@ -1,549 +1,549 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkIOUtil.h"
#include <mitkIOUtil.h>
#include <mitkCoreObjectFactory.h>
#include "mitkCoreServices.h"
#include "mitkIMimeTypeProvider.h"
#include "mitkMimeType.h"
#include "mitkCustomMimeType.h"
#include "mitkFileReaderRegistry.h"
#include "mitkFileWriterRegistry.h"
#include "QmitkFileReaderOptionsDialog.h"
#include "QmitkFileWriterOptionsDialog.h"
// QT
#include <QFileDialog>
#include <QMessageBox>
#include <QSet>
#include <QDebug>
//ITK
#include <itksys/SystemTools.hxx>
#include <algorithm>
struct QmitkIOUtil::Impl
{
struct ReaderOptionsDialogFunctor : public ReaderOptionsFunctorBase
{
- virtual bool operator()(LoadInfo& loadInfo)
+ virtual bool operator()(LoadInfo& loadInfo) override
{
QmitkFileReaderOptionsDialog dialog(loadInfo);
if (dialog.exec() == QDialog::Accepted)
{
return !dialog.ReuseOptions();
}
else
{
loadInfo.m_Cancel = true;
return true;
}
}
};
struct WriterOptionsDialogFunctor : public WriterOptionsFunctorBase
{
- virtual bool operator()(SaveInfo& saveInfo)
+ virtual bool operator()(SaveInfo& saveInfo) override
{
QmitkFileWriterOptionsDialog dialog(saveInfo);
if (dialog.exec() == QDialog::Accepted)
{
return !dialog.ReuseOptions();
}
else
{
saveInfo.m_Cancel = true;
return true;
}
}
};
};
struct MimeTypeComparison : public std::unary_function<mitk::MimeType, bool>
{
MimeTypeComparison(const std::string& mimeTypeName)
: m_Name(mimeTypeName)
{}
bool operator()(const mitk::MimeType& mimeType) const
{
return mimeType.GetName() == m_Name;
}
const std::string m_Name;
};
QString QmitkIOUtil::GetFileOpenFilterString()
{
QString filters;
mitk::CoreServicePointer<mitk::IMimeTypeProvider> mimeTypeProvider(mitk::CoreServices::GetMimeTypeProvider());
std::vector<std::string> categories = mimeTypeProvider->GetCategories();
for (std::vector<std::string>::iterator cat = categories.begin(); cat != categories.end(); ++cat)
{
QSet<QString> filterExtensions;
std::vector<mitk::MimeType> mimeTypes = mimeTypeProvider->GetMimeTypesForCategory(*cat);
for (std::vector<mitk::MimeType>::iterator mt = mimeTypes.begin(); mt != mimeTypes.end(); ++mt)
{
std::vector<std::string> extensions = mt->GetExtensions();
for (std::vector<std::string>::iterator ext = extensions.begin(); ext != extensions.end(); ++ext)
{
filterExtensions << QString::fromStdString(*ext);
}
}
QString filter = QString::fromStdString(*cat) + " (";
foreach(const QString& extension, filterExtensions)
{
filter += "*." + extension + " ";
}
filter = filter.replace(filter.size()-1, 1, ')');
filters += ";;" + filter;
}
filters.prepend("All (*)");
return filters;
}
QList<mitk::BaseData::Pointer> QmitkIOUtil::Load(const QStringList& paths, QWidget* parent)
{
std::vector<LoadInfo> loadInfos;
foreach(const QString& file, paths)
{
loadInfos.push_back(LoadInfo(file.toStdString()));
}
Impl::ReaderOptionsDialogFunctor optionsCallback;
std::string errMsg = Load(loadInfos, NULL, NULL, &optionsCallback);
if (!errMsg.empty())
{
QMessageBox::warning(parent, "Error reading files", QString::fromStdString(errMsg));
mitkThrow() << errMsg;
}
QList<mitk::BaseData::Pointer> qResult;
for(std::vector<LoadInfo>::const_iterator iter = loadInfos.begin(), iterEnd = loadInfos.end();
iter != iterEnd; ++iter)
{
for (std::vector<mitk::BaseData::Pointer>::const_iterator dataIter = iter->m_Output.begin(),
dataIterEnd = iter->m_Output.end(); dataIter != dataIterEnd; ++dataIter)
{
qResult << *dataIter;
}
}
return qResult;
}
mitk::DataStorage::SetOfObjects::Pointer QmitkIOUtil::Load(const QStringList& paths, mitk::DataStorage& storage, QWidget* parent)
{
std::vector<LoadInfo> loadInfos;
foreach(const QString& file, paths)
{
loadInfos.push_back(LoadInfo(QFile::encodeName(file).constData()));
}
mitk::DataStorage::SetOfObjects::Pointer nodeResult = mitk::DataStorage::SetOfObjects::New();
Impl::ReaderOptionsDialogFunctor optionsCallback;
std::string errMsg = Load(loadInfos, nodeResult, &storage, &optionsCallback);
if (!errMsg.empty())
{
QMessageBox::warning(parent, "Error reading files", QString::fromStdString(errMsg));
mitkThrow() << errMsg;
}
return nodeResult;
}
QList<mitk::BaseData::Pointer> QmitkIOUtil::Load(const QString& path, QWidget* parent)
{
QStringList paths;
paths << path;
return Load(paths, parent);
}
mitk::DataStorage::SetOfObjects::Pointer QmitkIOUtil::Load(const QString& path, mitk::DataStorage& storage,
QWidget* parent)
{
QStringList paths;
paths << path;
return Load(paths, storage, parent);
}
QString QmitkIOUtil::Save(const mitk::BaseData* data, const QString& defaultBaseName,
const QString& defaultPath, QWidget* parent)
{
std::vector<const mitk::BaseData*> dataVector;
dataVector.push_back(data);
QStringList defaultBaseNames;
defaultBaseNames.push_back(defaultBaseName);
return Save(dataVector, defaultBaseNames, defaultPath, parent).back();
}
QStringList QmitkIOUtil::Save(const std::vector<const mitk::BaseData*>& data,
const QStringList& defaultBaseNames,
const QString& defaultPath,
QWidget* parent)
{
QStringList fileNames;
QString currentPath = defaultPath;
std::vector<SaveInfo> saveInfos;
int counter = 0;
for(std::vector<const mitk::BaseData*>::const_iterator dataIter = data.begin(),
dataIterEnd = data.end(); dataIter != dataIterEnd; ++dataIter, ++counter)
{
SaveInfo saveInfo(*dataIter, mitk::MimeType(), std::string());
SaveFilter filters(saveInfo);
// If there is only the "__all__" filter string, it means there is no writer for this base data
if (filters.Size() < 2)
{
QMessageBox::warning(parent,
"Saving not possible",
QString("No writer available for type \"%1\"").arg(
QString::fromStdString((*dataIter)->GetNameOfClass())));
continue;
}
// Construct a default path and file name
QString filterString = filters.ToString();
QString selectedFilter = filters.GetDefaultFilter();
QString fileName = currentPath;
QString dialogTitle = "Save " + QString::fromStdString((*dataIter)->GetNameOfClass());
if (counter < defaultBaseNames.size())
{
dialogTitle += " \"" + defaultBaseNames[counter] + "\"";
fileName += QDir::separator() + defaultBaseNames[counter];
// We do not append an extension to the file name by default. The extension
// is chosen by the user by either selecting a filter or writing the
// extension in the file name himself (in the file save dialog).
/*
QString defaultExt = filters.GetDefaultExtension();
if (!defaultExt.isEmpty())
{
fileName += "." + defaultExt;
}
*/
}
// Ask the user for a file name
QString nextName = QFileDialog::getSaveFileName(parent,
dialogTitle,
fileName,
filterString,
&selectedFilter);
if (nextName.isEmpty())
{
// We stop asking for further file names, but we still save the
// data where the user already confirmed the save dialog.
break;
}
fileName = nextName;
std::string stdFileName = QFile::encodeName(fileName).constData();
QFileInfo fileInfo(fileName);
currentPath = fileInfo.absolutePath();
QString suffix = fileInfo.completeSuffix();
mitk::MimeType filterMimeType = filters.GetMimeTypeForFilter(selectedFilter);
mitk::MimeType selectedMimeType;
if (fileInfo.exists() && !fileInfo.isFile())
{
QMessageBox::warning(parent, "Saving not possible", QString("The path \"%1\" is not a file").arg(fileName));
continue;
}
// Theoretically, the user could have entered an extension that does not match the selected filter
// The extension then has prioritry over the filter
// Check if one of the available mime-types match the filename
std::vector<mitk::MimeType> filterMimeTypes = filters.GetMimeTypes();
for (std::vector<mitk::MimeType>::const_iterator mimeTypeIter = filterMimeTypes.begin(),
mimeTypeIterEnd = filterMimeTypes.end(); mimeTypeIter != mimeTypeIterEnd; ++mimeTypeIter)
{
if (mimeTypeIter->MatchesExtension(stdFileName))
{
selectedMimeType = *mimeTypeIter;
break;
}
}
if (!selectedMimeType.IsValid())
{
// The file name either does not contain an extension or the
// extension is unknown.
// If the file already exists, we stop here because we are unable
// to (over)write the file without adding a custom suffix. If the file
// does not exist, we add the default extension from the currently
// selected filter. If the "All" filter was selected, we only add the
// default extensions if the file name itself does not already contain
// an extension.
if (!fileInfo.exists())
{
if (filterMimeType == SaveFilter::ALL_MIMETYPE())
{
if (suffix.isEmpty())
{
// Use the highest ranked mime-type from the list
selectedMimeType = filters.GetDefaultMimeType();
}
}
else
{
selectedMimeType = filterMimeType;
}
if (selectedMimeType.IsValid())
{
suffix = QString::fromStdString(selectedMimeType.GetExtensions().front());
fileName += "." + suffix;
stdFileName = QFile::encodeName(fileName).constData();
// We changed the file name (added a suffix) so ask in case
// the file aready exists.
fileInfo = QFileInfo(fileName);
if (fileInfo.exists())
{
if (!fileInfo.isFile())
{
QMessageBox::warning(parent, "Saving not possible", QString("The path \"%1\" is not a file").arg(fileName));
continue;
}
if (QMessageBox::question(parent, "Replace File",
QString("A file named \"%1\" already exists. Do you want to replace it?").arg(fileName)) ==
QMessageBox::No)
{
continue;
}
}
}
}
}
if (!selectedMimeType.IsValid())
{
// The extension/filename is not valid (no mime-type found), bail out
QMessageBox::warning(parent,
"Saving not possible",
QString("No mime-type available which can handle \"%1\".")
.arg(fileName));
continue;
}
if (!QFileInfo(fileInfo.absolutePath()).isWritable())
{
QMessageBox::warning(parent, "Saving not possible", QString("The path \"%1\" is not writable").arg(fileName));
continue;
}
fileNames.push_back(fileName);
saveInfo.m_Path = stdFileName;
saveInfo.m_MimeType = selectedMimeType;
// pre-select the best writer for the chosen mime-type
saveInfo.m_WriterSelector.Select(selectedMimeType.GetName());
saveInfos.push_back(saveInfo);
}
if (!saveInfos.empty())
{
Impl::WriterOptionsDialogFunctor optionsCallback;
std::string errMsg = Save(saveInfos, &optionsCallback);
if (!errMsg.empty())
{
QMessageBox::warning(parent, "Error writing files", QString::fromStdString(errMsg));
mitkThrow() << errMsg;
}
}
return fileNames;
}
void QmitkIOUtil::SaveBaseDataWithDialog(mitk::BaseData* data, std::string fileName, QWidget* /*parent*/)
{
Save(data, fileName);
}
void QmitkIOUtil::SaveSurfaceWithDialog(mitk::Surface::Pointer surface, std::string fileName, QWidget* /*parent*/)
{
Save(surface, fileName);
}
void QmitkIOUtil::SaveImageWithDialog(mitk::Image::Pointer image, std::string fileName, QWidget* /*parent*/)
{
Save(image, fileName);
}
void QmitkIOUtil::SavePointSetWithDialog(mitk::PointSet::Pointer pointset, std::string fileName, QWidget* /*parent*/)
{
Save(pointset, fileName);
}
struct QmitkIOUtil::SaveFilter::Impl
{
Impl(const mitk::IOUtil::SaveInfo& saveInfo)
: m_SaveInfo(saveInfo)
{
// Add an artifical filter for "All"
m_MimeTypes.push_back(ALL_MIMETYPE());
m_FilterStrings.push_back("All (*.*)");
// Get all writers and their mime types for the given base data type
// (this is sorted already)
std::vector<mitk::MimeType> mimeTypes = saveInfo.m_WriterSelector.GetMimeTypes();
for (std::vector<mitk::MimeType>::const_reverse_iterator iter = mimeTypes.rbegin(),
iterEnd = mimeTypes.rend(); iter != iterEnd; ++iter)
{
QList<QString> filterExtensions;
mitk::MimeType mimeType = *iter;
std::vector<std::string> extensions = mimeType.GetExtensions();
for (std::vector<std::string>::iterator extIter = extensions.begin(), extIterEnd = extensions.end();
extIter != extIterEnd; ++extIter)
{
filterExtensions << QString::fromStdString(*extIter);
}
if (m_DefaultExtension.isEmpty())
{
m_DefaultExtension = QString::fromStdString(extensions.front());
}
QString filter = QString::fromStdString(mimeType.GetComment()) + " (";
foreach(const QString& extension, filterExtensions)
{
filter += "*." + extension + " ";
}
filter = filter.replace(filter.size()-1, 1, ')');
m_MimeTypes.push_back(mimeType);
m_FilterStrings.push_back(filter);
}
}
const mitk::IOUtil::SaveInfo m_SaveInfo;
std::vector<mitk::MimeType> m_MimeTypes;
QStringList m_FilterStrings;
QString m_DefaultExtension;
};
mitk::MimeType QmitkIOUtil::SaveFilter::ALL_MIMETYPE()
{
static mitk::CustomMimeType allMimeType(std::string("__all__"));
return mitk::MimeType(allMimeType, -1, -1);
}
QmitkIOUtil::SaveFilter::SaveFilter(const QmitkIOUtil::SaveFilter& other)
: d(new Impl(*other.d))
{
}
QmitkIOUtil::SaveFilter::SaveFilter(const SaveInfo& saveInfo)
: d(new Impl(saveInfo))
{
}
QmitkIOUtil::SaveFilter& QmitkIOUtil::SaveFilter::operator=(const QmitkIOUtil::SaveFilter& other)
{
d.reset(new Impl(*other.d));
return *this;
}
std::vector<mitk::MimeType> QmitkIOUtil::SaveFilter::GetMimeTypes() const
{
return d->m_MimeTypes;
}
QString QmitkIOUtil::SaveFilter::GetFilterForMimeType(const std::string& mimeType) const
{
std::vector<mitk::MimeType>::const_iterator iter =
std::find_if(d->m_MimeTypes.begin(), d->m_MimeTypes.end(), MimeTypeComparison(mimeType));
if (iter == d->m_MimeTypes.end())
{
return QString();
}
int index = static_cast<int>(iter - d->m_MimeTypes.begin());
if (index < 0 || index >= d->m_FilterStrings.size())
{
return QString();
}
return d->m_FilterStrings[index];
}
mitk::MimeType QmitkIOUtil::SaveFilter::GetMimeTypeForFilter(const QString& filter) const
{
int index = d->m_FilterStrings.indexOf(filter);
if (index < 0)
{
return mitk::MimeType();
}
return d->m_MimeTypes[index];
}
QString QmitkIOUtil::SaveFilter::GetDefaultFilter() const
{
if (d->m_FilterStrings.size() > 1)
{
return d->m_FilterStrings.at(1);
}
else if (d->m_FilterStrings.size() > 0)
{
return d->m_FilterStrings.front();
}
return QString();
}
QString QmitkIOUtil::SaveFilter::GetDefaultExtension() const
{
return d->m_DefaultExtension;
}
mitk::MimeType QmitkIOUtil::SaveFilter::GetDefaultMimeType() const
{
if (d->m_MimeTypes.size() > 1)
{
return d->m_MimeTypes.at(1);
}
else if (d->m_MimeTypes.size() > 0)
{
return d->m_MimeTypes.front();
}
return mitk::MimeType();
}
QString QmitkIOUtil::SaveFilter::ToString() const
{
return d->m_FilterStrings.join(";;");
}
int QmitkIOUtil::SaveFilter::Size() const
{
return d->m_FilterStrings.size();
}
bool QmitkIOUtil::SaveFilter::IsEmpty() const
{
return d->m_FilterStrings.isEmpty();
}
bool QmitkIOUtil::SaveFilter::ContainsMimeType(const std::string& mimeType)
{
return std::find_if(d->m_MimeTypes.begin(), d->m_MimeTypes.end(), MimeTypeComparison(mimeType)) != d->m_MimeTypes.end();
}
diff --git a/Modules/QtWidgetsExt/include/QmitkBasePropertyView.h b/Modules/QtWidgetsExt/include/QmitkBasePropertyView.h
index acec22f1e1..01e50afaa3 100644
--- a/Modules/QtWidgetsExt/include/QmitkBasePropertyView.h
+++ b/Modules/QtWidgetsExt/include/QmitkBasePropertyView.h
@@ -1,44 +1,44 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_BASEPROPERTYVIEW_H_INCLUDED
#define QMITK_BASEPROPERTYVIEW_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkProperties.h>
#include <QLabel>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkBasePropertyView : public QLabel, public mitk::PropertyView
{
Q_OBJECT
public:
QmitkBasePropertyView( const mitk::BaseProperty*, QWidget* parent);
virtual ~QmitkBasePropertyView();
protected:
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
private:
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkCallbackFromGUIThread.h b/Modules/QtWidgetsExt/include/QmitkCallbackFromGUIThread.h
index ca720a7b8a..f11676630e 100644
--- a/Modules/QtWidgetsExt/include/QmitkCallbackFromGUIThread.h
+++ b/Modules/QtWidgetsExt/include/QmitkCallbackFromGUIThread.h
@@ -1,48 +1,48 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ
#define QMITK_CALLBACK_WITHIN_GUI_TREAD_H_INCLUDGEWQ
#include "mitkCallbackFromGUIThread.h"
#include "MitkQtWidgetsExtExports.h"
#include <QObject>
/*!
\brief Qt specific implementation of mitk::CallbackFromGUIThreadImplementation
*/
class MITKQTWIDGETSEXT_EXPORT QmitkCallbackFromGUIThread : public QObject, public mitk::CallbackFromGUIThreadImplementation
{
Q_OBJECT
public:
/// Change the current application cursor
- virtual void CallThisFromGUIThread(itk::Command*, itk::EventObject*);
+ virtual void CallThisFromGUIThread(itk::Command*, itk::EventObject*) override;
QmitkCallbackFromGUIThread();
virtual ~QmitkCallbackFromGUIThread();
- virtual bool event( QEvent* e );
+ virtual bool event( QEvent* e ) override;
protected:
private:
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkColorPropertyEditor.h b/Modules/QtWidgetsExt/include/QmitkColorPropertyEditor.h
index 51839a903d..bc785e91d5 100644
--- a/Modules/QtWidgetsExt/include/QmitkColorPropertyEditor.h
+++ b/Modules/QtWidgetsExt/include/QmitkColorPropertyEditor.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_COLORPROPERTYEDITOR_H_INCLUDED
#define QMITK_COLORPROPERTYEDITOR_H_INCLUDED
#include "QmitkColorPropertyView.h"
#include "MitkQtWidgetsExtExports.h"
#include <QFrame>
#include <mitkColorProperty.h>
class QListBox;
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkPopupColorChooser : public QFrame
{
Q_OBJECT
public:
QmitkPopupColorChooser(QWidget* parent = 0, unsigned int steps = 16, unsigned int size = 150);
virtual ~QmitkPopupColorChooser();
void setSteps(int);
virtual void popup(QWidget* parent, const QPoint& point, const mitk::Color* = 0); /// Call to popup this widget. parent determines popup position
signals:
void colorSelected(QColor);
protected:
- virtual void keyReleaseEvent(QKeyEvent*);
+ virtual void keyReleaseEvent(QKeyEvent*) override;
- virtual void mouseMoveEvent(QMouseEvent*);
- virtual void mouseReleaseEvent(QMouseEvent*);
- virtual void closeEvent(QCloseEvent*);
+ virtual void mouseMoveEvent(QMouseEvent*) override;
+ virtual void mouseReleaseEvent(QMouseEvent*) override;
+ virtual void closeEvent(QCloseEvent*) override;
- virtual void paintEvent(QPaintEvent*);
+ virtual void paintEvent(QPaintEvent*) override;
void drawGradient(QPainter* p);
private:
QWidget* m_popupParent;
QWidget* my_parent;
unsigned int m_Steps;
unsigned int m_Steps2;
unsigned int m_HStep;
unsigned int m_SStep;
unsigned int m_VStep;
int m_H;
int m_S;
int m_V;
QColor m_OriginalColor;
};
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkColorPropertyEditor : public QmitkColorPropertyView
{
Q_OBJECT
public:
QmitkColorPropertyEditor( const mitk::ColorProperty*, QWidget* parent );
virtual ~QmitkColorPropertyEditor();
protected:
- virtual void mousePressEvent(QMouseEvent*);
- virtual void mouseReleaseEvent(QMouseEvent*);
+ virtual void mousePressEvent(QMouseEvent*) override;
+ virtual void mouseReleaseEvent(QMouseEvent*) override;
static QmitkPopupColorChooser* colorChooser;
static int colorChooserRefCount;
protected slots:
void onColorSelected(QColor);
private:
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkColorPropertyView.h b/Modules/QtWidgetsExt/include/QmitkColorPropertyView.h
index 0fd1343ddc..742a2c1d52 100644
--- a/Modules/QtWidgetsExt/include/QmitkColorPropertyView.h
+++ b/Modules/QtWidgetsExt/include/QmitkColorPropertyView.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_COLORPROPERTYVIEW_H_INCLUDED
#define QMITK_COLORPROPERTYVIEW_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkColorProperty.h>
#include <QLabel>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkColorPropertyView : public QLabel, public mitk::PropertyView
{
Q_OBJECT
public:
QmitkColorPropertyView( const mitk::ColorProperty*, QWidget* parent );
virtual ~QmitkColorPropertyView();
protected:
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
void DisplayColor();
const mitk::ColorProperty* m_ColorProperty;
QPalette m_WidgetPalette;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkColorTransferFunctionCanvas.h b/Modules/QtWidgetsExt/include/QmitkColorTransferFunctionCanvas.h
index 7b8d49be1e..eff74c68a5 100755
--- a/Modules/QtWidgetsExt/include/QmitkColorTransferFunctionCanvas.h
+++ b/Modules/QtWidgetsExt/include/QmitkColorTransferFunctionCanvas.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKCOLORTRANSFERFUNCTIONCANVAS_H_INCLUDED
#define QMITKCOLORTRANSFERFUNCTIONCANVAS_H_INCLUDED
#include "QmitkTransferFunctionCanvas.h"
#include "MitkQtWidgetsExtExports.h"
#include <vtkColorTransferFunction.h>
class MITKQTWIDGETSEXT_EXPORT QmitkColorTransferFunctionCanvas: public QmitkTransferFunctionCanvas
{
Q_OBJECT
public:
QmitkColorTransferFunctionCanvas( QWidget* parent = 0, Qt::WindowFlags f = 0 ) ;
- virtual void paintEvent( QPaintEvent* e );
- int GetNearHandle(int x,int y,unsigned int maxSquaredDistance = 32);
+ virtual void paintEvent( QPaintEvent* e ) override;
+ int GetNearHandle(int x,int y,unsigned int maxSquaredDistance = 32) override;
void SetTitle(const QString& title);
void SetColorTransferFunction(vtkColorTransferFunction* colorTransferFunction)
{
this->m_ColorTransferFunction = colorTransferFunction;
this->SetMin(colorTransferFunction->GetRange()[0]);
this->SetMax(colorTransferFunction->GetRange()[1]);
setEnabled(true);
update();
}
- int AddFunctionPoint(double x, double)
+ int AddFunctionPoint(double x, double) override
{
return m_ColorTransferFunction->AddRGBPoint(x,m_ColorTransferFunction->GetRedValue(x),m_ColorTransferFunction->GetGreenValue(x),m_ColorTransferFunction->GetBlueValue(x));
}
- void RemoveFunctionPoint(double x)
+ void RemoveFunctionPoint(double x) override
{
int old_size = GetFunctionSize();
m_ColorTransferFunction->RemovePoint(x);
if (GetFunctionSize() + 1 != old_size)
{
std::cout << "old/new size" << old_size << "/" << GetFunctionSize() << std::endl;
std::cout << "called with x=" << x << std::endl;
}
}
- double GetFunctionX(int index)
+ double GetFunctionX(int index) override
{
return m_ColorTransferFunction->GetDataPointer()[index*4];
}
- int GetFunctionSize()
+ int GetFunctionSize() override
{
return m_ColorTransferFunction->GetSize();
}
- void DoubleClickOnHandle(int handle);
- void MoveFunctionPoint(int index, std::pair<double,double> pos);
+ void DoubleClickOnHandle(int handle) override;
+ void MoveFunctionPoint(int index, std::pair<double,double> pos) override;
void AddRGB(double x, double r, double g, double b);
double GetFunctionMax()
{
return m_ColorTransferFunction->GetRange()[1];
}
double GetFunctionMin()
{
return m_ColorTransferFunction->GetRange()[0];
}
double GetFunctionRange()
{
double range;
if((m_ColorTransferFunction->GetRange()[0])==0)
{
range = m_ColorTransferFunction->GetRange()[1];
return range;
}
else
{
range = (m_ColorTransferFunction->GetRange()[1])-(m_ColorTransferFunction->GetRange()[0]);
return range;
}
}
void RemoveAllFunctionPoints()
{
m_ColorTransferFunction->AddRGBSegment(this->GetFunctionMin(),1,0,0,this->GetFunctionMax(),1,1,0);
}
- double GetFunctionY(int)
+ double GetFunctionY(int) override
{
return 0.0;
}
protected:
vtkColorTransferFunction* m_ColorTransferFunction;
QString m_Title;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsModel.h b/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsModel.h
index ba927e4794..f961c68599 100644
--- a/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsModel.h
+++ b/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsModel.h
@@ -1,183 +1,183 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_CORRESPONDINGPOINTSETS_MODEL_H_INCLUDED
#define QMITK_CORRESPONDINGPOINTSETS_MODEL_H_INCLUDED
#include <QAbstractTableModel>
#include <mitkStepper.h>
#include "MitkQtWidgetsExtExports.h"
#include "mitkDataNode.h"
#include "mitkPointSet.h"
#include <mitkPointSetInteractor.h>
#include "QmitkStdMultiWidget.h"
/**
* \deprecatedSince{2014_10} mitk::QmitkCorrespondingPointSetsModel is deprecated.
* Most Functionality is covered by QmitkPointListModel.cpp
*
* Alternatively this needs to be updated to the new interaction-framework.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKQTWIDGETSEXT_EXPORT QmitkCorrespondingPointSetsModel : public QAbstractTableModel
{
Q_OBJECT
Q_PROPERTY(bool QTPropShowCoordinates READ QTPropCoordinatesEnabled WRITE QTPropSetCoordinatesEnabled)
Q_PROPERTY(bool QTPropShowIds READ QTPropIdsEnabled WRITE QTPropSetIdsEnabled)
public:
QmitkCorrespondingPointSetsModel( int t = 0, QObject* parent = 0 );
~QmitkCorrespondingPointSetsModel();
- Qt::ItemFlags flags(const QModelIndex& index) const;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
void UpdateSelection(mitk::DataNode* selectedNode);
void RemoveInteractor();
// returns ID of selected point (-1 if no point is selected)
int SearchSelectedPoint();
/// interface of QAbstractTableModel
- int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
/// interface of QAbstractTableModel
- int columnCount( const QModelIndex& parent = QModelIndex() ) const;
+ int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
/// interface of QAbstractTableModel
- QVariant data(const QModelIndex& index, int role) const;
+ QVariant data(const QModelIndex& index, int role) const override;
/// interface of QAbstractTableModel
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
+ int role = Qt::DisplayRole) const override;
/// which point set to work on
void SetPointSetNodes( std::vector<mitk::DataNode*> nodes );
/// which time step to display/model
void SetTimeStep(int t);
/// which time step to display/model
int GetTimeStep() const;
/**
* \brief get point and point ID that correspond to a given QModelIndex
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the QModelIndex as point ID. This method returns the point and
* the corresponding point id for a given QModelIndex. The point and the point ID
* are returned in the outgoing parameters p and id. If a valid point and ID were
* found, the method returns true, otherwise it returns false
* \param[in] QModelIndex &index the index for which a point is requested.
The row() part of the index is used to find a corresponding point
* \param[out] mitk::Point3D& p If a valid point is found, it will be stored in the p parameter
* \param[out] int& id If a valid point is found, the corresponding ID will be stored in id
* \return Returns true, if a valid point was found, false otherwise
*/
bool GetPointForModelIndex( const QModelIndex &index, mitk::PointSet::PointType& p, int& id) const;
bool GetPointForModelIndex( int row, int column, mitk::PointSet::PointType& p, int& id) const;
/**Documentation
* \brief returns a QModelIndex for a given point ID
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the point ID as a QModelIndex. This method returns a QModelIndex
* for a given point ID in the outgoing parameter index.
* \param[in] int id The point ID for which the QModelIndex will be created
* \param[out] QModelIndex& index if a point with the ID id was found, index will contain a corresponding QModelIndex for that point
* \return returns true, if a valid QModelIndex was created, false otherwise
*/
bool GetModelIndexForPointID(int id, QModelIndex& index, int column) const;
bool QTPropCoordinatesEnabled() const;
void QTPropSetCoordinatesEnabled(bool qShowCoordinates);
bool QTPropIdsEnabled() const;
void QTPropSetIdsEnabled(bool qShowIds);
std::vector<mitk::DataNode*> GetPointSetNodes();
void SetSelectedPointSetIndex(int index);
int GetSelectedPointSetIndex();
void ClearSelectedPointSet();
void MoveSelectedPointUp();
void MoveSelectedPointDown();
void RemoveSelectedPoint();
void ClearCurrentTimeStep();
void SetStepper(mitk::Stepper::Pointer stepper);
mitk::Stepper::Pointer GetStepper();
- Qt::DropActions supportedDropActions() const;
+ Qt::DropActions supportedDropActions() const override;
- bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
bool GetModelIndexForSelectedPoint(QModelIndex& index) const;
void SetMultiWidget( QmitkStdMultiWidget* multiWidget ); ///< assign a QmitkStdMultiWidget for updating render window crosshair
QmitkStdMultiWidget* GetMultiWidget(); ///< return the QmitkStdMultiWidget that is used for updating render window crosshair
void OnPointSetChanged( const itk::EventObject & e );
private:
public slots:
signals:
void SignalPointSetChanged();
protected:
//initially checks if there is a PointSet as data in the DataNode.
//returns PointSet if so and NULL if other data is set to node
mitk::PointSet* CheckForPointSetInNode(mitk::DataNode* node) const;
protected:
bool QTPropShowIds;
bool QTPropShowCoordinates;
mitk::DataNode::Pointer m_PointSetNode;
mitk::DataNode::Pointer m_ReferencePointSetNode;
mitk::Stepper::Pointer m_TimeStepper;
int m_SelectedPointSetIndex;
mitk::PointSetInteractor::Pointer m_Interactor;
QmitkStdMultiWidget* m_MultiWidget;
unsigned long m_PointSetModifiedObserverTag;
unsigned long m_ReferencePointSetModifiedObserverTag;
void MoveSelectedPoint(int targetID);
void RemoveObservers();
void AddObservers();
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsView.h b/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsView.h
index fb5c6a0bce..732eae3e17 100644
--- a/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsView.h
+++ b/Modules/QtWidgetsExt/include/QmitkCorrespondingPointSetsView.h
@@ -1,133 +1,133 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_POINTLIST_VIEW_H_INCLUDED
#define QMITK_POINTLIST_VIEW_H_INCLUDED
#include <QTableView>
#include <QLabel>
#include <mitkDataStorage.h>
#include "MitkQtWidgetsExtExports.h"
#include "QmitkCorrespondingPointSetsModel.h"
class QmitkStdMultiWidget;
/*!
* \brief GUI widget for handling mitk::PointSet
*
* Displays all the points in a mitk::PointSet graphically.
* Reacts automatically to changes in the PointSet's selection status.
* Updates PointSet's selection status when this list's selection changes.
*
* If a QmitkStdMultiWidget is assigned via SetMultiWidget(), the
* crosshair of the QmitkStdMultiWidget is moved to the currently selected
* point.
*
* \deprecatedSince{2014_10} mitk::QmitkCorrespondingPointSetsModel is deprecated.
* Most Functionality is covered by QmitkPointListModel
*
* Alternatively this needs to be updated to the new interaction-framework.
* Refer to \see DataInteractionPage for general information about the concept of the new implementation.
*/
class MITKQTWIDGETSEXT_EXPORT QmitkCorrespondingPointSetsView : public QTableView
{
Q_OBJECT
public:
QmitkCorrespondingPointSetsView( QWidget* parent = 0 );
~QmitkCorrespondingPointSetsView();
/// assign a point set for observation
void SetPointSetNodes( std::vector<mitk::DataNode*> nodes );
void SetMultiWidget( QmitkStdMultiWidget* multiWidget ); ///< assign a QmitkStdMultiWidget for updating render window crosshair
QmitkStdMultiWidget* GetMultiWidget() const; ///< return the QmitkStdMultiWidget that is used for updating render window crosshair
void SetDataStorage(mitk::DataStorage::Pointer dataStorage);
std::vector<mitk::DataNode*> GetPointSetNodes();
void UpdateSelection(mitk::DataNode* selectedNode);
// return true if a point from one of the displayed point lists is selected
bool IsPointSelected();
QmitkCorrespondingPointSetsModel* GetModel();
signals:
void SignalPointSelectionChanged();
void SignalAddPointsModeChanged(bool);
public slots:
void AddPointSet();
void RemoveSelectedPoint();
void MoveSelectedPointDown();
void MoveSelectedPointUp();
void AddPointsMode(bool checked);
void SwapPointSets(bool checked);
protected slots:
/// called when the selection of the view widget changes
void OnPointSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
/// fade the shown timestep out
void fadeTimeStepOut();
/// open ContextMenu
void ctxMenu(const QPoint &pos);
void ClearSelectedPointSet();
void ClearCurrentTimeStep();
void UpdateSelectionHighlighting();
protected:
- void keyPressEvent( QKeyEvent * e ); ///< react to F2, F3 and DEL keys
- void wheelEvent( QWheelEvent* event); ///< change timestep of the current pointset by mouse wheel
+ void keyPressEvent( QKeyEvent * e ) override; ///< react to F2, F3 and DEL keys
+ void wheelEvent( QWheelEvent* event) override; ///< change timestep of the current pointset by mouse wheel
void fadeTimeStepIn(); ///< fade a label with the currently shown timestep in
protected:
std::vector<mitk::PointSet*> GetPointSets();
QmitkCorrespondingPointSetsModel* m_CorrespondingPointSetsModel;
bool m_SelfCall;
bool m_swapPointSets;
bool m_addPointsMode;
QLabel* m_TimeStepFaderLabel;
mitk::DataStorage::Pointer m_DataStorage;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkCrossWidget.h b/Modules/QtWidgetsExt/include/QmitkCrossWidget.h
index 392e2e7623..9d642a8fc1 100644
--- a/Modules/QtWidgetsExt/include/QmitkCrossWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkCrossWidget.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKTCROSSWIDGET_H_INCLUDED
#define QMITKTCROSSWIDGET_H_INCLUDED
#include <QLabel>
#include "MitkQtWidgetsExtExports.h"
#include <mitkCommon.h>
class MITKQTWIDGETSEXT_EXPORT QmitkCrossWidget : public QLabel
{
Q_OBJECT
public:
QmitkCrossWidget( QWidget * parent=0, Qt::WindowFlags f = 0 );
- void mousePressEvent( QMouseEvent* mouseEvent );
- void mouseMoveEvent( QMouseEvent* mouseEvent );
- void mouseReleaseEvent( QMouseEvent* mouseEvent );
+ void mousePressEvent( QMouseEvent* mouseEvent ) override;
+ void mouseMoveEvent( QMouseEvent* mouseEvent ) override;
+ void mouseReleaseEvent( QMouseEvent* mouseEvent ) override;
signals:
void SignalDeltaMove( int,int );
protected:
// fix for bug 3378 - setPos() causes an app crash on MAC OS X
#ifdef __APPLE__
void ResetMousePosition(int, int) {};
#else
void ResetMousePosition(int xpos, int ypos)
{
QCursor::setPos(xpos, ypos);
};
#endif
int lastX,lastY;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkGnuplotWidget.h b/Modules/QtWidgetsExt/include/QmitkGnuplotWidget.h
index 9fe0739a8d..c86b4d2872 100644
--- a/Modules/QtWidgetsExt/include/QmitkGnuplotWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkGnuplotWidget.h
@@ -1,78 +1,78 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkGnuplotWidget_h
#define QmitkGnuplotWidget_h
#include <itkTimeStamp.h>
#include <MitkQtWidgetsExtExports.h>
#include <QProcess>
#include <QScopedPointer>
#include <QWidget>
class QAction;
class QMenu;
namespace Ui
{
class QmitkGnuplotWidget;
}
class MITKQTWIDGETSEXT_EXPORT QmitkGnuplotWidget : public QWidget
{
Q_OBJECT
public:
explicit QmitkGnuplotWidget(QWidget* parent = NULL);
~QmitkGnuplotWidget();
QString GetGnuplotPath() const;
void SetGnuplotPath(const QString& path);
QStringList GetCommands() const;
void SetCommands(const QStringList& commands);
void Update();
- QSize sizeHint() const;
+ QSize sizeHint() const override;
protected:
- void contextMenuEvent(QContextMenuEvent* event);
- void resizeEvent(QResizeEvent* event);
+ void contextMenuEvent(QContextMenuEvent* event) override;
+ void resizeEvent(QResizeEvent* event) override;
private slots:
void OnProcessStateChanged(QProcess::ProcessState state);
void OnProcessError(QProcess::ProcessError error);
void OnProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void OnCopyPlot();
void OnCopyScript();
private:
void CreateContextMenu();
QString CreateSetTermCommand() const;
QScopedPointer<Ui::QmitkGnuplotWidget> m_Ui;
QMenu* m_ContextMenu;
QAction* m_CopyPlotAction;
QAction* m_CopyScriptAction;
QProcess* m_Process;
QString m_GnuplotPath;
QStringList m_Commands;
itk::TimeStamp m_ModifiedTime;
itk::TimeStamp m_UpdateTime;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkHistogram.h b/Modules/QtWidgetsExt/include/QmitkHistogram.h
index b44953d351..39c2c2fae0 100644
--- a/Modules/QtWidgetsExt/include/QmitkHistogram.h
+++ b/Modules/QtWidgetsExt/include/QmitkHistogram.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKHISTOGRAM_H
#define QMITKHISTOGRAM_H
#include <qglobal.h>
#include <qcolor.h>
#include <qwt_plot_item.h>
#include <qwt_series_data.h>
/**
\brief Used to create a histogram that can be shown in a Qwt Plot.
See QmitkHistogramWidget for an example of its usage.
*/
class QmitkHistogram: public QwtPlotItem
{
public:
explicit QmitkHistogram(const QString &title = QString::null);
explicit QmitkHistogram(const QwtText &title);
virtual ~QmitkHistogram();
void setData(const QwtIntervalSeriesData &data);
const QwtIntervalSeriesData &data() const;
void setColor(const QColor &);
QColor color() const;
- virtual QRectF boundingRect() const;
+ virtual QRectF boundingRect() const override;
virtual void draw(QPainter *, const QwtScaleMap &xMap,
- const QwtScaleMap &yMap, const QRectF &) const;
+ const QwtScaleMap &yMap, const QRectF &) const override;
void setBaseline(double reference);
double baseline() const;
protected:
virtual void drawBar(QPainter *,
Qt::Orientation o, const QRect &) const;
private:
void init();
class HistogramData;
HistogramData *m_Data;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkHistogramJSWidget.h b/Modules/QtWidgetsExt/include/QmitkHistogramJSWidget.h
index 7cf55969e4..c18f830a41 100644
--- a/Modules/QtWidgetsExt/include/QmitkHistogramJSWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkHistogramJSWidget.h
@@ -1,278 +1,278 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKHISTOGRAMJSWIDGET_H
#define QMITKHISTOGRAMJSWIDGET_H
#include <QWidget>
#include <QUrl>
#include <QWebView>
#include "MitkQtWidgetsExtExports.h"
#include <QVariant>
#include "mitkImage.h"
#include "mitkPlanarFigure.h"
#include <itkPolyLineParametricPath.h>
#include <QmitkWebPage.h>
/**
* \brief Widget which shows a histogram using JavaScript.
*
* This class is a QWebView. It shows the histogram for a selected image
* or segmentation. It also can display an intensity profile for
* path elements, which lais over an image.
*/
class MITKQTWIDGETSEXT_EXPORT QmitkHistogramJSWidget : public QWebView
{
Q_OBJECT
/**
* \brief Measurement property.
*
* This property is used in JavaScript as member of the current object.
* It holds a QList, containing the measurements of the current histogram.
* @see GetMeasurement()
*/
Q_PROPERTY(QList<QVariant> measurement
READ GetMeasurement)
/**
* \brief Frequency property.
*
* This property is used in JavaScript as member of the current object.
* It holds a QList, containing the frequencies of the current histogram.
* @see GetFrequency()
*/
Q_PROPERTY(QList<QVariant> frequency
READ GetFrequency)
/**
* \brief Line graph property.
*
* This property is used in JavaScript as member of the current object.
* It holds a boolean, which sais wether to use a line or not.
* @see GetUseLineGraph()
*/
Q_PROPERTY(bool useLineGraph
READ GetUseLineGraph)
/**
* @brief intensity profile property.
*
* This property is used in JavaScript as member of the current object.
* It holds a boolean, which says whether to use an intensity profile or not.
* @see GetIntensityProfile()
*/
Q_PROPERTY(bool intensityProfile
READ GetIntensityProfile)
public:
typedef mitk::Image::HistogramType HistogramType;
typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType;
typedef itk::PolyLineParametricPath< 3 > ParametricPathType;
typedef itk::ParametricPath< 3 >::Superclass PathType;
typedef mitk::PlanarFigure::PolyLineType VertexContainerType;
explicit QmitkHistogramJSWidget(QWidget *parent = 0);
~QmitkHistogramJSWidget();
/**
* \brief Event which notifies a change of the widget size.
*
* Reimplemented from QWebView::resizeEvent(),
* reloads the webframe
*/
- void resizeEvent(QResizeEvent* resizeEvent);
+ void resizeEvent(QResizeEvent* resizeEvent) override;
/**
* \brief Calculates the histogram.
*
* This function removes all frequencies of 0 until the first bin and behind the last bin.
* It writes the measurement and frequency, which are given from the HistogramType, into
* m_Measurement and m_Frequency.
* The SignalDataChanged is called, to update the information, which is displayed in the webframe.
*/
void ComputeHistogram(HistogramType* histogram);
/**
* \brief Calculates the intensityprofile.
*
* If an image and a pathelement are set, this function
* calculates an intensity profile for a pathelement which lies over an image.
* Sets m_IntensityProfile and m_UseLineGraph to true.
* The SignalDataChanged is called, to update the information, which is displayed in the webframe.
*/
void ComputeIntensityProfile(unsigned int timeStep = 0);
/**
* \brief Clears the Histogram.
*
* This function clears the data and calls SignalDataChanged to update
* the displayed information in the webframe.
*/
void ClearHistogram();
/**
* \brief Getter for measurement.
*
* @return List of measurements.
*/
QList<QVariant> GetMeasurement();
/**
* \brief Getter for frequency.
*
* @return List of frequencies.
*/
QList<QVariant> GetFrequency();
/**
* \brief Getter for uselineGraph.
*
* @return True if a linegraph should be used.
*/
bool GetUseLineGraph();
/**
* \brief Getter for intensity profile.
*
* @return True if current histogram is an intensityprofile
*/
bool GetIntensityProfile();
/**
* \brief Setter for reference image.
*
* @param image The corresponding image for an intensity profile.
*/
void SetImage(mitk::Image* image);
/**
* \brief Setter for planarFigure.
*
* @param planarFigure The pathelement for an intensity profile.
*/
void SetPlanarFigure(const mitk::PlanarFigure* planarFigure);
private:
/**
* \brief List of frequencies.
*
* A QList which holds the frequencies of the current histogram
* or holds the intesities of current intensity profile.
*/
QList<QVariant> m_Frequency;
/**
* \brief List of measurements.
*
* A QList which holds the measurements of the current histogram
* or holds the distances of current intensity profile.
*/
QList<QVariant> m_Measurement;
/**
* \brief Reference image.
*
* Holds the image to calculate an intensity profile.
*/
mitk::Image::Pointer m_Image;
/**
* \brief Pathelement.
*
* Holds a not closed planar figure to calculate an intensity profile.
*/
mitk::PlanarFigure::ConstPointer m_PlanarFigure;
bool m_UseLineGraph;
bool m_IntensityProfile;
/**
* Holds the current histogram
*/
HistogramType::ConstPointer m_Histogram;
/**
* Path derived either form user-specified path or from PlanarFigure-generated
* path
*/
PathType::ConstPointer m_DerivedPath;
/**
* Parametric path as generated from PlanarFigure
*/
ParametricPathType::Pointer m_ParametricPath;
/**
* \brief Clears data.
*
* Clears the QLists m_Measurement and m_Frequency
*/
void ClearData();
QmitkJSWebPage* m_Page;
private slots:
/**
* \brief Adds an object to JavaScript.
*
* Adds an object of the widget to JavaScript.
* By using this object JavaScript can react to the signals of the widget
* and can access the QProperties as members of the object.
*/
void AddJSObject();
public slots:
/**
* \brief Slot for radiobutton m_barRadioButton.
*
* Sets m_UseLineGraph to false.
* Calls signal GraphChanged to update the graph in the webframe.
*/
void OnBarRadioButtonSelected();
/**
* \brief Slot for radiobutton m_lineRadioButton.
*
* Sets m_UseLineGraph to true.
* Calls signal GraphChanged to update the graph in the webframe.
*/
void OnLineRadioButtonSelected();
signals:
/**
* \brief Signal data has changed.
*
* It has to be called when the data of the histogram or intensity profile has changed.
*/
void SignalDataChanged();
/**
* \brief Signal graph has changed.
*
* It has to be called when the graph changed from barchart to linegraph. Vice versa.
*/
void SignalGraphChanged();
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkHotkeyLineEdit.h b/Modules/QtWidgetsExt/include/QmitkHotkeyLineEdit.h
index 7dc21e26f0..9fb8fe5c12 100644
--- a/Modules/QtWidgetsExt/include/QmitkHotkeyLineEdit.h
+++ b/Modules/QtWidgetsExt/include/QmitkHotkeyLineEdit.h
@@ -1,53 +1,53 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKHOTKEYLINEEDIT_H_
#define QMITKHOTKEYLINEEDIT_H_
#include <QLineEdit>
#include <QKeySequence>
#include "MitkQtWidgetsExtExports.h"
class MITKQTWIDGETSEXT_EXPORT QmitkHotkeyLineEdit : public QLineEdit
{
Q_OBJECT
public:
static const std::string TOOLTIP;
QmitkHotkeyLineEdit(QWidget* parent = 0);
QmitkHotkeyLineEdit(const QKeySequence& _QKeySequence, QWidget* parent = 0);
QmitkHotkeyLineEdit(const QString& _QString, QWidget* parent = 0);
virtual void SetKeySequence(const QKeySequence& _QKeySequence);
virtual void SetKeySequence(const QString& _QKeySequenceAsString);
virtual QKeySequence GetKeySequence();
virtual QString GetKeySequenceAsString();
bool Matches( QKeyEvent * event );
protected slots:
void LineEditTextChanged(const QString &);
protected:
- virtual void keyPressEvent ( QKeyEvent * event );
+ virtual void keyPressEvent ( QKeyEvent * event ) override;
void Init();
protected:
QKeySequence m_KeySequence;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkModuleTableModel.h b/Modules/QtWidgetsExt/include/QmitkModuleTableModel.h
index 592867ad54..213ba5ddcf 100644
--- a/Modules/QtWidgetsExt/include/QmitkModuleTableModel.h
+++ b/Modules/QtWidgetsExt/include/QmitkModuleTableModel.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKMODULETABLEMODEL_H
#define QMITKMODULETABLEMODEL_H
#include <QAbstractTableModel>
#include <QList>
#include <MitkQtWidgetsExtExports.h>
namespace us {
class ModuleContext;
class Module;
}
class QmitkModuleTableModelPrivate;
class MITKQTWIDGETSEXT_EXPORT QmitkModuleTableModel : public QAbstractTableModel
{
public:
QmitkModuleTableModel(QObject* parent = 0, us::ModuleContext* mc = 0);
~QmitkModuleTableModel();
protected:
- int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role) const;
+ QVariant data(const QModelIndex& index, int role) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
private:
friend class QmitkModuleTableModelPrivate;
void insertModule(us::Module* module);
QmitkModuleTableModelPrivate* const d;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkNumberPropertyEditor.h b/Modules/QtWidgetsExt/include/QmitkNumberPropertyEditor.h
index db6997a5a3..1f2f6128f2 100644
--- a/Modules/QtWidgetsExt/include/QmitkNumberPropertyEditor.h
+++ b/Modules/QtWidgetsExt/include/QmitkNumberPropertyEditor.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_NUMBERPROPERTYEDITOR_H_INCLUDED
#define QMITK_NUMBERPROPERTYEDITOR_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkProperties.h>
#include <QSpinBox>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkNumberPropertyEditor : public QSpinBox, public mitk::PropertyEditor
{
Q_OBJECT
Q_PROPERTY( short decimalPlaces READ getDecimalPlaces WRITE setDecimalPlaces )
Q_PROPERTY( bool showPercent READ getShowPercent WRITE setShowPercent )
Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
public:
QmitkNumberPropertyEditor( mitk::IntProperty*, QWidget* parent );
QmitkNumberPropertyEditor( mitk::FloatProperty*, QWidget* parent );
QmitkNumberPropertyEditor( mitk::DoubleProperty*, QWidget* parent );
virtual ~QmitkNumberPropertyEditor();
short getDecimalPlaces() const;
void setDecimalPlaces(short);
bool getShowPercent() const;
void setShowPercent(bool);
int minValue() const;
void setMinValue(int);
int maxValue() const;
void setMaxValue(int);
double doubleValue() const;
void setDoubleValue(double);
protected:
void initialize();
- virtual QString textFromValue(int) const;
- virtual int valueFromText(const QString&) const;
+ virtual QString textFromValue(int) const override;
+ virtual int valueFromText(const QString&) const override;
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
void DisplayNumber();
union {
mitk::GenericProperty<int>* m_IntProperty;
mitk::GenericProperty<float>* m_FloatProperty;
mitk::GenericProperty<double>* m_DoubleProperty;
};
const int m_DataType;
short m_DecimalPlaces; // how many decimal places are shown
double m_FactorPropertyToSpinbox; // internal conversion factor. neccessary because spinbox ranges work only with ints
double m_FactorSpinboxToDisplay; // internal conversion factor. neccessary because spinbox ranges work only with ints
bool m_ShowPercents; // whether values are given in percent (0.5 -> 50%)
protected slots:
void onValueChanged(int);
private:
void adjustFactors(short, bool);
bool m_SelfChangeLock;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkNumberPropertyView.h b/Modules/QtWidgetsExt/include/QmitkNumberPropertyView.h
index 724612d6a0..807c421bcc 100644
--- a/Modules/QtWidgetsExt/include/QmitkNumberPropertyView.h
+++ b/Modules/QtWidgetsExt/include/QmitkNumberPropertyView.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_NUMBERPROPERTYVIEW_H_INCLUDED
#define QMITK_NUMBERPROPERTYVIEW_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkProperties.h>
#include <QLabel>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkNumberPropertyView : public QLabel, public mitk::PropertyView
{
Q_OBJECT
Q_PROPERTY( short decimalPlaces READ decimalPlaces WRITE setDecimalPlaces )
Q_PROPERTY( QString suffix READ suffix WRITE setSuffix )
Q_PROPERTY( bool showPercent READ showPercent WRITE setShowPercent )
public:
QmitkNumberPropertyView( const mitk::IntProperty*, QWidget* parent );
QmitkNumberPropertyView( const mitk::FloatProperty*, QWidget* parent );
QmitkNumberPropertyView( const mitk::DoubleProperty*, QWidget* parent );
virtual ~QmitkNumberPropertyView();
short decimalPlaces() const;
void setDecimalPlaces(short);
QString suffix() const;
void setSuffix(const QString&);
bool showPercent() const;
void setShowPercent(bool);
protected:
void initialize();
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
void DisplayNumber();
union {
const mitk::GenericProperty<int>* m_IntProperty;
const mitk::GenericProperty<float>* m_FloatProperty;
const mitk::GenericProperty<double>* m_DoubleProperty;
};
const int m_DataType;
short m_DecimalPlaces; /// -1 indicates "no limit to decimal places"
QString m_Suffix;
double m_DisplayFactor;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkPiecewiseFunctionCanvas.h b/Modules/QtWidgetsExt/include/QmitkPiecewiseFunctionCanvas.h
index e9ea01756c..add3797720 100755
--- a/Modules/QtWidgetsExt/include/QmitkPiecewiseFunctionCanvas.h
+++ b/Modules/QtWidgetsExt/include/QmitkPiecewiseFunctionCanvas.h
@@ -1,130 +1,130 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKPIECEWISEFUNCTIONCANVAS_H_INCLUDED
#define QMITKPIECEWISEFUNCTIONCANVAS_H_INCLUDED
#include "QmitkTransferFunctionCanvas.h"
#include "MitkQtWidgetsExtExports.h"
#include <vtkPiecewiseFunction.h>
class MITKQTWIDGETSEXT_EXPORT QmitkPiecewiseFunctionCanvas: public QmitkTransferFunctionCanvas
{
Q_OBJECT
public:
QmitkPiecewiseFunctionCanvas( QWidget * parent=0, Qt::WindowFlags f = 0 );
- virtual void paintEvent( QPaintEvent* e );
+ virtual void paintEvent( QPaintEvent* e ) override;
void SetTitle(const QString& title);
- int GetNearHandle(int x,int y,unsigned int maxSquaredDistance = 32);
+ int GetNearHandle(int x,int y,unsigned int maxSquaredDistance = 32) override;
void SetPiecewiseFunction(vtkPiecewiseFunction* piecewiseFunction)
{
this->m_PiecewiseFunction = piecewiseFunction;
this->SetMin(m_PiecewiseFunction->GetRange()[0]);
this->SetMax(m_PiecewiseFunction->GetRange()[1]);
setEnabled(true);
update();
}
- int AddFunctionPoint(double x,double val)
+ int AddFunctionPoint(double x,double val) override
{
return m_PiecewiseFunction->AddPoint(x,val);
}
- void RemoveFunctionPoint(double x)
+ void RemoveFunctionPoint(double x) override
{
int old_size = GetFunctionSize();
m_PiecewiseFunction->RemovePoint(x);
if (GetFunctionSize() + 1 != old_size)
{
std::cout << "old/new size" << old_size << "/" << GetFunctionSize() << std::endl;
std::cout << "called with x=" << x << std::endl;
}
}
- double GetFunctionX(int index)
+ double GetFunctionX(int index) override
{
return m_PiecewiseFunction->GetDataPointer()[index*2];
}
- double GetFunctionY(int index)
+ double GetFunctionY(int index) override
{
return m_PiecewiseFunction->GetValue(m_PiecewiseFunction->GetDataPointer()[index*2]);
}
- int GetFunctionSize()
+ int GetFunctionSize() override
{
return m_PiecewiseFunction->GetSize();
}
- void DoubleClickOnHandle(int)
+ void DoubleClickOnHandle(int) override
{
}
- void MoveFunctionPoint(int index, std::pair<double,double> pos);
+ void MoveFunctionPoint(int index, std::pair<double,double> pos) override;
double GetFunctionMax()
{
return m_PiecewiseFunction->GetRange()[1];
}
double GetFunctionMin()
{
return m_PiecewiseFunction->GetRange()[0];
}
double GetFunctionRange()
{
double range;
if((m_PiecewiseFunction->GetRange()[0])<0)
{
range = (m_PiecewiseFunction->GetRange()[1])-(m_PiecewiseFunction->GetRange()[0]);
return range;
}
else
{
range = m_PiecewiseFunction->GetRange()[1];
return range;
}
}
void RemoveAllFunctionPoints()
{
m_PiecewiseFunction->AddSegment(this->GetFunctionMin(),0,this->GetFunctionMax(),1);
m_PiecewiseFunction->AddPoint(0.0,0.0);
}
void ResetGO()
{ //Gradient Opacity
m_PiecewiseFunction->AddSegment(this->GetFunctionMin(),0,0,1);
m_PiecewiseFunction->AddSegment(0,1,((this->GetFunctionRange())*0.125),1);
m_PiecewiseFunction->AddSegment(((this->GetFunctionRange())*0.125),1,((this->GetFunctionRange())*0.2),1);
m_PiecewiseFunction->AddSegment(((this->GetFunctionRange())*0.2),1,((this->GetFunctionRange())*0.25),1);
}
protected:
vtkPiecewiseFunction* m_PiecewiseFunction;
QString m_Title;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkPointListModel.h b/Modules/QtWidgetsExt/include/QmitkPointListModel.h
index b71cf84b13..aad79fda4d 100644
--- a/Modules/QtWidgetsExt/include/QmitkPointListModel.h
+++ b/Modules/QtWidgetsExt/include/QmitkPointListModel.h
@@ -1,133 +1,133 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_POINTLIST_MODEL_H_INCLUDED
#define QMITK_POINTLIST_MODEL_H_INCLUDED
#include <QAbstractListModel>
#include "MitkQtWidgetsExtExports.h"
#include "mitkDataNode.h"
#include "mitkPointSet.h"
class MITKQTWIDGETSEXT_EXPORT QmitkPointListModel : public QAbstractListModel
{
Q_OBJECT
public:
QmitkPointListModel( mitk::DataNode* = NULL, int t = 0, QObject* parent = 0 );
~QmitkPointListModel();
- Qt::ItemFlags flags(const QModelIndex&) const;
+ Qt::ItemFlags flags(const QModelIndex&) const override;
/// interface of QAbstractListModel
- int rowCount( const QModelIndex& parent = QModelIndex() ) const;
+ int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
/// interface of QAbstractListModel
- QVariant data(const QModelIndex& index, int role) const;
+ QVariant data(const QModelIndex& index, int role) const override;
/// interface of QAbstractListModel
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
+ int role = Qt::DisplayRole) const override;
/// which point set to work on
void SetPointSetNode( mitk::DataNode* pointSetNode );
/// which point set to work on
mitk::PointSet* GetPointSet() const;
// which point set to work on
mitk::DataNode* GetPointSetNode() const;
/// which time step to display/model
void SetTimeStep(int t);
/// which time step to display/model
int GetTimeStep() const;
/// itk observer for point set "modified" events
void OnPointSetChanged( const itk::EventObject & e );
/// itk observer for point set "delete" events
void OnPointSetDeleted( const itk::EventObject & e );
/**
* \brief get point and point ID that correspond to a given QModelIndex
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the QModelIndex as point ID. This method returns the point and
* the corresponding point id for a given QModelIndex. The point and the point ID
* are returned in the outgoing parameters p and id. If a valid point and ID were
* found, the method returns true, otherwise it returns false
* \param[in] QModelIndex &index the index for which a point is requested.
The row() part of the index is used to find a corresponding point
* \param[out] mitk::Point3D& p If a valid point is found, it will be stored in the p parameter
* \param[out] mitk::PointSet::PointIdentifier& id If a valid point is found, the corresponding ID will be stored in id
* \return Returns true, if a valid point was found, false otherwise
*/
bool GetPointForModelIndex( const QModelIndex &index, mitk::PointSet::PointType& p, mitk::PointSet::PointIdentifier& id) const;
/**Documentation
* \brief returns a QModelIndex for a given point ID
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the point ID as a QModelIndex. This method returns a QModelIndex
* for a given point ID in the outgoing parameter index.
* \param[in] mitk::PointSet::PointIdentifier id The point ID for which the QModelIndex will be created
* \param[out] QModelIndex& index if a point with the ID id was found, index will contain a corresponding QModelIndex for that point
* \return returns true, if a valid QModelIndex was created, false otherwise
*/
bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex& index) const;
public slots:
void MoveSelectedPointUp();
void MoveSelectedPointDown();
void RemoveSelectedPoint();
signals:
/// emitted, when views should update their selection status
/// (because mouse interactions in render windows can change
/// the selection status of points)
void SignalUpdateSelection();
protected:
/// internally observe different point set
void ObserveNewPointSet( mitk::DataNode* pointSetNode );
//initially checks if there is a PointSet as data in the DataNode.
//returns PointSet if so and NULL if other data is set to node
mitk::PointSet* CheckForPointSetInNode(mitk::DataNode* node) const;
protected:
mitk::DataNode* m_PointSetNode;
unsigned int m_PointSetModifiedObserverTag;
unsigned int m_PointSetDeletedObserverTag;
int m_TimeStep;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkPointListView.h b/Modules/QtWidgetsExt/include/QmitkPointListView.h
index 18b927c165..3b35403ba5 100644
--- a/Modules/QtWidgetsExt/include/QmitkPointListView.h
+++ b/Modules/QtWidgetsExt/include/QmitkPointListView.h
@@ -1,155 +1,155 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_POINTLIST_VIEW_H_INCLUDED
#define QMITK_POINTLIST_VIEW_H_INCLUDED
#include <QListView>
#include <QLabel>
#include "MitkQtWidgetsExtExports.h"
#include <mitkSliceNavigationController.h>
#include "QmitkPointListModel.h"
class QmitkStdMultiWidget;
/*!
* \brief GUI widget for handling mitk::PointSet
*
* Displays all the points in a mitk::PointSet graphically.
* Reacts automatically to changes in the PointSet's selection status.
* Updates PointSet's selection status when this list's selection changes.
*
* If a QmitkStdMultiWidget is assigned via SetMultiWidget(), the
* crosshair of the QmitkStdMultiWidget is moved to the currently selected
* point.
*
*/
class MITKQTWIDGETSEXT_EXPORT QmitkPointListView : public QListView
{
Q_OBJECT
public:
QmitkPointListView( QWidget* parent = 0 );
~QmitkPointListView();
/// assign a point set for observation
void SetPointSetNode( mitk::DataNode* pointSetNode );
/// which point set to work on
const mitk::PointSet* GetPointSet() const;
/**
* \brief If Multiwidget is set, the crosshair is automatically centering to the selected point
* As an alternative, if you dont have a multiwidget, you can call SetSnc1, SetSnc2, SetSnc3 to set the
* SliceNavigationControllers directly to enable the focussing feature.
*/
void SetMultiWidget( QmitkStdMultiWidget* multiWidget );
QmitkStdMultiWidget* GetMultiWidget() const; ///< return the QmitkStdMultiWidget that is used for updating render window crosshair
void SetTimesStep(int i); ///< which time step to display/model
///@{
/**
* \brief Sets the SliceNavigationController of the three 2D Renderwindows.
* If they are defined, they can be used to automatically set the crosshair to the selected point
*
* \deprecatedSince{2013_03} Use AddSliceNavigationController and RemoveSliceNavigationController instead.
*/
DEPRECATED( void SetSnc1(mitk::SliceNavigationController* snc) );
DEPRECATED( void SetSnc2(mitk::SliceNavigationController* snc) );
DEPRECATED( void SetSnc3(mitk::SliceNavigationController* snc) );
///@}
/**
* @brief Add a mitk::SliceNavigationController instance.
* @param snc The mitk::SliceNavigationController instance.
*
* This method adds \c snc to the set of slice navigation controllers which are
* used to navigate to the selected point.
*/
void AddSliceNavigationController(mitk::SliceNavigationController* snc);
/**
* @brief Remove a mitk::SliceNavigationController instance.
* @param snc The mitk::SliceNavigationController instance.
*
* This method removes \c snc from the set of slice navigation controllers which are
* used to navigate to the selected point.
*/
void RemoveSliceNavigationController(mitk::SliceNavigationController* snc);
signals:
void SignalPointSelectionChanged(); ///< this signal is emmitted, if the selection of a point in the pointset is changed
protected slots:
/// Filtering double click event for editing point coordinates via a dialog
void OnPointDoubleClicked(const QModelIndex & index);
/// called when the point set data structure changes
void OnPointSetSelectionChanged();
/// called when the selection of the view widget changes
void OnListViewSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
/// fade the shown timestep out
void fadeTimeStepOut();
/// open ContextMenu
void ctxMenu(const QPoint &pos);
/// Turn TimeStep Fading On/Off
void SetFading(bool onOff);
/// Delete all points in the list
void ClearPointList();
/// delete all points in the list in the current timestep
void ClearPointListTS();
protected:
- void keyPressEvent( QKeyEvent * e ); ///< react to F2, F3 and DEL keys
- void wheelEvent( QWheelEvent* event); ///< change timestep of the current pointset by mouse wheel
+ void keyPressEvent( QKeyEvent * e ) override; ///< react to F2, F3 and DEL keys
+ void wheelEvent( QWheelEvent* event) override; ///< change timestep of the current pointset by mouse wheel
void fadeTimeStepIn(); ///< fade a label with the currently shown timestep in
mitk::SliceNavigationController* m_Snc1;
mitk::SliceNavigationController* m_Snc2;
mitk::SliceNavigationController* m_Snc3;
std::set<mitk::SliceNavigationController*> m_Sncs;
QmitkPointListModel* m_PointListModel;
bool m_SelfCall;
bool m_showFading;
/// used to position the planes on a selected point
QmitkStdMultiWidget* m_MultiWidget;
QLabel* m_TimeStepFaderLabel;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkPointListViewWidget.h b/Modules/QtWidgetsExt/include/QmitkPointListViewWidget.h
index 38af01b4c7..64554671a5 100644
--- a/Modules/QtWidgetsExt/include/QmitkPointListViewWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkPointListViewWidget.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkPointListViewWidget_h
#define QmitkPointListViewWidget_h
#include <QListWidget>
#include "MitkQtWidgetsExtExports.h"
#include <mitkWeakPointer.h>
#include <mitkPointSet.h>
class QmitkStdMultiWidget;
/*!
* \brief GUI widget for handling mitk::PointSet
*
* Displays all the points in a mitk::PointSet graphically.
* Reacts automatically to changes in the PointSet's selection status.
* Updates PointSet's selection status when this list's selection changes.
*
* If a QmitkStdMultiWidget is assigned via SetMultiWidget(), the
* crosshair of the QmitkStdMultiWidget is moved to the currently selected
* point.
*
*/
class MITKQTWIDGETSEXT_EXPORT QmitkPointListViewWidget : public QListWidget
{
Q_OBJECT
signals:
void PointSelectionChanged(); ///< this signal is emmitted, if the selection of a point in the pointset is changed
public:
QmitkPointListViewWidget( QWidget* parent = 0 );
~QmitkPointListViewWidget();
/// assign a point set for observation
void SetPointSet( mitk::PointSet* pointSet );
/// which point set to work on
const mitk::PointSet* GetPointSet() const;
void SetMultiWidget( QmitkStdMultiWidget* multiWidget ); ///< assign a QmitkStdMultiWidget for updating render window crosshair
QmitkStdMultiWidget* GetMultiWidget() const; ///< return the QmitkStdMultiWidget that is used for updating render window crosshair
/// which time step to display/model
void SetTimeStep(int t);
/// which time step to display/model
int GetTimeStep() const;
/// observer for point set "modified" events
void OnPointSetChanged( const itk::Object* /*obj*/ );
/// observer for point set "delete" events
void OnPointSetDeleted( const itk::Object* /*obj*/ );
protected slots:
///
/// Filtering double click event for editing point coordinates via a dialog
///
void OnItemDoubleClicked( QListWidgetItem * item );
/// called when the selection of the view widget changes
void OnCurrentRowChanged( int /*currentRow*/ );
protected:
- void keyPressEvent( QKeyEvent * e ); ///< react to F2, F3 and DEL keys
+ void keyPressEvent( QKeyEvent * e ) override; ///< react to F2, F3 and DEL keys
void MoveSelectedPointUp();
void MoveSelectedPointDown();
void RemoveSelectedPoint();
void Update(bool currentRowChanged=false);
protected:
mitk::WeakPointer<mitk::PointSet> m_PointSet;
int m_TimeStep;
bool m_SelfCall;
/// used to position the planes on a selected point
QmitkStdMultiWidget* m_MultiWidget;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkSelectableGLWidget.h b/Modules/QtWidgetsExt/include/QmitkSelectableGLWidget.h
index 55c44a5ef1..469f086214 100644
--- a/Modules/QtWidgetsExt/include/QmitkSelectableGLWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkSelectableGLWidget.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKSELECTABLEGLWIDGET_H
#define QMITKSELECTABLEGLWIDGET_H
#include "ui_QmitkSelectableGLWidget.h"
#include "mitkCameraRotationController.h"
#include "mitkCommon.h"
#include "mitkSliceNavigationController.h"
#include "mitkVtkPropRenderer.h"
#include <MitkQtWidgetsExtExports.h>
#include <mitkCommon.h>
#include <QWidget>
class QmitkRenderWindow;
class MITKQTWIDGETSEXT_EXPORT QmitkSelectableGLWidget : public QWidget
{
Q_OBJECT
public:
QmitkSelectableGLWidget(QWidget* parent=0);
~QmitkSelectableGLWidget();
mitk::VtkPropRenderer* GetRenderer();
QmitkRenderWindow* GetRenderWindow() const;
mitk::SliceNavigationController* GetSliceNavigationController() const;
mitk::CameraRotationController* GetCameraRotationController() const;
mitk::BaseController* GetController() const;
protected:
- void wheelEvent( QWheelEvent * e );
+ void wheelEvent( QWheelEvent * e ) override;
QmitkRenderWindow *m_RenderWindow;
mitk::VtkPropRenderer::Pointer m_Renderer;
private:
Ui::QmitkSelectableGLWidget* m_Ui;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkSliceWidget.h b/Modules/QtWidgetsExt/include/QmitkSliceWidget.h
index 8dfd1422d5..fcfe2dd793 100644
--- a/Modules/QtWidgetsExt/include/QmitkSliceWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkSliceWidget.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKSLICEWIDGET_H_
#define QMITKSLICEWIDGET_H_
#include "ui_QmitkSliceWidget.h"
#include "MitkQtWidgetsExtExports.h"
#include "QmitkRenderWindow.h"
#include "mitkSliceNavigationController.h"
#include "mitkDataStorage.h"
#include "mitkStandaloneDataStorage.h"
#include "mitkSlicedGeometry3D.h"
#include <QWidget>
class MITKQTWIDGETSEXT_EXPORT QmitkSliceWidget : public QWidget, public Ui::QmitkSliceWidgetUi
{
Q_OBJECT
public:
QmitkSliceWidget(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags f = 0);
mitk::VtkPropRenderer* GetRenderer();
QFrame* GetSelectionFrame();
void UpdateGL();
- void mousePressEvent( QMouseEvent * e );
+ void mousePressEvent( QMouseEvent * e ) override;
void setPopUpEnabled( bool b );
void SetDataStorage( mitk::StandaloneDataStorage::Pointer storage );
mitk::StandaloneDataStorage* GetDataStorage();
QmitkSliderNavigatorWidget* GetNavigatorWidget();
bool IsLevelWindowEnabled();
QmitkRenderWindow* GetRenderWindow();
mitk::SliceNavigationController* GetSliceNavigationController() const;
mitk::CameraRotationController* GetCameraRotationController() const;
mitk::BaseController* GetController() const;
public slots:
void SetData(mitk::DataStorage::SetOfObjects::ConstIterator it);
void SetData(mitk::DataStorage::SetOfObjects::ConstIterator it, mitk::SliceNavigationController::ViewDirection view);
void SetData( mitk::DataNode::Pointer node );
void SetData( mitk::DataNode::Pointer node, mitk::SliceNavigationController::ViewDirection view );
void InitWidget( mitk::SliceNavigationController::ViewDirection viewDirection );
- void wheelEvent( QWheelEvent * e );
+ void wheelEvent( QWheelEvent * e ) override;
void ChangeView(QAction* val);
void SetLevelWindowEnabled( bool enable );
protected:
QmitkRenderWindow* m_RenderWindow;
mitk::SliceNavigationController::ViewDirection m_View;
private:
bool popUpEnabled;
mitk::VtkPropRenderer::Pointer m_Renderer;
mitk::SlicedGeometry3D::Pointer m_SlicedGeometry;
mitk::StandaloneDataStorage::Pointer m_DataStorage;
QMenu* popUp;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkStepperAdapter.h b/Modules/QtWidgetsExt/include/QmitkStepperAdapter.h
index 2e6e934422..e6ba7d6a8d 100644
--- a/Modules/QtWidgetsExt/include/QmitkStepperAdapter.h
+++ b/Modules/QtWidgetsExt/include/QmitkStepperAdapter.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
#define QMITKSTEPPERADAPTER_H_HEADER_INCLUDED_C1E77191
#include "qobject.h"
#include "MitkQtWidgetsExtExports.h"
#include "mitkStepper.h"
#include "itkObject.h"
#include "itkCommand.h"
//##Documentation
//## @brief Helper class to connect Qt-based navigators to instances of Stepper
//##
//## The constructor has to be provided with the \a Navigator
//## that wants to use the \a Stepper. The \a Navigator has to define the
//## slots \a Refetch() and \a SetStepper(mitk::Stepper *). \a SetStepper will be
//## called only once to pass the \a Stepper to the \a Navigator. When the values of
//## the \a Stepper changes, \a Refetch() will be called. The \a Navigator can than
//## ask the \a Stepper for its new values.
//## \warning The \a Navigator has to be aware that it might have caused the changes
//## of the \a Stepper itself. So take care that no infinite recursion is created!
//## @ingroup NavigationControl
class MITKQTWIDGETSEXT_EXPORT QmitkStepperAdapter : public QObject
{
Q_OBJECT
public:
QmitkStepperAdapter( QObject * navigator, mitk::Stepper * stepper, const char * name );
virtual ~QmitkStepperAdapter();
void SetStepper( mitk::Stepper* stepper )
{
this->SendStepper( stepper );
this->Refetch();
}
class MITKQTWIDGETSEXT_EXPORT ItkEventListener : public itk::Command
{
public:
- mitkClassMacro(ItkEventListener, itk::Command);
+ mitkClassMacroItkParent(ItkEventListener, itk::Command);
ItkEventListener(QmitkStepperAdapter* receiver) :
m_Receiver(receiver)
{
};
- virtual void Execute (itk::Object*, const itk::EventObject&)
+ virtual void Execute (itk::Object*, const itk::EventObject&) override
{
emit m_Receiver->Refetch();
};
- virtual void Execute (const itk::Object*, const itk::EventObject&)
+ virtual void Execute (const itk::Object*, const itk::EventObject&) override
{
emit m_Receiver->Refetch();
};
protected:
QmitkStepperAdapter* m_Receiver;
};
signals:
void signal_dummy();
void Refetch();
void SendStepper(mitk::Stepper *);
protected:
mitk::Stepper::Pointer m_Stepper;
long m_ObserverTag;
friend class QmitkStepperAdapter::ItkEventListener;
ItkEventListener::Pointer m_ItkEventListener;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkStringPropertyEditor.h b/Modules/QtWidgetsExt/include/QmitkStringPropertyEditor.h
index f01b0ce24d..f023655516 100644
--- a/Modules/QtWidgetsExt/include/QmitkStringPropertyEditor.h
+++ b/Modules/QtWidgetsExt/include/QmitkStringPropertyEditor.h
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_STRINGPROPERTYEDITOR_H_INCLUDED
#define QMITK_STRINGPROPERTYEDITOR_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkStringProperty.h>
#include <QLineEdit>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkStringPropertyEditor : public QLineEdit, public mitk::PropertyEditor
{
Q_OBJECT
public:
QmitkStringPropertyEditor( mitk::StringProperty*, QWidget* parent );
virtual ~QmitkStringPropertyEditor();
protected:
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
mitk::StringProperty* m_StringProperty;
protected slots:
void onTextChanged(const QString&);
private:
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkStringPropertyOnDemandEdit.h b/Modules/QtWidgetsExt/include/QmitkStringPropertyOnDemandEdit.h
index d2af4cff12..341b84f409 100644
--- a/Modules/QtWidgetsExt/include/QmitkStringPropertyOnDemandEdit.h
+++ b/Modules/QtWidgetsExt/include/QmitkStringPropertyOnDemandEdit.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_STRINGPROPERTYONDEMANDDEDITOR_H_INCLUDED
#define QMITK_STRINGPROPERTYONDEMANDDEDITOR_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkStringProperty.h>
#include <QLayout>
#include <QLabel>
class MITKQTWIDGETSEXT_EXPORT QClickableLabel2 : public QLabel
{
Q_OBJECT
signals:
void clicked();
public:
QClickableLabel2( QWidget * parent, Qt::WindowFlags f = 0 )
:QLabel(parent, f)
{
}
- virtual void mouseReleaseEvent( QMouseEvent* )
+ virtual void mouseReleaseEvent( QMouseEvent* ) override
{
emit clicked();
}
};
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkStringPropertyOnDemandEdit : public QFrame, public mitk::PropertyEditor
{
Q_OBJECT
public:
QmitkStringPropertyOnDemandEdit( mitk::StringProperty*, QWidget* parent );
virtual ~QmitkStringPropertyOnDemandEdit();
protected:
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
mitk::StringProperty* m_StringProperty;
QHBoxLayout* m_layout;
QLabel* m_label;
QClickableLabel2* m_toolbutton;
protected slots:
void onToolButtonClicked();
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkStringPropertyView.h b/Modules/QtWidgetsExt/include/QmitkStringPropertyView.h
index 145b7defd5..ae20312fc2 100644
--- a/Modules/QtWidgetsExt/include/QmitkStringPropertyView.h
+++ b/Modules/QtWidgetsExt/include/QmitkStringPropertyView.h
@@ -1,43 +1,43 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITK_STRINGPROPERTYVIEW_H_INCLUDED
#define QMITK_STRINGPROPERTYVIEW_H_INCLUDED
#include <mitkPropertyObserver.h>
#include "MitkQtWidgetsExtExports.h"
#include <mitkStringProperty.h>
#include <QLabel>
/// @ingroup Widgets
class MITKQTWIDGETSEXT_EXPORT QmitkStringPropertyView : public QLabel, public mitk::PropertyView
{
Q_OBJECT
public:
QmitkStringPropertyView( const mitk::StringProperty*, QWidget* parent );
virtual ~QmitkStringPropertyView();
protected:
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
const mitk::StringProperty* m_StringProperty;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkTransferFunctionCanvas.h b/Modules/QtWidgetsExt/include/QmitkTransferFunctionCanvas.h
index 7c8f1e41a7..40406c5d4d 100755
--- a/Modules/QtWidgetsExt/include/QmitkTransferFunctionCanvas.h
+++ b/Modules/QtWidgetsExt/include/QmitkTransferFunctionCanvas.h
@@ -1,168 +1,168 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QMITKTRANSFERFUNCTIONCANVAS_H_INCLUDED
#define QMITKTRANSFERFUNCTIONCANVAS_H_INCLUDED
#include "MitkQtWidgetsExtExports.h"
#include <mitkSimpleHistogram.h>
#include <mitkRenderingManager.h>
#include <QWidget>
#include <QLineEdit>
class MITKQTWIDGETSEXT_EXPORT QmitkTransferFunctionCanvas : public QWidget
{
Q_OBJECT
public:
QmitkTransferFunctionCanvas( QWidget * parent=0, Qt::WindowFlags f = 0 );
mitk::SimpleHistogram* GetHistogram()
{
return m_Histogram;
}
void SetHistogram(mitk::SimpleHistogram *histogram)
{
m_Histogram = histogram;
}
double GetMin()
{
return m_Min;
}
void SetMin(double min)
{
this->m_Min = min;
SetLower(min);
}
double GetMax()
{
return m_Max;
}
void SetMax(double max)
{
this->m_Max = max;
SetUpper(max);
}
double GetLower()
{
return m_Lower;
}
void SetLower(double lower)
{
this->m_Lower = lower;
}
double GetUpper()
{
return m_Upper;
}
void SetUpper(double upper)
{
this->m_Upper = upper;
}
- void mousePressEvent( QMouseEvent* mouseEvent );
- virtual void paintEvent( QPaintEvent* e );
+ void mousePressEvent( QMouseEvent* mouseEvent ) override;
+ virtual void paintEvent( QPaintEvent* e ) override;
virtual void DoubleClickOnHandle(int handle) = 0;
- void mouseMoveEvent( QMouseEvent* mouseEvent );
- void mouseReleaseEvent( QMouseEvent* mouseEvent );
- void mouseDoubleClickEvent( QMouseEvent* mouseEvent );
+ void mouseMoveEvent( QMouseEvent* mouseEvent ) override;
+ void mouseReleaseEvent( QMouseEvent* mouseEvent ) override;
+ void mouseDoubleClickEvent( QMouseEvent* mouseEvent ) override;
void PaintHistogram(QPainter &p);
virtual int GetNearHandle(int x,int y,unsigned int maxSquaredDistance = 32) = 0;
virtual int AddFunctionPoint(double x,double val) = 0;
virtual void RemoveFunctionPoint(double x) = 0;
virtual void MoveFunctionPoint(int index, std::pair<double,double> pos) = 0;
virtual double GetFunctionX(int index) = 0;
virtual double GetFunctionY(int index) = 0;
virtual int GetFunctionSize() = 0;
int m_GrabbedHandle;
double m_Lower, m_Upper, m_Min, m_Max;
std::pair<int,int> FunctionToCanvas(std::pair<double,double>);
std::pair<double,double> CanvasToFunction(std::pair<int,int>);
mitk::SimpleHistogram *m_Histogram;
- void keyPressEvent ( QKeyEvent * e );
+ void keyPressEvent ( QKeyEvent * e ) override;
void SetImmediateUpdate(bool state);
std::pair<double,double> ValidateCoord( std::pair<double,double> x )
{
double max = m_Histogram->GetMax();
double min = m_Histogram->GetMin();
if( x.first < min ) x.first = min;
if( x.first > max ) x.first = max;
if( x.second < 0 ) x.second = 0;
if( x.second > 1 ) x.second = 1;
return x;
}
void SetX(float x)
{
if (m_GrabbedHandle != -1)
{
this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(x,GetFunctionY(m_GrabbedHandle))));
update();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void SetY(float y)
{
if (m_GrabbedHandle != -1)
{
this->MoveFunctionPoint(m_GrabbedHandle, ValidateCoord(std::make_pair(GetFunctionX(m_GrabbedHandle),y)));
update();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void SetQLineEdits(QLineEdit* xEdit, QLineEdit* yEdit)
{
m_XEdit = xEdit;
m_YEdit = yEdit;
m_LineEditAvailable = true;
}
protected:
bool m_ImmediateUpdate;
float m_Range;
bool m_LineEditAvailable;
QLineEdit* m_XEdit;
QLineEdit* m_YEdit;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkWebPage.h b/Modules/QtWidgetsExt/include/QmitkWebPage.h
index 90a55ae0ee..01be86ca2e 100644
--- a/Modules/QtWidgetsExt/include/QmitkWebPage.h
+++ b/Modules/QtWidgetsExt/include/QmitkWebPage.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <QWebPage>
#ifndef QMITK_WEBPAGE_H
#define QMITK_WEBPAGE_H
/**
* @brief The QmitkWebPage class
*
* This class reimplements QWebPage as a fix for bug 16158.
*/
class QmitkJSWebPage : public QWebPage
{
Q_OBJECT
public:
/**
* @brief Constructor
*/
QmitkJSWebPage(QObject *parent=0);
/**
* @brief Destructor
*/
virtual ~QmitkJSWebPage();
public slots:
/**
* @brief shouldInterruptJavaScript
*
* Overwritten from QWebView, to stop asking Qt to stop the JavaScript.
* @return false so JavaScript is not stopped
*/
- bool shouldInterruptJavaScript();
+ bool shouldInterruptJavaScript() override;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/qclickablelabel.h b/Modules/QtWidgetsExt/include/qclickablelabel.h
index 074a8603b4..f92d15ad64 100644
--- a/Modules/QtWidgetsExt/include/qclickablelabel.h
+++ b/Modules/QtWidgetsExt/include/qclickablelabel.h
@@ -1,81 +1,81 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef qclickablelabelhincluded
#define qclickablelabelhincluded
#include <QLabel>
#include "MitkQtWidgetsExtExports.h"
#include <vector>
#include <map>
#include "mitkCommon.h"
/**
\brief A QLabel with multiple hotspots, that can be clicked
Specially useful in connection with a pixmap.
Stretched images should be avoided, because the hotspots will not be adjusted in any way.
*/
class MITKQTWIDGETSEXT_EXPORT QClickableLabel : public QLabel
{
Q_OBJECT
public:
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QClickableLabel( QWidget* parent, Qt::WFlags f = 0 );
QClickableLabel( const QString& text, QWidget* parent, Qt::WFlags f = 0 );
#else
QClickableLabel( QWidget* parent, Qt::WindowFlags f = 0 );
QClickableLabel( const QString& text, QWidget* parent, Qt::WindowFlags f = 0 );
#endif
virtual ~QClickableLabel();
void AddHotspot( const QString& name, const QRect position );
void RemoveHotspot( const QString& name );
void RemoveHotspot( unsigned int hotspotIndex );
void RemoveAllHotspots();
signals:
void mousePressed( const QString& hotspotName );
void mousePressed( unsigned int hotspotIndex );
void mouseReleased( const QString& hotspotName );
void mouseReleased( unsigned int hotspotIndex );
protected:
- virtual void mousePressEvent ( QMouseEvent* e );
- virtual void mouseReleaseEvent ( QMouseEvent* e );
+ virtual void mousePressEvent ( QMouseEvent* e ) override;
+ virtual void mouseReleaseEvent ( QMouseEvent* e ) override;
/// returns index == m_Hotspots.size() if nothing is hit
unsigned int matchingRect( const QPoint& p );
typedef std::vector< QRect > RectVectorType;
RectVectorType m_Hotspots;
typedef std::map< QString, unsigned int > NameToIndexMapType;
typedef std::map< unsigned int, QString > IndexToNameMapType;
NameToIndexMapType m_HotspotIndexForName;
IndexToNameMapType m_HotspotNameForIndex;
};
#endif
diff --git a/Modules/QtWidgetsExt/src/QmitkBoolPropertyWidget.cpp b/Modules/QtWidgetsExt/src/QmitkBoolPropertyWidget.cpp
index 1f0f6ed07e..92bc49b298 100644
--- a/Modules/QtWidgetsExt/src/QmitkBoolPropertyWidget.cpp
+++ b/Modules/QtWidgetsExt/src/QmitkBoolPropertyWidget.cpp
@@ -1,111 +1,111 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkBoolPropertyWidget.h"
#include <mitkPropertyObserver.h>
class _BoolPropertyWidgetImpl : public mitk::PropertyEditor
{
public:
_BoolPropertyWidgetImpl(mitk::BoolProperty* property, QCheckBox* checkBox)
: PropertyEditor(property), m_BoolProperty(property), m_CheckBox(checkBox)
{
}
- virtual void PropertyChanged()
+ virtual void PropertyChanged() override
{
if ( m_Property )
m_CheckBox->setChecked( m_BoolProperty->GetValue() );
}
- virtual void PropertyRemoved()
+ virtual void PropertyRemoved() override
{
m_Property = NULL;
m_BoolProperty = NULL;
// display "no certain value"
m_CheckBox->blockSignals(true);
m_CheckBox->setTristate(true);
m_CheckBox->setCheckState(Qt::PartiallyChecked);
m_CheckBox->setEnabled(false);
m_CheckBox->blockSignals(false);
}
void ValueChanged(bool value)
{
this->BeginModifyProperty(); // deregister from events
m_BoolProperty->SetValue(value);
this->EndModifyProperty(); // again register for events
}
protected:
mitk::BoolProperty* m_BoolProperty;
QCheckBox* m_CheckBox;
};
QmitkBoolPropertyWidget::QmitkBoolPropertyWidget(QWidget* parent )
: QCheckBox(parent), m_PropEditorImpl(0)
{
setEnabled(false);
connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggle(bool)));
}
QmitkBoolPropertyWidget::QmitkBoolPropertyWidget(const QString& text, QWidget* parent )
: QCheckBox(text, parent ), m_PropEditorImpl(0)
{
setEnabled( false );
connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggle(bool)));
}
QmitkBoolPropertyWidget::~QmitkBoolPropertyWidget()
{
delete m_PropEditorImpl;
}
void QmitkBoolPropertyWidget::SetProperty(mitk::BoolProperty* property)
{
if (m_PropEditorImpl)
{
delete m_PropEditorImpl;
m_PropEditorImpl = 0;
}
if (!property)
{
setTristate(true);
setCheckState(Qt::PartiallyChecked);
setEnabled(false);
return;
}
setEnabled(true);
m_PropEditorImpl = new _BoolPropertyWidgetImpl(property, this);
m_PropEditorImpl->PropertyChanged();
}
void QmitkBoolPropertyWidget::onToggle(bool on)
{
if (m_PropEditorImpl)
{
m_PropEditorImpl->ValueChanged(on);
}
}
diff --git a/Modules/QtWidgetsExt/src/QmitkEnumerationPropertyWidget.cpp b/Modules/QtWidgetsExt/src/QmitkEnumerationPropertyWidget.cpp
index e25437dd17..f82dc4ccfb 100644
--- a/Modules/QtWidgetsExt/src/QmitkEnumerationPropertyWidget.cpp
+++ b/Modules/QtWidgetsExt/src/QmitkEnumerationPropertyWidget.cpp
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkEnumerationPropertyWidget.h"
#include <mitkPropertyObserver.h>
#include <mitkEnumerationProperty.h>
class _EnumPropEditorImpl : public mitk::PropertyEditor
{
public:
_EnumPropEditorImpl(mitk::EnumerationProperty* property,
QComboBox* combo, const QHash<int, int>& enumIdToItemIndex)
: PropertyEditor(property), m_EnumerationProperty(property), m_ComboBox(combo),
m_EnumIdToItemIndex(enumIdToItemIndex)
{
}
~_EnumPropEditorImpl()
{
m_EnumerationProperty = 0;
}
void IndexChanged(int enumId)
{
this->BeginModifyProperty();
m_EnumerationProperty->SetValue(enumId);
this->EndModifyProperty();
}
- virtual void PropertyChanged()
+ virtual void PropertyChanged() override
{
if (m_EnumerationProperty)
{
m_ComboBox->setCurrentIndex(m_EnumIdToItemIndex[m_EnumerationProperty->GetValueAsId()]);
}
}
- virtual void PropertyRemoved()
+ virtual void PropertyRemoved() override
{
m_Property = 0;
m_EnumerationProperty = 0;
m_ComboBox->setEnabled(false);
}
protected:
mitk::EnumerationProperty* m_EnumerationProperty;
QComboBox* m_ComboBox;
QHash<int, int> m_EnumIdToItemIndex;
};
QmitkEnumerationPropertyWidget::QmitkEnumerationPropertyWidget(QWidget* parent)
: QComboBox(parent), propView(0)
{
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(OnIndexChanged(int)));
}
QmitkEnumerationPropertyWidget::~QmitkEnumerationPropertyWidget()
{
delete propView;
}
void QmitkEnumerationPropertyWidget::SetProperty(mitk::EnumerationProperty* property)
{
if(propView)
{
delete propView;
propView = 0;
}
this->clear();
if(!property)
{
return;
}
this->setEnabled(true);
QHash<int,int> enumIdToItemIndex;
const mitk::EnumerationProperty::EnumStringsContainerType& strings = property->GetEnumStrings();
int index = 0;
for (mitk::EnumerationProperty::EnumStringsContainerType::const_iterator it = strings.begin();
it != strings.end(); ++it, ++index)
{
enumIdToItemIndex.insert(it->second, index);
this->addItem(QString::fromStdString(it->first), it->second);
}
propView = new _EnumPropEditorImpl(property, this, enumIdToItemIndex);
propView->PropertyChanged();
}
void QmitkEnumerationPropertyWidget::OnIndexChanged(int index)
{
if (propView)
{
int enumIndex = this->itemData(index, Qt::UserRole).toInt();
propView->IndexChanged(enumIndex);
}
}
diff --git a/Modules/QtWidgetsExt/src/QmitkNumberPropertySlider.cpp b/Modules/QtWidgetsExt/src/QmitkNumberPropertySlider.cpp
index 771175002b..40e5b2eca6 100644
--- a/Modules/QtWidgetsExt/src/QmitkNumberPropertySlider.cpp
+++ b/Modules/QtWidgetsExt/src/QmitkNumberPropertySlider.cpp
@@ -1,356 +1,356 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <QmitkNumberPropertySlider.h>
#include <mitkPropertyObserver.h>
#include <mitkProperties.h>
#include <mitkRenderingManager.h>
#define DT_SHORT 1
#define DT_INT 2
#define DT_FLOAT 3
#define DT_DOUBLE 4
#define ROUND(x) (((x) > 0) ? int((x) + 0.5) : int((x) - 0.5))
#define ROUND_SHORT(x) (((x) > 0) ? short((x) + 0.5) : short((x) - 0.5))
class QmitkNumberPropertySlider::Impl
{
public:
Impl(QmitkNumberPropertySlider* q);
void DisplayNumber();
void adjustFactors(short, bool);
class Editor : public mitk::PropertyEditor
{
public:
Editor(mitk::IntProperty*, Impl* impl);
Editor(mitk::FloatProperty*, Impl* impl);
Editor(mitk::DoubleProperty*, Impl* impl);
- virtual void PropertyChanged();
- virtual void PropertyRemoved();
+ virtual void PropertyChanged() override;
+ virtual void PropertyRemoved() override;
void BeginModifyProperty()
{ mitk::PropertyEditor::BeginModifyProperty(); }
void EndModifyProperty()
{ mitk::PropertyEditor::EndModifyProperty(); }
union {
mitk::GenericProperty<int>* m_IntProperty;
mitk::GenericProperty<float>* m_FloatProperty;
mitk::GenericProperty<double>* m_DoubleProperty;
};
const int m_DataType;
private:
Impl* m_Impl;
};
std::auto_ptr<Editor> m_PropEditor;
short m_DecimalPlaces; // how many decimal places are shown
double m_FactorPropertyToSlider; // internal conversion factor. neccessary because slider ranges work only with ints
double m_FactorSliderToDisplay; // internal conversion factor. neccessary because slider ranges work only with ints
bool m_ShowPercents; // whether values are given in percent (0.5 -> 50%)
bool m_SelfChangeLock;
private:
void initialize();
QmitkNumberPropertySlider* q;
};
QmitkNumberPropertySlider::Impl::Editor::Editor(mitk::IntProperty* property, Impl* impl)
: mitk::PropertyEditor(property)
, m_IntProperty(property)
, m_DataType(DT_INT)
, m_Impl(impl)
{
}
QmitkNumberPropertySlider::Impl::Editor::Editor(mitk::FloatProperty* property, Impl* impl)
: mitk::PropertyEditor( property )
, m_FloatProperty(property)
, m_DataType(DT_FLOAT)
, m_Impl(impl)
{
}
QmitkNumberPropertySlider::Impl::Editor::Editor(mitk::DoubleProperty* property, Impl* impl)
: mitk::PropertyEditor( property )
, m_DoubleProperty(property)
, m_DataType(DT_DOUBLE)
, m_Impl(impl)
{
}
QmitkNumberPropertySlider::~QmitkNumberPropertySlider()
{
}
void QmitkNumberPropertySlider::SetProperty(mitk::IntProperty* property)
{
if (property == NULL)
{
d->m_PropEditor.reset();
this->setEnabled(false);
}
else
{
d->m_PropEditor.reset(new Impl::Editor(property, d.get()));
d->m_PropEditor->PropertyChanged();
this->setEnabled(true);
}
}
void QmitkNumberPropertySlider::SetProperty(mitk::FloatProperty* property)
{
if (property == NULL)
{
d->m_PropEditor.reset();
this->setEnabled(false);
}
else
{
d->m_PropEditor.reset(new Impl::Editor(property, d.get()));
d->m_PropEditor->PropertyChanged();
this->setEnabled(true);
}
}
void QmitkNumberPropertySlider::SetProperty(mitk::DoubleProperty* property)
{
if (property == NULL)
{
d->m_PropEditor.reset();
this->setEnabled(false);
}
else
{
d->m_PropEditor.reset(new Impl::Editor(property, d.get()));
d->m_PropEditor->PropertyChanged();
this->setEnabled(true);
}
}
QmitkNumberPropertySlider::Impl::Impl(QmitkNumberPropertySlider* q)
: m_DecimalPlaces(0)
, m_FactorPropertyToSlider(1.0)
, m_FactorSliderToDisplay(1.0)
, m_ShowPercents(false)
, m_SelfChangeLock(false)
, q(q)
{
}
QmitkNumberPropertySlider::QmitkNumberPropertySlider(QWidget *parent)
: QSlider(parent)
, d(new Impl(this))
{
connect( this, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)) );
this->setEnabled(false);
}
void QmitkNumberPropertySlider::Impl::adjustFactors(short newDecimalPlaces, bool newShowPercents)
{
int oldMax = q->maxValue();
int oldMin = q->minValue();
m_DecimalPlaces = newDecimalPlaces;
m_ShowPercents = newShowPercents;
m_FactorPropertyToSlider = pow(10.0,m_DecimalPlaces);
m_FactorSliderToDisplay = 1.0 / m_FactorPropertyToSlider;
if ( m_ShowPercents )
m_FactorPropertyToSlider *= 100.0;
q->setMinimum(oldMin);
q->setMaximum(oldMax);
}
short QmitkNumberPropertySlider::getDecimalPlaces() const
{
return d->m_DecimalPlaces;
}
void QmitkNumberPropertySlider::setDecimalPlaces(short places)
{
if (d->m_PropEditor.get() == NULL) return;
switch (d->m_PropEditor->m_DataType)
{
case DT_FLOAT:
case DT_DOUBLE:
{
d->adjustFactors( places, d->m_ShowPercents );
d->DisplayNumber();
break;
}
default:
break;
}
}
bool QmitkNumberPropertySlider::getShowPercent() const
{
return d->m_ShowPercents;
}
void QmitkNumberPropertySlider::setShowPercent(bool showPercent)
{
if ( showPercent == d->m_ShowPercents ) return; // nothing to change
if (d->m_PropEditor.get() == NULL) return;
switch (d->m_PropEditor->m_DataType)
{
case DT_FLOAT:
case DT_DOUBLE:
{
d->adjustFactors(d->m_DecimalPlaces, showPercent);
break;
}
default:
{
break;
}
}
d->DisplayNumber();
}
int QmitkNumberPropertySlider::minValue() const
{
return ROUND( QSlider::minimum() / d->m_FactorPropertyToSlider );
}
void QmitkNumberPropertySlider::setMinValue(int value)
{
QSlider::setMinimum( ROUND(value * d->m_FactorPropertyToSlider ) );
}
int QmitkNumberPropertySlider::maxValue() const
{
return ROUND( QSlider::maximum() / d->m_FactorPropertyToSlider );
}
void QmitkNumberPropertySlider::setMaxValue(int value)
{
QSlider::setMaximum( ROUND( value * d->m_FactorPropertyToSlider ) );
}
double QmitkNumberPropertySlider::doubleValue() const
{
return static_cast<double>((QSlider::value()) / d->m_FactorPropertyToSlider );
}
void QmitkNumberPropertySlider::setDoubleValue(double value)
{
QSlider::setValue( ROUND( value * d->m_FactorPropertyToSlider ) );
}
void QmitkNumberPropertySlider::onValueChanged(int value)
{
if (d->m_PropEditor.get() == NULL) return;
if (d->m_SelfChangeLock) return; // valueChanged is even emitted, when this widget initiates a change to its value
// this may be useful some times, but in this use, it would be wrong:
// (A) is an editor with 3 decimal places
// (B) is an editor with 2 decimal places
// User changes A's displayed value to 4.002
// A's onValueChanged gets called, sets the associated Property to 4.002
// B's onPropertyChanged gets called, sets its display to 4.00
// B's onValueChanged gets called and sets the associated Property to 4.00
// A's onPropertyChanged gets called, sets its display to 4.000
d->m_PropEditor->BeginModifyProperty();
double newValue( value / d->m_FactorPropertyToSlider );
switch (d->m_PropEditor->m_DataType)
{
case DT_INT:
{
d->m_PropEditor->m_IntProperty->SetValue(ROUND(newValue));
break;
}
case DT_FLOAT:
{
d->m_PropEditor->m_FloatProperty->SetValue(newValue);
break;
}
case DT_DOUBLE:
{
d->m_PropEditor->m_DoubleProperty->SetValue(newValue);
break;
}
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
d->m_PropEditor->EndModifyProperty();
}
void QmitkNumberPropertySlider::Impl::Editor::PropertyChanged()
{
m_Impl->DisplayNumber();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
void QmitkNumberPropertySlider::Impl::Editor::PropertyRemoved()
{
this->m_Property = NULL;
}
void QmitkNumberPropertySlider::Impl::DisplayNumber()
{
if (m_PropEditor.get() == NULL) return;
m_SelfChangeLock = true;
switch (m_PropEditor->m_DataType)
{
case DT_INT:
{
int i = m_PropEditor->m_IntProperty->GetValue();
q->setValue( i );
break;
}
case DT_FLOAT:
{
float f = m_PropEditor->m_FloatProperty->GetValue();
q->setDoubleValue( f );
break;
}
case DT_DOUBLE:
{
double d = m_PropEditor->m_DoubleProperty->GetValue();
q->setDoubleValue( d );
break;
}
default:
break;
}
m_SelfChangeLock = false;
}
diff --git a/Modules/QtWidgetsExt/src/QmitkUGCombinedRepresentationPropertyWidget.cpp b/Modules/QtWidgetsExt/src/QmitkUGCombinedRepresentationPropertyWidget.cpp
index 6589d759b4..aee0fd4980 100644
--- a/Modules/QtWidgetsExt/src/QmitkUGCombinedRepresentationPropertyWidget.cpp
+++ b/Modules/QtWidgetsExt/src/QmitkUGCombinedRepresentationPropertyWidget.cpp
@@ -1,289 +1,289 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkUGCombinedRepresentationPropertyWidget.h"
#include <mitkGridRepresentationProperty.h>
#include <mitkGridVolumeMapperProperty.h>
#include <mitkPropertyObserver.h>
#include <mitkProperties.h>
class _UGCombinedBoolPropEditor : public mitk::PropertyEditor
{
public:
_UGCombinedBoolPropEditor(mitk::BoolProperty* boolProp,
QmitkUGCombinedRepresentationPropertyWidget* combo)
: PropertyEditor(boolProp), m_BoolProperty(boolProp),
m_ComboBox(combo)
{
PropertyChanged();
}
virtual ~_UGCombinedBoolPropEditor() {}
bool IsEnabled() const
{
return enabled;
}
void SetEnabled(bool enable)
{
this->BeginModifyProperty();
m_BoolProperty->SetValue(enable);
this->EndModifyProperty();
}
protected:
- virtual void PropertyChanged()
+ virtual void PropertyChanged() override
{
if (m_BoolProperty)
enabled = m_BoolProperty->GetValue();
else
enabled = false;
m_ComboBox->IsVolumeChanged(enabled);
}
- virtual void PropertyRemoved()
+ virtual void PropertyRemoved() override
{
m_Property = 0;
m_BoolProperty = 0;
enabled = false;
}
mitk::BoolProperty* m_BoolProperty;
QmitkUGCombinedRepresentationPropertyWidget* m_ComboBox;
bool enabled;
};
class _UGCombinedEnumPropEditor : public mitk::PropertyEditor
{
public:
_UGCombinedEnumPropEditor(mitk::EnumerationProperty* property,
QmitkUGCombinedRepresentationPropertyWidget* combo, bool isVolumeProp)
: PropertyEditor(property), m_EnumerationProperty(property), m_ComboBox(combo),
m_IsVolumeProp(isVolumeProp)
{
}
~_UGCombinedEnumPropEditor()
{
m_EnumerationProperty = 0;
}
void IndexChanged(int enumId)
{
this->BeginModifyProperty();
m_EnumerationProperty->SetValue(enumId);
this->EndModifyProperty();
}
- virtual void PropertyChanged()
+ virtual void PropertyChanged() override
{
if (m_EnumerationProperty)
{
if (m_IsVolumeProp)
{
m_ComboBox->SetGridVolumeId(m_EnumerationProperty->GetValueAsId());
}
else
{
m_ComboBox->SetGridRepresentationId(m_EnumerationProperty->GetValueAsId());
}
}
}
- virtual void PropertyRemoved()
+ virtual void PropertyRemoved() override
{
m_Property = 0;
m_EnumerationProperty = 0;
}
protected:
mitk::EnumerationProperty* m_EnumerationProperty;
QmitkUGCombinedRepresentationPropertyWidget* m_ComboBox;
QHash<int, int> m_EnumIdToItemIndex;
bool m_IsVolumeProp;
};
QmitkUGCombinedRepresentationPropertyWidget::QmitkUGCombinedRepresentationPropertyWidget(QWidget *parent) :
QComboBox(parent), gridRepPropEditor(0), volumeMapperPropEditor(0), volumePropEditor(0),
m_GridRepIndex(0), m_GridVolIndex(0), m_FirstVolumeRepId(0)
{
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(OnIndexChanged(int)));
}
QmitkUGCombinedRepresentationPropertyWidget::~QmitkUGCombinedRepresentationPropertyWidget()
{
delete gridRepPropEditor;
delete volumeMapperPropEditor;
delete volumePropEditor;
}
void QmitkUGCombinedRepresentationPropertyWidget::SetProperty(
mitk::GridRepresentationProperty* gridRepProp,
mitk::GridVolumeMapperProperty* gridVolProp,
mitk::BoolProperty* volumeProp)
{
if (gridRepPropEditor)
{
delete gridRepPropEditor;
gridRepPropEditor = 0;
}
if (volumeMapperPropEditor)
{
delete volumeMapperPropEditor;
volumeMapperPropEditor = 0;
}
if (volumePropEditor)
{
delete volumePropEditor;
volumePropEditor = 0;
}
this->clear();
this->setEnabled(true);
m_FirstVolumeRepId = 0;
m_MapRepEnumToIndex.clear();
m_MapVolEnumToIndex.clear();
if (!gridRepProp && !gridVolProp)
return;
int i = 0;
if (gridRepProp)
{
const mitk::EnumerationProperty::EnumStringsContainerType& repStrings = gridRepProp->GetEnumStrings();
for (mitk::EnumerationProperty::EnumStringsContainerType::const_iterator it = repStrings.begin();
it != repStrings.end(); ++it, ++i)
{
m_MapRepEnumToIndex.insert(it->second, i);
this->addItem(QString::fromStdString(it->first), it->second);
}
m_FirstVolumeRepId = i;
}
if (gridVolProp)
{
const mitk::EnumerationProperty::EnumStringsContainerType& volStrings = gridVolProp->GetEnumStrings();
for (mitk::EnumerationProperty::EnumStringsContainerType::const_iterator it = volStrings.begin();
it != volStrings.end(); ++it, ++i)
{
m_MapVolEnumToIndex.insert(it->second, i);
this->addItem(QString("Volume (") + QString::fromStdString(it->first) + ")", it->second);
}
}
if (gridRepProp)
{
gridRepPropEditor = new _UGCombinedEnumPropEditor(gridRepProp, this, false);
}
if (gridVolProp)
{
volumeMapperPropEditor = new _UGCombinedEnumPropEditor(gridVolProp, this, true);
}
if (volumeProp)
{
volumePropEditor = new _UGCombinedBoolPropEditor(volumeProp, this);
}
if (gridRepProp)
{
this->SetGridRepresentationId(gridRepProp->GetValueAsId());
}
if (gridVolProp)
{
this->SetGridVolumeId(gridVolProp->GetValueAsId());
}
}
void QmitkUGCombinedRepresentationPropertyWidget::OnIndexChanged(int index)
{
int enumIndex = this->itemData(index, Qt::UserRole).toInt();
if (index < m_FirstVolumeRepId && gridRepPropEditor)
{
gridRepPropEditor->IndexChanged(enumIndex);
if (volumePropEditor)
{
volumePropEditor->SetEnabled(false);
}
}
else if (volumeMapperPropEditor)
{
volumeMapperPropEditor->IndexChanged(enumIndex);
if (volumePropEditor)
{
volumePropEditor->SetEnabled(true);
}
}
}
void QmitkUGCombinedRepresentationPropertyWidget::SetGridRepresentationId(int enumId)
{
m_GridRepIndex = enumId;
if (volumePropEditor && volumePropEditor->IsEnabled())
{
return;
}
else
{
this->setCurrentIndex(m_MapRepEnumToIndex[enumId]);
}
}
void QmitkUGCombinedRepresentationPropertyWidget::SetGridVolumeId(int enumId)
{
m_GridVolIndex = enumId;
if (volumePropEditor && volumePropEditor->IsEnabled())
{
this->setCurrentIndex(m_MapVolEnumToIndex[enumId]);
}
else
{
return;
}
}
void QmitkUGCombinedRepresentationPropertyWidget::IsVolumeChanged(bool volume)
{
if (volume)
{
this->SetGridVolumeId(m_GridVolIndex);
}
else
{
this->SetGridRepresentationId(m_GridRepIndex);
}
}
diff --git a/Modules/RigidRegistration/mitkImageRegistrationMethod.h b/Modules/RigidRegistration/mitkImageRegistrationMethod.h
index 696eb9409f..09a32f9a93 100644
--- a/Modules/RigidRegistration/mitkImageRegistrationMethod.h
+++ b/Modules/RigidRegistration/mitkImageRegistrationMethod.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKIMAGEREGISTRATIONMETHOD_H
#define MITKIMAGEREGISTRATIONMETHOD_H
#include "itkImageRegistrationMethod.h"
#include "MitkRigidRegistrationExports.h"
#include "itkSingleValuedNonLinearOptimizer.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageAccessByItk.h"
#include "mitkRigidRegistrationObserver.h"
#include "mitkCommon.h"
#include "itkImageMaskSpatialObject.h"
#include "mitkRigidRegistrationPreset.h"
namespace mitk
{
/*!
\brief Main class for the rigid registration pipeline.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT ImageRegistrationMethod : public ImageToImageFilter
{
public:
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef itk::ImageMaskSpatialObject< 3 > MaskType;
mitkClassMacro(ImageRegistrationMethod, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
static const int LINEARINTERPOLATOR = 0;
static const int NEARESTNEIGHBORINTERPOLATOR = 1;
void SetObserver(RigidRegistrationObserver::Pointer observer);
void SetInterpolator(int interpolator);
- virtual void GenerateData();
+ virtual void GenerateData() override;
virtual void SetReferenceImage( Image::Pointer fixedImage);
virtual void SetFixedMask( Image::Pointer fixedMask);
virtual void SetMovingMask( Image::Pointer movingMask);
void SetOptimizerScales(itk::Array<double> scales);
void SetTransform(itk::Object::Pointer transform);
void SetMetric(itk::Object::Pointer metric);
void SetOptimizer(itk::Object::Pointer optimizer);
protected:
ImageRegistrationMethod();
virtual ~ImageRegistrationMethod();
friend struct ImageRegistrationMethodAccessFunctor;
RigidRegistrationObserver::Pointer m_Observer;
int m_Interpolator;
Image::Pointer m_ReferenceImage;
Image::Pointer m_FixedMask;
Image::Pointer m_MovingMask;
- virtual void GenerateOutputInformation(){};
+ virtual void GenerateOutputInformation() override{};
private:
itk::Object::Pointer m_Transform;
itk::Object::Pointer m_Metric;
itk::Object::Pointer m_Optimizer;
itk::Array<double> m_OptimizerScales;
};
}
#endif // MITKIMAGEREGISTRATIONMETHOD_H
diff --git a/Modules/RigidRegistration/mitkMetricFactory.h b/Modules/RigidRegistration/mitkMetricFactory.h
index 71f93d4b4f..63820f55ae 100644
--- a/Modules/RigidRegistration/mitkMetricFactory.h
+++ b/Modules/RigidRegistration/mitkMetricFactory.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMETRICFACTORY_H
#define MITKMETRICFACTORY_H
#include "itkImageToImageMetric.h"
#include "itkImage.h"
#include "mitkMetricParameters.h"
#include "itkImageMaskSpatialObject.h"
namespace mitk {
/*!
\brief This class creates a metric for a rigid registration process.
This class will e.g. be instantiated by mitkImageRegistrationMethod and a
metric corresponding to the integer value stored in mitkMetricParameters
will be created. Therefore SetMetricParameters() has to be called with an instance
of mitkMetricParameters, which holds all parameter informations for the new
metric.
GetMetric() returns the metric which then can be used in combination with a
transform, an optimizer and an interpolator within a registration pipeline.
\ingroup RigidRegistration
\author Daniel Stein
*/
template < class TPixelType, unsigned int VImageDimension >
class MetricFactory : public itk::Object
{
public:
- mitkClassMacro(MetricFactory, itk::Object);
+ mitkClassMacroItkParent(MetricFactory, itk::Object);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef typename itk::Image< TPixelType, VImageDimension > FixedImageType;
typedef typename itk::Image< unsigned char, VImageDimension > FixedMaskImageType;
typedef typename itk::ImageMaskSpatialObject< VImageDimension > FixedImageMaskType;
typedef typename itk::Image< TPixelType, VImageDimension > MovingImageType;
typedef typename itk::Image< unsigned char, VImageDimension > MovingMaskImageType;
typedef typename itk::ImageMaskSpatialObject< VImageDimension > MovingImageMaskType;
typedef typename itk::ImageToImageMetric< FixedImageType, MovingImageType > MetricType;
typedef typename MetricType::Pointer MetricPointer;
/**
\brief Returns the metric which then can be used in combination with a transform, an optimizer
and an interpolator within a registration pipeline.
*/
MetricPointer GetMetric( );
/**
\brief Sets the instance to the metric parameters class which holds all parameters for the new metric.
*/
void SetMetricParameters(MetricParameters::Pointer metricParameters)
{
m_MetricParameters = metricParameters;
}
/**
\brief Returns the instance to the metric parameters class which holds all parameters for the new metric.
*/
MetricParameters::Pointer GetMetricParameters()
{
return m_MetricParameters;
}
protected:
MetricFactory();
~MetricFactory() {};
MetricParameters::Pointer m_MetricParameters;
};
} // namespace mitk
#include "mitkMetricFactory.txx"
#endif // MITKMETRICFACTORY_H
diff --git a/Modules/RigidRegistration/mitkMetricParameters.h b/Modules/RigidRegistration/mitkMetricParameters.h
index 963036a6eb..73fe6f93e4 100644
--- a/Modules/RigidRegistration/mitkMetricParameters.h
+++ b/Modules/RigidRegistration/mitkMetricParameters.h
@@ -1,268 +1,268 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKMETRICPARAMETERS_H
#define MITKMETRICPARAMETERS_H
#include <itkObjectFactory.h>
#include "MitkRigidRegistrationExports.h"
#include "mitkCommon.h"
namespace mitk {
/*!
\brief This class is used to hold all metric parameters needed for a rigid registration process.
To use the rigid registration framework you have to create an instance of this class and fill it with the parameters
belonging to the selected metric. To let the rigid registration work properly, this instance has to be given
to mitkImageRegistrationMethod before calling the update() method in mitkImageRegistrationMethod.
Also instances of the classes mitkTransformParameters and mitkOptimizerParameters have to be set in mitkImageRegistrationMethod
before calling the update() method.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT MetricParameters : public itk::Object
{
public:
- mitkClassMacro(MetricParameters,::itk::Object);
+ mitkClassMacroItkParent(MetricParameters,::itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Unique integer value for every metric.
*/
enum MetricType {
MEANSQUARESIMAGETOIMAGEMETRIC = 0,
NORMALIZEDCORRELATIONIMAGETOIMAGEMETRIC = 1,
GRADIENTDIFFERENCEIMAGETOIMAGEMETRIC = 2,
KULLBACKLEIBLERCOMPAREHISTOGRAMIMAGETOIMAGEMETRIC = 3,
CORRELATIONCOEFFICIENTHISTOGRAMIMAGETOIMAGEMETRIC = 4,
MEANSQUARESHISTOGRAMIMAGETOIMAGEMETRIC = 5,
MUTUALINFORMATIONHISTOGRAMIMAGETOIMAGEMETRIC = 6,
NORMALIZEDMUTUALINFORMATIONHISTOGRAMIMAGETOIMAGEMETRIC = 7,
MATTESMUTUALINFORMATIONIMAGETOIMAGEMETRIC = 8,
MEANRECIPROCALSQUAREDIFFERENCEIMAGETOIMAGEMETRIC = 9,
MUTUALINFORMATIONIMAGETOIMAGEMETRIC = 10,
MATCHCARDINALITYIMAGETOIMAGEMETRIC = 11,
KAPPASTATISTICIMAGETOIMAGEMETRIC = 12
};
/**
\brief Sets the metric used for registration by its unique integer value.
*/
itkSetMacro( Metric, int );
/**
\brief Returns the metric used for registration by its unique integer value.
*/
itkGetMacro( Metric, int );
/**
\brief Sets whether a gradient image has to be computed. Some optimizer need this.
*/
itkSetMacro( ComputeGradient, bool );
/**
\brief Returns whether a gradient image has to be computed.
*/
itkGetMacro( ComputeGradient, bool );
/**
\brief for itk::KullbackLeiblerCompareHistogramImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsKullbackLeiblerCompareHistogram, unsigned int );
/**
\brief for itk::KullbackLeiblerCompareHistogramImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsKullbackLeiblerCompareHistogram, unsigned int );
/**
\brief for itk::CorrelationCoefficientHistogramImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsCorrelationCoefficientHistogram, unsigned int );
/**
\brief for itk::CorrelationCoefficientHistogramImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsCorrelationCoefficientHistogram, unsigned int );
/**
\brief for itk::MeanSquaresHistogramImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsMeanSquaresHistogram, unsigned int );
/**
\brief for itk::MeanSquaresHistogramImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsMeanSquaresHistogram, unsigned int );
/**
\brief for itk::MutualInformationHistogramImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsMutualInformationHistogram, unsigned int );
/**
\brief for itk::MutualInformationHistogramImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsMutualInformationHistogram, unsigned int );
/**
\brief for itk::NormalizedMutualInformationHistogramImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsNormalizedMutualInformationHistogram, unsigned int );
/**
\brief for itk::NormalizedMutualInformationHistogramImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsNormalizedMutualInformationHistogram, unsigned int );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkSetMacro( SpatialSamplesMattesMutualInformation, unsigned int );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkGetMacro( SpatialSamplesMattesMutualInformation, unsigned int );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkSetMacro( UseSamplesMattesMutualInformation, bool );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkGetMacro( UseSamplesMattesMutualInformation, bool );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkSetMacro( NumberOfHistogramBinsMattesMutualInformation, unsigned int );
/**
\brief for itk::MattesMutualInformationImageToImageMetric
*/
itkGetMacro( NumberOfHistogramBinsMattesMutualInformation, unsigned int );
/**
\brief for itk::MeanReciprocalSquareDifferenceImageToImageMetric
*/
itkSetMacro( LambdaMeanReciprocalSquareDifference, unsigned int );
/**
\brief for itk::MeanReciprocalSquareDifferenceImageToImageMetric
*/
itkGetMacro( LambdaMeanReciprocalSquareDifference, unsigned int );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( SpatialSamplesMutualInformation, unsigned int );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( SpatialSamplesMutualInformation, unsigned int );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( FixedImageStandardDeviationMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( FixedImageStandardDeviationMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( MovingImageStandardDeviationMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( MovingImageStandardDeviationMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( UseNormalizerAndSmootherMutualInformation, bool );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( UseNormalizerAndSmootherMutualInformation, bool );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( FixedSmootherVarianceMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( FixedSmootherVarianceMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkSetMacro( MovingSmootherVarianceMutualInformation, float );
/**
\brief for itk::MutualInformationImageToImageMetric
*/
itkGetMacro( MovingSmootherVarianceMutualInformation, float );
protected:
MetricParameters();
~MetricParameters() {};
int m_Metric;
bool m_ComputeGradient;
// for itk::KullbackLeiblerCompareHistogramImageToImageMetric
unsigned int m_NumberOfHistogramBinsKullbackLeiblerCompareHistogram;
// for itk::CorrelationCoefficientHistogramImageToImageMetric
unsigned int m_NumberOfHistogramBinsCorrelationCoefficientHistogram;
// for itk::MeanSquaresHistogramImageToImageMetric
unsigned int m_NumberOfHistogramBinsMeanSquaresHistogram;
// for itk::MutualInformationHistogramImageToImageMetric
unsigned int m_NumberOfHistogramBinsMutualInformationHistogram;
// for itk::NormalizedMutualInformationHistogramImageToImageMetric
unsigned int m_NumberOfHistogramBinsNormalizedMutualInformationHistogram;
// for itk::MattesMutualInformationImageToImageMetric
unsigned int m_NumberOfHistogramBinsMattesMutualInformation;
bool m_UseSamplesMattesMutualInformation;
unsigned int m_SpatialSamplesMattesMutualInformation;
// for itk::MeanReciprocalSquareDifferenceImageToImageMetric
unsigned int m_LambdaMeanReciprocalSquareDifference;
// for itk::MutualInformationImageToImageMetric
unsigned int m_SpatialSamplesMutualInformation;
float m_FixedImageStandardDeviationMutualInformation;
float m_MovingImageStandardDeviationMutualInformation;
bool m_UseNormalizerAndSmootherMutualInformation;
float m_FixedSmootherVarianceMutualInformation;
float m_MovingSmootherVarianceMutualInformation;
};
} // namespace mitk
#endif // MITKMETRICPARAMETERS_H
diff --git a/Modules/RigidRegistration/mitkOptimizerFactory.h b/Modules/RigidRegistration/mitkOptimizerFactory.h
index 24c0465fea..3c285e65b7 100644
--- a/Modules/RigidRegistration/mitkOptimizerFactory.h
+++ b/Modules/RigidRegistration/mitkOptimizerFactory.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKOPTIMIZERFACTORY_H
#define MITKOPTIMIZERFACTORY_H
#include "itkSingleValuedNonLinearOptimizer.h"
#include "MitkRigidRegistrationExports.h"
#include "mitkOptimizerParameters.h"
namespace mitk {
/*!
\brief This class creates an optimizer for a rigid registration process.
This class will e.g. be instantiated by mitkImageRegistrationMethod and an
optimizer corresponding to the integer value stored in mitkOptimizerParameters
will be created. Therefore SetOptimizerParameters() has to be called with an instance
of mitkOptimizerParameters, which holds all parameter informations for the new
optimizer.
GetOptimizer() returns the optimizer which then can be used in combination with a
transform, a metric and an interpolator within a registration pipeline.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT OptimizerFactory : public ::itk::Object
{
public:
- mitkClassMacro(OptimizerFactory, Object);
+ mitkClassMacroItkParent(OptimizerFactory, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
/**
\brief Returns the optimizer which then can be used in combination with a transform, a metric
and an interpolator within a registration pipeline.
*/
OptimizerType::Pointer GetOptimizer();
/**
\brief Sets the number of transformParameters.
*/
void SetNumberOfTransformParameters(int numberTransformParameters);
/**
\brief Sets the instance to the optimizer parameters class which holds all parameters for the new optimizer.
*/
void SetOptimizerParameters(OptimizerParameters::Pointer optimizerParameters)
{
m_OptimizerParameters = optimizerParameters;
}
/**
\brief Returns the instance to the optimizer parameters class which holds all parameters for the new optimizer.
*/
OptimizerParameters::Pointer GetOptimizerParameters()
{
return m_OptimizerParameters;
}
protected:
OptimizerFactory();
~OptimizerFactory();
private:
OptimizerParameters::Pointer m_OptimizerParameters;
int m_NumberTransformParameters;
};
} // namespace mitk
#endif // MITKOPTIMIZERFACTORY_H
diff --git a/Modules/RigidRegistration/mitkOptimizerParameters.h b/Modules/RigidRegistration/mitkOptimizerParameters.h
index 32491a47f9..df806be457 100644
--- a/Modules/RigidRegistration/mitkOptimizerParameters.h
+++ b/Modules/RigidRegistration/mitkOptimizerParameters.h
@@ -1,702 +1,702 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKOPTIMIZERPARAMETERS_H
#define MITKOPTIMIZERPARAMETERS_H
#include <itkArray.h>
#include "MitkRigidRegistrationExports.h"
#include <itkObjectFactory.h>
#include "mitkCommon.h"
namespace mitk {
/*!
\brief This class is used to hold all optimizer parameters needed for a rigid registration process.
To use the rigid registration framework you have to create an instance of this class and fill it with the parameters
belonging to the selected optimizer. To let the rigid registration work properly, this instance has to be given
to mitkImageRegistrationMethod before calling the update() method in mitkImageRegistrationMethod.
Also instances of the classes mitkTransformParameters and mitkMetricParameters have to be set in mitkImageRegistrationMethod
before calling the update() method.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT OptimizerParameters : public ::itk::Object
{
public:
- mitkClassMacro(OptimizerParameters,::itk::Object);
+ mitkClassMacroItkParent(OptimizerParameters,::itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Unique integer value for every optimizer.
*/
enum OptimizerType {
EXHAUSTIVEOPTIMIZER = 0,
GRADIENTDESCENTOPTIMIZER = 1,
QUATERNIONRIGIDTRANSFORMGRADIENTDESCENTOPTIMIZER = 2,
LBFGSBOPTIMIZER = 3,
ONEPLUSONEEVOLUTIONARYOPTIMIZER = 4,
POWELLOPTIMIZER = 5,
FRPROPTIMIZER = 6,
REGULARSTEPGRADIENTDESCENTOPTIMIZER = 7,
VERSORTRANSFORMOPTIMIZER = 8,
AMOEBAOPTIMIZER = 9,
CONJUGATEGRADIENTOPTIMIZER = 10,
LBFGSOPTIMIZER = 11,
SPSAOPTIMIZER = 12,
VERSORRIGID3DTRANSFORMOPTIMIZER = 13
};
/**
\brief Sets the optimizer used for registration by its unique integer value.
*/
itkSetMacro( Optimizer, int );
/**
\brief Returns the optimizer used for registration by its unique integer value.
*/
itkGetMacro( Optimizer, int );
/**
\brief Sets the images dimension which have to be registered.
*/
itkSetMacro( Dimension, unsigned int );
/**
\brief Returns the images dimension which have to be registered.
*/
itkGetMacro( Dimension, unsigned int );
/**
\brief Sets whether the optimizer should maximize or minimize the metrics value.
*/
itkSetMacro( Maximize, bool );
/**
\brief Returns whether the optimizer should maximize or minimize the metrics value.
*/
itkGetMacro( Maximize, bool );
/**
\brief for itk::ExhaustiveOptimizer
*/
itkSetMacro( StepLengthExhaustive, float );
/**
\brief for itk::ExhaustiveOptimizer
*/
itkGetMacro( StepLengthExhaustive, float );
/**
\brief for itk::ExhaustiveOptimizer
*/
itkSetMacro( NumberOfStepsExhaustive, int );
/**
\brief for itk::ExhaustiveOptimizer
*/
itkGetMacro( NumberOfStepsExhaustive, int );
/**
\brief for itk::GradientDescentOptimizer
*/
itkSetMacro( LearningRateGradientDescent, float );
/**
\brief for itk::GradientDescentOptimizer
*/
itkGetMacro( LearningRateGradientDescent, float );
/**
\brief for itk::GradientDescentOptimizer
*/
itkSetMacro( NumberOfIterationsGradientDescent, int );
/**
\brief for itk::GradientDescentOptimizer
*/
itkGetMacro( NumberOfIterationsGradientDescent, int );
/**
\brief for itk::QuaternionRigidTransformGradientDescentOptimizer
*/
itkSetMacro( LearningRateQuaternionRigidTransformGradientDescent, float );
/**
\brief for itk::QuaternionRigidTransformGradientDescentOptimizer
*/
itkGetMacro( LearningRateQuaternionRigidTransformGradientDescent, float );
/**
\brief for itk::QuaternionRigidTransformGradientDescentOptimizer
*/
itkSetMacro( NumberOfIterationsQuaternionRigidTransformGradientDescent, int );
/**
\brief for itk::QuaternionRigidTransformGradientDescentOptimizer
*/
itkGetMacro( NumberOfIterationsQuaternionRigidTransformGradientDescent, int );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkSetMacro( GrowthFactorOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkGetMacro( GrowthFactorOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkSetMacro( ShrinkFactorOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkGetMacro( ShrinkFactorOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkSetMacro( EpsilonOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkGetMacro( EpsilonOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkSetMacro( InitialRadiusOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkGetMacro( InitialRadiusOnePlusOneEvolutionary, float );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkSetMacro( NumberOfIterationsOnePlusOneEvolutionary, int );
/**
\brief for itk::OnePlusOneEvolutionaryOptimizer
*/
itkGetMacro( NumberOfIterationsOnePlusOneEvolutionary, int );
/**
\brief for itk::PowellOptimizer
*/
itkSetMacro( StepLengthPowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkGetMacro( StepLengthPowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkSetMacro( StepTolerancePowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkGetMacro( StepTolerancePowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkSetMacro( ValueTolerancePowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkGetMacro( ValueTolerancePowell, float );
/**
\brief for itk::PowellOptimizer
*/
itkSetMacro( NumberOfIterationsPowell, int );
/**
\brief for itk::PowellOptimizer
*/
itkGetMacro( NumberOfIterationsPowell, int );
/**
\brief for itk::FRPROptimizer
*/
itkSetMacro( StepLengthFRPR, float );
/**
\brief for itk::FRPROptimizer
*/
itkGetMacro( StepLengthFRPR, float );
/**
\brief for itk::FRPROptimizer
*/
itkSetMacro( FletchReevesFRPR, bool );
/**
\brief for itk::FRPROptimizer
*/
itkGetMacro( FletchReevesFRPR, bool );
/**
\brief for itk::FRPROptimizer
*/
itkSetMacro( PolakRibiereFRPR, bool );
/**
\brief for itk::FRPROptimizer
*/
itkGetMacro( PolakRibiereFRPR, bool );
/**
\brief for itk::FRPROptimizer
*/
itkSetMacro( NumberOfIterationsFRPR, int );
/**
\brief for itk::FRPROptimizer
*/
itkGetMacro( NumberOfIterationsFRPR, int );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkSetMacro( GradientMagnitudeToleranceRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkGetMacro( GradientMagnitudeToleranceRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkSetMacro( MinimumStepLengthRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkGetMacro( MinimumStepLengthRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkSetMacro( MaximumStepLengthRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkGetMacro( MaximumStepLengthRegularStepGradientDescent, float );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkSetMacro( NumberOfIterationsRegularStepGradientDescent, int );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkGetMacro( NumberOfIterationsRegularStepGradientDescent, int );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkSetMacro( RelaxationFactorRegularStepGradientDescent, double );
/**
\brief for itk::RegularStepGradientDescentOptimizer
*/
itkGetMacro( RelaxationFactorRegularStepGradientDescent, double );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkSetMacro( GradientMagnitudeToleranceVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkGetMacro( GradientMagnitudeToleranceVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkSetMacro( MinimumStepLengthVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkGetMacro( MinimumStepLengthVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkSetMacro( MaximumStepLengthVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkGetMacro( MaximumStepLengthVersorRigid3DTransform, float );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkSetMacro( NumberOfIterationsVersorRigid3DTransform, int );
/**
\brief for itk::VersorRigid3DTransformOptimizer
*/
itkGetMacro( NumberOfIterationsVersorRigid3DTransform, int );
/**
\brief for itk::VersorTransformOptimizer
*/
itkSetMacro( GradientMagnitudeToleranceVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkGetMacro( GradientMagnitudeToleranceVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkSetMacro( MinimumStepLengthVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkGetMacro( MinimumStepLengthVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkSetMacro( MaximumStepLengthVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkGetMacro( MaximumStepLengthVersorTransform, float );
/**
\brief for itk::VersorTransformOptimizer
*/
itkSetMacro( NumberOfIterationsVersorTransform, int );
/**
\brief for itk::VersorTransformOptimizer
*/
itkGetMacro( NumberOfIterationsVersorTransform, int );
/**
\brief for itk::AmoebaOptimizer
*/
void SetSimplexDeltaAmoeba(itk::Array<double> simplexDelta);
/**
\brief for itk::AmoebaOptimizer
*/
itk::Array<double> GetSimplexDeltaAmoeba();
/**
\brief for itk::AmoebaOptimizer
*/
itkSetMacro( ParametersConvergenceToleranceAmoeba, float );
/**
\brief for itk::AmoebaOptimizer
*/
itkGetMacro( ParametersConvergenceToleranceAmoeba, float );
/**
\brief for itk::AmoebaOptimizer
*/
itkSetMacro( FunctionConvergenceToleranceAmoeba, float );
/**
\brief for itk::AmoebaOptimizer
*/
itkGetMacro( FunctionConvergenceToleranceAmoeba, float );
/**
\brief for itk::AmoebaOptimizer
*/
itkSetMacro( NumberOfIterationsAmoeba, int );
/**
\brief for itk::AmoebaOptimizer
*/
itkGetMacro( NumberOfIterationsAmoeba, int );
// nothing for itk::ConjugateGradientOptimizer
/**
\brief for itk::LBFGSOptimizer
*/
itkSetMacro( GradientConvergenceToleranceLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkGetMacro( GradientConvergenceToleranceLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkSetMacro( LineSearchAccuracyLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkGetMacro( LineSearchAccuracyLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkSetMacro( DefaultStepLengthLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkGetMacro( DefaultStepLengthLBFGS, float );
/**
\brief for itk::LBFGSOptimizer
*/
itkSetMacro( TraceOnLBFGS, bool );
/**
\brief for itk::LBFGSOptimizer
*/
itkGetMacro( TraceOnLBFGS, bool );
/**
\brief for itk::LBFGSOptimizer
*/
itkSetMacro( NumberOfIterationsLBFGS, int );
/**
\brief for itk::LBFGSOptimizer
*/
itkGetMacro( NumberOfIterationsLBFGS, int );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( aSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( aSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( ASPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( ASPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( AlphaSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( AlphaSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( cSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( cSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( GammaSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( GammaSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( ToleranceSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( ToleranceSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( StateOfConvergenceDecayRateSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( StateOfConvergenceDecayRateSPSA, float );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( MinimumNumberOfIterationsSPSA, int );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( MinimumNumberOfIterationsSPSA, int );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( NumberOfPerturbationsSPSA, int );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( NumberOfPerturbationsSPSA, int );
/**
\brief for itk::SPSAOptimizer
*/
itkSetMacro( NumberOfIterationsSPSA, int );
/**
\brief for itk::SPSAOptimizer
*/
itkGetMacro( NumberOfIterationsSPSA, int );
protected:
OptimizerParameters();
~OptimizerParameters(){};
// for all Optimizer
int m_Optimizer;
unsigned int m_Dimension;
bool m_Maximize;
// for itk::ExhaustiveOptimizer
float m_StepLengthExhaustive;
int m_NumberOfStepsExhaustive;
// for itk::GradientDescentOptimizer
float m_LearningRateGradientDescent;
int m_NumberOfIterationsGradientDescent;
// for itk::QuaternionRigidTransformGradientDescentOptimizer
float m_LearningRateQuaternionRigidTransformGradientDescent;
int m_NumberOfIterationsQuaternionRigidTransformGradientDescent;
// for itk::LBFGSBOptimizer
// for itk::OnePlusOneEvolutionaryOptimizer
float m_GrowthFactorOnePlusOneEvolutionary;
float m_ShrinkFactorOnePlusOneEvolutionary;
float m_EpsilonOnePlusOneEvolutionary;
float m_InitialRadiusOnePlusOneEvolutionary;
int m_NumberOfIterationsOnePlusOneEvolutionary;
// for itk::PowellOptimizer
float m_StepLengthPowell;
float m_StepTolerancePowell;
float m_ValueTolerancePowell;
int m_NumberOfIterationsPowell;
// for itk::FRPROptimizer
float m_StepLengthFRPR;
bool m_FletchReevesFRPR;
bool m_PolakRibiereFRPR;
int m_NumberOfIterationsFRPR;
// for itk::RegularStepGradientDescentOptimizer
float m_GradientMagnitudeToleranceRegularStepGradientDescent;
float m_MinimumStepLengthRegularStepGradientDescent;
float m_MaximumStepLengthRegularStepGradientDescent;
int m_NumberOfIterationsRegularStepGradientDescent;
double m_RelaxationFactorRegularStepGradientDescent;
// for itk::VersorRigid3DTransformOptimizer
float m_GradientMagnitudeToleranceVersorRigid3DTransform;
float m_MinimumStepLengthVersorRigid3DTransform;
float m_MaximumStepLengthVersorRigid3DTransform;
int m_NumberOfIterationsVersorRigid3DTransform;
// for itk::VersorTransformOptimizer
float m_GradientMagnitudeToleranceVersorTransform;
float m_MinimumStepLengthVersorTransform;
float m_MaximumStepLengthVersorTransform;
int m_NumberOfIterationsVersorTransform;
// for itk::AmoebaOptimizer
itk::Array<double> m_SimplexDeltaAmoeba;
float m_ParametersConvergenceToleranceAmoeba;
float m_FunctionConvergenceToleranceAmoeba;
int m_NumberOfIterationsAmoeba;
// for itk::ConjugateGradientOptimizer
// for itk::LBFGSOptimizer
float m_GradientConvergenceToleranceLBFGS;
float m_LineSearchAccuracyLBFGS;
float m_DefaultStepLengthLBFGS;
bool m_TraceOnLBFGS;
int m_NumberOfIterationsLBFGS;
// for itk::SPSAOptimizer
float m_aSPSA;
float m_ASPSA;
float m_AlphaSPSA;
float m_cSPSA;
float m_GammaSPSA;
float m_ToleranceSPSA;
float m_StateOfConvergenceDecayRateSPSA;
int m_MinimumNumberOfIterationsSPSA;
int m_NumberOfPerturbationsSPSA;
int m_NumberOfIterationsSPSA;
};
} // namespace mitk
#endif // MITKOPTIMIZERPARAMETERS_H
diff --git a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
index 5b5b52dabc..c7d66113f1 100644
--- a/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
+++ b/Modules/RigidRegistration/mitkPyramidalRegistrationMethod.h
@@ -1,166 +1,166 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPYRAMIDALREGISTRATIONMETHOD_H
#define MITKPYRAMIDALREGISTRATIONMETHOD_H
#include "itkImageRegistrationMethod.h"
#include "MitkRigidRegistrationExports.h"
#include "itkSingleValuedNonLinearOptimizer.h"
#include "mitkImageToImageFilter.h"
#include "mitkImageAccessByItk.h"
#include "mitkRigidRegistrationObserver.h"
#include "mitkCommon.h"
#include "mitkOptimizerParameters.h"
#include "mitkTransformParameters.h"
#include "mitkMetricParameters.h"
#include "itkImageMaskSpatialObject.h"
#include "mitkRigidRegistrationPreset.h"
namespace mitk
{
/*!
\brief Main class for the rigid registration pipeline.
\ingroup RigidRegistration
\author Thomas van Bruggen */
class MITKRIGIDREGISTRATION_EXPORT PyramidalRegistrationMethod : public ImageToImageFilter
{
public:
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef itk::ImageMaskSpatialObject< 3 > MaskType;
mitkClassMacro(PyramidalRegistrationMethod, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
static const int LINEARINTERPOLATOR = 0;
static const int NEARESTNEIGHBORINTERPOLATOR = 1;
void SetObserver(RigidRegistrationObserver::Pointer observer);
void SetInterpolator(int interpolator);
- virtual void GenerateData();
+ virtual void GenerateData() override;
virtual void SetReferenceImage( Image::Pointer fixedImage);
virtual void SetFixedMask( Image::Pointer fixedMask);
virtual void SetMovingMask( Image::Pointer movingMask);
void SetOptimizerParameters(OptimizerParameters::Pointer optimizerParameters)
{
m_OptimizerParameters = optimizerParameters;
}
OptimizerParameters::Pointer GetOptimizerParameters()
{
return m_OptimizerParameters;
}
void SetTransformParameters(TransformParameters::Pointer transformParameters)
{
m_TransformParameters = transformParameters;
}
TransformParameters::Pointer GetTransformParameters()
{
return m_TransformParameters;
}
void SetMetricParameters(MetricParameters::Pointer metricParameters)
{
m_MetricParameters = metricParameters;
}
MetricParameters::Pointer GetMetricParameters()
{
return m_MetricParameters;
}
void SetPresets(std::vector<std::string> presets)
{
m_Presets = presets;
}
itkSetMacro(FixedSchedule, itk::Array2D<unsigned int>);
itkSetMacro(MovingSchedule, itk::Array2D<unsigned int>);
itkSetMacro(MatchHistograms, bool);
itkGetMacro(Preset, mitk::RigidRegistrationPreset*);
itkSetMacro(BlurFixedImage, bool);
itkSetMacro(BlurMovingImage, bool);
protected:
PyramidalRegistrationMethod();
virtual ~PyramidalRegistrationMethod();
friend struct PyramidalRegistrationMethodAccessFunctor;
RigidRegistrationObserver::Pointer m_Observer;
int m_Interpolator;
Image::Pointer m_ReferenceImage;
Image::Pointer m_FixedMask;
Image::Pointer m_MovingMask;
- void GenerateOutputInformation(){};
+ void GenerateOutputInformation() override{};
private:
OptimizerParameters::Pointer m_OptimizerParameters;
TransformParameters::Pointer m_TransformParameters;
MetricParameters::Pointer m_MetricParameters;
std::vector<std::string> m_Presets;
mitk::RigidRegistrationPreset* m_Preset;
// Schedules
itk::Array2D<unsigned int> m_FixedSchedule;
itk::Array2D<unsigned int> m_MovingSchedule;
bool m_UseMask;
bool m_MatchHistograms;
bool m_BlurFixedImage;
bool m_BlurMovingImage;
MaskType::Pointer m_BrainMask;
mitk::TransformParameters::Pointer ParseTransformParameters(itk::Array<double> transformValues);
mitk::MetricParameters::Pointer ParseMetricParameters(itk::Array<double> metricValues);
mitk::OptimizerParameters::Pointer ParseOptimizerParameters(itk::Array<double> optimizerValues);
};
}
#endif // MITKIMAGEREGISTRATIONMETHOD_H
diff --git a/Modules/RigidRegistration/mitkRegistrationInterfaceCommand.h b/Modules/RigidRegistration/mitkRegistrationInterfaceCommand.h
index 25a44910fa..d8b5eae1d1 100644
--- a/Modules/RigidRegistration/mitkRegistrationInterfaceCommand.h
+++ b/Modules/RigidRegistration/mitkRegistrationInterfaceCommand.h
@@ -1,179 +1,179 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
namespace mitk {
template <class TRegistration, class TPixel>
class RegistrationInterfaceCommand : public itk::Command
{
public:
typedef RegistrationInterfaceCommand Self;
typedef itk::Command Superclass;
typedef itk::SmartPointer<Self> Pointer;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
protected:
RegistrationInterfaceCommand()
{
m_UseMask = false;
}
public:
//typedef TRegistration RegistrationType;
typedef itk::MultiResolutionImageRegistrationMethod< itk::Image<float, 3>
, itk::Image<float, 3> > RegistrationType;
typedef RegistrationType * RegistrationPointer;
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef OptimizerType * OptimizerPointer;
typedef itk::ImageMaskSpatialObject< 3 > MaskType;
mitk::RigidRegistrationObserver::Pointer observer;
bool m_UseMask;
std::vector<std::string> m_Presets;
MaskType::Pointer m_BrainMask;
- void Execute(itk::Object * object, const itk::EventObject & event)
+ void Execute(itk::Object * object, const itk::EventObject & event) override
{
if( !(itk::IterationEvent().CheckEvent( &event )) )
{
return;
}
RegistrationPointer registration = dynamic_cast<RegistrationPointer>( object );
/*OptimizerPointer optimizer = dynamic_cast< OptimizerPointer >(
registration->GetOptimizer() );*/
std::cout << "-------------------------------------" << std::endl;
std::cout << "MultiResolution Level : "
<< registration->GetCurrentLevel() << std::endl << std::endl;
if ( registration->GetCurrentLevel() == 0 )
{
// Nothing needs to be changed in the first step
}
else
{
// Load presets and make a new optimizer if that succeeds
mitk::RigidRegistrationPreset *preset = new mitk::RigidRegistrationPreset();
if( preset->LoadPreset() )
{
mitk::OptimizerParameters::Pointer optimizerParameters = mitk::OptimizerParameters::New();
itk::Array<double> optimizerValues = preset->getOptimizerValues(m_Presets[ registration->GetCurrentLevel() ]);
optimizerParameters->SetOptimizer(optimizerValues[0]);
optimizerParameters->SetMaximize(optimizerValues[1]); //should be when used with maximize mutual information for example
if(optimizerValues[0] == mitk::OptimizerParameters::GRADIENTDESCENTOPTIMIZER)
{
optimizerParameters->SetLearningRateGradientDescent(optimizerValues[2]);
optimizerParameters->SetNumberOfIterationsGradientDescent(optimizerValues[3]);
}
if(optimizerValues[0] == mitk::OptimizerParameters::REGULARSTEPGRADIENTDESCENTOPTIMIZER)
{
cout << "use regularstepgradientdescent" << endl;
optimizerParameters->SetGradientMagnitudeToleranceRegularStepGradientDescent(optimizerValues[2]);
optimizerParameters->SetMinimumStepLengthRegularStepGradientDescent(optimizerValues[3]);
optimizerParameters->SetMaximumStepLengthRegularStepGradientDescent(optimizerValues[4]);
optimizerParameters->SetRelaxationFactorRegularStepGradientDescent(optimizerValues[5]);
optimizerParameters->SetNumberOfIterationsRegularStepGradientDescent(optimizerValues[6]);
}
// Typedef for the OptimizerFactory and initialisation of the optimizer using m_OptimizerParameters
typename OptimizerFactory::Pointer optFac = OptimizerFactory::New();
optFac->SetOptimizerParameters(optimizerParameters);
optFac->SetNumberOfTransformParameters(registration->GetTransform()->GetNumberOfParameters());
typename OptimizerType::Pointer optimizer = optFac->GetOptimizer();
if(observer.IsNotNull())
{
optimizer->AddObserver(itk::AnyEvent(), observer);
}
itk::Array<double> transformValues = preset->getTransformValues(m_Presets[ registration->GetCurrentLevel() ]);
itk::Array<double> scales;
if(transformValues[0] == mitk::TransformParameters::AFFINETRANSFORM) scales.SetSize(12);
mitk::TransformParameters::Pointer transformParameters = mitk::TransformParameters::New();
transformParameters->SetTransform(transformValues[0]);
for(unsigned int i = 0; i < scales.size(); i++)
{
scales[i] = transformValues[i+2];
std::cout << "scale " << i << ": " << scales[i] << std::endl;
}
transformParameters->SetScales(scales);
//transformParameters->SetTransformInitializerOn(false);
// Use Scales
if(transformValues[1] == 1)
{
transformParameters->SetUseOptimizerScales(true);
}
if (transformParameters->GetUseOptimizerScales())
{
itk::Array<double> optimizerScales = transformParameters->GetScales();
typename OptimizerType::ScalesType scales( registration->GetTransform()->GetNumberOfParameters() );
for (unsigned int i = 0; i < scales.Size(); i++)
{
scales[i] = optimizerScales[i];
}
optimizer->SetScales( scales );
}
registration->SetOptimizer(optimizer);
}
delete preset;
}
registration->Print(std::cout,0);
std::cout << std::endl;
std::cout << "METRIC" << std::endl;
registration->GetMetric()->Print(std::cout,0);
std::cout << std::endl;
std::cout << "OPTIMIZER" << std::endl;
registration->GetOptimizer()->Print(std::cout,0);
std::cout << std::endl;
std::cout << "TRANSFORM" << std::endl;
registration->GetTransform()->Print(std::cout,0);
}
- void Execute(const itk::Object * , const itk::EventObject & )
+ void Execute(const itk::Object * , const itk::EventObject & ) override
{ return; }
};
}
diff --git a/Modules/RigidRegistration/mitkRigidRegistrationObserver.h b/Modules/RigidRegistration/mitkRigidRegistrationObserver.h
index 7754a01108..731d1bf62e 100644
--- a/Modules/RigidRegistration/mitkRigidRegistrationObserver.h
+++ b/Modules/RigidRegistration/mitkRigidRegistrationObserver.h
@@ -1,175 +1,175 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRIGIDREGISTRATIONOBSERVER_H
#define MITKRIGIDREGISTRATIONOBSERVER_H
#include "itkSingleValuedNonLinearOptimizer.h"
#include "MitkRigidRegistrationExports.h"
#include <itkExhaustiveOptimizer.h>
#include <itkGradientDescentOptimizer.h>
#include <itkQuaternionRigidTransformGradientDescentOptimizer.h>
#include <itkLBFGSBOptimizer.h>
#include <itkOnePlusOneEvolutionaryOptimizer.h>
#include <itkNormalVariateGenerator.h>
#include <itkPowellOptimizer.h>
#include <itkFRPROptimizer.h>
#include <itkRegularStepGradientDescentOptimizer.h>
#include <itkVersorRigid3DTransformOptimizer.h>
#include <itkVersorTransformOptimizer.h>
#include <itkAmoebaOptimizer.h>
#include <itkConjugateGradientOptimizer.h>
#include <itkLBFGSOptimizer.h>
#include <itkSPSAOptimizer.h>
#include "itkCommand.h"
#include "mitkCommon.h"
namespace mitk {
/**
* \brief Observer to react on rigid registration optimizer events.
*
* \sa ProgressBar
*
* \ingroup RigidRegistration
*
* This class reacts on events sent by ITK optimizers. These events will be sent for every iteration the optimizer performs.
* This class also takes care for the progress bar for every iteration step.
*
* The current optimizer values will be stored and a modified event will be sent to listeners registered to this observer.
* These listeners have the possibility to get the current optimizer parameters.
*
* The optimization process can be stopped by setting stopOptimization to true. The optimization will be stopped after the next
* iteration step of the optimizer. Unfortunately this is not implemented for ExhaustiveOptimizer, LBFGSBOptimizer, AmoebaOptimizer,
* ConjugateGradientOptimizer and LBFGSOptimizer in ITK.
*
* \author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT RigidRegistrationObserver : public itk::Command
{
public:
typedef RigidRegistrationObserver Self;
typedef itk::Command Superclass;
typedef itk::SmartPointer<Self> Pointer;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef itk::SingleValuedNonLinearOptimizer OptimizerType;
typedef OptimizerType * OptimizerPointer;
typedef itk::ExhaustiveOptimizer ExhaustiveOptimizerType;
typedef ExhaustiveOptimizerType * ExhaustiveOptimizerPointer;
typedef itk::GradientDescentOptimizer GradientDescentOptimizerType;
typedef GradientDescentOptimizerType * GradientDescentOptimizerPointer;
typedef itk::QuaternionRigidTransformGradientDescentOptimizer QuaternionRigidTransformGradientDescentOptimizerType;
typedef QuaternionRigidTransformGradientDescentOptimizerType * QuaternionRigidTransformGradientDescentOptimizerPointer;
typedef itk::LBFGSBOptimizer LBFGSBOptimizerType;
typedef LBFGSBOptimizerType * LBFGSBOptimizerPointer;
typedef itk::OnePlusOneEvolutionaryOptimizer OnePlusOneEvolutionaryOptimizerType;
typedef OnePlusOneEvolutionaryOptimizerType * OnePlusOneEvolutionaryOptimizerPointer;
typedef itk::PowellOptimizer PowellOptimizerType;
typedef PowellOptimizerType * PowellOptimizerPointer;
typedef itk::FRPROptimizer FRPROptimizerType;
typedef FRPROptimizerType * FRPROptimizerPointer;
typedef itk::RegularStepGradientDescentOptimizer RegularStepGradientDescentOptimizerType;
typedef RegularStepGradientDescentOptimizerType * RegularStepGradientDescentOptimizerPointer;
typedef itk::VersorRigid3DTransformOptimizer VersorRigid3DTransformOptimizerType;
typedef VersorRigid3DTransformOptimizerType * VersorRigid3DTransformOptimizerPointer;
typedef itk::VersorTransformOptimizer VersorTransformOptimizerType;
typedef VersorTransformOptimizerType * VersorTransformOptimizerPointer;
typedef itk::AmoebaOptimizer AmoebaOptimizerType;
typedef AmoebaOptimizerType * AmoebaOptimizerPointer;
typedef itk::ConjugateGradientOptimizer ConjugateGradientOptimizerType;
typedef ConjugateGradientOptimizerType * ConjugateGradientOptimizerPointer;
typedef itk::LBFGSOptimizer LBFGSOptimizerType;
typedef LBFGSOptimizerType * LBFGSOptimizerPointer;
typedef itk::SPSAOptimizer SPSAOptimizerType;
typedef SPSAOptimizerType * SPSAOptimizerPointer;
/**
* \brief Reacts on events from ITK optimizers.
*
* Stores the optimizer values, adds progress to the progress bar and sends a stop flag to stop the optimization process if it is
* set in this class. Also emits a signal to inform listeners about new optimizer values.
*/
- void Execute(itk::Object *caller, const itk::EventObject & event);
+ void Execute(itk::Object *caller, const itk::EventObject & event) override;
/**
* \brief Not implemented...
*
*/
- void Execute(const itk::Object * object, const itk::EventObject & event);
+ void Execute(const itk::Object * object, const itk::EventObject & event) override;
/**
* \brief Add new steps to the progress bar.
*
*/
void AddStepsToDo(int steps);
/**
* \brief Sets the remaining progress to the progress bar when the optimization process is done.
*
*/
void SetRemainingProgress(int steps);
/**
* \brief Returns the current optimizer value. This value is calculated by the used metric and shows, how good the images are aligned.
*
*
*/
double GetCurrentOptimizerValue();
/**
* \brief Returns the current transformation parameters for the moving image to this iteration step.
*
* These can include parameters for translation, scaling, rotation and shearing.
*/
itk::Array<double> GetCurrentTranslation();
/**
* \brief Sets the stop optimization flag, which is used to call the StopOptimization() method of the optimizer.
*
* Unfortunately it is not implemented for ExhaustiveOptimizer, LBFGSBOptimizer, AmoebaOptimizer,
* ConjugateGradientOptimizer and LBFGSOptimizer in ITK.
*/
void SetStopOptimization(bool stopOptimization);
protected:
RigidRegistrationObserver();
private:
double m_OptimizerValue;
itk::Array<double> m_Params;
bool m_StopOptimization;
};
} // namespace mitk
#endif // MITKRIGIDREGISTRATIONOBSERVER_H
diff --git a/Modules/RigidRegistration/mitkRigidRegistrationPreset.h b/Modules/RigidRegistration/mitkRigidRegistrationPreset.h
index 865f1d1fd9..40f16c11fa 100644
--- a/Modules/RigidRegistration/mitkRigidRegistrationPreset.h
+++ b/Modules/RigidRegistration/mitkRigidRegistrationPreset.h
@@ -1,170 +1,170 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKRIGIDREGISTRATIONPRESET_H_HEADER
#define MITKRIGIDREGISTRATIONPRESET_H_HEADER
#include <vtkXMLParser.h>
#include "MitkRigidRegistrationExports.h"
#include <map>
#include <string>
#include <list>
#include <itkArray.h>
#include "mitkCommon.h"
namespace mitk {
/**
* \brief Class to load and save parameter presets for rigid registration.
*
* \ingroup RigidRegistration
*
* This class stores parameter presets for rigid registration applications. To that belong parameters for transformations, metrics,
* optimizer and interpolators. The presets will be stored in a xml file. Existing presets can be opened with LoadPreset() and saved with
* newPresets(...).
*
*
* \author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT RigidRegistrationPreset : public vtkXMLParser
{
public:
RigidRegistrationPreset();
~RigidRegistrationPreset();
/**
* \brief Tries to find mitkRigidRegistrationPresets.xml in /mitk/Config and loads all presets stored in this file.
*/
bool LoadPreset();
/**
* \brief Tries to open preset xml file \e fileName and loads all presets stored in this file.
*/
bool LoadPreset(std::string fileName);
/**
* \brief Returns an array including all all transform values belonging to preset \e name.
*/
itk::Array<double> getTransformValues(std::string name);
/**
* \brief Returns an array including all all metric values belonging to preset \e name.
*/
itk::Array<double> getMetricValues(std::string name);
/**
* \brief Returns an array including all all optimizer values belonging to preset \e name.
*/
itk::Array<double> getOptimizerValues(std::string name);
/**
* \brief Returns an array including all interpolator values belonging to preset \e name.
*/
itk::Array<double> getInterpolatorValues(std::string name);
std::list< std::string>& getAvailablePresets();
/**
* \brief Returns a map with all preset names and their according transform values as an array.
*/
std::map<std::string, itk::Array<double> >& getTransformValuesPresets();
/**
* \brief Returns a map with all preset names and their according metric values as an array.
*/
std::map<std::string, itk::Array<double> >& getMetricValuesPresets();
/**
* \brief Returns a map with all preset names and their according optimizer values as an array.
*/
std::map<std::string, itk::Array<double> >& getOptimizerValuesPresets();
/**
* \brief Returns a map with all preset names and their according interpolator values as an array.
*/
std::map<std::string, itk::Array<double> >& getInterpolatorValuesPresets();
/**
* \brief Saves new presets in the previous opened xml file or in the new fileName location.
*
* Every old entry will be removed from the xml file and replaced by the ones stored in the parameter maps. Make sure you have the
* old presets as well as the new ones within the maps.
*/
bool newPresets(std::map<std::string, itk::Array<double> > newTransformValues,
std::map<std::string, itk::Array<double> > newMetricValues,
std::map<std::string, itk::Array<double> > newOptimizerValues,
std::map<std::string, itk::Array<double> > newInterpolatorValues,
std::string fileName = "");
private:
/**
* \brief method used in XLM-Reading; gets called when a start-tag is read
*/
- void StartElement (const char *elementName, const char **atts);
+ void StartElement (const char *elementName, const char **atts) override;
/**
* \brief Saves all preset attributes to xml file.
*/
//bool saveXML(mitk::XMLWriter& xmlWriter);
/**
* \brief Saves all preset attributes to xml file.
*/
bool save();
/**
* \brief Saves the transform values for one preset to the xml file.
*/
//void saveTransformValues(mitk::XMLWriter& xmlWriter, std::string item);
/**
* \brief Saves the metric values for one preset to the xml file.
*/
//void saveMetricValues(mitk::XMLWriter& xmlWriter, std::string item);
/**
* \brief Saves the optimizer values for one preset to the xml file.
*/
//void saveOptimizerValues(mitk::XMLWriter& xmlWriter, std::string item);
/**
* \brief Saves the interpolator values for one preset to the xml file.
*/
//void saveInterpolatorValues(mitk::XMLWriter& xmlWriter, std::string item);
/**
* \brief Loads the transform values for one preset from the xml file.
*/
itk::Array<double> loadTransformValues(itk::Array<double> transformValues, double transform, const char **atts);
/**
* \brief Loads the metric values for one preset from the xml file.
*/
itk::Array<double> loadMetricValues(itk::Array<double> metricValues, double metric, const char **atts);
/**
* \brief Loads the optimizer values for one preset from the xml file.
*/
itk::Array<double> loadOptimizerValues(itk::Array<double> optimizerValues, double optimizer, const char **atts);
/**
* \brief Loads the interpolator values for one preset from the xml file.
*/
itk::Array<double> loadInterpolatorValues(itk::Array<double> interpolatorValues/*, double interpolator, const char **atts*/);
/**
* \brief Reads an XML-String-Attribute
*/
std::string ReadXMLStringAttribut( std::string name, const char** atts);
std::string m_Name;
std::map<std::string, itk::Array<double> > m_TransformValues;
std::map<std::string, itk::Array<double> > m_MetricValues;
std::map<std::string, itk::Array<double> > m_OptimizerValues;
std::map<std::string, itk::Array<double> > m_InterpolatorValues;
std::list<std::string> m_LoadedPresets;
std::string m_XmlFileName;
};
}
#endif
diff --git a/Modules/RigidRegistration/mitkTransformFactory.h b/Modules/RigidRegistration/mitkTransformFactory.h
index 25f543145f..a104653f38 100644
--- a/Modules/RigidRegistration/mitkTransformFactory.h
+++ b/Modules/RigidRegistration/mitkTransformFactory.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRANSFORMFACTORY_H
#define MITKTRANSFORMFACTORY_H
#include "itkTransform.h"
#include "MitkRigidRegistrationExports.h"
#include "itkImage.h"
#include "mitkTransformParameters.h"
namespace mitk {
/*!
\brief This class creates a transform for a rigid registration process.
This class will e.g. be instantiated by mitkImageRegistrationMethod and a
transform corresponding to the integer value stored in mitkTransformParameters
will be created. Therefore SetTransformParameters() has to be called with an instance
of mitkTransformParameters, which holds all parameter informations for the new
transformation.
GetTransform() returns the transform which then can be used in combination with a
metric, an optimizer and an interpolator within a registration pipeline.
\ingroup RigidRegistration
\author Daniel Stein
*/
template < class TPixelType, unsigned int VImageDimension >
class MITKRIGIDREGISTRATION_EXPORT TransformFactory : public itk::Object
{
public:
- mitkClassMacro(TransformFactory, itk::Object);
+ mitkClassMacroItkParent(TransformFactory, itk::Object);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef typename itk::Image< TPixelType, VImageDimension > FixedImageType;
typedef typename itk::Image< TPixelType, VImageDimension > MovingImageType;
typedef typename itk::Image< TPixelType, 2 > FixedImage2DType;
typedef typename itk::Image< TPixelType, 2 > MovingImage2DType;
typedef typename itk::Image< TPixelType, 3 > FixedImage3DType;
typedef typename itk::Image< TPixelType, 3 > MovingImage3DType;
typedef typename itk::Transform< double, VImageDimension, VImageDimension > TransformType;
typedef typename TransformType::Pointer TransformPointer;
/**
\brief Returns the transform which then can be used in combination with a metric, an optimizer
and an interpolator within a registration pipeline.
*/
TransformPointer GetTransform( );
/**
\brief Sets the fixed image which is needed by transform initializer.
*/
void SetFixedImage(FixedImageType* fixed);
/**
\brief Sets the moving image which is needed by transform initializer.
*/
void SetMovingImage(MovingImageType* moving);
/**
\brief Sets the instance to the transform parameters class which holds all parameters for the new transform.
*/
void SetTransformParameters(TransformParameters::Pointer transformParameters)
{
m_TransformParameters = transformParameters;
}
/**
\brief Returns the instance to the transform parameters class which holds all parameters for the new transform.
*/
TransformParameters::Pointer GetTransformParameters()
{
return m_TransformParameters;
}
protected:
TransformFactory();
~TransformFactory() {};
TransformParameters::Pointer m_TransformParameters;
typename FixedImageType::Pointer m_FixedImage;
typename MovingImageType::Pointer m_MovingImage;
typename FixedImage2DType::Pointer m_FixedImage2D;
typename MovingImage2DType::Pointer m_MovingImage2D;
typename FixedImage3DType::Pointer m_FixedImage3D;
typename MovingImage3DType::Pointer m_MovingImage3D;
};
} // namespace mitk
#include "mitkTransformFactory.txx"
#endif // MITKTRANSFORMFACTORY_H
diff --git a/Modules/RigidRegistration/mitkTransformParameters.h b/Modules/RigidRegistration/mitkTransformParameters.h
index 92a14d4696..3b5479d76f 100644
--- a/Modules/RigidRegistration/mitkTransformParameters.h
+++ b/Modules/RigidRegistration/mitkTransformParameters.h
@@ -1,212 +1,212 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKTRANSFORMPARAMETERS_H
#define MITKTRANSFORMPARAMETERS_H
#include <itkObjectFactory.h>
#include "MitkRigidRegistrationExports.h"
#include <itkArray.h>
#include "mitkCommon.h"
namespace mitk {
/*!
\brief This class is used to hold all transform parameters needed for a rigid registration process.
To use the rigid registration framework you have to create an instance of this class and fill it with the parameters
belonging to the selected transformation. To let the rigid registration work properly, this instance has to be given
to mitkImageRegistrationMethod before calling the update() method in mitkImageRegistrationMethod.
Also instances of the classes mitkMetricParameters and mitkOptimizerParameters have to be set in mitkImageRegistrationMethod
before calling the update() method.
\ingroup RigidRegistration
\author Daniel Stein
*/
class MITKRIGIDREGISTRATION_EXPORT TransformParameters : public itk::Object
{
public:
- mitkClassMacro(TransformParameters, ::itk::Object);
+ mitkClassMacroItkParent(TransformParameters, ::itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Unique integer value for every transform.
*/
enum TransformType {
TRANSLATIONTRANSFORM = 0,
SCALETRANSFORM = 1,
SCALELOGARITHMICTRANSFORM = 2,
AFFINETRANSFORM = 3,
FIXEDCENTEROFROTATIONAFFINETRANSFORM = 4,
RIGID3DTRANSFORM = 5, //TODO remove rigid3dTrassform
EULER3DTRANSFORM = 6,
CENTEREDEULER3DTRANSFORM = 7,
QUATERNIONRIGIDTRANSFORM = 8,
VERSORTRANSFORM = 9,
VERSORRIGID3DTRANSFORM = 10,
SCALESKEWVERSOR3DTRANSFORM = 11,
SIMILARITY3DTRANSFORM = 12,
RIGID2DTRANSFORM = 13,
CENTEREDRIGID2DTRANSFORM = 14,
EULER2DTRANSFORM = 15,
SIMILARITY2DTRANSFORM = 16,
CENTEREDSIMILARITY2DTRANSFORM = 17
};
/**
\brief Sets the transform used for registration by its unique integer value.
*/
itkSetMacro( Transform, int );
/**
\brief Returns the transform used for registration by its unique integer value.
*/
itkGetMacro( Transform, int );
/**
\brief Sets an array that holds the magnitudes of changes for the transforms degrees of freedom.
The optimizer changes the transforms values corresponding to this array values.
*/
void SetScales(itk::Array<double> scales);
/**
\brief Returns an array that holds the magnitudes of changes for the transforms degrees of freedom.
The optimizer changes the transforms values corresponding to this array values.
*/
itk::Array<double> GetScales();
/**
\brief Sets an array that holds the initial transform parameters.
*/
void SetInitialParameters(itk::Array<double> initialParameters);
/**
\brief Returns an array that holds the initial transform parameters.
*/
itk::Array<double> GetInitialParameters();
/**
\brief Sets whether a transform initializer will be used.
True = initializer is used, initializer is not used.
*/
itkSetMacro( TransformInitializerOn, bool );
/**
\brief Returns whether a transform initializer will be used.
True = initializer is used, false = initializer is not used.
*/
itkGetMacro( TransformInitializerOn, bool );
/**
\brief Sets whether the transform initializer will be used to align the images moments or their centers.
True = image moments will be aligned, false = image centers will be aligned.
*/
itkSetMacro( MomentsOn, bool );
/**
\brief Returns whether the transform initializer will be used to align the images moments or their centers.
True = image moments will be aligned, false = image centers will be aligned.
*/
itkGetMacro( MomentsOn, bool );
/**
\brief Sets whether the optimizer scales will be used to let the optimizer know about different magnitudes for
the transforms degrees of freedom.
True = optimizer scales will be used, false = optimizer scales will not be used.
*/
itkSetMacro( UseOptimizerScales, bool );
/**
\brief Returns whether the optimizer scales will be used to let the optimizer know about different magnitudes for
the transforms degrees of freedom.
True = optimizer scales will be used, false = optimizer scales will not be used.
*/
itkGetMacro( UseOptimizerScales, bool );
/**
\brief Sets the initial angle for transforms.
*/
itkSetMacro( Angle, float );
/**
\brief Returns the initial angle for transforms.
*/
itkGetMacro( Angle, float );
/**
\brief Sets the transforms initial scale.
*/
itkSetMacro( Scale, float );
/**
\brief Returns the transforms initial scale.
*/
itkGetMacro( Scale, float );
/**
\brief This setter is used by the mitkTransformFactory to set the transforms initial center in X direction.
*/
itkSetMacro( TransformCenterX, double );
/**
\brief Returns the transforms initial center in X direction.
*/
itkGetMacro( TransformCenterX, double );
/**
\brief This setter is used by the mitkTransformFactory to set the transforms initial center in Y direction.
*/
itkSetMacro( TransformCenterY, double );
/**
\brief Returns the transforms initial center in Y direction.
*/
itkGetMacro( TransformCenterY, double );
/**
\brief This setter is used by the mitkTransformFactory to set the transforms initial center in Z direction.
*/
itkSetMacro( TransformCenterZ, double );
/**
\brief Returns the transforms initial center in Z direction.
*/
itkGetMacro( TransformCenterZ, double );
protected:
TransformParameters();
~TransformParameters() {};
int m_Transform;
float m_Angle;
float m_Scale;
bool m_TransformInitializerOn;
bool m_MomentsOn;
bool m_UseOptimizerScales;
double m_TransformCenterX;
double m_TransformCenterY;
double m_TransformCenterZ;
itk::Array<double> m_Scales;
itk::Array<double> m_InitialParameters;
};
} // namespace mitk
#endif // MITKTRANSFORMPARAMETERS_H
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkCorrelationCoefficientHistogramMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkCorrelationCoefficientHistogramMetricView.h
index b3ab1f8f87..8480468d8c 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkCorrelationCoefficientHistogramMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkCorrelationCoefficientHistogramMetricView.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkCorrelationCoefficientHistogramMetricViewWidgetHIncluded
#define QmitkCorrelationCoefficientHistogramMetricViewWidgetHIncluded
#include "ui_QmitkCorrelationCoefficientHistogramMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkCorrelationCoefficientHistogramMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkCorrelationCoefficientHistogramMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkCorrelationCoefficientHistogramMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkCorrelationCoefficientHistogramMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkGradientDifferenceMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkGradientDifferenceMetricView.h
index a9c4d56bda..34b7fc8986 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkGradientDifferenceMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkGradientDifferenceMetricView.h
@@ -1,67 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkGradientDifferenceMetricViewWidgetHIncluded
#define QmitkGradientDifferenceMetricViewWidgetHIncluded
#include "ui_QmitkGradientDifferenceMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkGradientDifferenceMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkGradientDifferenceMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkGradientDifferenceMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkGradientDifferenceMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKappaStatisticMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKappaStatisticMetricView.h
index 0bd60e9ca8..11ff99d17b 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKappaStatisticMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKappaStatisticMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkKappaStatisticMetricViewWidgetHIncluded
#define QmitkKappaStatisticMetricViewWidgetHIncluded
#include "ui_QmitkKappaStatisticMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkKappaStatisticMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkKappaStatisticMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkKappaStatisticMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkKappaStatisticMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKullbackLeiblerCompareHistogramMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKullbackLeiblerCompareHistogramMetricView.h
index d8ec0dda33..a13eac0d03 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKullbackLeiblerCompareHistogramMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkKullbackLeiblerCompareHistogramMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkKullbackLeiblerCompareHistogramMetricViewWidgetHIncluded
#define QmitkKullbackLeiblerCompareHistogramMetricViewWidgetHIncluded
#include "ui_QmitkKullbackLeiblerCompareHistogramMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkKullbackLeiblerCompareHistogramMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkKullbackLeiblerCompareHistogramMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkKullbackLeiblerCompareHistogramMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkKullbackLeiblerCompareHistogramMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMatchCardinalityMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMatchCardinalityMetricView.h
index cb012e7b7f..9c328b67f4 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMatchCardinalityMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMatchCardinalityMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMatchCardinalityMetricViewWidgetHIncluded
#define QmitkMatchCardinalityMetricViewWidgetHIncluded
#include "ui_QmitkMatchCardinalityMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMatchCardinalityMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMatchCardinalityMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMatchCardinalityMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMatchCardinalityMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMattesMutualInformationMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMattesMutualInformationMetricView.h
index 76c7e79eb1..82b90daadf 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMattesMutualInformationMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMattesMutualInformationMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMattesMutualInformationMetricViewWidgetHIncluded
#define QmitkMattesMutualInformationMetricViewWidgetHIncluded
#include "ui_QmitkMattesMutualInformationMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMattesMutualInformationMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMattesMutualInformationMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMattesMutualInformationMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMattesMutualInformationMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanReciprocalSquareDifferenceMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanReciprocalSquareDifferenceMetricView.h
index 62e3b8b376..bc0b2d6613 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanReciprocalSquareDifferenceMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanReciprocalSquareDifferenceMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMeanReciprocalSquareDifferenceMetricViewWidgetHIncluded
#define QmitkMeanReciprocalSquareDifferenceMetricViewWidgetHIncluded
#include "ui_QmitkMeanReciprocalSquareDifferenceMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMeanReciprocalSquareDifferenceMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMeanReciprocalSquareDifferenceMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMeanReciprocalSquareDifferenceMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMeanReciprocalSquareDifferenceMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresHistogramMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresHistogramMetricView.h
index 03c8e7f28d..5b235aae71 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresHistogramMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresHistogramMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMeanSquaresHistogramMetricViewWidgetHIncluded
#define QmitkMeanSquaresHistogramMetricViewWidgetHIncluded
#include "ui_QmitkMeanSquaresHistogramMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMeanSquaresHistogramMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMeanSquaresHistogramMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMeanSquaresHistogramMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMeanSquaresHistogramMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresMetricView.h
index 4a312abef1..669df72a82 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMeanSquaresMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMeanSquaresMetricViewWidgetHIncluded
#define QmitkMeanSquaresMetricViewWidgetHIncluded
#include "ui_QmitkMeanSquaresMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMeanSquaresMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMeanSquaresMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMeanSquaresMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMeanSquaresMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationHistogramMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationHistogramMetricView.h
index 307efb2d0e..fda193d4b3 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationHistogramMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationHistogramMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMutualInformationHistogramMetricViewWidgetHIncluded
#define QmitkMutualInformationHistogramMetricViewWidgetHIncluded
#include "ui_QmitkMutualInformationHistogramMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMutualInformationHistogramMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMutualInformationHistogramMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMutualInformationHistogramMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMutualInformationHistogramMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationMetricView.h
index f86c75196c..9ac4c1f690 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkMutualInformationMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkMutualInformationMetricViewWidgetHIncluded
#define QmitkMutualInformationMetricViewWidgetHIncluded
#include "ui_QmitkMutualInformationMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkMutualInformationMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkMutualInformationMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkMutualInformationMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkMutualInformationMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedCorrelationMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedCorrelationMetricView.h
index 3b8924f795..e2ec0b53df 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedCorrelationMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedCorrelationMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkNormalizedCorrelationMetricViewWidgetHIncluded
#define QmitkNormalizedCorrelationMetricViewWidgetHIncluded
#include "ui_QmitkNormalizedCorrelationMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkNormalizedCorrelationMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkNormalizedCorrelationMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkNormalizedCorrelationMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkNormalizedCorrelationMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedMutualInformationHistogramMetricView.h b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedMutualInformationHistogramMetricView.h
index 18a36fecac..068df85471 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedMutualInformationHistogramMetricView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationMetrics/QmitkNormalizedMutualInformationHistogramMetricView.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkNormalizedMutualInformationHistogramMetricViewWidgetHIncluded
#define QmitkNormalizedMutualInformationHistogramMetricViewWidgetHIncluded
#include "ui_QmitkNormalizedMutualInformationHistogramMetricControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationMetricsGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkNormalizedMutualInformationHistogramMetricView : public QmitkRigidRegistrationMetricsGUIBase
{
public:
QmitkNormalizedMutualInformationHistogramMetricView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkNormalizedMutualInformationHistogramMetricView();
- virtual mitk::MetricParameters::MetricType GetMetricType();
+ virtual mitk::MetricParameters::MetricType GetMetricType() override;
- virtual itk::Object::Pointer GetMetric();
+ virtual itk::Object::Pointer GetMetric() override;
- virtual itk::Array<double> GetMetricParameters();
+ virtual itk::Array<double> GetMetricParameters() override;
- virtual void SetMetricParameters(itk::Array<double> metricValues);
+ virtual void SetMetricParameters(itk::Array<double> metricValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual bool Maximize();
+ virtual bool Maximize() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetMetric2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkNormalizedMutualInformationHistogramMetricControls m_Controls;
itk::Object::Pointer m_MetricObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkAmoebaOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkAmoebaOptimizerView.h
index 50fb0ffc15..a4992f7c26 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkAmoebaOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkAmoebaOptimizerView.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkAmoebaOptimizerViewWidgetHIncluded
#define QmitkAmoebaOptimizerViewWidgetHIncluded
#include "ui_QmitkAmoebaOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
class QLineEdit;
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkAmoebaOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkAmoebaOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkAmoebaOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
private:
void ShowSimplexDelta();
protected:
Ui::QmitkAmoebaOptimizerControls m_Controls;
int m_NumberTransformParameters;
std::list<QLineEdit*> simplexDeltaLineEdits;
std::list<QLabel*> simplexDeltaLabels;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkConjugateGradientOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkConjugateGradientOptimizerView.h
index 77f249c14c..746ad371fe 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkConjugateGradientOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkConjugateGradientOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkConjugateGradientOptimizerViewWidgetHIncluded
#define QmitkConjugateGradientOptimizerViewWidgetHIncluded
#include "ui_QmitkConjugateGradientOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkConjugateGradientOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkConjugateGradientOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkConjugateGradientOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkConjugateGradientOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkExhaustiveOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkExhaustiveOptimizerView.h
index 9e2d340518..51550f1796 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkExhaustiveOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkExhaustiveOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkExhaustiveOptimizerViewWidgetHIncluded
#define QmitkExhaustiveOptimizerViewWidgetHIncluded
#include "ui_QmitkExhaustiveOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkExhaustiveOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkExhaustiveOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkExhaustiveOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkExhaustiveOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkFRPROptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkFRPROptimizerView.h
index a36d31a305..30600e93f8 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkFRPROptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkFRPROptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkFRPROptimizerViewWidgetHIncluded
#define QmitkFRPROptimizerViewWidgetHIncluded
#include "ui_QmitkFRPROptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkFRPROptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkFRPROptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkFRPROptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkFRPROptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkGradientDescentOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkGradientDescentOptimizerView.h
index fb039fce54..ca9d1ff0cf 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkGradientDescentOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkGradientDescentOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkGradientDescentOptimizerViewWidgetHIncluded
#define QmitkGradientDescentOptimizerViewWidgetHIncluded
#include "ui_QmitkGradientDescentOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkGradientDescentOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkGradientDescentOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkGradientDescentOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkGradientDescentOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSBOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSBOptimizerView.h
index 0872047740..ba23ed2a41 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSBOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSBOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkLBFGSBOptimizerViewWidgetHIncluded
#define QmitkLBFGSBOptimizerViewWidgetHIncluded
#include "ui_QmitkLBFGSBOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkLBFGSBOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkLBFGSBOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkLBFGSBOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkLBFGSBOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSOptimizerView.h
index 66a8969cf0..e206df02e0 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkLBFGSOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkLBFGSOptimizerViewWidgetHIncluded
#define QmitkLBFGSOptimizerViewWidgetHIncluded
#include "ui_QmitkLBFGSOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkLBFGSOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkLBFGSOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkLBFGSOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkLBFGSOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkOnePlusOneEvolutionaryOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkOnePlusOneEvolutionaryOptimizerView.h
index 34cd057060..7f73dd2745 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkOnePlusOneEvolutionaryOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkOnePlusOneEvolutionaryOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkOnePlusOneEvolutionaryOptimizerViewWidgetHIncluded
#define QmitkOnePlusOneEvolutionaryOptimizerViewWidgetHIncluded
#include "ui_QmitkOnePlusOneEvolutionaryOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkOnePlusOneEvolutionaryOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkOnePlusOneEvolutionaryOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkOnePlusOneEvolutionaryOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkOnePlusOneEvolutionaryOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkPowellOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkPowellOptimizerView.h
index ce329d34cf..3483285119 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkPowellOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkPowellOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkPowellOptimizerViewWidgetHIncluded
#define QmitkPowellOptimizerViewWidgetHIncluded
#include "ui_QmitkPowellOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkPowellOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkPowellOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkPowellOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkPowellOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkQuaternionRigidTransformGradientDescentOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkQuaternionRigidTransformGradientDescentOptimizerView.h
index d1139ed62d..866093576b 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkQuaternionRigidTransformGradientDescentOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkQuaternionRigidTransformGradientDescentOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkQuaternionRigidTransformGradientDescentOptimizerViewWidgetHIncluded
#define QmitkQuaternionRigidTransformGradientDescentOptimizerViewWidgetHIncluded
#include "ui_QmitkQuaternionRigidTransformGradientDescentOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkQuaternionRigidTransformGradientDescentOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkQuaternionRigidTransformGradientDescentOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkQuaternionRigidTransformGradientDescentOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkQuaternionRigidTransformGradientDescentOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkRegularStepGradientDescentOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkRegularStepGradientDescentOptimizerView.h
index c7159a2c28..969d49f6c0 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkRegularStepGradientDescentOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkRegularStepGradientDescentOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkRegularStepGradientDescentOptimizerViewWidgetHIncluded
#define QmitkRegularStepGradientDescentOptimizerViewWidgetHIncluded
#include "ui_QmitkRegularStepGradientDescentOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkRegularStepGradientDescentOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkRegularStepGradientDescentOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkRegularStepGradientDescentOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkRegularStepGradientDescentOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkSPSAOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkSPSAOptimizerView.h
index 013d374b7c..e5c5a05e2c 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkSPSAOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkSPSAOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkSPSAOptimizerViewWidgetHIncluded
#define QmitkSPSAOptimizerViewWidgetHIncluded
#include "ui_QmitkSPSAOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkSPSAOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkSPSAOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkSPSAOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkSPSAOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorRigid3DTransformOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorRigid3DTransformOptimizerView.h
index 569a0288b1..70b84535bc 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorRigid3DTransformOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorRigid3DTransformOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkVersorRigid3DOptimizerViewWidgetHIncluded
#define QmitkVersorRigid3DOptimizerViewWidgetHIncluded
#include "ui_QmitkVersorRigid3DTransformOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkVersorRigid3DTransformOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkVersorRigid3DTransformOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkVersorRigid3DTransformOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkVersorRigid3DTransformOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorTransformOptimizerView.h b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorTransformOptimizerView.h
index e1a24f2024..18fb7dadea 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorTransformOptimizerView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationOptimizer/QmitkVersorTransformOptimizerView.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkVersorTransformOptimizerViewWidgetHIncluded
#define QmitkVersorTransformOptimizerViewWidgetHIncluded
#include "ui_QmitkVersorTransformOptimizerControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationOptimizerGUIBase.h"
#include <itkArray.h>
#include <itkObject.h>
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkVersorTransformOptimizerView : public QmitkRigidRegistrationOptimizerGUIBase
{
public:
QmitkVersorTransformOptimizerView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkVersorTransformOptimizerView();
- virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType();
+ virtual mitk::OptimizerParameters::OptimizerType GetOptimizerType() override;
- virtual itk::Object::Pointer GetOptimizer();
+ virtual itk::Object::Pointer GetOptimizer() override;
- virtual itk::Array<double> GetOptimizerParameters();
+ virtual itk::Array<double> GetOptimizerParameters() override;
- virtual void SetOptimizerParameters(itk::Array<double> metricValues);
+ virtual void SetOptimizerParameters(itk::Array<double> metricValues) override;
- virtual void SetNumberOfTransformParameters(int transformParameters);
+ virtual void SetNumberOfTransformParameters(int transformParameters) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
protected:
Ui::QmitkVersorTransformOptimizerControls m_Controls;
int m_NumberTransformParameters;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.h
index 517fd111b1..5c4661d8a8 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkAffineTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkAffineTransformViewWidgetHIncluded
#define QmitkAffineTransformViewWidgetHIncluded
#include "ui_QmitkAffineTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkAffineTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkAffineTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkAffineTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, class MovingPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1, itk::Image<MovingPixelType, VImageDimension>* itkImage2);
protected:
Ui::QmitkAffineTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredEuler3DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredEuler3DTransformView.h
index c8957cb31a..f2c97982d9 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredEuler3DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredEuler3DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkCenteredEuler3DTransformViewWidgetHIncluded
#define QmitkCenteredEuler3DTransformViewWidgetHIncluded
#include "ui_QmitkCenteredEuler3DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkCenteredEuler3DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkCenteredEuler3DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkCenteredEuler3DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkCenteredEuler3DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.h
index a14d850c2e..bef6dc9532 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredRigid2DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkCenteredRigid2DTransformViewWidgetHIncluded
#define QmitkCenteredRigid2DTransformViewWidgetHIncluded
#include "ui_QmitkCenteredRigid2DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkCenteredRigid2DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkCenteredRigid2DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkCenteredRigid2DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkCenteredRigid2DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.h
index 242b28ee22..e4564a2f32 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkCenteredSimilarity2DTransformView.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkCenteredSimilarity2DTransformViewWidgetHIncluded
#define QmitkCenteredSimilarity2DTransformViewWidgetHIncluded
#include "ui_QmitkCenteredSimilarity2DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkCenteredSimilarity2DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkCenteredSimilarity2DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkCenteredSimilarity2DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkCenteredSimilarity2DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.h
index 167238002a..660e768e28 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler2DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkEuler2DTransformViewWidgetHIncluded
#define QmitkEuler2DTransformViewWidgetHIncluded
#include "ui_QmitkEuler2DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkEuler2DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkEuler2DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkEuler2DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkEuler2DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler3DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler3DTransformView.h
index 55cbfafe4a..83f2e9e378 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler3DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkEuler3DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkEuler3DTransformViewWidgetHIncluded
#define QmitkEuler3DTransformViewWidgetHIncluded
#include "ui_QmitkEuler3DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkEuler3DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkEuler3DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkEuler3DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkEuler3DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.h
index ca45b92505..8fd96bd341 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkFixedCenterOfRotationAffineTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkFixedCenterOfRotationAffineTransformViewWidgetHIncluded
#define QmitkFixedCenterOfRotationAffineTransformViewWidgetHIncluded
#include "ui_QmitkFixedCenterOfRotationAffineTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkFixedCenterOfRotationAffineTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkFixedCenterOfRotationAffineTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkFixedCenterOfRotationAffineTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkFixedCenterOfRotationAffineTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.h
index 11778da4e3..d5ef88d565 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkQuaternionRigidTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkQuaternionRigidTransformViewWidgetHIncluded
#define QmitkQuaternionRigidTransformViewWidgetHIncluded
#include "ui_QmitkQuaternionRigidTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkQuaternionRigidTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkQuaternionRigidTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkQuaternionRigidTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkQuaternionRigidTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.h
index 6af28857d1..a397d5ccf2 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkRigid2DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkRigid2DTransformViewWidgetHIncluded
#define QmitkRigid2DTransformViewWidgetHIncluded
#include "ui_QmitkRigid2DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkRigid2DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkRigid2DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkRigid2DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkRigid2DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleLogarithmicTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleLogarithmicTransformView.h
index 3604c2161c..23d372f1ac 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleLogarithmicTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleLogarithmicTransformView.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkScaleLogarithmicTransformViewWidgetHIncluded
#define QmitkScaleLogarithmicTransformViewWidgetHIncluded
#include "ui_QmitkScaleLogarithmicTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkScaleLogarithmicTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkScaleLogarithmicTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkScaleLogarithmicTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkScaleLogarithmicTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.h
index 8a40eefa38..bcc2841ae4 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleSkewVersor3DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkScaleSkewVersor3DTransformViewWidgetHIncluded
#define QmitkScaleSkewVersor3DTransformViewWidgetHIncluded
#include "ui_QmitkScaleSkewVersor3DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkScaleSkewVersor3DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkScaleSkewVersor3DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkScaleSkewVersor3DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkScaleSkewVersor3DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleTransformView.h
index a9140eef13..fbf4e76eb6 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkScaleTransformView.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkScaleTransformViewWidgetHIncluded
#define QmitkScaleTransformViewWidgetHIncluded
#include "ui_QmitkScaleTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkScaleTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkScaleTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkScaleTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkScaleTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.h
index 23fac21d0d..026088054c 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity2DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkSimilarity2DTransformViewWidgetHIncluded
#define QmitkSimilarity2DTransformViewWidgetHIncluded
#include "ui_QmitkSimilarity2DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkSimilarity2DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkSimilarity2DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkSimilarity2DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkSimilarity2DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.h
index c3b23fe0d9..cedd4c8457 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkSimilarity3DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkSimilarity3DTransformViewWidgetHIncluded
#define QmitkSimilarity3DTransformViewWidgetHIncluded
#include "ui_QmitkSimilarity3DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkSimilarity3DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkSimilarity3DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkSimilarity3DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkSimilarity3DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkTranslationTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkTranslationTransformView.h
index 67399777a7..e447c05647 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkTranslationTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkTranslationTransformView.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkTranslationTransformViewWidgetHIncluded
#define QmitkTranslationTransformViewWidgetHIncluded
#include "ui_QmitkTranslationTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkTranslationTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkTranslationTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkTranslationTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkTranslationTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.h
index 90cf58b18b..2476d887cd 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorRigid3DTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkVersorRigid3DTransformViewWidgetHIncluded
#define QmitkVersorRigid3DTransformViewWidgetHIncluded
#include "ui_QmitkVersorRigid3DTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkVersorRigid3DTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkVersorRigid3DTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkVersorRigid3DTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkVersorRigid3DTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.h b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.h
index 212cfecd30..1fa5084096 100644
--- a/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.h
+++ b/Modules/RigidRegistrationUI/RigidRegistrationTransforms/QmitkVersorTransformView.h
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkVersorTransformViewWidgetHIncluded
#define QmitkVersorTransformViewWidgetHIncluded
#include "ui_QmitkVersorTransformControls.h"
#include "MitkRigidRegistrationUIExports.h"
#include "QmitkRigidRegistrationTransformsGUIBase.h"
#include <itkImage.h>
/*!
* \brief Widget for rigid registration
*
* Displays options for rigid registration.
*/
class MITKRIGIDREGISTRATIONUI_EXPORT QmitkVersorTransformView : public QmitkRigidRegistrationTransformsGUIBase
{
public:
QmitkVersorTransformView( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QmitkVersorTransformView();
- virtual mitk::TransformParameters::TransformType GetTransformType();
+ virtual mitk::TransformParameters::TransformType GetTransformType() override;
- virtual itk::Object::Pointer GetTransform();
+ virtual itk::Object::Pointer GetTransform() override;
- virtual itk::Array<double> GetTransformParameters();
+ virtual itk::Array<double> GetTransformParameters() override;
- virtual void SetTransformParameters(itk::Array<double> transformValues);
+ virtual void SetTransformParameters(itk::Array<double> transformValues) override;
- virtual QString GetName();
+ virtual QString GetName() override;
- virtual void SetupUI(QWidget* parent);
+ virtual void SetupUI(QWidget* parent) override;
- virtual itk::Array<double> GetScales();
+ virtual itk::Array<double> GetScales() override;
- virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams);
+ virtual vtkTransform* Transform(vtkMatrix4x4* vtkmatrix, vtkTransform* vtktransform, itk::Array<double> transformParams) override;
- virtual int GetNumberOfTransformParameters();
+ virtual int GetNumberOfTransformParameters() override;
private:
template < class TPixelType, unsigned int VImageDimension >
itk::Object::Pointer GetTransform2(itk::Image<TPixelType, VImageDimension>* itkImage1);
protected:
Ui::QmitkVersorTransformControls m_Controls;
itk::Object::Pointer m_TransformObject;
double m_CenterX;
double m_CenterY;
double m_CenterZ;
};
#endif
diff --git a/Modules/SceneSerialization/include/mitkSceneIO.h b/Modules/SceneSerialization/include/mitkSceneIO.h
index 9efd1c567d..7e680f1864 100644
--- a/Modules/SceneSerialization/include/mitkSceneIO.h
+++ b/Modules/SceneSerialization/include/mitkSceneIO.h
@@ -1,119 +1,119 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSceneIO_h_included
#define mitkSceneIO_h_included
#include <MitkSceneSerializationExports.h>
#include "mitkDataStorage.h"
#include "mitkNodePredicateBase.h"
#include <Poco/Zip/ZipLocalFileHeader.h>
class TiXmlElement;
namespace mitk
{
class BaseData;
class PropertyList;
class MITKSCENESERIALIZATION_EXPORT SceneIO : public itk::Object
{
public:
- mitkClassMacro( SceneIO, itk::Object );
+ mitkClassMacroItkParent( SceneIO, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef DataStorage::SetOfObjects FailedBaseDataListType;
/**
* \brief Load a scene of objects from file
* \return DataStorage with all scene objects and their relations. If loading failed, query GetFailedNodes() and GetFailedProperties() for more detail.
*
* Attempts to read the provided file and create objects with
* parent/child relations into a DataStorage.
*
* \param filename full filename of the scene file
* \param storage If given, this DataStorage is used instead of a newly created one
* \param clearStorageFirst If set, the provided DataStorage will be cleared before populating it with the loaded objects
*/
virtual DataStorage::Pointer LoadScene( const std::string& filename,
DataStorage* storage = NULL,
bool clearStorageFirst = false );
/**
* \brief Save a scene of objects to file
* \return True if complete success, false if any problem occurred. Note that a scene file might still be written if false is returned,
it just will not contain every node/property. If writing failed, query GetFailedNodes() and GetFailedProperties() for more detail.
*
* Attempts to write a scene file, which contains the nodes of the
* provided DataStorage, their parent/child relations, and properties.
*
* \param storage a DataStorage containing all nodes that should be saved
* \param filename full filename of the scene file
* \param predicate defining which items of the datastorage to use and which not
*/
virtual bool SaveScene( DataStorage::SetOfObjects::ConstPointer sceneNodes, const DataStorage* storage,
const std::string& filename);
/**
* \brief Get a list of nodes (BaseData containers) that failed to be read/written.
*
* FailedBaseDataListType hold all those nodes that contain BaseData objects
* which could not be read or written during the last call to LoadScene or SaveScene.
*/
const FailedBaseDataListType* GetFailedNodes();
/**
* \brief Get a list of properties that failed to be read/written.
*
* Each entry corresponds to a property which could not
* be (de)serialized. The properties may come from either of
* <ul>
* <li> The BaseData's PropertyList
* <li> The DataNodes's PropertyList
* <li> Any of a DataNodes's render window specific PropertyLists
* </ul>
*/
const PropertyList* GetFailedProperties();
protected:
SceneIO();
virtual ~SceneIO();
std::string CreateEmptyTempDirectory();
TiXmlElement* SaveBaseData( BaseData* data, const std::string& filenamehint, bool& error);
TiXmlElement* SavePropertyList( PropertyList* propertyList, const std::string& filenamehint );
void OnUnzipError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info);
void OnUnzipOk(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const Poco::Path>& info);
FailedBaseDataListType::Pointer m_FailedNodes;
PropertyList::Pointer m_FailedProperties;
std::string m_WorkingDirectory;
unsigned int m_UnzipErrors;
};
}
#endif
diff --git a/Modules/SceneSerialization/include/mitkSceneReader.h b/Modules/SceneSerialization/include/mitkSceneReader.h
index d0b1f7ce82..200550b630 100644
--- a/Modules/SceneSerialization/include/mitkSceneReader.h
+++ b/Modules/SceneSerialization/include/mitkSceneReader.h
@@ -1,40 +1,40 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <MitkSceneSerializationExports.h>
#include <tinyxml.h>
#include <itkObjectFactory.h>
#include "mitkDataStorage.h"
namespace mitk
{
class MITKSCENESERIALIZATION_EXPORT SceneReader : public itk::Object
{
public:
- mitkClassMacro( SceneReader, itk::Object );
+ mitkClassMacroItkParent( SceneReader, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual bool LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage );
};
}
diff --git a/Modules/SceneSerialization/src/mitkImageSerializer.h b/Modules/SceneSerialization/src/mitkImageSerializer.h
index 1f2aa85414..2f833365b9 100644
--- a/Modules/SceneSerialization/src/mitkImageSerializer.h
+++ b/Modules/SceneSerialization/src/mitkImageSerializer.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkImageSerializer_h_included
#define mitkImageSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Image for mitk::SceneIO
*/
class ImageSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( ImageSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
ImageSerializer();
virtual ~ImageSerializer();
};
} // namespace
#endif
diff --git a/Modules/SceneSerialization/src/mitkPointSetSerializer.h b/Modules/SceneSerialization/src/mitkPointSetSerializer.h
index 3575bb22fc..1a692d077f 100644
--- a/Modules/SceneSerialization/src/mitkPointSetSerializer.h
+++ b/Modules/SceneSerialization/src/mitkPointSetSerializer.h
@@ -1,39 +1,39 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPointSetSerializer_h_included
#define mitkPointSetSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class PointSetSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( PointSetSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
PointSetSerializer();
virtual ~PointSetSerializer();
};
} // namespace
#endif
diff --git a/Modules/SceneSerialization/src/mitkPropertyListDeserializer.h b/Modules/SceneSerialization/src/mitkPropertyListDeserializer.h
index 7f0accac97..42e73eb6b9 100644
--- a/Modules/SceneSerialization/src/mitkPropertyListDeserializer.h
+++ b/Modules/SceneSerialization/src/mitkPropertyListDeserializer.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyListDeserializer_h_included
#define mitkPropertyListDeserializer_h_included
#include "mitkPropertyList.h"
namespace mitk
{
/**
\brief Deserializes a mitk::PropertyList
*/
class PropertyListDeserializer : public itk::Object
{
public:
- mitkClassMacro( PropertyListDeserializer, itk::Object );
+ mitkClassMacroItkParent( PropertyListDeserializer, itk::Object );
itkFactorylessNewMacro(Self) // is this needed? should never be instantiated, only subclasses should
itkCloneMacro(Self)
itkSetStringMacro(Filename);
itkGetStringMacro(Filename);
/**
\brief Reads a propertylist from file
\return success of deserialization
*/
virtual bool Deserialize();
virtual PropertyList::Pointer GetOutput();
protected:
PropertyListDeserializer();
virtual ~PropertyListDeserializer();
std::string m_Filename;
PropertyList::Pointer m_PropertyList;
};
} // namespace
#endif
diff --git a/Modules/SceneSerialization/src/mitkPropertyListDeserializerV1.h b/Modules/SceneSerialization/src/mitkPropertyListDeserializerV1.h
index da6030d10d..6ebdfc3865 100644
--- a/Modules/SceneSerialization/src/mitkPropertyListDeserializerV1.h
+++ b/Modules/SceneSerialization/src/mitkPropertyListDeserializerV1.h
@@ -1,51 +1,51 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyListDeserializerV1_h_included
#define mitkPropertyListDeserializerV1_h_included
#include "mitkPropertyListDeserializer.h"
namespace mitk
{
/**
\brief Deserializes a mitk::PropertyList
*/
class PropertyListDeserializerV1 : public PropertyListDeserializer
{
public:
mitkClassMacro( PropertyListDeserializerV1, PropertyListDeserializer );
itkFactorylessNewMacro(Self) // is this needed? should never be instantiated, only subclasses should
itkCloneMacro(Self)
/**
\brief Reads a propertylist from file. Get result via GetOutput()
\return success of deserialization
*/
- virtual bool Deserialize();
+ virtual bool Deserialize() override;
protected:
PropertyListDeserializerV1();
virtual ~PropertyListDeserializerV1();
};
} // namespace
#endif
diff --git a/Modules/SceneSerialization/src/mitkSceneReaderV1.h b/Modules/SceneSerialization/src/mitkSceneReaderV1.h
index b7d7aab804..58546d2893 100644
--- a/Modules/SceneSerialization/src/mitkSceneReaderV1.h
+++ b/Modules/SceneSerialization/src/mitkSceneReaderV1.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkSceneReader.h"
namespace mitk
{
class SceneReaderV1 : public SceneReader
{
public:
mitkClassMacro( SceneReaderV1, SceneReader);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual bool LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage );
+ virtual bool LoadScene( TiXmlDocument& document, const std::string& workingDirectory, DataStorage* storage ) override;
protected:
/**
\brief tries to create one DataNode from a given XML <node> element
*/
DataNode::Pointer LoadBaseDataFromDataTag( TiXmlElement* dataElement,
const std::string& workingDirectory,
bool& error );
/**
\brief reads all the properties from the XML document and recreates them in node
*/
bool DecorateNodeWithProperties(DataNode* node, TiXmlElement* nodeElement, const std::string& workingDirectory);
/**
\brief reads all properties assigned to a base data element and assigns the list to the base data object
The baseDataNodeElem is supposed to be the <properties file="..."> element.
*/
bool DecorateBaseDataWithProperties(BaseData::Pointer data, TiXmlElement* baseDataNodeElem, const std::string& workingDir);
typedef std::multimap<int, std::string> UnorderedLayers;
typedef std::map<std::string, int> OrderedLayers;
typedef std::pair<DataNode::Pointer, std::list<std::string> > NodesAndParentsPair;
typedef std::map<int, NodesAndParentsPair > LayerPropertyMapType;
typedef std::map<std::string, DataNode*> IDToNodeMappingType;
typedef std::map<DataNode*, std::string> NodeToIDMappingType;
void GetLayerOrder(TiXmlDocument& document, const std::string& workingDirectory, std::vector<mitk::DataNode::Pointer> DataNodes, OrderedLayers& order);
UnorderedLayers m_UnorderedLayers;
OrderedLayers m_OrderedLayers;
LayerPropertyMapType m_OrderedNodePairs;
IDToNodeMappingType m_NodeForID;
NodeToIDMappingType m_IDForNode;
UIDGenerator m_UIDGen;
};
}
diff --git a/Modules/SceneSerialization/src/mitkSurfaceSerializer.h b/Modules/SceneSerialization/src/mitkSurfaceSerializer.h
index f565c0640c..25aa942290 100644
--- a/Modules/SceneSerialization/src/mitkSurfaceSerializer.h
+++ b/Modules/SceneSerialization/src/mitkSurfaceSerializer.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurfaceSerializer_h_included
#define mitkSurfaceSerializer_h_included
#include "mitkBaseDataSerializer.h"
namespace mitk
{
/**
\brief Serializes mitk::Surface for mitk::SceneIO
*/
class SurfaceSerializer : public BaseDataSerializer
{
public:
mitkClassMacro( SurfaceSerializer, BaseDataSerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual std::string Serialize();
+ virtual std::string Serialize() override;
protected:
SurfaceSerializer();
virtual ~SurfaceSerializer();
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/include/mitkBaseDataSerializer.h b/Modules/SceneSerializationBase/include/mitkBaseDataSerializer.h
index b860ff230e..3f87db118d 100644
--- a/Modules/SceneSerializationBase/include/mitkBaseDataSerializer.h
+++ b/Modules/SceneSerializationBase/include/mitkBaseDataSerializer.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSerializeBaseData_h_included
#define mitkSerializeBaseData_h_included
#include <MitkSceneSerializationBaseExports.h>
#include "mitkSerializerMacros.h"
#include <itkObjectFactoryBase.h>
#include "mitkBaseData.h"
namespace mitk
{
/**
\brief Base class for objects that serialize BaseData types.
The name of sub-classes must be deduced from the class name of the object that should be serialized.
The serialization assumes that
\verbatim
If the class derived from BaseData is called GreenData
Then the serializer for this class must be called GreenDataSerializer
\endverbatim
*/
class MITKSCENESERIALIZATIONBASE_EXPORT BaseDataSerializer : public itk::Object
{
public:
- mitkClassMacro( BaseDataSerializer, itk::Object );
+ mitkClassMacroItkParent( BaseDataSerializer, itk::Object );
itkSetStringMacro(FilenameHint);
itkGetStringMacro(FilenameHint);
itkSetStringMacro(WorkingDirectory);
itkGetStringMacro(WorkingDirectory);
itkSetConstObjectMacro(Data, BaseData);
/**
\brief Serializes given BaseData object.
\return the filename of the newly created file.
This should be overwritten by specific sub-classes.
*/
virtual std::string Serialize();
protected:
BaseDataSerializer();
virtual ~BaseDataSerializer();
std::string GetUniqueFilenameInWorkingDirectory();
std::string m_FilenameHint;
std::string m_WorkingDirectory;
BaseData::ConstPointer m_Data;
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/include/mitkBasePropertySerializer.h b/Modules/SceneSerializationBase/include/mitkBasePropertySerializer.h
index 9c84185852..1face0f5da 100644
--- a/Modules/SceneSerializationBase/include/mitkBasePropertySerializer.h
+++ b/Modules/SceneSerializationBase/include/mitkBasePropertySerializer.h
@@ -1,78 +1,78 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSerializeBaseProperty_h_included
#define mitkSerializeBaseProperty_h_included
#include <MitkSceneSerializationBaseExports.h>
#include "mitkSerializerMacros.h"
#include <itkObjectFactoryBase.h>
#include "mitkBaseProperty.h"
#include <tinyxml.h>
namespace mitk
{
/**
\brief Base class for objects that serialize BaseProperty types.
The name of sub-classes must be deduced from the class name of the object that should be serialized.
The serialization assumes that
\verbatim
If the class derived from BaseProperty is called GreenProperty
Then the serializer for this class must be called GreenPropertySerializer
\endverbatim
*/
class MITKSCENESERIALIZATIONBASE_EXPORT BasePropertySerializer : public itk::Object
{
public:
- mitkClassMacro( BasePropertySerializer, itk::Object );
+ mitkClassMacroItkParent( BasePropertySerializer, itk::Object );
itkSetConstObjectMacro(Property, BaseProperty);
/**
\brief Serializes given BaseProperty object.
\return The filename of the newly created file.
This should be overwritten by specific sub-classes.
*/
virtual TiXmlElement* Serialize();
/**
\brief Deserializes given TiXmlElement.
\return The deserialized Property.
This should be overwritten by specific sub-classes.
*/
virtual BaseProperty::Pointer Deserialize(TiXmlElement*);
protected:
BasePropertySerializer();
virtual ~BasePropertySerializer();
BaseProperty::ConstPointer m_Property;
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/include/mitkEnumerationPropertySerializer.h b/Modules/SceneSerializationBase/include/mitkEnumerationPropertySerializer.h
index b49593e358..104b809368 100644
--- a/Modules/SceneSerializationBase/include/mitkEnumerationPropertySerializer.h
+++ b/Modules/SceneSerializationBase/include/mitkEnumerationPropertySerializer.h
@@ -1,44 +1,44 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkEnumerationPropertySerializer_h_included
#define mitkEnumerationPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkEnumerationProperty.h"
namespace mitk
{
class MITKSCENESERIALIZATIONBASE_EXPORT EnumerationPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( EnumerationPropertySerializer, BasePropertySerializer );
- virtual TiXmlElement* Serialize();
+ virtual TiXmlElement* Serialize() override;
protected:
EnumerationPropertySerializer();
virtual ~EnumerationPropertySerializer();
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/include/mitkPropertyListSerializer.h b/Modules/SceneSerializationBase/include/mitkPropertyListSerializer.h
index d8d4326b95..c6e416a1f3 100644
--- a/Modules/SceneSerializationBase/include/mitkPropertyListSerializer.h
+++ b/Modules/SceneSerializationBase/include/mitkPropertyListSerializer.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPropertyListSerializer_h_included
#define mitkPropertyListSerializer_h_included
#include <MitkSceneSerializationBaseExports.h>
#include "mitkPropertyList.h"
#include <itkObjectFactoryBase.h>
class TiXmlElement;
namespace mitk
{
/**
\brief Serializes a mitk::PropertyList
*/
class MITKSCENESERIALIZATIONBASE_EXPORT PropertyListSerializer : public itk::Object
{
public:
- mitkClassMacro( PropertyListSerializer, itk::Object );
+ mitkClassMacroItkParent( PropertyListSerializer, itk::Object );
itkFactorylessNewMacro(Self) // is this needed? should never be instantiated, only subclasses should
itkCloneMacro(Self)
itkSetStringMacro(FilenameHint);
itkGetStringMacro(FilenameHint);
itkSetStringMacro(WorkingDirectory);
itkGetStringMacro(WorkingDirectory);
itkSetObjectMacro(PropertyList, PropertyList);
/**
\brief Serializes given PropertyList object.
\return the filename of the newly created file.
*/
virtual std::string Serialize();
PropertyList* GetFailedProperties();
protected:
PropertyListSerializer();
virtual ~PropertyListSerializer();
TiXmlElement* SerializeOneProperty( const std::string& key, const BaseProperty* property );
std::string m_FilenameHint;
std::string m_WorkingDirectory;
PropertyList::Pointer m_PropertyList;
PropertyList::Pointer m_FailedProperties;
};
} // namespace
#endif
diff --git a/Modules/SceneSerializationBase/include/mitkSerializerMacros.h b/Modules/SceneSerializationBase/include/mitkSerializerMacros.h
index 769c2de067..cebc00dd3f 100644
--- a/Modules/SceneSerializationBase/include/mitkSerializerMacros.h
+++ b/Modules/SceneSerializationBase/include/mitkSerializerMacros.h
@@ -1,99 +1,99 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <itkObjectFactoryBase.h>
#include <itkVersion.h>
#define MITK_REGISTER_SERIALIZER(classname) \
\
namespace mitk \
{ \
\
class classname ## Factory : public ::itk::ObjectFactoryBase \
{ \
public: \
\
/* ITK typedefs */ \
typedef classname ## Factory Self; \
typedef itk::ObjectFactoryBase Superclass; \
typedef itk::SmartPointer<Self> Pointer; \
typedef itk::SmartPointer<const Self> ConstPointer; \
\
/* Methods from ObjectFactoryBase */ \
- virtual const char* GetITKSourceVersion() const \
+ virtual const char* GetITKSourceVersion() const override \
{ \
return ITK_SOURCE_VERSION; \
} \
\
- virtual const char* GetDescription() const \
+ virtual const char* GetDescription() const override \
{ \
return "Generated factory for " #classname; \
} \
\
/* Method for class instantiation. */ \
itkFactorylessNewMacro(Self); \
\
/* Run-time type information (and related methods). */ \
itkTypeMacro(classname ## Factory, itkObjectFactoryBase); \
\
protected: \
\
classname ## Factory() \
{ \
itk::ObjectFactoryBase::RegisterOverride(#classname, \
#classname, \
"Generated factory for " #classname, \
1, \
itk::CreateObjectFunction<classname>::New()); \
} \
\
~classname ## Factory() \
{ \
} \
\
private: \
\
classname ## Factory(const Self&); /* purposely not implemented */ \
void operator=(const Self&); /* purposely not implemented */ \
\
}; \
\
\
\
class classname ## RegistrationMethod \
{ \
public: \
\
classname ## RegistrationMethod() \
{ \
m_Factory = classname ## Factory::New(); \
itk::ObjectFactoryBase::RegisterFactory( m_Factory ); \
} \
\
~classname ## RegistrationMethod() \
{ \
itk::ObjectFactoryBase::UnRegisterFactory( m_Factory ); \
} \
\
private: \
\
classname ## Factory::Pointer m_Factory; \
\
}; \
} \
\
static mitk::classname ## RegistrationMethod somestaticinitializer_ ## classname ;
diff --git a/Modules/SceneSerializationBase/include/mitkTransferFunctionPropertySerializer.h b/Modules/SceneSerializationBase/include/mitkTransferFunctionPropertySerializer.h
index 18a19d2494..81d64d08cc 100644
--- a/Modules/SceneSerializationBase/include/mitkTransferFunctionPropertySerializer.h
+++ b/Modules/SceneSerializationBase/include/mitkTransferFunctionPropertySerializer.h
@@ -1,42 +1,42 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTransferFunctionProperty.h"
#include "mitkBasePropertySerializer.h"
namespace mitk
{
class MITKSCENESERIALIZATIONBASE_EXPORT TransferFunctionPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( TransferFunctionPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize();
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element);
+ virtual TiXmlElement* Serialize() override;
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override;
static bool SerializeTransferFunction( const char * filename, TransferFunction::Pointer tf );
static TransferFunction::Pointer DeserializeTransferFunction( const char *filePath );
protected:
TransferFunctionPropertySerializer();
virtual ~TransferFunctionPropertySerializer();
};
} // namespace
diff --git a/Modules/SceneSerializationBase/src/mitkAnnotationPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkAnnotationPropertySerializer.cpp
index 213b951885..e95438ccd0 100644
--- a/Modules/SceneSerializationBase/src/mitkAnnotationPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkAnnotationPropertySerializer.cpp
@@ -1,76 +1,76 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAnnotationPropertySerializer_h_included
#define mitkAnnotationPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkAnnotationProperty.h"
namespace mitk
{
class AnnotationPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( AnnotationPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const AnnotationProperty* prop = dynamic_cast<const AnnotationProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("annotation");
element->SetAttribute("label", prop->GetLabel());
Point3D point = prop->GetPosition();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
const char* label( element->Attribute("label") );
Point3D p;
if ( element->QueryDoubleAttribute( "x", &p[0] ) != TIXML_SUCCESS )
return NULL;
if ( element->QueryDoubleAttribute( "y", &p[1] ) != TIXML_SUCCESS )
return NULL;
if ( element->QueryDoubleAttribute( "z", &p[2] ) != TIXML_SUCCESS )
return NULL;
return AnnotationProperty::New(label, p).GetPointer();
}
protected:
AnnotationPropertySerializer() {}
virtual ~AnnotationPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(AnnotationPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkBoolLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkBoolLookupTablePropertySerializer.cpp
index 9ac8acf8fa..46bb504019 100644
--- a/Modules/SceneSerializationBase/src/mitkBoolLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkBoolLookupTablePropertySerializer.cpp
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkBoolLookupTablePropertySerializer_h_included
#define mitkBoolLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class BoolLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( BoolLookupTablePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
const BoolLookupTableProperty* prop = dynamic_cast<const BoolLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
BoolLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const BoolLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("BoolLookupTable");
for (BoolLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
if (it->second == true)
tableEntry->SetAttribute("value", "true");
else
tableEntry->SetAttribute("value", "false");
element->LinkEndChild( tableEntry );
}
return element;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element)
return NULL;
BoolLookupTable lut;
for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
{
int xmlID;
if (child->QueryIntAttribute("id", &xmlID) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
BoolLookupTable::IdentifierType id = static_cast<BoolLookupTable::IdentifierType>(xmlID);
BoolLookupTable::ValueType val = std::string(child->Attribute("value")) == std::string("true");
lut.SetTableValue(id, val);
}
return BoolLookupTableProperty::New(lut).GetPointer();
}
protected:
BoolLookupTablePropertySerializer() {}
virtual ~BoolLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(BoolLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkBoolPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkBoolPropertySerializer.cpp
index 50cbc4409c..58f63e910e 100644
--- a/Modules/SceneSerializationBase/src/mitkBoolPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkBoolPropertySerializer.cpp
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkBoolPropertySerializer_h_included
#define mitkBoolPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class BoolPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( BoolPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const BoolProperty* prop = dynamic_cast<const BoolProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("bool");
if (prop->GetValue() == true)
{
element->SetAttribute("value", "true");
}
else
{
element->SetAttribute("value", "false");
}
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
return BoolProperty::New( std::string(element->Attribute("value")) == "true" ).GetPointer();
}
protected:
BoolPropertySerializer() {}
virtual ~BoolPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(BoolPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkClippingPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkClippingPropertySerializer.cpp
index 04204f43bf..35183ba434 100644
--- a/Modules/SceneSerializationBase/src/mitkClippingPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkClippingPropertySerializer.cpp
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkClippingPropertySerializer_h_included
#define mitkClippingPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkClippingProperty.h"
#include "mitkNumericTypes.h"
namespace mitk
{
class ClippingPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( ClippingPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const ClippingProperty* prop = dynamic_cast<const ClippingProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("clipping");
if (prop->GetClippingEnabled())
element->SetAttribute("enabled", "true");
else
element->SetAttribute("enabled", "false");
TiXmlElement* originElement = new TiXmlElement("origin");
const Point3D origin = prop->GetOrigin();
originElement->SetDoubleAttribute("x", origin[0]);
originElement->SetDoubleAttribute("y", origin[1]);
originElement->SetDoubleAttribute("z", origin[2]);
element->LinkEndChild(originElement);
TiXmlElement* normalElement = new TiXmlElement("normal");
const Vector3D normal = prop->GetNormal();
normalElement->SetDoubleAttribute("x", normal[0]);
normalElement->SetDoubleAttribute("y", normal[1]);
normalElement->SetDoubleAttribute("z", normal[2]);
element->LinkEndChild(normalElement);
return element;
}
else
return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element)
return NULL;
bool enabled = std::string(element->Attribute("enabled")) == "true";
TiXmlElement* originElement = element->FirstChildElement("origin");
if (originElement == NULL)
return NULL;
Point3D origin;
if ( originElement->QueryDoubleAttribute( "x", &origin[0] ) != TIXML_SUCCESS )
return NULL;
if ( originElement->QueryDoubleAttribute( "y", &origin[1] ) != TIXML_SUCCESS )
return NULL;
if ( originElement->QueryDoubleAttribute( "z", &origin[2] ) != TIXML_SUCCESS )
return NULL;
TiXmlElement* normalElement = element->FirstChildElement("normal");
if (normalElement == NULL)
return NULL;
Vector3D normal;
if ( normalElement->QueryDoubleAttribute( "x", &normal[0] ) != TIXML_SUCCESS )
return NULL;
if ( normalElement->QueryDoubleAttribute( "y", &normal[1] ) != TIXML_SUCCESS )
return NULL;
if ( normalElement->QueryDoubleAttribute( "z", &normal[2] ) != TIXML_SUCCESS )
return NULL;
ClippingProperty::Pointer cp = ClippingProperty::New(origin, normal);
cp->SetClippingEnabled(enabled);
return cp.GetPointer();
}
protected:
ClippingPropertySerializer() {}
virtual ~ClippingPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(ClippingPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkColorPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkColorPropertySerializer.cpp
index b135520132..1be52dc397 100644
--- a/Modules/SceneSerializationBase/src/mitkColorPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkColorPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkColorPropertySerializer_h_included
#define mitkColorPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkColorProperty.h"
namespace mitk
{
class ColorPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( ColorPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const ColorProperty* prop = dynamic_cast<const ColorProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("color");
Color color = prop->GetValue();
element->SetDoubleAttribute("r", color[0]);
element->SetDoubleAttribute("g", color[1]);
element->SetDoubleAttribute("b", color[2]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
Color c;
if ( element->QueryFloatAttribute( "r", &c[0] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryFloatAttribute( "g", &c[1] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryFloatAttribute( "b", &c[2] ) != TIXML_SUCCESS ) return NULL;
return ColorProperty::New( c ).GetPointer();
}
protected:
ColorPropertySerializer() {}
virtual ~ColorPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(ColorPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkDoublePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkDoublePropertySerializer.cpp
index 93b5f6d0e4..4f5c7e6c0e 100644
--- a/Modules/SceneSerializationBase/src/mitkDoublePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkDoublePropertySerializer.cpp
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDoublePropertySerializer_h_included
#define mitkDoublePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
#include <MitkSceneSerializationBaseExports.h>
namespace mitk
{
class DoublePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( DoublePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const DoubleProperty* prop = dynamic_cast<const DoubleProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("double");
element->SetDoubleAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
double d;
if ( element->QueryDoubleAttribute( "value", &d ) == TIXML_SUCCESS )
{
return DoubleProperty::New(d).GetPointer();
}
else
{
return NULL;
}
}
protected:
DoublePropertySerializer() {}
virtual ~DoublePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(DoublePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkFloatLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkFloatLookupTablePropertySerializer.cpp
index 9ec332c806..5d921e6033 100644
--- a/Modules/SceneSerializationBase/src/mitkFloatLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkFloatLookupTablePropertySerializer.cpp
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFloatLookupTablePropertySerializer_h_included
#define mitkFloatLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class FloatLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( FloatLookupTablePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
const FloatLookupTableProperty* prop = dynamic_cast<const FloatLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
FloatLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const FloatLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("FloatLookupTableTable");
for (FloatLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetDoubleAttribute("value", static_cast<double>(it->second));
element->LinkEndChild( tableEntry );
}
return element;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element)
return NULL;
FloatLookupTable lut;
for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
{
int tempID;
if (child->QueryIntAttribute("id", &tempID) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
FloatLookupTable::IdentifierType id = static_cast<FloatLookupTable::IdentifierType>(tempID);
float tempVal = -1.0;
if (child->QueryFloatAttribute("value", &tempVal) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
FloatLookupTable::ValueType val = static_cast<FloatLookupTable::ValueType>(tempVal);
lut.SetTableValue(id, val);
}
return FloatLookupTableProperty::New(lut).GetPointer();
}
protected:
FloatLookupTablePropertySerializer() {}
virtual ~FloatLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(FloatLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkFloatPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkFloatPropertySerializer.cpp
index 248c7ff903..173a97b446 100644
--- a/Modules/SceneSerializationBase/src/mitkFloatPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkFloatPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFloatPropertySerializer_h_included
#define mitkFloatPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class FloatPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( FloatPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const FloatProperty* prop = dynamic_cast<const FloatProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("float");
element->SetDoubleAttribute("value", static_cast<double>(prop->GetValue()));
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
float f;
if ( element->QueryFloatAttribute( "value", &f ) == TIXML_SUCCESS )
{
return FloatProperty::New(f).GetPointer();
}
else
{
return NULL;
}
}
protected:
FloatPropertySerializer() {}
virtual ~FloatPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(FloatPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkGroupTagPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkGroupTagPropertySerializer.cpp
index 50be2d6561..00c807edac 100644
--- a/Modules/SceneSerializationBase/src/mitkGroupTagPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkGroupTagPropertySerializer.cpp
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkGroupTagPropertySerializer_h_included
#define mitkGroupTagPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkGroupTagProperty.h"
namespace mitk
{
class GroupTagPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( GroupTagPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (dynamic_cast<const GroupTagProperty*>(m_Property.GetPointer()) != NULL)
{
TiXmlElement* element = new TiXmlElement("GroupTag");
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement*)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement*) override
{
//if (!element)
// return NULL;
return GroupTagProperty::New().GetPointer();
}
protected:
GroupTagPropertySerializer() {}
virtual ~GroupTagPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(GroupTagPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkIntLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkIntLookupTablePropertySerializer.cpp
index 4a8ea49eac..a8b5859c91 100644
--- a/Modules/SceneSerializationBase/src/mitkIntLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkIntLookupTablePropertySerializer.cpp
@@ -1,83 +1,83 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkIntLookupTablePropertySerializer_h_included
#define mitkIntLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class IntLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( IntLookupTablePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
const IntLookupTableProperty* prop = dynamic_cast<const IntLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
IntLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const IntLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("IntLookupTableTable");
for (IntLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetAttribute("value", it->second);
element->LinkEndChild( tableEntry );
}
return element;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element)
return NULL;
IntLookupTable lut;
for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
{
int temp;
if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
IntLookupTable::IdentifierType id = static_cast<IntLookupTable::IdentifierType>(temp);
if (child->QueryIntAttribute("value", &temp) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
IntLookupTable::ValueType val = static_cast<IntLookupTable::ValueType>(temp);
lut.SetTableValue(id, val);
}
return IntLookupTableProperty::New(lut).GetPointer();
}
protected:
IntLookupTablePropertySerializer() {}
virtual ~IntLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(IntLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkIntPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkIntPropertySerializer.cpp
index ab3dd29967..aa4c1b062b 100644
--- a/Modules/SceneSerializationBase/src/mitkIntPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkIntPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkIntPropertySerializer_h_included
#define mitkIntPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class IntPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( IntPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const IntProperty* prop = dynamic_cast<const IntProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("int");
element->SetAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
int integer;
if ( element->QueryIntAttribute( "value", &integer ) == TIXML_SUCCESS )
{
return IntProperty::New(integer).GetPointer();
}
else
{
return NULL;
}
}
protected:
IntPropertySerializer() {}
virtual ~IntPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(IntPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkLevelWindowPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkLevelWindowPropertySerializer.cpp
index ecb6b2e12e..be2225de93 100644
--- a/Modules/SceneSerializationBase/src/mitkLevelWindowPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkLevelWindowPropertySerializer.cpp
@@ -1,117 +1,117 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkLevelWindowPropertySerializer_h_included
#define mitkLevelWindowPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkLevelWindowProperty.h"
namespace mitk
{
class LevelWindowPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( LevelWindowPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const LevelWindowProperty* prop = dynamic_cast<const LevelWindowProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("LevelWindow");
LevelWindow lw = prop->GetLevelWindow();
std::string boolString("false");
if (lw.IsFixed() == true)
boolString = "true";
element->SetAttribute("fixed", boolString.c_str());
TiXmlElement* child = new TiXmlElement("CurrentSettings");
element->LinkEndChild( child );
child->SetDoubleAttribute("level", lw.GetLevel());
child->SetDoubleAttribute("window", lw.GetWindow());
child = new TiXmlElement("DefaultSettings");
element->LinkEndChild( child );
child->SetDoubleAttribute("level", lw.GetDefaultLevel());
child->SetDoubleAttribute("window", lw.GetDefaultWindow());
child = new TiXmlElement("CurrentRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", lw.GetRangeMin());
child->SetDoubleAttribute("max", lw.GetRangeMax());
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
bool isFixed(false);
if (element->Attribute("fixed"))
isFixed = std::string(element->Attribute("fixed")) == "true";
float level;
float window;
TiXmlElement* child = element->FirstChildElement("CurrentSettings");
if ( child->QueryFloatAttribute( "level", &level ) != TIXML_SUCCESS ) return NULL;
if ( child->QueryFloatAttribute( "window", &window ) != TIXML_SUCCESS ) return NULL;
float defaultLevel;
float defaultWindow;
child = element->FirstChildElement("DefaultSettings");
if ( child->QueryFloatAttribute( "level", &defaultLevel ) != TIXML_SUCCESS ) return NULL;
if ( child->QueryFloatAttribute( "window", &defaultWindow ) != TIXML_SUCCESS ) return NULL;
float minRange;
float maxRange;
child = element->FirstChildElement("CurrentRange");
if ( child->QueryFloatAttribute( "min", &minRange ) != TIXML_SUCCESS ) return NULL;
if ( child->QueryFloatAttribute( "max", &maxRange ) != TIXML_SUCCESS ) return NULL;
LevelWindow lw;
lw.SetRangeMinMax( minRange, maxRange );
lw.SetDefaultLevelWindow( defaultLevel, defaultWindow );
lw.SetLevelWindow( level, window );
lw.SetFixed( isFixed );
return LevelWindowProperty::New( lw ).GetPointer();
}
protected:
LevelWindowPropertySerializer() {}
virtual ~LevelWindowPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(LevelWindowPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkLookupTablePropertySerializer.cpp
index 365ddec823..b31917144d 100644
--- a/Modules/SceneSerializationBase/src/mitkLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkLookupTablePropertySerializer.cpp
@@ -1,213 +1,213 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkLookupTablePropertySerializer_h_included
#define mitkLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkLookupTableProperty.h"
namespace mitk
{
class LookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( LookupTablePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const LookupTableProperty* prop = dynamic_cast<const LookupTableProperty*>(m_Property.GetPointer()))
{
LookupTable::Pointer mitkLut = const_cast<LookupTableProperty*>(prop)->GetLookupTable();
if (mitkLut.IsNull()) return NULL; // really?
vtkLookupTable* lut = mitkLut->GetVtkLookupTable();
if (!lut) return NULL;
TiXmlElement* element = new TiXmlElement("LookupTable");
double* range;
double* rgba;
element->SetAttribute("NumberOfColors", lut->GetNumberOfTableValues());
element->SetAttribute("Scale", lut->GetScale());
element->SetAttribute("Ramp", lut->GetRamp());
range = lut->GetHueRange();
TiXmlElement* child = new TiXmlElement("HueRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetValueRange();
child = new TiXmlElement("ValueRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetSaturationRange();
child = new TiXmlElement("SaturationRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetAlphaRange();
child = new TiXmlElement("AlphaRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
range = lut->GetTableRange();
child = new TiXmlElement("TableRange");
element->LinkEndChild( child );
child->SetDoubleAttribute("min", range[0]);
child->SetDoubleAttribute("max", range[1]);
child = new TiXmlElement("Table");
element->LinkEndChild( child );
for ( int index = 0; index < lut->GetNumberOfTableValues(); ++index)
{
TiXmlElement* grandChildNinife = new TiXmlElement("RgbaColor");
rgba = lut->GetTableValue(index);
grandChildNinife->SetDoubleAttribute("R", rgba[0]);
grandChildNinife->SetDoubleAttribute("G", rgba[1]);
grandChildNinife->SetDoubleAttribute("B", rgba[2]);
grandChildNinife->SetDoubleAttribute("A", rgba[3]);
child->LinkEndChild( grandChildNinife );
}
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
typedef double OUR_VTK_FLOAT_TYPE;
double range[2];
double rgba[4];
double d; // bec. of tinyXML's interface that takes a pointer to float or double...
vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<vtkLookupTable>::New();
int numberOfColors;
int scale;
int ramp; // hope the int values don't change betw. vtk versions...
if ( element->QueryIntAttribute( "NumberOfColors", &numberOfColors ) == TIXML_SUCCESS )
{
lut->SetNumberOfTableValues( numberOfColors );
}
else
return NULL;
if ( element->QueryIntAttribute( "Scale", &scale ) == TIXML_SUCCESS )
{
lut->SetScale( scale );
}
else
return NULL;
if ( element->QueryIntAttribute( "Ramp", &ramp ) == TIXML_SUCCESS )
{
lut->SetRamp( ramp );
}
else
return NULL;
TiXmlElement* child = element->FirstChildElement("HueRange");
if (child)
{
if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS )
return NULL;
range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS )
return NULL;
range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetHueRange( range );
}
child = element->FirstChildElement("ValueRange");
if (child)
{
if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetValueRange( range );
}
child = element->FirstChildElement("SaturationRange");
if (child)
{
if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetSaturationRange( range );
}
child = element->FirstChildElement("AlphaRange");
if (child)
{
if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetAlphaRange( range );
}
child = element->FirstChildElement("TableRange");
if (child)
{
if ( child->QueryDoubleAttribute( "min", &d ) != TIXML_SUCCESS ) return NULL; range[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( child->QueryDoubleAttribute( "max", &d ) != TIXML_SUCCESS ) return NULL; range[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetTableRange( range );
}
child = element->FirstChildElement("Table");
if (child)
{
unsigned int index(0);
for( TiXmlElement* grandChild = child->FirstChildElement("RgbaColor"); grandChild; grandChild = grandChild->NextSiblingElement("RgbaColor"))
{
if ( grandChild->QueryDoubleAttribute("R", &d) != TIXML_SUCCESS ) return NULL; rgba[0] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( grandChild->QueryDoubleAttribute("G", &d) != TIXML_SUCCESS ) return NULL; rgba[1] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( grandChild->QueryDoubleAttribute("B", &d) != TIXML_SUCCESS ) return NULL; rgba[2] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
if ( grandChild->QueryDoubleAttribute("A", &d) != TIXML_SUCCESS ) return NULL; rgba[3] = static_cast<OUR_VTK_FLOAT_TYPE>(d);
lut->SetTableValue( index, rgba );
++index;
}
}
LookupTable::Pointer mitkLut = LookupTable::New();
mitkLut->SetVtkLookupTable( lut );
return LookupTableProperty::New(mitkLut).GetPointer();
}
protected:
LookupTablePropertySerializer() {}
virtual ~LookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(LookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkPoint3dPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkPoint3dPropertySerializer.cpp
index 1f743dfa16..438d278cdb 100644
--- a/Modules/SceneSerializationBase/src/mitkPoint3dPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkPoint3dPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPoint3dPropertySerializer_h_included
#define mitkPoint3dPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class Point3dPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point3dPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const Point3dProperty* prop = dynamic_cast<const Point3dProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point3D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
Point3D v;
if ( element->QueryDoubleAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
return Point3dProperty::New( v ).GetPointer();
}
protected:
Point3dPropertySerializer() {}
virtual ~Point3dPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point3dPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkPoint3iPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkPoint3iPropertySerializer.cpp
index 5440eb7c82..01912549a2 100644
--- a/Modules/SceneSerializationBase/src/mitkPoint3iPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkPoint3iPropertySerializer.cpp
@@ -1,63 +1,63 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPoint3iPropertySerializer_h_included
#define mitkPoint3iPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class Point3iPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point3iPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const Point3iProperty* prop = dynamic_cast<const Point3iProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point3I point = prop->GetValue();
element->SetAttribute("x", point[0]);
element->SetAttribute("y", point[1]);
element->SetAttribute("z", point[2]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
Point3I v;
if ( element->QueryIntAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryIntAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryIntAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
return Point3iProperty::New( v ).GetPointer();
}
protected:
Point3iPropertySerializer() {}
virtual ~Point3iPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point3iPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkPoint4dPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkPoint4dPropertySerializer.cpp
index 9ac40938b9..59d2db40d8 100644
--- a/Modules/SceneSerializationBase/src/mitkPoint4dPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkPoint4dPropertySerializer.cpp
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPoint4dPropertySerializer_h_included
#define mitkPoint4dPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class Point4dPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Point4dPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const Point4dProperty* prop = dynamic_cast<const Point4dProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("point");
Point4D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
element->SetDoubleAttribute("t", point[3]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
Point4D v;
if ( element->QueryDoubleAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "t", &v[3] ) != TIXML_SUCCESS ) return NULL;
return Point4dProperty::New( v ).GetPointer();
}
protected:
Point4dPropertySerializer() {}
virtual ~Point4dPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Point4dPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkStringLookupTablePropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkStringLookupTablePropertySerializer.cpp
index 21172a6efe..ad9cd3bb7a 100644
--- a/Modules/SceneSerializationBase/src/mitkStringLookupTablePropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkStringLookupTablePropertySerializer.cpp
@@ -1,84 +1,84 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkStringLookupTablePropertySerializer_h_included
#define mitkStringLookupTablePropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class StringLookupTablePropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( StringLookupTablePropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
const StringLookupTableProperty* prop = dynamic_cast<const StringLookupTableProperty*>(m_Property.GetPointer());
if (prop == NULL)
return NULL;
StringLookupTable lut = prop->GetValue();
//if (lut.IsNull())
// return NULL; // really?
const StringLookupTable::LookupTableType& map = lut.GetLookupTable();
TiXmlElement* element = new TiXmlElement("StringLookupTable");
for (StringLookupTable::LookupTableType::const_iterator it = map.begin(); it != map.end(); ++it)
{
TiXmlElement* tableEntry = new TiXmlElement("LUTValue");
tableEntry->SetAttribute("id", it->first);
tableEntry->SetAttribute("value", it->second);
element->LinkEndChild( tableEntry );
}
return element;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element)
return NULL;
StringLookupTable lut;
for( TiXmlElement* child = element->FirstChildElement("LUTValue"); child != NULL; child = child->NextSiblingElement("LUTValue"))
{
int temp;
if (child->QueryIntAttribute("id", &temp) == TIXML_WRONG_TYPE)
return NULL; // TODO: can we do a better error handling?
StringLookupTable::IdentifierType id = static_cast<StringLookupTable::IdentifierType>(temp);
if (child->Attribute("value") == NULL)
return NULL; // TODO: can we do a better error handling?
StringLookupTable::ValueType val = child->Attribute("value");
lut.SetTableValue(id, val);
}
return StringLookupTableProperty::New(lut).GetPointer();
}
protected:
StringLookupTablePropertySerializer() {}
virtual ~StringLookupTablePropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(StringLookupTablePropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkStringPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkStringPropertySerializer.cpp
index 75e62a060d..a980462762 100644
--- a/Modules/SceneSerializationBase/src/mitkStringPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkStringPropertySerializer.cpp
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkStringPropertySerializer_h_included
#define mitkStringPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkStringProperty.h"
namespace mitk
{
class StringPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( StringPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const StringProperty* prop = dynamic_cast<const StringProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("string");
element->SetAttribute("value", prop->GetValue());
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
const char* s( element->Attribute("value") );
return StringProperty::New( std::string(s?s:"") ).GetPointer();
}
protected:
StringPropertySerializer() {}
virtual ~StringPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(StringPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkUIntPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkUIntPropertySerializer.cpp
index ffe6e906f5..16003831e5 100644
--- a/Modules/SceneSerializationBase/src/mitkUIntPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkUIntPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkUIntPropertySerializer_h_included
#define mitkUIntPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class UIntPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( UIntPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const UIntProperty* prop = dynamic_cast<const UIntProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("unsigned");
element->SetAttribute("value", static_cast<unsigned int>(prop->GetValue()));
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
unsigned int integer;
if ( element->QueryUnsignedAttribute( "value", &integer ) == TIXML_SUCCESS )
{
return UIntProperty::New(integer).GetPointer();
}
else
{
return NULL;
}
}
protected:
UIntPropertySerializer() {}
virtual ~UIntPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(UIntPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkUShortPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkUShortPropertySerializer.cpp
index 8dfd387e3d..62c054443d 100644
--- a/Modules/SceneSerializationBase/src/mitkUShortPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkUShortPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkUShortPropertySerializer_h_included
#define mitkUShortPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class UShortPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( UShortPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const UShortProperty* prop = dynamic_cast<const UShortProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("unsigned");
element->SetAttribute("value", static_cast<unsigned short>(prop->GetValue()));
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
unsigned int value;
if ( element->QueryUnsignedAttribute( "value", &value ) == TIXML_SUCCESS )
{
return UShortProperty::New(static_cast<unsigned short>(value)).GetPointer();
}
else
{
return NULL;
}
}
protected:
UShortPropertySerializer() {}
virtual ~UShortPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(UShortPropertySerializer);
#endif
diff --git a/Modules/SceneSerializationBase/src/mitkVector3DPropertySerializer.cpp b/Modules/SceneSerializationBase/src/mitkVector3DPropertySerializer.cpp
index d9d8522894..3d9fa00bd3 100644
--- a/Modules/SceneSerializationBase/src/mitkVector3DPropertySerializer.cpp
+++ b/Modules/SceneSerializationBase/src/mitkVector3DPropertySerializer.cpp
@@ -1,73 +1,73 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkVector3DPropertySerializer_h_included
#define mitkVector3DPropertySerializer_h_included
#include "mitkBasePropertySerializer.h"
#include "mitkProperties.h"
namespace mitk
{
class Vector3DPropertySerializer : public BasePropertySerializer
{
public:
mitkClassMacro( Vector3DPropertySerializer, BasePropertySerializer );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual TiXmlElement* Serialize()
+ virtual TiXmlElement* Serialize() override
{
if (const Vector3DProperty* prop = dynamic_cast<const Vector3DProperty*>(m_Property.GetPointer()))
{
TiXmlElement* element = new TiXmlElement("vector");
Vector3D point = prop->GetValue();
element->SetDoubleAttribute("x", point[0]);
element->SetDoubleAttribute("y", point[1]);
element->SetDoubleAttribute("z", point[2]);
return element;
}
else return NULL;
}
- virtual BaseProperty::Pointer Deserialize(TiXmlElement* element)
+ virtual BaseProperty::Pointer Deserialize(TiXmlElement* element) override
{
if (!element) return NULL;
Vector3D v;
if ( element->QueryDoubleAttribute( "x", &v[0] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "y", &v[1] ) != TIXML_SUCCESS ) return NULL;
if ( element->QueryDoubleAttribute( "z", &v[2] ) != TIXML_SUCCESS ) return NULL;
return Vector3DProperty::New( v ).GetPointer();
}
protected:
Vector3DPropertySerializer() {}
virtual ~Vector3DPropertySerializer() {}
};
} // namespace
// important to put this into the GLOBAL namespace (because it starts with 'namespace mitk')
MITK_REGISTER_SERIALIZER(Vector3DPropertySerializer);
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkCalculateSegmentationVolume.h b/Modules/Segmentation/Algorithms/mitkCalculateSegmentationVolume.h
index aa41fb20b0..779aa1dfb6 100644
--- a/Modules/Segmentation/Algorithms/mitkCalculateSegmentationVolume.h
+++ b/Modules/Segmentation/Algorithms/mitkCalculateSegmentationVolume.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CALCULATE_SEGMENTATION_VOLUME_H_INCLUDET_WAD
#define MITK_CALCULATE_SEGMENTATION_VOLUME_H_INCLUDET_WAD
#include "mitkSegmentationSink.h"
#include <MitkSegmentationExports.h>
#include "mitkImageCast.h"
namespace mitk
{
class MITKSEGMENTATION_EXPORT CalculateSegmentationVolume : public SegmentationSink
{
public:
mitkClassMacro( CalculateSegmentationVolume, SegmentationSink )
mitkAlgorithmNewMacro( CalculateSegmentationVolume );
protected:
CalculateSegmentationVolume(); // use smart pointers
virtual ~CalculateSegmentationVolume();
- virtual bool ReadyToRun();
+ virtual bool ReadyToRun() override;
- virtual bool ThreadedUpdateFunction(); // will be called from a thread after calling StartAlgorithm
+ virtual bool ThreadedUpdateFunction() override; // will be called from a thread after calling StartAlgorithm
template < typename TPixel, unsigned int VImageDimension >
void ItkImageProcessing( itk::Image< TPixel, VImageDimension >* itkImage, TPixel* dummy = NULL );
private:
unsigned int m_Volume;
Vector3D m_CenterOfMass;
Vector3D m_MinIndexOfBoundingBox;
Vector3D m_MaxIndexOfBoundingBox;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkContourModelSetToImageFilter.h b/Modules/Segmentation/Algorithms/mitkContourModelSetToImageFilter.h
index 37e5069d66..760fe0a1ae 100644
--- a/Modules/Segmentation/Algorithms/mitkContourModelSetToImageFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkContourModelSetToImageFilter.h
@@ -1,100 +1,100 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOURMODEL_SOURCE_H
#define _MITK_CONTOURMODEL_SOURCE_H
#include <MitkSegmentationExports.h>
#include <mitkImageSource.h>
namespace mitk
{
class ContourModelSet;
/**
* @brief Fills a given mitk::ContourModelSet into a given mitk::Image
* @ingroup Process
*/
class MITKSEGMENTATION_EXPORT ContourModelSetToImageFilter : public ImageSource
{
public:
mitkClassMacro( ContourModelSetToImageFilter, ImageSource )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(MakeOutputBinary, bool);
itkGetMacro(MakeOutputBinary, bool);
itkBooleanMacro(MakeOutputBinary);
itkSetMacro(TimeStep, unsigned int);
/**
* Allocates a new output object and returns it. Currently the
* index idx is not evaluated.
* @param idx the index of the output for which an object should be created
* @returns the new object
*/
- virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx );
+ virtual itk::DataObject::Pointer MakeOutput ( DataObjectPointerArraySizeType idx ) override;
/**
* This is a default implementation to make sure we have something.
* Once all the subclasses of ProcessObject provide an appopriate
* MakeOutput(), then ProcessObject::MakeOutput() can be made pure
* virtual.
*/
- virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name);
+ virtual itk::DataObject::Pointer MakeOutput(const DataObjectIdentifierType &name) override;
- virtual void GenerateInputRequestedRegion();
+ virtual void GenerateInputRequestedRegion() override;
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
const mitk::ContourModelSet* GetInput(void);
using itk::ProcessObject::SetInput;
virtual void SetInput(const mitk::ContourModelSet* input);
/**
* @brief Set the image which will be used to initialize the output of this filter.
* @param refImage the image used to initialize the output image
*/
void SetImage(const mitk::Image *refImage);
const mitk::Image *GetImage(void);
protected:
ContourModelSetToImageFilter();
virtual ~ContourModelSetToImageFilter();
/**
* @brief Initializes the volume of the output image with zeros
*/
void InitializeOutputEmpty();
bool m_MakeOutputBinary;
unsigned int m_TimeStep;
const mitk::Image* m_ReferenceImage;
};
}
#endif // #_MITK_CONTOURMODEL_SOURCE_H
diff --git a/Modules/Segmentation/Algorithms/mitkContourSetToPointSetFilter.h b/Modules/Segmentation/Algorithms/mitkContourSetToPointSetFilter.h
index 8a4edc3880..7ce8856154 100644
--- a/Modules/Segmentation/Algorithms/mitkContourSetToPointSetFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkContourSetToPointSetFilter.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkContourSetToPointSetFilter_h__
#define _mitkContourSetToPointSetFilter_h__
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkPointSet.h"
#include "mitkPointSetSource.h"
#include "mitkContourSet.h"
namespace mitk {
/**
*
* @brief Converts a contour set to a point set.
*
* The resulting pointset consists of sample points of all the contours
*
* @ingroup SurfaceFilters
* @ingroup Process
*/
class MITKSEGMENTATION_EXPORT ContourSetToPointSetFilter : public PointSetSource
{
public:
mitkClassMacro(ContourSetToPointSetFilter, PointSetSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(Frequency, unsigned int);
itkGetMacro(Frequency, unsigned int);
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
- virtual void GenerateData();
+ virtual void GenerateData() override;
const mitk::ContourSet* GetInput(void);
virtual void SetInput(const mitk::ContourSet *contourSet);
protected:
ContourSetToPointSetFilter();
virtual ~ContourSetToPointSetFilter();
protected:
unsigned int m_Frequency;
};
} // namespace mitk
#endif // _mitkContourSetToPointSetFilter_h__
diff --git a/Modules/Segmentation/Algorithms/mitkContourUtils.h b/Modules/Segmentation/Algorithms/mitkContourUtils.h
index c6507a0a54..2bc14c5bc5 100644
--- a/Modules/Segmentation/Algorithms/mitkContourUtils.h
+++ b/Modules/Segmentation/Algorithms/mitkContourUtils.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkContourUtilshIncludett
#define mitkContourUtilshIncludett
#include "mitkImage.h"
#include <MitkSegmentationExports.h>
#include "mitkContour.h"
#include "mitkContourModel.h"
namespace mitk
{
/**
* \brief Helpful methods for working with contours and images
*
* Legacy support for mitk::Contour
* TODO remove this class when mitk::Contour is removed
*/
class MITKSEGMENTATION_EXPORT ContourUtils : public itk::Object
{
public:
- mitkClassMacro(ContourUtils, itk::Object);
+ mitkClassMacroItkParent(ContourUtils, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Projects a contour onto an image point by point. Converts from world to index coordinates.
\param correctionForIpSegmentation adds 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)
*/
ContourModel::Pointer ProjectContourTo2DSlice(Image* slice, Contour* contourIn3D, bool correctionForIpSegmentation, bool constrainToInside);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
\param correctionForIpSegmentation subtracts 0.5 to x and y index coordinates (difference between ipSegmentation and MITK contours)
*/
ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry* sliceGeometry, Contour* contourIn2D, bool correctionForIpSegmentation = false);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
*/
void FillContourInSlice( Contour* projectedContour, Image* sliceImage, int paintingPixelValue = 1 );
protected:
ContourUtils();
virtual ~ContourUtils();
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkCorrectorAlgorithm.h b/Modules/Segmentation/Algorithms/mitkCorrectorAlgorithm.h
index 73f342021f..b2f0ca1868 100644
--- a/Modules/Segmentation/Algorithms/mitkCorrectorAlgorithm.h
+++ b/Modules/Segmentation/Algorithms/mitkCorrectorAlgorithm.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCorrectorAlgorithmhIncluded
#define mitkCorrectorAlgorithmhIncluded
#include "mitkImageToImageFilter.h"
#include <MitkSegmentationExports.h>
#include "mitkContourModel.h"
#include "ipSegmentation.h"
#include <itkImage.h>
namespace mitk
{
/**
* This class encapsulates an algorithm, which takes a 2D binary image and a contour.
* The algorithm tests if the line begins and ends inside or outside a segmentation
* and whether areas should be added to or subtracted from the segmentation shape.
*
* This class has two outputs:
* \li the modified input image from GetOutput()
*
* The output image is a combination of the original input with the generated difference image.
*
* \sa CorrectorTool2D
*/
class MITKSEGMENTATION_EXPORT CorrectorAlgorithm : public ImageToImageFilter
{
public:
mitkClassMacro(CorrectorAlgorithm, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief User drawn contour
*/
void SetContour( ContourModel* contour){this->m_Contour = contour;}
/**
* \brief Calculated difference image.
*/
//itkGetObjectMacro(DifferenceImage, Image);
// used by TobiasHeimannCorrectionAlgorithm
typedef struct
{
int lineStart;
int lineEnd;
bool modified;
std::vector< itk::Index<2> > points;
}
TSegData;
protected:
CorrectorAlgorithm();
virtual ~CorrectorAlgorithm();
// does the actual processing
- virtual void GenerateData();
+ virtual void GenerateData() override;
bool ImprovedHeimannCorrectionAlgorithm(itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer pic);
bool ModifySegment(const TSegData &segment, itk::Image< ipMITKSegmentationTYPE, 2 >::Pointer pic);
Image::Pointer m_WorkingImage;
ContourModel::Pointer m_Contour;
Image::Pointer m_DifferenceImage;
int m_FillColor;
int m_EraseColor;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkDiffImageApplier.h b/Modules/Segmentation/Algorithms/mitkDiffImageApplier.h
index 23013b3eec..91797cc3ed 100644
--- a/Modules/Segmentation/Algorithms/mitkDiffImageApplier.h
+++ b/Modules/Segmentation/Algorithms/mitkDiffImageApplier.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDiffImageApplier_h_Included
#define mitkDiffImageApplier_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkOperationActor.h"
#include "mitkImage.h"
#include <itkObjectFactory.h>
#include <itkImage.h>
namespace mitk
{
/**
\brief Applies difference images to 3D images.
This class is supposed to execute ApplyDiffImageOperations, which contain information about pixel changes within one image slice.
Class should be called from the undo stack. At the moment, ApplyDiffImageOperations are only created by OverwriteSliceImageFilter.
$Author: maleike $
*/
class MITKSEGMENTATION_EXPORT DiffImageApplier : public itk::Object, public OperationActor
{
public:
- mitkClassMacro(DiffImageApplier, Object);
+ mitkClassMacro(DiffImageApplier, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual void ExecuteOperation( Operation* operation );
+ virtual void ExecuteOperation( Operation* operation ) override;
static DiffImageApplier* GetInstanceForUndo();
protected:
DiffImageApplier(); // purposely hidden
virtual ~DiffImageApplier();
template<typename TPixel, unsigned int VImageDimension>
void ItkImageSwitch2DDiff( itk::Image<TPixel,VImageDimension>* image );
template<typename TPixel, unsigned int VImageDimension>
void ItkImageSwitch3DDiff( itk::Image<TPixel,VImageDimension>* image );
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void ItkImageProcessing2DDiff( itk::Image<TPixel1,VImageDimension1>* itkImage1, itk::Image<TPixel2,VImageDimension2>* itkImage2 );
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void ItkImageProcessing3DDiff( itk::Image<TPixel1,VImageDimension1>* itkImage1, itk::Image<TPixel2,VImageDimension2>* itkImage2 );
template<typename TPixel, unsigned int VImageDimension>
void ItkInvertPixelValues( itk::Image<TPixel,VImageDimension>* itkImage );
Image::Pointer m_Image;
Image::Pointer m_SliceDifferenceImage;
unsigned int m_SliceIndex;
unsigned int m_SliceDimension;
unsigned int m_TimeStep;
unsigned int m_Dimension0;
unsigned int m_Dimension1;
double m_Factor;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkDiffSliceOperationApplier.h b/Modules/Segmentation/Algorithms/mitkDiffSliceOperationApplier.h
index 57c69959dc..d69f16c49a 100644
--- a/Modules/Segmentation/Algorithms/mitkDiffSliceOperationApplier.h
+++ b/Modules/Segmentation/Algorithms/mitkDiffSliceOperationApplier.h
@@ -1,64 +1,64 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkDiffSliceOpertationApplier_h_Included
#define mitkDiffSliceOpertationApplier_h_Included
#include <MitkSegmentationExports.h>
#include "mitkCommon.h"
#include <mitkOperationActor.h>
#include "mitkDiffSliceOperation.h"
#include <mitkExtractSliceFilter.h>
#include <mitkVtkImageOverwrite.h>
namespace mitk
{
/** \brief Executes a DiffSliceOperation.
\sa DiffSliceOperation
*/
class MITKSEGMENTATION_EXPORT DiffSliceOperationApplier : public OperationActor
{
public:
mitkClassMacro(DiffSliceOperationApplier, OperationActor)
//itkFactorylessNewMacro(Self)
//itkCloneMacro(Self)
/** \brief Returns an instance of the class */
static DiffSliceOperationApplier* GetInstance();
/** \brief Executes a DiffSliceOperation.
\sa DiffSliceOperation
Note:
Only DiffSliceOperation is supported.
*/
- virtual void ExecuteOperation(Operation* op);
+ virtual void ExecuteOperation(Operation* op) override;
protected:
DiffSliceOperationApplier();
virtual ~DiffSliceOperationApplier();
//static DiffSliceOperationApplier* s_Instance;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h b/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
index e4adde8fbc..e8a13b6564 100644
--- a/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
@@ -1,167 +1,167 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkImageLiveWireContourModelFilter_h__
#define _mitkImageLiveWireContourModelFilter_h__
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
#include <mitkImage.h>
#include <mitkImageAccessByItk.h>
#include <mitkImageCast.h>
#include <itkShortestPathCostFunctionLiveWire.h>
#include <itkShortestPathImageFilter.h>
namespace mitk {
/**
\brief Calculates a LiveWire contour between two points in an image.
For defining costs between two pixels specific features are extraced from the image and tranformed into a single cost value.
\sa ShortestPathCostFunctionLiveWire
The filter is able to create dynamic cost tranfer map and thus use on the fly training.
\Note On the fly training will only be used for next update.
The computation uses the last calculated segment to map cost according to features in the area of the segment.
For time resolved purposes use ImageLiveWireContourModelFilter::SetTimestep( unsigned int ) to create the LiveWire contour
at a specific timestep.
\ingroup ContourModelFilters
\ingroup Process
*/
class MITKSEGMENTATION_EXPORT ImageLiveWireContourModelFilter : public ContourModelSource
{
public:
mitkClassMacro(ImageLiveWireContourModelFilter, ContourModelSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef ContourModel OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef mitk::Image InputType;
typedef itk::Image< float, 2 > InternalImageType;
typedef itk::ShortestPathImageFilter< InternalImageType, InternalImageType > ShortestPathImageFilterType;
typedef itk::ShortestPathCostFunctionLiveWire< InternalImageType > CostFunctionType;
typedef std::vector< itk::Index<2> > ShortestPathType;
/** \brief start point in world coordinates*/
itkSetMacro(StartPoint, mitk::Point3D);
itkGetMacro(StartPoint, mitk::Point3D);
/** \brief end point in woorld coordinates*/
itkSetMacro(EndPoint, mitk::Point3D);
itkGetMacro(EndPoint, mitk::Point3D);
/** \brief Create dynamic cost tranfer map - use on the fly training.
\Note On the fly training will be used for next update only.
The computation uses the last calculated segment to map cost according to features in the area of the segment.
*/
itkSetMacro(UseDynamicCostMap, bool);
itkGetMacro(UseDynamicCostMap, bool);
/** \brief Actual time step
*/
itkSetMacro(TimeStep, unsigned int);
itkGetMacro(TimeStep, unsigned int);
/** \brief Clear all repulsive points used in the cost function
*/
void ClearRepulsivePoints();
/** \brief Set a vector with repulsive points to use in the cost function
*/
void SetRepulsivePoints(const ShortestPathType& points);
/** \brief Add a single repulsive point to the cost function
*/
void AddRepulsivePoint( const itk::Index<2>& idx );
/** \brief Remove a single repulsive point from the cost function
*/
void RemoveRepulsivePoint( const itk::Index<2>& idx );
virtual void SetInput( const InputType *input);
virtual void SetInput( unsigned int idx, const InputType * input);
const InputType* GetInput(void);
const InputType* GetInput(unsigned int idx);
virtual OutputType* GetOutput();
virtual void DumpMaskImage();
/** \brief Create dynamic cost tranfer map - on the fly training*/
bool CreateDynamicCostMap(mitk::ContourModel* path=NULL);
protected:
ImageLiveWireContourModelFilter();
virtual ~ImageLiveWireContourModelFilter();
- void GenerateOutputInformation() {};
+ void GenerateOutputInformation() override {};
- void GenerateData();
+ void GenerateData() override;
void UpdateLiveWire();
/** \brief start point in worldcoordinates*/
mitk::Point3D m_StartPoint;
/** \brief end point in woorldcoordinates*/
mitk::Point3D m_EndPoint;
/** \brief Start point in index*/
mitk::Point3D m_StartPointInIndex;
/** \brief End point in index*/
mitk::Point3D m_EndPointInIndex;
/** \brief The cost function to compute costs between two pixels*/
CostFunctionType::Pointer m_CostFunction;
/** \brief Shortest path filter according to cost function m_CostFunction*/
ShortestPathImageFilterType::Pointer m_ShortestPathFilter;
/** \brief Flag to use a dynmic cost map or not*/
bool m_UseDynamicCostMap;
unsigned int m_TimeStep;
template<typename TPixel, unsigned int VImageDimension>
void ItkPreProcessImage (const itk::Image<TPixel, VImageDimension>* inputImage);
template<typename TPixel, unsigned int VImageDimension>
void CreateDynamicCostMapByITK(const itk::Image<TPixel, VImageDimension>* inputImage, mitk::ContourModel* path=NULL);
InternalImageType::Pointer m_InternalImage;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkImageToContourFilter.h b/Modules/Segmentation/Algorithms/mitkImageToContourFilter.h
index 9469cfa5df..17eebee4db 100644
--- a/Modules/Segmentation/Algorithms/mitkImageToContourFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkImageToContourFilter.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkImageToContourFilter_h_Included
#define mitkImageToContourFilter_h_Included
//#include "MitkSBExports.h"
#include <MitkSegmentationExports.h>
#include "itkImage.h"
#include "mitkImage.h"
#include "itkContourExtractor2DImageFilter.h"
#include "mitkImageToSurfaceFilter.h"
#include "mitkSurface.h"
#include "vtkPolyData.h"
#include "vtkPolygon.h"
#include "vtkCellArray.h"
#include "mitkProgressBar.h"
namespace mitk {
/**
\brief A filter that can extract contours out of a 2D binary image
This class takes an 2D mitk::Image as input and extracts all contours which are drawn it. The contour
extraction is done by using the itk::ContourExtractor2DImageFilter.
The output is a mitk::Surface.
$Author: fetzer$
*/
class MITKSEGMENTATION_EXPORT ImageToContourFilter : public ImageToSurfaceFilter
{
public:
mitkClassMacro(ImageToContourFilter,ImageToSurfaceFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Set macro for the geometry of the slice. If it is not set explicitly the geometry will be taken from the slice
\a Parameter The slice`s geometry
*/
itkSetMacro(SliceGeometry, BaseGeometry*);
//typedef unsigned int VDimension;
typedef itk::PolyLineParametricPath<2> PolyLineParametricPath2D;
typedef PolyLineParametricPath2D::VertexListType ContourPath;
/**
\brief Set whether the mitkProgressBar should be used
\a Parameter true for using the progress bar, false otherwise
*/
void SetUseProgressBar(bool);
/**
\brief Set the stepsize which the progress bar should proceed
\a Parameter The stepsize for progressing
*/
void SetProgressStepSize(unsigned int stepSize);
protected:
ImageToContourFilter();
virtual ~ImageToContourFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
private:
const BaseGeometry* m_SliceGeometry;
bool m_UseProgressBar;
unsigned int m_ProgressStepSize;
template<typename TPixel, unsigned int VImageDimension>
void Itk2DContourExtraction (const itk::Image<TPixel, VImageDimension>* sliceImage);
};//class
}//namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkImageToLiveWireContourFilter.h b/Modules/Segmentation/Algorithms/mitkImageToLiveWireContourFilter.h
index a32eb72a4c..b1fa6807ce 100644
--- a/Modules/Segmentation/Algorithms/mitkImageToLiveWireContourFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkImageToLiveWireContourFilter.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkImageToLiveWireContourFilter_h__
#define _mitkImageToLiveWireContourFilter_h__
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
#include <mitkImage.h>
#include <mitkImageAccessByItk.h>
#include <mitkImageCast.h>
namespace mitk {
/**
*
* \brief
*
* \ingroup ContourModelFilters
* \ingroup Process
*/
class MITKSEGMENTATION_EXPORT ImageToLiveWireContourFilter : public ContourModelSource
{
public:
mitkClassMacro(ImageToLiveWireContourFilter, ContourModelSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef ContourModel OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef mitk::Image InputType;
itkSetMacro(StartPoint, mitk::Point3D);
itkGetMacro(StartPoint, mitk::Point3D);
itkSetMacro(EndPoint, mitk::Point3D);
itkGetMacro(EndPoint, mitk::Point3D);
virtual void SetInput( const InputType *input);
virtual void SetInput( unsigned int idx, const InputType * input);
const InputType* GetInput(void);
const InputType* GetInput(unsigned int idx);
protected:
ImageToLiveWireContourFilter();
virtual ~ImageToLiveWireContourFilter();
- void GenerateData();
+ void GenerateData() override;
- void GenerateOutputInformation() {};
+ void GenerateOutputInformation() override {};
mitk::Point3D m_StartPoint;
mitk::Point3D m_EndPoint;
mitk::Point3D m_StartPointInIndex;
mitk::Point3D m_EndPointInIndex;
private:
template<typename TPixel, unsigned int VImageDimension>
void ItkProcessImage (const itk::Image<TPixel, VImageDimension>* inputImage);
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkManualSegmentationToSurfaceFilter.h b/Modules/Segmentation/Algorithms/mitkManualSegmentationToSurfaceFilter.h
index df38b740f3..c11fc6515c 100644
--- a/Modules/Segmentation/Algorithms/mitkManualSegmentationToSurfaceFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkManualSegmentationToSurfaceFilter.h
@@ -1,170 +1,170 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKMANUALSEGMENTATIONTISURFACEFILTER_h__
#define _MITKMANUALSEGMENTATIONTISURFACEFILTER_h__
#include <mitkImageToSurfaceFilter.h>
#include <MitkSegmentationExports.h>
#include <vtkImageGaussianSmooth.h>
#include <vtkImageMedian3D.h>
#include <vtkImageResample.h>
#include <vtkImageThreshold.h>
namespace mitk {
/**
* @brief Supplies a 3D surface from pre-processed segmentation.
*
* The resulting surface depends on a filter pipeline based on vtkMedian (1) and a Gaussian filter with vtkImageGaussianSmooth (2).
* All voxel can be changed to an isotropic representation of the
* image (ATTANTION: the number of voxels in the will change). The
* resulting isotropic image has 1mm isotropic voxel by default. But
* can be varied freely.
*
* @ingroup ImageFilters
* @ingroup Process
*/
class MITKSEGMENTATION_EXPORT ManualSegmentationToSurfaceFilter : public ImageToSurfaceFilter
{
public:
mitkClassMacro(ManualSegmentationToSurfaceFilter,ImageToSurfaceFilter);
typedef double vtkDouble;
/**
* Will pre-process a segmentation voxelwise. The segmentation can use
* a hole fill relating a median filter and smooth by a Gaussian
* filter.
* The image can be interpolated to an isotropic image.
* By default every filter is disabled.
* This method calls CreateSurface from mitkImageToSurfaceFilter and
* does not need a manual call since we use Update().
*/
- virtual void GenerateData();
+ virtual void GenerateData() override;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* Supplies a method for setting median filter by a bool value.
*/
itkSetMacro(MedianFilter3D,bool);
/**
* Return state if median filter is enabled.
*/
itkGetConstMacro(MedianFilter3D,bool);
/**
* Enable the median filter (first filter in pipeline).
*/
itkBooleanMacro(MedianFilter3D);
/**
* Supplies a method to enable Interpolation.
*/
itkSetMacro(Interpolation,bool);
/**
* Returns activation state of interpolation filter.
*/
itkGetConstMacro(Interpolation,bool);
/**
* Enable the interpolation filter (second filter in pipeline) for
* isotropic voxel.
*/
itkBooleanMacro(Interpolation);
/**
* Supplies a method for Gaussian filter (third filter in pipeline).
*/
itkSetMacro(UseGaussianImageSmooth,bool);
/**
* Returns activation state of standard deviation filter.
*/
itkGetConstMacro(UseGaussianImageSmooth,bool);
/**
* Enables Gaussian image smooth. As well the threshold for the
* CreateSurface() method will raise the threshold to 49 and changes
* the image range set from 0 to 100. It is made for reasons in
* binary images to prevent conflicts with the used filter. There are
* better results for dividing fore- and background.
*/
itkBooleanMacro(UseGaussianImageSmooth);
/**
* Set standard deviation for Gaussian Filter.
* @param _arg by default 1.5
*/
itkSetMacro(GaussianStandardDeviation, double);
/**
* Returns the standard deviation of the Gaussian filter which will be
* used when filter is enabled.
*/
itkGetConstMacro(GaussianStandardDeviation, double);
/**
* Set the Kernel for Median3DFilter. By default kernel is set to 3x3x3.
* If you choose '1' nothing will be processed in this direction.
*/
void SetMedianKernelSize(int x, int y, int z);
/**
* Returns the kernel size in the first direction.
*/
itkGetConstMacro(MedianKernelSizeX, int);
/**
* Returns the kernel size in the second direction.
*/
itkGetConstMacro(MedianKernelSizeY, int);
/**
* Returns the kernel size in the third direction.
*/
itkGetConstMacro(MedianKernelSizeZ, int);
/**
* Set the values for Spacing in X, Y and Z-Dimension
*/
void SetInterpolation(vtkDouble x, vtkDouble y, vtkDouble z);
protected:
ManualSegmentationToSurfaceFilter();
virtual ~ManualSegmentationToSurfaceFilter();
bool m_MedianFilter3D;
int m_MedianKernelSizeX, m_MedianKernelSizeY, m_MedianKernelSizeZ;
bool m_UseGaussianImageSmooth; //Gaussian Filter
double m_GaussianStandardDeviation;
bool m_Interpolation;
vtkDouble m_InterpolationX;
vtkDouble m_InterpolationY;
vtkDouble m_InterpolationZ;
};//namespace
}
#endif //_MITKMANUALSEGMENTATIONTISURFACEFILTER_h__
diff --git a/Modules/Segmentation/Algorithms/mitkOtsuSegmentationFilter.h b/Modules/Segmentation/Algorithms/mitkOtsuSegmentationFilter.h
index 0472b794ca..a06a6e7798 100644
--- a/Modules/Segmentation/Algorithms/mitkOtsuSegmentationFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkOtsuSegmentationFilter.h
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkOtsuSegmentationFilter_h_Included
#define mitkOtsuSegmentationFilter_h_Included
//#include "MitkSBExports.h"
#include "mitkImageToImageFilter.h"
#include "mitkImage.h"
#include "mitkITKImageImport.h"
#include "itkImage.h"
#include <MitkSegmentationExports.h>
namespace mitk {
/**
\brief A filter that performs a multiple threshold otsu image segmentation.
This class being an mitk::ImageToImageFilter performs a multiple threshold otsu image segmentation based on the image histogram.
Internally, the itk::OtsuMultipleThresholdsImageFilter is used.
$Author: somebody$
*/
class MITKSEGMENTATION_EXPORT OtsuSegmentationFilter : public ImageToImageFilter
{
public:
typedef unsigned char OutputPixelType;
typedef itk::Image< OutputPixelType, 3 > itkOutputImageType;
typedef mitk::ITKImageImport<itkOutputImageType> ImageConverterType;
mitkClassMacro(OtsuSegmentationFilter,ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro(NumberOfThresholds, unsigned int);
void SetNumberOfThresholds( unsigned int number )
{
if (number < 1)
{
MITK_WARN << "Tried to set an invalid number of thresholds in the OtsuSegmentationFilter.";
return;
}
m_NumberOfThresholds = number;
}
void SetValleyEmphasis( bool useValley )
{
m_ValleyEmphasis = useValley;
}
void SetNumberOfBins( unsigned int number )
{
if (number < 1)
{
MITK_WARN << "Tried to set an invalid number of bins in the OtsuSegmentationFilter.";
return;
}
m_NumberOfBins = number;
}
protected:
OtsuSegmentationFilter();
virtual ~OtsuSegmentationFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
//virtual void GenerateOutputInformation();
private:
unsigned int m_NumberOfThresholds;
bool m_ValleyEmphasis;
unsigned int m_NumberOfBins;
};//class
}//namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkOverwriteDirectedPlaneImageFilter.h b/Modules/Segmentation/Algorithms/mitkOverwriteDirectedPlaneImageFilter.h
index 180b87c64b..a7abe55c17 100644
--- a/Modules/Segmentation/Algorithms/mitkOverwriteDirectedPlaneImageFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkOverwriteDirectedPlaneImageFilter.h
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkOverwriteDirectedPlaneImageFilter_h_Included
#define mitkOverwriteDirectedPlaneImageFilter_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkImageToImageFilter.h"
#include <itkImage.h>
namespace mitk
{
/**
\deprecated This class is deprecated. Use mitkVtkImageOverwrite instead.
\sa mitkVtkImageOverwrite
\brief Writes a 2D slice into a 3D image.
\sa SegTool2D
\sa ContourTool
\sa ExtractImageFilter
\ingroup Process
\ingroup Reliver
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkInteractiveSegmentationTechnicalPage
This class takes a 3D mitk::Image as input and tries to replace one slice in it with the second input image, which is specified
by calling SetSliceImage with a 2D mitk::Image.
Two parameters determine which slice is replaced: the "slice dimension" is that one, which is constant for all points in the plane, e.g. axial would mean 2.
The "slice index" is the slice index in the image direction you specified with "affected dimension". Indices count from zero.
This class works with all kind of image types, the only restrictions being that the input is 3D, and the slice image is 2D.
If requested by SetCreateUndoInformation(true), this class will create instances of ApplyDiffImageOperation for the undo stack.
These operations will (on user request) be executed by DiffImageApplier to perform undo.
Last contributor: $Author: maleike $
*/
class MITKSEGMENTATION_EXPORT OverwriteDirectedPlaneImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(OverwriteDirectedPlaneImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Which plane to overwrite
*/
const BaseGeometry* GetPlaneGeometry3D() const { return m_PlaneGeometry; }
void SetPlaneGeometry3D( const BaseGeometry *geometry ) { m_PlaneGeometry = geometry; }
/**
\brief Time step of the slice to overwrite
*/
itkSetMacro(TimeStep, unsigned int);
itkGetConstMacro(TimeStep, unsigned int);
/**
\brief Whether to create undo operation in the MITK undo stack
*/
itkSetMacro(CreateUndoInformation, bool);
itkGetConstMacro(CreateUndoInformation, bool);
itkSetObjectMacro(SliceImage, Image);
const Image* GetSliceImage() { return m_SliceImage.GetPointer(); }
const Image* GetLastDifferenceImage() { return m_SliceDifferenceImage.GetPointer(); }
protected:
OverwriteDirectedPlaneImageFilter(); // purposely hidden
virtual ~OverwriteDirectedPlaneImageFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
template<typename TPixel, unsigned int VImageDimension>
void ItkSliceOverwriting ( itk::Image<TPixel, VImageDimension>* input3D);
template<typename TPixel, unsigned int VImageDimension>
void ItkImageSwitch( itk::Image<TPixel,VImageDimension>* image );
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void ItkImageProcessing( itk::Image<TPixel1,VImageDimension1>* itkImage1, itk::Image<TPixel2,VImageDimension2>* itkImage2 );
//std::string EventDescription( unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep );
Image::ConstPointer m_SliceImage;
Image::Pointer m_SliceDifferenceImage;
const BaseGeometry *m_PlaneGeometry;
const BaseGeometry *m_ImageGeometry3D;
unsigned int m_TimeStep;
unsigned int m_Dimension0;
unsigned int m_Dimension1;
bool m_CreateUndoInformation;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkOverwriteSliceImageFilter.h b/Modules/Segmentation/Algorithms/mitkOverwriteSliceImageFilter.h
index 08d0d01dbf..0638d6a4b5 100644
--- a/Modules/Segmentation/Algorithms/mitkOverwriteSliceImageFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkOverwriteSliceImageFilter.h
@@ -1,127 +1,127 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkOverwriteSliceImageFilter_h_Included
#define mitkOverwriteSliceImageFilter_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkImageToImageFilter.h"
#include <itkImage.h>
namespace mitk
{
/**
\deprecated This class is deprecated. Use mitkVtkImageOverwrite instead.
\sa mitkVtkImageOverwrite
\brief Writes a 2D slice into a 3D image.
\sa SegTool2D
\sa ContourTool
\sa ExtractImageFilter
\ingroup Process
\ingroup ToolManagerEtAl
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkInteractiveSegmentationTechnicalPage
This class takes a 3D mitk::Image as input and tries to replace one slice in it with the second input image, which is specified
by calling SetSliceImage with a 2D mitk::Image.
Two parameters determine which slice is replaced: the "slice dimension" is that one, which is constant for all points in the plane, e.g. axial would mean 2.
The "slice index" is the slice index in the image direction you specified with "affected dimension". Indices count from zero.
This class works with all kind of image types, the only restrictions being that the input is 3D, and the slice image is 2D.
If requested by SetCreateUndoInformation(true), this class will create instances of ApplyDiffImageOperation for the undo stack.
These operations will (on user request) be executed by DiffImageApplier to perform undo.
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT OverwriteSliceImageFilter : public ImageToImageFilter
{
public:
mitkClassMacro(OverwriteSliceImageFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Which slice to overwrite (first one has index 0).
*/
itkSetMacro(SliceIndex, unsigned int);
itkGetConstMacro(SliceIndex, unsigned int);
/**
\brief The orientation of the slice to overwrite.
\a Parameter \a SliceDimension Number of the dimension which is constant for all pixels of the desired slices (e.g. 0 for axial)
*/
itkSetMacro(SliceDimension, unsigned int);
itkGetConstMacro(SliceDimension, unsigned int);
/**
\brief Time step of the slice to overwrite
*/
itkSetMacro(TimeStep, unsigned int);
itkGetConstMacro(TimeStep, unsigned int);
/**
\brief Whether to create undo operation in the MITK undo stack
*/
itkSetMacro(CreateUndoInformation, bool);
itkGetConstMacro(CreateUndoInformation, bool);
itkSetObjectMacro(SliceImage, Image);
const Image* GetSliceImage() { return m_SliceImage.GetPointer(); }
const Image* GetLastDifferenceImage() { return m_SliceDifferenceImage.GetPointer(); }
protected:
OverwriteSliceImageFilter(); // purposely hidden
virtual ~OverwriteSliceImageFilter();
- virtual void GenerateData();
+ virtual void GenerateData() override;
template<typename TPixel, unsigned int VImageDimension>
void ItkImageSwitch( itk::Image<TPixel,VImageDimension>* image );
template<typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
void ItkImageProcessing( const itk::Image<TPixel1,VImageDimension1>* itkImage1, itk::Image<TPixel2,VImageDimension2>* itkImage2 );
std::string EventDescription( unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep );
Image::ConstPointer m_SliceImage;
Image::Pointer m_SliceDifferenceImage;
unsigned int m_SliceIndex;
unsigned int m_SliceDimension;
unsigned int m_TimeStep;
unsigned int m_Dimension0;
unsigned int m_Dimension1;
bool m_CreateUndoInformation;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkSegmentationInterpolationAlgorithm.h b/Modules/Segmentation/Algorithms/mitkSegmentationInterpolationAlgorithm.h
index 45e0b27ffa..5a98f509bd 100644
--- a/Modules/Segmentation/Algorithms/mitkSegmentationInterpolationAlgorithm.h
+++ b/Modules/Segmentation/Algorithms/mitkSegmentationInterpolationAlgorithm.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSegmentationInterpolationAlgorithm_h_Included
#define mitkSegmentationInterpolationAlgorithm_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkImage.h"
#include <itkObjectFactory.h>
namespace mitk
{
/**
* \brief Interface class for interpolation algorithms
*
* Interpolation algorithms estimate a binary image (segmentation) given
* manual segmentations of neighboring slices. They get the following inputs:
*
* - slice orientation of given and requested slices (dimension which is constant for all pixels of the meant orientation, e.g. 2 for axial).
* - slice indices of the neighboring slices (for upper and lower slice)
* - slice data of the neighboring slices (for upper and lower slice)
* - slice index of the requested slice (guaranteed to be between upper and lower index)
* - image data of the original patient image that is being segmented (optional, may not be present)
* - time step of the requested slice (needed to read out original image data)
*
* Concrete algorithms can use e.g. itk::ImageSliceConstIteratorWithIndex to
* inspect the original patient image at appropriate positions - if they
* want to take image data into account.
*
* All processing is triggered by calling Interpolate().
*
* Last contributor:
* $Author:$
*/
class MITKSEGMENTATION_EXPORT SegmentationInterpolationAlgorithm : public itk::Object
{
public:
- mitkClassMacro(SegmentationInterpolationAlgorithm, itk::Object);
+ mitkClassMacroItkParent(SegmentationInterpolationAlgorithm, itk::Object);
virtual Image::Pointer Interpolate(Image::ConstPointer lowerSlice, unsigned int lowerSliceIndex,
Image::ConstPointer upperSlice, unsigned int upperSliceIndex,
unsigned int requestedIndex,
unsigned int sliceDimension,
Image::Pointer resultImage,
unsigned int timeStep = 0,
Image::ConstPointer referenceImage = NULL) = 0;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkSegmentationObjectFactory.h b/Modules/Segmentation/Algorithms/mitkSegmentationObjectFactory.h
index 9a2e25bdd0..7c05181eab 100644
--- a/Modules/Segmentation/Algorithms/mitkSegmentationObjectFactory.h
+++ b/Modules/Segmentation/Algorithms/mitkSegmentationObjectFactory.h
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef SEGMENTATIONOBJECTFACTORY_H_INCLUDED
#define SEGMENTATIONOBJECTFACTORY_H_INCLUDED
#include "mitkCoreObjectFactoryBase.h"
#include <MitkSegmentationExports.h>
namespace mitk {
class MITKSEGMENTATION_EXPORT SegmentationObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(SegmentationObjectFactory,CoreObjectFactoryBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
- virtual void SetDefaultProperties(mitk::DataNode* node);
- virtual const char* GetFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
- virtual const char* GetSaveFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
+ virtual const char* GetFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
+ virtual const char* GetSaveFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
void RegisterIOFactories();
protected:
SegmentationObjectFactory();
void CreateFileExtensionsMap();
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkShapeBasedInterpolationAlgorithm.h b/Modules/Segmentation/Algorithms/mitkShapeBasedInterpolationAlgorithm.h
index 1a31b089d4..afe2ebcce1 100644
--- a/Modules/Segmentation/Algorithms/mitkShapeBasedInterpolationAlgorithm.h
+++ b/Modules/Segmentation/Algorithms/mitkShapeBasedInterpolationAlgorithm.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkShapeBasedInterpolationAlgorithm_h_Included
#define mitkShapeBasedInterpolationAlgorithm_h_Included
#include "mitkSegmentationInterpolationAlgorithm.h"
#include "mitkLegacyAdaptors.h"
#include <MitkSegmentationExports.h>
namespace mitk
{
/**
* \brief Shape-based binary image interpolation.
*
* This class uses legacy code from ipSegmentation to implement
* the shape-based interpolation algorithm described in
*
* G.T. Herman, J. Zheng, C.A. Bucholtz: "Shape-based interpolation"
* IEEE Computer Graphics & Applications, pp. 69-79,May 1992
*
* Last contributor:
* $Author:$
*/
class MITKSEGMENTATION_EXPORT ShapeBasedInterpolationAlgorithm : public SegmentationInterpolationAlgorithm
{
public:
mitkClassMacro(ShapeBasedInterpolationAlgorithm, SegmentationInterpolationAlgorithm);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
Image::Pointer Interpolate(Image::ConstPointer lowerSlice, unsigned int lowerSliceIndex,
Image::ConstPointer upperSlice, unsigned int upperSliceIndex,
unsigned int requestedIndex,
unsigned int sliceDimension,
Image::Pointer resultImage,
unsigned int timeStep,
- Image::ConstPointer referenceImage);
+ Image::ConstPointer referenceImage) override;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSmoothedSurface.h b/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSmoothedSurface.h
index 7d073e3478..ddec1f5e51 100644
--- a/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSmoothedSurface.h
+++ b/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSmoothedSurface.h
@@ -1,46 +1,46 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_SHOW_SEGMENTATION_AS_SMOOTHED_SURFACE_H
#define MITK_SHOW_SEGMENTATION_AS_SMOOTHED_SURFACE_H
#include <MitkSegmentationExports.h>
#include "mitkSegmentationSink.h"
#include <mitkSurface.h>
namespace mitk
{
class MITKSEGMENTATION_EXPORT ShowSegmentationAsSmoothedSurface : public SegmentationSink
{
public:
mitkClassMacro(ShowSegmentationAsSmoothedSurface, SegmentationSink);
mitkAlgorithmNewMacro(ShowSegmentationAsSmoothedSurface);
protected:
- void Initialize(const NonBlockingAlgorithm *other = NULL);
- bool ReadyToRun();
- bool ThreadedUpdateFunction();
- void ThreadedUpdateSuccessful();
+ void Initialize(const NonBlockingAlgorithm *other = NULL) override;
+ bool ReadyToRun() override;
+ bool ThreadedUpdateFunction() override;
+ void ThreadedUpdateSuccessful() override;
private:
ShowSegmentationAsSmoothedSurface();
~ShowSegmentationAsSmoothedSurface();
Surface::Pointer m_Surface;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSurface.h b/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSurface.h
index e7b667222a..538d6a6764 100644
--- a/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSurface.h
+++ b/Modules/Segmentation/Algorithms/mitkShowSegmentationAsSurface.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_SHOW_SEGMENTATION_AS_SURFACE_H_INCLUDET_WAD
#define MITK_SHOW_SEGMENTATION_AS_SURFACE_H_INCLUDET_WAD
#include "mitkSegmentationSink.h"
#include <MitkSegmentationExports.h>
#include "mitkUIDGenerator.h"
#include "mitkSurface.h"
namespace mitk
{
class MITKSEGMENTATION_EXPORT ShowSegmentationAsSurface : public SegmentationSink
{
public:
mitkClassMacro( ShowSegmentationAsSurface, SegmentationSink )
mitkAlgorithmNewMacro( ShowSegmentationAsSurface );
protected:
ShowSegmentationAsSurface(); // use smart pointers
virtual ~ShowSegmentationAsSurface();
- virtual void Initialize(const NonBlockingAlgorithm* other = NULL);
- virtual bool ReadyToRun();
+ virtual void Initialize(const NonBlockingAlgorithm* other = NULL) override;
+ virtual bool ReadyToRun() override;
- virtual bool ThreadedUpdateFunction(); // will be called from a thread after calling StartAlgorithm
+ virtual bool ThreadedUpdateFunction() override; // will be called from a thread after calling StartAlgorithm
- virtual void ThreadedUpdateSuccessful(); // will be called from a thread after calling StartAlgorithm
+ virtual void ThreadedUpdateSuccessful() override; // will be called from a thread after calling StartAlgorithm
private:
UIDGenerator m_UIDGeneratorSurfaces;
Surface::Pointer m_Surface;
DataNode::Pointer m_Node;
bool m_AddToTree;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkVtkImageOverwrite.h b/Modules/Segmentation/Algorithms/mitkVtkImageOverwrite.h
index b975195bc7..211c44df2f 100644
--- a/Modules/Segmentation/Algorithms/mitkVtkImageOverwrite.h
+++ b/Modules/Segmentation/Algorithms/mitkVtkImageOverwrite.h
@@ -1,88 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkVtkImageOverwrite_h_Included
#define mitkVtkImageOverwrite_h_Included
#include <vtkImageReslice.h>
#include <MitkSegmentationExports.h>
/** \brief A vtk Filter based on vtkImageReslice with the aditional feature to write a slice into the given input volume.
All optimizations for e.g. the plane directions or interpolation are stripped away, the algorithm only interpolates nearest
neighbor and uses the non optimized execute function of vtkImageReslice. Note that any interpolation doesn't make sense
for round trip use extract->edit->overwrite, because it is nearly impossible to invert the interolation.
There are two use cases for the Filter which are specified by the overwritemode property:
1)Extract slices from a 3D volume.
Overwritemode = false
In this mode the class can be used like vtkImageReslice. The usual way to do this is:
- Set an image volume as input
- Set the ResliceAxes via SetResliceAxesDirectionCosines and SetResliceAxesOrigin
- Set the the OutputSpacing, OutputOrigin and OutputExtent
- Call Update
2)Overwrite a 3D volume at a given slice.
Overwritemode = true
The handling in this mode is quite similar to the description above with the addition that the
InputSlice needs to be specified via SetInputSlice(vtkImageData*).
- Set the properties mentioned above (Note that SetInput specifies the volume to write to)
- Set the slice to that has to be overwritten in the volume ( SetInputSlice(vtkImageData*)
After calling Update() there is no need to retrieve the output as the input volume is modified.
\sa vtkImageReslice
(Note that the execute and interpolation functions are no members and thus can not be overriden)
*/
class MITKSEGMENTATION_EXPORT mitkVtkImageOverwrite : public vtkImageReslice
{
public:
static mitkVtkImageOverwrite *New();
vtkTypeMacro(mitkVtkImageOverwrite, vtkImageReslice);
/** \brief Set the mode either to reslice (false) or to overwrite (true).
Default: false
*/
void SetOverwriteMode(bool b);
bool IsOverwriteMode(){return m_Overwrite_Mode;}
/** \brief Set the slice for overwrite mode.
Note:
It is recommend not to use this in reslice mode because otherwise the slice will be modified!
*/
void SetInputSlice(vtkImageData* slice);
protected:
mitkVtkImageOverwrite();
virtual ~mitkVtkImageOverwrite();
bool m_Overwrite_Mode;
/** Overridden from vtkImageReslice. \sa vtkImageReslice::ThreadedRequestData */
virtual void ThreadedRequestData(vtkInformation *vtkNotUsed(request),
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *vtkNotUsed(outputVector),
vtkImageData ***inData,
vtkImageData **outData,
- int outExt[6], int id);
+ int outExt[6], int id) override;
};
#endif //mitkVtkImageOverwrite_h_Included
diff --git a/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h b/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
index 4ff27cd061..750133c084 100644
--- a/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
+++ b/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
@@ -1,209 +1,209 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSegmentationInterpolationController_h_Included
#define mitkSegmentationInterpolationController_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkImage.h"
#include <itkImage.h>
#include <itkObjectFactory.h>
#include <vector>
#include <map>
namespace mitk
{
class Image;
/**
\brief Generates interpolations of 2D slices.
\sa QmitkSlicesInterpolator
\sa QmitkInteractiveSegmentation
\ingroup ToolManagerEtAl
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkInteractiveSegmentationTechnicalPage
This class keeps track of the contents of a 3D segmentation image.
\attention mitk::SegmentationInterpolationController assumes that the image contains pixel values of 0 and 1.
After you set the segmentation image using SetSegmentationVolume(), the whole image is scanned for pixels other than 0.
SegmentationInterpolationController registers as an observer to the segmentation image, and repeats the scan whenvever the
image is modified.
You can prevent this (time consuming) scan if you do the changes slice-wise and send difference images to SegmentationInterpolationController.
For this purpose SetChangedSlice() should be used. mitk::OverwriteImageFilter already does this every time it changes a
slice of an image. There is a static method InterpolatorForImage(), which can be used to find out if there already is an interpolator
instance for a specified image. OverwriteImageFilter uses this to get to know its interpolator.
SegmentationInterpolationController needs to maintain some information about the image slices (in every dimension).
This information is stored internally in m_SegmentationCountInSlice, which is basically three std::vectors (one for each dimension).
Each item describes one image dimension, each vector item holds the count of pixels in "its" slice. This is perhaps better to understand
from the following picture (where red items just mean to symbolize "there is some segmentation" - in reality there is an integer count).
\image html slice_based_segmentation_interpolator.png
$Author$
*/
class MITKSEGMENTATION_EXPORT SegmentationInterpolationController : public itk::Object
{
public:
- mitkClassMacro(SegmentationInterpolationController, itk::Object);
+ mitkClassMacroItkParent(SegmentationInterpolationController, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
\brief Find interpolator for a given image.
\return NULL if there is no interpolator yet.
This method is useful if several "clients" modify the same image and want to access the interpolations.
Then they can share the same object.
*/
static SegmentationInterpolationController* InterpolatorForImage(const Image*);
/**
\brief Block reaction to an images Modified() events.
Blocking the scan of the whole image is especially useful when you are about to change a single slice
of the image. Then you would send a difference image of this single slice to SegmentationInterpolationController
but call image->Modified() anyway. Before calling image->Modified() you should block
SegmentationInterpolationController's reactions to this modified by using this method.
*/
void BlockModified(bool);
/**
\brief Initialize with a whole volume.
Will scan the volume for segmentation pixels (values other than 0) and fill some internal data structures.
You don't have to call this method every time something changes, but only
when several slices at once change.
When you change a single slice, call SetChangedSlice() instead.
*/
void SetSegmentationVolume( const Image* segmentation );
/**
\brief Set a reference image (original patient image) - optional.
If this volume is set (must exactly match the dimensions of the segmentation),
the interpolation algorithm may consider image content to improve the interpolated
(estimated) segmentation.
*/
void SetReferenceVolume( const Image* segmentation );
/**
\brief Update after changing a single slice.
\param sliceDiff is a 2D image with the difference image of the slice determined by sliceDimension and sliceIndex.
The difference is (pixel value in the new slice minus pixel value in the old slice).
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
\param timeStep Which time step is changed
*/
void SetChangedSlice( const Image* sliceDiff, unsigned int sliceDimension, unsigned int sliceIndex, unsigned int timeStep );
void SetChangedVolume( const Image* sliceDiff, unsigned int timeStep );
/**
\brief Generates an interpolated image for the given slice.
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
\param timeStep Which time step to use
*/
Image::Pointer Interpolate( unsigned int sliceDimension, unsigned int sliceIndex, const mitk::PlaneGeometry* currentPlane, unsigned int timeStep );
void OnImageModified(const itk::EventObject&);
/**
* Activate/Deactivate the 2D interpolation.
*/
void Activate2DInterpolation(bool);
protected:
/**
\brief Protected class of mitk::SegmentationInterpolationController. Don't use (you shouldn't be able to do so)!
*/
class MITKSEGMENTATION_EXPORT SetChangedSliceOptions
{
public:
SetChangedSliceOptions( unsigned int sd, unsigned int si, unsigned int d0, unsigned int d1, unsigned int t, void* pixels )
: sliceDimension(sd), sliceIndex(si), dim0(d0), dim1(d1), timeStep(t), pixelData(pixels)
{
}
unsigned int sliceDimension;
unsigned int sliceIndex;
unsigned int dim0;
unsigned int dim1;
unsigned int timeStep;
void* pixelData;
};
typedef std::vector<unsigned int> DirtyVectorType;
//typedef std::vector< DirtyVectorType[3] > TimeResolvedDirtyVectorType; // cannot work with C++, so next line is used for implementation
typedef std::vector< std::vector<DirtyVectorType> > TimeResolvedDirtyVectorType;
typedef std::map< const Image*, SegmentationInterpolationController* > InterpolatorMapType;
SegmentationInterpolationController();// purposely hidden
virtual ~SegmentationInterpolationController();
/// internal scan of a single slice
template < typename DATATYPE >
void ScanChangedSlice( const itk::Image<DATATYPE, 2>*, const SetChangedSliceOptions& options );
template < typename TPixel, unsigned int VImageDimension >
void ScanChangedVolume( const itk::Image<TPixel, VImageDimension>*, unsigned int timeStep );
template < typename DATATYPE >
void ScanWholeVolume( const itk::Image<DATATYPE, 3>*, const Image* volume, unsigned int timeStep );
void PrintStatus();
/**
An array of flags. One for each dimension of the image. A flag is set, when a slice in a certain dimension
has at least one pixel that is not 0 (which would mean that it has to be considered by the interpolation algorithm).
E.g. flags for axial slices are stored in m_SegmentationCountInSlice[0][index].
Enhanced with time steps it is now m_SegmentationCountInSlice[timeStep][0][index]
*/
TimeResolvedDirtyVectorType m_SegmentationCountInSlice;
static InterpolatorMapType s_InterpolatorForImage;
Image::ConstPointer m_Segmentation;
Image::ConstPointer m_ReferenceImage;
bool m_BlockModified;
bool m_2DInterpolationActivated;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp
index 7d1733d2ed..610892b18c 100644
--- a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp
+++ b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp
@@ -1,50 +1,50 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usGetModuleContext.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usModule.h>
#include "mitkToolManagerProvider.h"
namespace mitk
{
/**
\brief Registers services for segmentation module.
*/
class SegmentationModuleActivator : public us::ModuleActivator
{
public:
- void Load(us::ModuleContext* context)
+ void Load(us::ModuleContext* context) override
{
/*register ToolManager provider service*/
m_ToolManagerProvider = mitk::ToolManagerProvider::New();
context->RegisterService<mitk::ToolManagerProvider>(m_ToolManagerProvider);
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
}
private:
mitk::ToolManagerProvider::Pointer m_ToolManagerProvider;
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::SegmentationModuleActivator)
diff --git a/Modules/Segmentation/Controllers/mitkToolManager.h b/Modules/Segmentation/Controllers/mitkToolManager.h
index f077ce930a..09d9288cd1 100644
--- a/Modules/Segmentation/Controllers/mitkToolManager.h
+++ b/Modules/Segmentation/Controllers/mitkToolManager.h
@@ -1,310 +1,310 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkToolManager_h_Included
#define mitkToolManager_h_Included
#include "mitkTool.h"
#include <MitkSegmentationExports.h>
#include "mitkDataNode.h"
#include "mitkDataStorage.h"
#include "mitkWeakPointer.h"
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
#include <vector>
#include <map>
#include "usServiceRegistration.h"
namespace mitk
{
class Image;
class PlaneGeometry;
/**
\brief Manages and coordinates instances of mitk::Tool.
\sa QmitkToolSelectionBox
\sa QmitkToolReferenceDataSelectionBox
\sa QmitkToolWorkingDataSelectionBox
\sa Tool
\sa QmitkSegmentationView
\ingroup Interaction
\ingroup ToolManagerEtAl
There is a separate page describing the general design of QmitkSegmentationView: \ref QmitkSegmentationTechnicalPage
This class creates and manages several instances of mitk::Tool.
\li ToolManager creates instances of mitk::Tool by asking the itk::ObjectFactory to list all known implementations of mitk::Tool.
As a result, one has to implement both a subclass of mitk::Tool and a matching subclass of itk::ObjectFactoryBase that is registered
to the top-level itk::ObjectFactory. For an example, see mitkContourToolFactory.h. (this limitiation of one-class-one-factory is due
to the implementation of itk::ObjectFactory).
In MITK, the right place to register the factories to itk::ObjectFactory is the mitk::QMCoreObjectFactory or mitk::SBCoreObjectFactory.
\li One (and only one - or none at all) of the registered tools can be activated using ActivateTool. This tool is registered to mitk::GlobalInteraction
as a listener and will receive all mouse clicks and keyboard strokes that get into the MITK event mechanism. Tools are automatically
unregistered from GlobalInteraction when no clients are registered to ToolManager (see RegisterClient()).
\li ToolManager knows a set of "reference" DataNodes and a set of "working" DataNodes. The first application are segmentation tools, where the
reference is the original image and the working data the (kind of) binary segmentation. However, ToolManager is implemented more generally, so that
there could be other tools that work, e.g., with surfaces.
\li Any "user/client" of ToolManager, i.e. every functionality that wants to use a tool, should call RegisterClient when the tools should be active.
ToolManager keeps track of how many clients want it to be used, and when this count reaches zero, it unregistes the active Tool from GlobalInteraction.
In "normal" settings, the functionality does not need to care about that if it uses a QmitkToolSelectionBox, which does exactly that when it is
enabled/disabled.
\li There is a set of events that are sent by ToolManager. At the moment these are TODO update documentation:
- mitk::ToolReferenceDataChangedEvent whenever somebody calls SetReferenceData. Most of the time this actually means that the data has changed, but
there might be cases where the same data is passed to SetReferenceData a second time, so don't rely on the assumption that something actually changed.
- mitk::ToolSelectedEvent is sent when a (truly) different tool was activated. In reaction to this event you can ask for the active Tool using
GetActiveTool or GetActiveToolID (where NULL or -1 indicate that NO tool is active at the moment).
Design descisions:
\li Not a singleton, because there could be two functionalities using tools, each one with different reference/working data.
$Author$
*/
class MITKSEGMENTATION_EXPORT ToolManager : public itk::Object
{
public:
typedef std::vector<Tool::Pointer> ToolVectorType;
typedef std::vector<Tool::ConstPointer> ToolVectorTypeConst;
typedef std::vector<DataNode*> DataVectorType; // has to be observed for delete events!
typedef std::map<DataNode*, unsigned long> NodeTagMapType;
Message<> NodePropertiesChanged;
Message<> NewNodesGenerated;
Message1<DataVectorType*> NewNodeObjectsGenerated;
Message<> ActiveToolChanged;
Message<> ReferenceDataChanged;
Message<> WorkingDataChanged;
Message<> RoiDataChanged;
Message1<std::string> ToolErrorMessage;
Message1<std::string> GeneralToolMessage;
- mitkClassMacro(ToolManager, itk::Object);
+ mitkClassMacroItkParent(ToolManager, itk::Object);
mitkNewMacro1Param(ToolManager, DataStorage*);
/**
\brief Gives you a list of all tools.
This is const on purpose.
*/
const ToolVectorTypeConst GetTools();
int GetToolID( const Tool* tool );
/*
\param id The tool of interest.
Counting starts with 0.
*/
Tool* GetToolById(int id);
/**
\param id The tool to activate. Provide -1 for disabling any tools.
Counting starts with 0.
Registeres a listner for NodeRemoved event at DataStorage (see mitk::ToolManager::OnNodeRemoved).
*/
bool ActivateTool(int id);
template <class T>
int GetToolIdByToolType()
{
int id = 0;
for ( ToolVectorType::iterator iter = m_Tools.begin();
iter != m_Tools.end();
++iter, ++id )
{
if ( dynamic_cast<T*>(iter->GetPointer()) )
{
return id;
}
}
return -1;
}
/**
\return -1 for "No tool is active"
*/
int GetActiveToolID();
/**
\return NULL for "No tool is active"
*/
Tool* GetActiveTool();
/*
\brief Set a list of data/images as reference objects.
*/
void SetReferenceData(DataVectorType);
/*
\brief Set single data item/image as reference object.
*/
void SetReferenceData(DataNode*);
/*
\brief Set a list of data/images as working objects.
*/
void SetWorkingData(DataVectorType);
/*
\brief Set single data item/image as working object.
*/
void SetWorkingData(DataNode*);
/*
\brief Set a list of data/images as roi objects.
*/
void SetRoiData(DataVectorType);
/*
\brief Set a single data item/image as roi object.
*/
void SetRoiData(DataNode*);
/**
* If set to true the mitk::GlobalInteraction just informs
* the active tool about new mitk::StateEvent but no other
* Interactor or Statemachine
*/
void ActivateExclusiveStateEventPolicy(bool);
/*
\brief Get the list of reference data.
*/
DataVectorType GetReferenceData();
/*
\brief Get the current reference data.
\warning If there is a list of items, this method will only return the first list item.
*/
DataNode* GetReferenceData(int);
/*
\brief Get the list of working data.
*/
DataVectorType GetWorkingData();
/*
\brief Get the current working data.
\warning If there is a list of items, this method will only return the first list item.
*/
DataNode* GetWorkingData(int);
/*
\brief Get the current roi data
*/
DataVectorType GetRoiData();
/*
\brief Get the roi data at position idx
*/
DataNode* GetRoiData(int idx);
DataStorage* GetDataStorage();
void SetDataStorage(DataStorage& storage);
/*
\brief Tell that someone is using tools.
GUI elements should call this when they become active. This method increases an internal "client count". Tools
are only registered to GlobalInteraction when this count is greater than 0. This is useful to automatically deactivate
tools when you hide their GUI elements.
*/
void RegisterClient();
/*
\brief Tell that someone is NOT using tools.
GUI elements should call this when they become active. This method increases an internal "client count". Tools
are only registered to GlobalInteraction when this count is greater than 0. This is useful to automatically deactivate
tools when you hide their GUI elements.
*/
void UnregisterClient();
/** \brief Initialize all classes derived from mitk::Tool by itkObjectFactoy */
void InitializeTools();
void OnOneOfTheReferenceDataDeletedConst(const itk::Object* caller, const itk::EventObject& e);
void OnOneOfTheReferenceDataDeleted (itk::Object* caller, const itk::EventObject& e);
void OnOneOfTheWorkingDataDeletedConst(const itk::Object* caller, const itk::EventObject& e);
void OnOneOfTheWorkingDataDeleted (itk::Object* caller, const itk::EventObject& e);
void OnOneOfTheRoiDataDeletedConst(const itk::Object* caller, const itk::EventObject& e);
void OnOneOfTheRoiDataDeleted (itk::Object* caller, const itk::EventObject& e);
/*
\brief Connected to tool's messages
This method just resends error messages coming from any of the tools. This way clients (GUIs) only have to observe one message.
*/
void OnToolErrorMessage(std::string s);
void OnGeneralToolMessage(std::string s);
protected:
/**
You may specify a list of tool "groups" that should be available for this ToolManager. Every Tool can report its group
as a string. This constructor will try to find the tool's group inside the supplied string. If there is a match,
the tool is accepted. Effectively, you can provide a human readable list like "default, lymphnodevolumetry, oldERISstuff".
*/
ToolManager(DataStorage* storage); // purposely hidden
virtual ~ToolManager();
ToolVectorType m_Tools;
Tool* m_ActiveTool;
int m_ActiveToolID;
us::ServiceRegistration<InteractionEventObserver> m_ActiveToolRegistration;
DataVectorType m_ReferenceData;
NodeTagMapType m_ReferenceDataObserverTags;
DataVectorType m_WorkingData;
NodeTagMapType m_WorkingDataObserverTags;
DataVectorType m_RoiData;
NodeTagMapType m_RoiDataObserverTags;
int m_RegisteredClients;
WeakPointer<DataStorage> m_DataStorage;
bool m_ExclusiveStateEventPolicy;
/// \brief Callback for NodeRemove events
void OnNodeRemoved(const mitk::DataNode* node);
private:
std::map<us::ServiceReferenceU, EventConfig> m_DisplayInteractorConfigs;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Controllers/mitkToolManagerProvider.h b/Modules/Segmentation/Controllers/mitkToolManagerProvider.h
index 2ca44e720b..74c2065c8a 100644
--- a/Modules/Segmentation/Controllers/mitkToolManagerProvider.h
+++ b/Modules/Segmentation/Controllers/mitkToolManagerProvider.h
@@ -1,82 +1,82 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_TOOLMANAGERPROVIDER_H
#define MITK_TOOLMANAGERPROVIDER_H
#include <MitkSegmentationExports.h>
#include <usModuleContext.h>
#include <mitkServiceInterface.h>
#include "mitkToolManager.h"
#include <itkObjectFactory.h>
#include <mitkCommon.h>
namespace mitk
{
class SegmentationModuleActivator;
/**
\brief Micro Service Singleton to get an instance of mitk::ToolManager
\sa ToolManager
Implemented as a singleton to have implicitly only one instance of ToolManager.
Use this service to make sure your Tools are managed by the object.
\note Can only be instantiated by SegmentationModuleActivator. The common way to get the ToolManager is by
<code> mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager(); </code>
*/
class MITKSEGMENTATION_EXPORT ToolManagerProvider : public itk::LightObject
{
public:
- mitkClassMacro(ToolManagerProvider, itk::LightObject);
+ mitkClassMacroItkParent(ToolManagerProvider, itk::LightObject);
/**
\brief Returns ToolManager object.
\note As this service is implemented as a singleton there is always the same ToolManager instance returned.
*/
virtual mitk::ToolManager* GetToolManager();
/**
\brief Returns an instance of ToolManagerProvider service.
*/
static mitk::ToolManagerProvider* GetInstance();
//ONLY SegmentationModuleActivator is able to create instances of the service.
friend class mitk::SegmentationModuleActivator;
protected:
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//hide everything
ToolManagerProvider();
virtual ~ToolManagerProvider();
ToolManagerProvider(const ToolManagerProvider&);
ToolManagerProvider& operator=(const ToolManagerProvider&);
mitk::ToolManager::Pointer m_ToolManager;
};
}
MITK_DECLARE_SERVICE_INTERFACE(mitk::ToolManagerProvider, "org.mitk.services.ToolManagerProvider")
#endif
diff --git a/Modules/Segmentation/DataManagement/mitkContour.h b/Modules/Segmentation/DataManagement/mitkContour.h
index 506489f297..7918e65ce0 100644
--- a/Modules/Segmentation/DataManagement/mitkContour.h
+++ b/Modules/Segmentation/DataManagement/mitkContour.h
@@ -1,186 +1,186 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOUR_H_
#define _MITK_CONTOUR_H_
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkBaseData.h"
#include <vtkRenderWindow.h>
#include <itkPolyLineParametricPath.h>
namespace mitk
{
/**
\brief Stores vertices for drawing a contour.
\deprecated Use class mitk::ContourModel instead.
\sa ContourModel
*/
class MITKSEGMENTATION_EXPORT Contour : public BaseData
{
public:
mitkClassMacro(Contour, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef itk::PolyLineParametricPath<3> PathType;
typedef PathType::Pointer PathPointer;
typedef PathType::ContinuousIndexType ContinuousIndexType;
typedef PathType::InputType InputType;
typedef PathType::OutputType OutputType;
typedef PathType::OffsetType OffsetType;
typedef itk::BoundingBox<unsigned long, 3, ScalarType,
itk::VectorContainer< unsigned long, mitk::Point< ScalarType, 3 > > > BoundingBoxType;
typedef BoundingBoxType::PointsContainer PointsContainer;
typedef BoundingBoxType::PointsContainer::Pointer PointsContainerPointer;
typedef BoundingBoxType::PointsContainerIterator PointsContainerIterator;
/**
* sets whether the contour should be closed or open.
* by default the contour is closed
*/
itkSetMacro(Closed, bool);
/**
* returns if the contour is closed or opened
*/
itkGetMacro(Closed, bool);
itkSetMacro(Selected, bool);
itkGetMacro(Selected, bool);
itkSetMacro(Width, float);
itkGetMacro(Width, float);
/**
* clean up the contour data
*/
- void Initialize();
+ void Initialize() override;
/**
* add a new vertex to the contour
*/
void AddVertex(mitk::Point3D newPoint);
/**
* return an itk parametric path of the contour
*/
PathPointer GetContourPath() const;
/**
* set the current render window. This is helpful if one
* wants to draw the contour in one special window only.
*/
void SetCurrentWindow(vtkRenderWindow* rw);
/**
* returns the points to the current render window
*/
vtkRenderWindow* GetCurrentWindow() const;
/**
* returns the number of points stored in the contour
*/
unsigned int GetNumberOfPoints() const;
/**
* returns the container of the contour points
*/
PointsContainerPointer GetPoints() const;
/**
* set the contour points container.
*/
void SetPoints(PointsContainerPointer points);
/**
* intherited from parent
*/
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
/**
* intherited from parent
*/
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
/**
* intherited from parent
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
* intherited from parent
*/
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
/**
* intherited from parent
*/
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
protected:
mitkCloneMacro(Self);
Contour();
Contour(const Contour & other);
virtual ~Contour();
- virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ virtual void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
/**
* parametric path of a contour;
*/
PathType::Pointer m_ContourPath;
/**
* the current render window
*/
vtkRenderWindow* m_CurrentWindow;
/**
* the bounding box of the contour
*/
BoundingBoxType::Pointer m_BoundingBox;
/**
* container for all contour points
*/
BoundingBoxType::PointsContainer::Pointer m_Vertices;
/**
* decide whether th contour is open or closed
*/
bool m_Closed;
bool m_Selected;
float m_Width;
};
} // namespace mitk
#endif //_MITK_CONTOUR_H_
diff --git a/Modules/Segmentation/DataManagement/mitkContourSet.h b/Modules/Segmentation/DataManagement/mitkContourSet.h
index 7e5c5ed257..33388942b4 100644
--- a/Modules/Segmentation/DataManagement/mitkContourSet.h
+++ b/Modules/Segmentation/DataManagement/mitkContourSet.h
@@ -1,115 +1,115 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CONTOUR_SET_H_
#define _MITK_CONTOUR_SET_H_
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkBaseData.h"
#include "mitkContour.h"
#include <map>
namespace mitk
{
/**
* This class holds stores vertices for drawing a contour
*
*/
class MITKSEGMENTATION_EXPORT ContourSet : public BaseData
{
public:
mitkClassMacro(ContourSet, BaseData);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
typedef std::map<unsigned long,Contour::Pointer> ContourVectorType;
typedef ContourVectorType::iterator ContourIterator;
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBoxType;
/**
* clean up the contour data
*/
- void Initialize();
+ void Initialize() override;
/**
* add a contour
*/
void AddContour(unsigned int index, mitk::Contour::Pointer contour);
/**
* add a contour
*/
void RemoveContour(unsigned long index);
/**
* returns the number of points stored in the contour
*/
unsigned int GetNumberOfContours();
/**
* returns the container of the contour points
*/
ContourVectorType GetContours();
/**
* intherited from parent
*/
- virtual void UpdateOutputInformation();
+ virtual void UpdateOutputInformation() override;
/**
* intherited from parent
*/
- virtual void SetRequestedRegionToLargestPossibleRegion();
+ virtual void SetRequestedRegionToLargestPossibleRegion() override;
/**
* intherited from parent
*/
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
* intherited from parent
*/
- virtual bool VerifyRequestedRegion();
+ virtual bool VerifyRequestedRegion() override;
/**
* intherited from parent
*/
- virtual void SetRequestedRegion( const itk::DataObject *data);
+ virtual void SetRequestedRegion( const itk::DataObject *data) override;
protected:
ContourSet();
virtual ~ContourSet();
private:
/**
* the bounding box of the contour
*/
BoundingBoxType::Pointer m_BoundingBox;
ContourVectorType m_ContourVector;
unsigned int m_NumberOfContours;
};
} // namespace mitk
#endif //_MITK_CONTOUR_SET_H_
diff --git a/Modules/Segmentation/DataManagement/mitkExtrudedContour.h b/Modules/Segmentation/DataManagement/mitkExtrudedContour.h
index 5cd61a3394..f9f8713ede 100644
--- a/Modules/Segmentation/DataManagement/mitkExtrudedContour.h
+++ b/Modules/Segmentation/DataManagement/mitkExtrudedContour.h
@@ -1,128 +1,128 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKEXTRUDEDCONTOUR_H_HEADER_INCLUDED
#define MITKEXTRUDEDCONTOUR_H_HEADER_INCLUDED
#include "mitkBoundingObject.h"
#include <MitkSegmentationExports.h>
#include <mitkContour.h>
#include <vtkConfigure.h>
#include <mitkPlaneGeometry.h>
#include <vtkVersionMacros.h>
class vtkLinearExtrusionFilter;
class vtkPlanes;
class vtkClipPolyData;
class vtkLinearSubdivisionFilter;
class vtkTriangleFilter;
class vtkDecimatePro;
class vtkPolygon;
namespace mitk {
//##Documentation
//## @brief Data class containing a bounding-object created by
//## extruding a Contour along a vector
//##
//## The m_Contour is extruded in the direction m_Vector until
//## reaching m_ClippingGeometry.
//## @ingroup Data
class MITKSEGMENTATION_EXPORT ExtrudedContour : public BoundingObject
{
public:
mitkClassMacro(ExtrudedContour, BoundingObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual mitk::ScalarType GetVolume();
- virtual bool IsInside(const Point3D& p) const;
- virtual void UpdateOutputInformation();
+ virtual mitk::ScalarType GetVolume() override;
+ virtual bool IsInside(const Point3D& p) const override;
+ virtual void UpdateOutputInformation() override;
//##Documentation
//## @brief Contour to extrude
itkGetConstObjectMacro(Contour, mitk::Contour);
itkSetObjectMacro(Contour, mitk::Contour);
//##Documentation
//## @brief Vector to specify the direction of the extrusion
mitkGetVectorMacro(Vector, mitk::Vector3D);
mitkSetVectorMacro(Vector, mitk::Vector3D);
itkGetConstMacro(AutomaticVectorGeneration, bool);
itkSetMacro(AutomaticVectorGeneration, bool);
itkBooleanMacro(AutomaticVectorGeneration);
//##Documentation
//## @brief Optional vector to specify the orientation of the bounding-box
mitkGetVectorMacro(RightVector, mitk::Vector3D);
mitkSetVectorMacro(RightVector, mitk::Vector3D);
//##Documentation
//## @brief Optional geometry for clipping the extruded contour
itkGetConstObjectMacro(ClippingGeometry, mitk::BaseGeometry);
itkSetObjectMacro(ClippingGeometry, mitk::BaseGeometry);
- virtual unsigned long GetMTime() const;
+ virtual unsigned long GetMTime() const override;
protected:
ExtrudedContour();
virtual ~ExtrudedContour();
void BuildSurface();
void BuildGeometry();
mitk::Contour::Pointer m_Contour;
mitk::Vector3D m_Vector;
mitk::Vector3D m_RightVector;
mitk::BaseGeometry::Pointer m_ClippingGeometry;
bool m_AutomaticVectorGeneration;
vtkPolygon* m_Polygon;
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double m_ProjectedContourBounds[6];
#else
float m_ProjectedContourBounds[6];
#endif
mitk::PlaneGeometry::Pointer m_ProjectionPlane;
//##Documentation
//## @brief For fast projection on plane
float m_Right[3];
float m_Down[3];
#if ((VTK_MAJOR_VERSION > 4) || ((VTK_MAJOR_VERSION==4) && (VTK_MINOR_VERSION>=4) ))
double m_Normal[3];
#else
float m_Normal[3];
#endif
float m_Origin[3];
vtkLinearExtrusionFilter* m_ExtrusionFilter;
vtkTriangleFilter *m_TriangleFilter;
vtkDecimatePro* m_Decimate;
vtkLinearSubdivisionFilter* m_SubdivisionFilter;
vtkPlanes* m_ClippingBox;
vtkClipPolyData* m_ClipPolyDataFilter;
itk::TimeStamp m_LastCalculateExtrusionTime;
};
}
#endif /* MITKEXTRUDEDCONTOUR_H_HEADER_INCLUDED */
diff --git a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h
index 1cd211011b..0c48a7ea47 100644
--- a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h
+++ b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h
@@ -1,135 +1,135 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAdaptiveRegionGrowingTool_h_Included
#define mitkAdaptiveRegionGrowingTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include "mitkDataStorage.h"
#include "mitkSinglePointDataInteractor.h"
#include "mitkPointSet.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Dummy Tool for AdaptiveRegionGrowingToolGUI to get Tool functionality for AdaptiveRegionGrowing.
The actual logic is implemented in QmitkAdaptiveRegionGrowingToolGUI.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
*/
class MITKSEGMENTATION_EXPORT AdaptiveRegionGrowingTool : public AutoSegmentationTool
{
public:
/**
* @brief mitkClassMacro
*/
mitkClassMacro(AdaptiveRegionGrowingTool, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- bool CanHandle(BaseData* referenceData) const;
+ bool CanHandle(BaseData* referenceData) const override;
/**
* @brief Get XPM
* @return NULL
*/
- virtual const char** GetXPM() const;
+ virtual const char** GetXPM() const override;
/**
* @brief Get name
* @return name of the Tool
*/
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
/**
* @brief Get icon resource
* @return the resource Object of the Icon
*/
- us::ModuleResource GetIconResource() const;
+ us::ModuleResource GetIconResource() const override;
/**
* @brief Adds interactor for the seedpoint and creates a seedpoint if neccessary.
*
*
*/
- virtual void Activated();
+ virtual void Activated() override;
/**
* @brief Removes all set points and interactors.
*
*
*/
- virtual void Deactivated();
+ virtual void Deactivated() override;
/**
* @brief get pointset node
* @return the point set node
*/
virtual DataNode::Pointer GetPointSetNode();
/**
* @brief get reference data
* @return the current reference data.
*/
mitk::DataNode* GetReferenceData();
/**
* @brief Get working data
* @return a list of all working data.
*/
mitk::DataNode* GetWorkingData();
/**
* @brief Get datastorage
* @return the current data storage.
*/
mitk::DataStorage* GetDataStorage();
protected:
/**
* @brief constructor
*/
AdaptiveRegionGrowingTool(); // purposely hidden
/**
* @brief destructor
*/
virtual ~AdaptiveRegionGrowingTool();
private:
PointSet::Pointer m_PointSet;
SinglePointDataInteractor::Pointer m_SeedPointInteractor;
DataNode::Pointer m_PointSetNode;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkAddContourTool.h b/Modules/Segmentation/Interactions/mitkAddContourTool.h
index cc019cde5a..b81dde9d88 100644
--- a/Modules/Segmentation/Interactions/mitkAddContourTool.h
+++ b/Modules/Segmentation/Interactions/mitkAddContourTool.h
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAddContourTool_h_Included
#define mitkAddContourTool_h_Included
#include "mitkContourTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Fill the inside of a contour with 1
\sa ContourTool
\ingroup Interaction
\ingroup ToolManagerEtAl
Fills a visible contour (from FeedbackContourTool) during mouse dragging. When the mouse button
is released, AddContourTool tries to extract a slice from the working image and fill in
the (filled) contour as a binary image. All inside pixels are set to 1.
While holding the CTRL key, the contour changes color and the pixels on the inside would be
filled with 0.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT AddContourTool : public ContourTool
{
public:
mitkClassMacro(AddContourTool, ContourTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
AddContourTool(); // purposely hidden
virtual ~AddContourTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkAutoCropTool.h b/Modules/Segmentation/Interactions/mitkAutoCropTool.h
index e7655501ae..abea224781 100644
--- a/Modules/Segmentation/Interactions/mitkAutoCropTool.h
+++ b/Modules/Segmentation/Interactions/mitkAutoCropTool.h
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAutoCropTool_h_Included
#define mitkAutoCropTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkSegmentationsProcessingTool.h"
namespace mitk
{
/**
\brief Crops selected segmentations.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT AutoCropTool : public SegmentationsProcessingTool
{
public:
mitkClassMacro(AutoCropTool, SegmentationsProcessingTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
protected:
- virtual bool ProcessOneWorkingData( DataNode* node );
- virtual std::string GetErrorMessage();
+ virtual bool ProcessOneWorkingData( DataNode* node ) override;
+ virtual std::string GetErrorMessage() override;
AutoCropTool(); // purposely hidden
virtual ~AutoCropTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkAutoSegmentationTool.h b/Modules/Segmentation/Interactions/mitkAutoSegmentationTool.h
index 5b10b8c0e8..7f85acb0d8 100644
--- a/Modules/Segmentation/Interactions/mitkAutoSegmentationTool.h
+++ b/Modules/Segmentation/Interactions/mitkAutoSegmentationTool.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkAutoSegmentationTool_h_Included
#define mitkAutoSegmentationTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkTool.h"
namespace mitk
{
class Image;
/**
\brief Superclass for tool that create a new segmentation without user interaction in render windows
This class is undocumented. Ask the creator ($Author$) to supply useful comments.
*/
class MITKSEGMENTATION_EXPORT AutoSegmentationTool : public Tool
{
public:
mitkClassMacro(AutoSegmentationTool, Tool);
void SetOverwriteExistingSegmentation(bool overwrite);
/**
* @brief Gets the name of the currently selected segmentation node
* @return the name of the segmentation node or an empty string if
* none is selected
*/
std::string GetCurrentSegmentationName();
/**
* @brief Depending on the selected mode either returns the currently selected segmentation
* or creates a new one from the selected reference data and adds the new segmentation
* to the datastorage
* @return a mitk::DataNode which contains a segmentation image
*/
virtual mitk::DataNode* GetTargetSegmentationNode();
protected:
AutoSegmentationTool(); // purposely hidden
virtual ~AutoSegmentationTool();
- virtual const char* GetGroup() const;
+ virtual const char* GetGroup() const override;
virtual itk::SmartPointer<Image> Get3DImage(itk::SmartPointer<Image> image, unsigned int timestep);
bool m_OverwriteExistingSegmentation;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.h b/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.h
index 4d7ef612b2..3cc859302a 100644
--- a/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.h
+++ b/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkBinaryThresholdTool_h_Included
#define mitkBinaryThresholdTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include "mitkDataNode.h"
#include <itkImage.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Calculates the segmented volumes for binary images.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT BinaryThresholdTool : public AutoSegmentationTool
{
public:
Message3<double,double, bool> IntervalBordersChanged;
Message1<double> ThresholdingValueChanged;
mitkClassMacro(BinaryThresholdTool, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- us::ModuleResource GetIconResource() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ us::ModuleResource GetIconResource() const override;
+ virtual const char* GetName() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual void SetThresholdValue(double value);
virtual void AcceptCurrentThresholdValue();
virtual void CancelThresholding();
protected:
BinaryThresholdTool(); // purposely hidden
virtual ~BinaryThresholdTool();
void SetupPreviewNodeFor( DataNode* nodeForThresholding );
void CreateNewSegmentationFromThreshold(DataNode* node);
void OnRoiDataChanged();
template <typename TPixel, unsigned int VImageDimension>
void ITKThresholding( itk::Image<TPixel, VImageDimension>* originalImage, mitk::Image* segmentation, unsigned int timeStep );
DataNode::Pointer m_ThresholdFeedbackNode;
DataNode::Pointer m_OriginalImageNode;
DataNode::Pointer m_NodeForThresholding;
double m_SensibleMinimumThresholdValue;
double m_SensibleMaximumThresholdValue;
double m_CurrentThresholdValue;
bool m_IsFloatImage;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.h b/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.h
index 959995e4d1..b2dc45ce5f 100644
--- a/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.h
+++ b/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkBinaryThresholdULTool_h_Included
#define mitkBinaryThresholdULTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include "mitkDataNode.h"
#include <itkImage.h>
#include <itkBinaryThresholdImageFilter.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Calculates the segmented volumes for binary images.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT BinaryThresholdULTool : public AutoSegmentationTool
{
public:
Message2<double,double> IntervalBordersChanged;
Message2<mitk::ScalarType, mitk::ScalarType> ThresholdingValuesChanged;
mitkClassMacro(BinaryThresholdULTool, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- us::ModuleResource GetIconResource() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ us::ModuleResource GetIconResource() const override;
+ virtual const char* GetName() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual void SetThresholdValues(double lower, double upper);
virtual void AcceptCurrentThresholdValue();
virtual void CancelThresholding();
protected:
BinaryThresholdULTool(); // purposely hidden
virtual ~BinaryThresholdULTool();
void SetupPreviewNode();
void CreateNewSegmentationFromThreshold(DataNode* node);
void OnRoiDataChanged();
void UpdatePreview();
DataNode::Pointer m_ThresholdFeedbackNode;
DataNode::Pointer m_OriginalImageNode;
DataNode::Pointer m_NodeForThresholding;
mitk::ScalarType m_SensibleMinimumThresholdValue;
mitk::ScalarType m_SensibleMaximumThresholdValue;
mitk::ScalarType m_CurrentLowerThresholdValue;
mitk::ScalarType m_CurrentUpperThresholdValue;
typedef itk::Image<int, 3> ImageType;
typedef itk::Image< Tool::DefaultSegmentationDataType, 3> SegmentationType; // this is sure for new segmentations
typedef itk::BinaryThresholdImageFilter<ImageType, SegmentationType> ThresholdFilterType;
ThresholdFilterType::Pointer m_ThresholdFilter;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkCalculateGrayValueStatisticsTool.h b/Modules/Segmentation/Interactions/mitkCalculateGrayValueStatisticsTool.h
index f93d3e1cf3..e69f8579a0 100644
--- a/Modules/Segmentation/Interactions/mitkCalculateGrayValueStatisticsTool.h
+++ b/Modules/Segmentation/Interactions/mitkCalculateGrayValueStatisticsTool.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCalculateGrayValueStatisticsTool_h_Included
#define mitkCalculateGrayValueStatisticsTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkSegmentationsProcessingTool.h"
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
#include <itkImage.h>
#include <sstream>
namespace mitk
{
/**
\brief Calculates some gray value statistics for segmentations.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT CalculateGrayValueStatisticsTool : public SegmentationsProcessingTool
{
public:
Message<> StatisticsCompleted;
mitkClassMacro(CalculateGrayValueStatisticsTool, SegmentationsProcessingTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
virtual std::string GetReport() const;
//
// Insight/Code/Review/Algorithms version of Histogram takes
// only one template parameter, and the 'release' version
// takes 2, but the default value for the second, 1, is what
// was specified here.
typedef itk::Statistics::Histogram<double> HistogramType;
HistogramType::Pointer m_ITKHistogram;
HistogramType::ConstPointer GetHistogram();
typedef HistogramType::MeasurementType HistogramMeasurementType;
protected:
CalculateGrayValueStatisticsTool(); // purposely hidden
virtual ~CalculateGrayValueStatisticsTool();
- virtual void StartProcessingAllData();
- virtual bool ProcessOneWorkingData( DataNode* node );
- virtual void FinishProcessingAllData();
+ virtual void StartProcessingAllData() override;
+ virtual bool ProcessOneWorkingData( DataNode* node ) override;
+ virtual void FinishProcessingAllData() override;
- virtual std::string GetErrorMessage();
+ virtual std::string GetErrorMessage() override;
/**
Calculates the minimum and maximum of the pixelvalues. They have to be known to initialize the histogram.
*/
template<typename TPixel, unsigned int VImageDimension>
void CalculateMinMax(itk::Image<TPixel, VImageDimension>* referenceImage, Image* segmentation,
TPixel& minimum, TPixel& maximum);
/**
- initializes and fills the histogram
- calculates mean, sd and quantiles
*/
template<typename TPixel, unsigned int VImageDimension>
void ITKHistogramming(itk::Image<TPixel, VImageDimension>* referenceImage, Image* segmentation,
std::stringstream& report);
std::stringstream m_CompleteReport;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkCalculateVolumetryTool.h b/Modules/Segmentation/Interactions/mitkCalculateVolumetryTool.h
index b7f0f7ba18..c1ad856de0 100644
--- a/Modules/Segmentation/Interactions/mitkCalculateVolumetryTool.h
+++ b/Modules/Segmentation/Interactions/mitkCalculateVolumetryTool.h
@@ -1,61 +1,61 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCalculateVolumetryTool_h_Included
#define mitkCalculateVolumetryTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkSegmentationsProcessingTool.h"
namespace mitk
{
/**
\brief Calculates the segmented volumes for binary images.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT CalculateVolumetryTool : public SegmentationsProcessingTool
{
public:
mitkClassMacro(CalculateVolumetryTool, SegmentationsProcessingTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
protected:
- virtual bool ProcessOneWorkingData( DataNode* node );
- virtual std::string GetErrorMessage();
+ virtual bool ProcessOneWorkingData( DataNode* node ) override;
+ virtual std::string GetErrorMessage() override;
- virtual void FinishProcessingAllData();
+ virtual void FinishProcessingAllData() override;
CalculateVolumetryTool(); // purposely hidden
virtual ~CalculateVolumetryTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkContourInteractor.h b/Modules/Segmentation/Interactions/mitkContourInteractor.h
index f45a6c9867..6f989d7024 100644
--- a/Modules/Segmentation/Interactions/mitkContourInteractor.h
+++ b/Modules/Segmentation/Interactions/mitkContourInteractor.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __ContourInteractor_H
#define __ContourInteractor_H
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include <mitkInteractor.h>
#include <mitkNumericTypes.h>
namespace mitk {
//##Documentation
//## @brief Interactor for the creation of an mitk::Contour
//## @ingroup Interaction
class MITKSEGMENTATION_EXPORT ContourInteractor : public mitk::Interactor
{
public:
mitkClassMacro(ContourInteractor, Interactor);
mitkNewMacro2Param(Self, const char*, DataNode*);
protected:
ContourInteractor(const char * type, DataNode* dataNode);
virtual ~ContourInteractor();
- virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
/**
* entry method for any interaction. Method is called if user
* presses the left mouse button down.
*/
virtual void Press (mitk::Point3D& op);
/**
* this method is finally called after user release the left mouse button
*/
virtual void Release (mitk::Point3D& op);
/**
* method is called when the user moves the mouse with left mouse button down
*/
virtual void Move (mitk::Point3D& op);
protected:
bool m_Positive;
bool m_Started;
};
}
#endif //__ContourInteractor_H
diff --git a/Modules/Segmentation/Interactions/mitkContourModelInteractor.h b/Modules/Segmentation/Interactions/mitkContourModelInteractor.h
index 9e847048af..d4b2c419a1 100644
--- a/Modules/Segmentation/Interactions/mitkContourModelInteractor.h
+++ b/Modules/Segmentation/Interactions/mitkContourModelInteractor.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkContourModelInteractor_h_Included
#define mitkContourModelInteractor_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkInteractor.h"
#include <mitkContourModel.h>
#include <mitkDataNode.h>
namespace mitk
{
/**
\brief
\sa Interactor
\ingroup Interaction
\ingroup ToolManagerEtAl
*/
class MITKSEGMENTATION_EXPORT ContourModelInteractor : public Interactor
{
public:
mitkClassMacro(ContourModelInteractor, Interactor);
mitkNewMacro1Param(Self, 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
*/
- virtual float CanHandleEvent(StateEvent const* stateEvent) const;
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const override;
/**
*@brief If data changed then initialize according to numbers of loaded points
**/
- virtual void DataChanged();
+ virtual void DataChanged() override;
protected:
ContourModelInteractor(DataNode* dataNode); // purposely hidden
virtual ~ContourModelInteractor();
virtual bool OnCheckPointClick (Action*, const StateEvent*);
virtual bool OnCheckContourClick (Action*, const StateEvent*);
virtual bool OnDeletePoint(Action*, const StateEvent*);
virtual bool OnMovePoint(Action*, const StateEvent*);
virtual bool OnMove(Action*, const StateEvent*);
virtual bool OnMoveContour(Action*, const StateEvent*);
virtual bool OnFinishEditing(Action*, const StateEvent*);
mitk::Point3D m_lastMousePosition;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkContourModelLiveWireInteractor.h b/Modules/Segmentation/Interactions/mitkContourModelLiveWireInteractor.h
index 3dbab94ed8..5a84cf94f7 100644
--- a/Modules/Segmentation/Interactions/mitkContourModelLiveWireInteractor.h
+++ b/Modules/Segmentation/Interactions/mitkContourModelLiveWireInteractor.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkContourModelLiveWireInteractor_h_Included
#define mitkContourModelLiveWireInteractor_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkContourModelInteractor.h"
#include <mitkImageLiveWireContourModelFilter.h>
namespace mitk
{
/**
\brief
\sa Interactor
\sa ContourModelInteractor
\ingroup Interaction
\warning Make sure the working image is properly set, otherwise the algorithm for computing livewire contour segments will not work!
*/
class MITKSEGMENTATION_EXPORT ContourModelLiveWireInteractor : public ContourModelInteractor
{
public:
mitkClassMacro(ContourModelLiveWireInteractor, ContourModelInteractor);
mitkNewMacro1Param(Self, DataNode*);
virtual void SetEditingContourModelNode (mitk::DataNode* _arg);
virtual void SetWorkingImage (mitk::Image* _arg);
protected:
ContourModelLiveWireInteractor(DataNode* dataNode);
virtual ~ContourModelLiveWireInteractor();
- virtual bool OnDeletePoint(Action*, const StateEvent*);
- virtual bool OnMovePoint(Action*, const StateEvent*);
- virtual bool OnCheckPointClick( Action* action, const StateEvent* stateEvent);
- virtual bool OnFinishEditing( Action* action, const StateEvent* stateEvent);
+ virtual bool OnDeletePoint(Action*, const StateEvent*) override;
+ virtual bool OnMovePoint(Action*, const StateEvent*) override;
+ virtual bool OnCheckPointClick( Action* action, const StateEvent* stateEvent) override;
+ virtual bool OnFinishEditing( Action* action, const StateEvent* stateEvent) override;
int SplitContourFromSelectedVertex(mitk::ContourModel* srcContour,
mitk::ContourModel* destContour,
bool fromSelectedUpwards,
int timestep);
mitk::ImageLiveWireContourModelFilter::Pointer m_LiveWireFilter;
mitk::Image::Pointer m_WorkingSlice;
mitk::Point3D m_NextActiveVertexDown;
mitk::Point3D m_NextActiveVertexUp;
mitk::ContourModel::VertexIterator m_NextActiveVertexDownIter;
mitk::ContourModel::VertexIterator m_NextActiveVertexUpIter;
std::vector < itk::Index<2> > m_ContourBeingModified;
mitk::DataNode::Pointer m_EditingContourNode;
mitk::ContourModel::Pointer m_ContourLeft;
mitk::ContourModel::Pointer m_ContourRight;
};
} // namespace mitk
#endif // mitkContourModelLiveWireInteractor_h_Included
diff --git a/Modules/Segmentation/Interactions/mitkContourTool.h b/Modules/Segmentation/Interactions/mitkContourTool.h
index 718691864a..e09f67537f 100644
--- a/Modules/Segmentation/Interactions/mitkContourTool.h
+++ b/Modules/Segmentation/Interactions/mitkContourTool.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkContourTool_h_Included
#define mitkContourTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkFeedbackContourTool.h"
namespace mitk
{
class Image;
class StateMachineAction;
class InteractionEvent;
/**
\brief Simple contour filling tool.
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Fills a visible contour (from FeedbackContourTool) during mouse dragging. When the mouse button
is released, ContourTool tries to extract a slice from the working image and fill in
the (filled) contour as a binary image.
The painting "color" is defined by m_PaintingPixelValue, which is set in the constructor
(by sub-classes) or during some event (e.g. in OnInvertLogic - when CTRL is pressed).
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT ContourTool : public FeedbackContourTool
{
public:
mitkClassMacro(ContourTool, FeedbackContourTool);
protected:
ContourTool(int paintingPixelValue = 1); // purposely hidden
virtual ~ContourTool();
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual bool OnMousePressed( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnMouseMoved( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnMouseReleased( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnInvertLogic( StateMachineAction*, InteractionEvent* interactionEvent );
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
int m_PaintingPixelValue;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkCorrectorTool2D.h b/Modules/Segmentation/Interactions/mitkCorrectorTool2D.h
index aedfd73e71..fb4b9588cd 100644
--- a/Modules/Segmentation/Interactions/mitkCorrectorTool2D.h
+++ b/Modules/Segmentation/Interactions/mitkCorrectorTool2D.h
@@ -1,91 +1,91 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCorrectorTool2D_h_Included
#define mitkCorrectorTool2D_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkFeedbackContourTool.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
class Image;
class StateMachineAction;
class InteractionEvent;
/**
\brief Corrector tool for 2D binary segmentations
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Lets the user draw a (multi-point) line and intelligently decides what to do. The underlying algorithm
tests if the line begins and ends inside or outside a segmentation and either adds or subtracts a piece of
segmentation.
Algorithm is implemented in CorrectorAlgorithm (so that it could be reimplemented in a more modern fashion some time).
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT CorrectorTool2D : public FeedbackContourTool
{
public:
mitkClassMacro(CorrectorTool2D, FeedbackContourTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
CorrectorTool2D(int paintingPixelValue = 1); // purposely hidden
virtual ~CorrectorTool2D();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual bool OnMousePressed ( StateMachineAction*, InteractionEvent* );
virtual bool OnMouseMoved ( StateMachineAction*, InteractionEvent* );
virtual bool OnMouseReleased( StateMachineAction*, InteractionEvent* );
int m_PaintingPixelValue;
Image::Pointer m_WorkingSlice;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkCreateSurfaceTool.h b/Modules/Segmentation/Interactions/mitkCreateSurfaceTool.h
index 62df1c6f63..ebcc42c2df 100644
--- a/Modules/Segmentation/Interactions/mitkCreateSurfaceTool.h
+++ b/Modules/Segmentation/Interactions/mitkCreateSurfaceTool.h
@@ -1,60 +1,60 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCreateSurfaceTool_h_Included
#define mitkCreateSurfaceTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkSegmentationsProcessingTool.h"
namespace mitk
{
/**
\brief Creates surface models from segmentations.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
Last contributor: $Author$
*/
class MITKSEGMENTATION_EXPORT CreateSurfaceTool : public SegmentationsProcessingTool
{
public:
mitkClassMacro(CreateSurfaceTool, SegmentationsProcessingTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
void OnSurfaceCalculationDone();
protected:
- virtual bool ProcessOneWorkingData( DataNode* node );
- virtual std::string GetErrorMessage();
+ virtual bool ProcessOneWorkingData( DataNode* node ) override;
+ virtual std::string GetErrorMessage() override;
CreateSurfaceTool(); // purposely hidden
virtual ~CreateSurfaceTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.h b/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.h
index 5529525eb2..b6d0865c83 100644
--- a/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.h
+++ b/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPaintContourTool_h_Included
#define mitkPaintContourTool_h_Included
#include "mitkPaintbrushTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Paintbrush tool for InteractiveSegmentation
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Simple paintbrush drawing tool. Right now there are only circular pens of varying size.
This class specified only the drawing "color" for the super class PaintbrushTool.
\warning Only to be instantiated by mitk::ToolManager.
$Author: maleike $
*/
class MITKSEGMENTATION_EXPORT DrawPaintbrushTool : public PaintbrushTool
{
public:
mitkClassMacro(DrawPaintbrushTool, PaintbrushTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
DrawPaintbrushTool(); // purposely hidden
virtual ~DrawPaintbrushTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.h b/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.h
index af2ec90330..67c145d740 100644
--- a/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.h
+++ b/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkErasePaintbrushTool_h_Included
#define mitkErasePaintbrushTool_h_Included
#include "mitkPaintbrushTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Paintbrush tool for InteractiveSegmentation
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Simple paintbrush drawing tool. Right now there are only circular pens of varying size.
This class specified only the drawing "color" for the super class PaintbrushTool.
\warning Only to be instantiated by mitk::ToolManager.
$Author: maleike $
*/
class MITKSEGMENTATION_EXPORT ErasePaintbrushTool : public PaintbrushTool
{
public:
mitkClassMacro(ErasePaintbrushTool, PaintbrushTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
ErasePaintbrushTool(); // purposely hidden
virtual ~ErasePaintbrushTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkEraseRegionTool.h b/Modules/Segmentation/Interactions/mitkEraseRegionTool.h
index 7f70140aac..67bf94824c 100644
--- a/Modules/Segmentation/Interactions/mitkEraseRegionTool.h
+++ b/Modules/Segmentation/Interactions/mitkEraseRegionTool.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkEraseRegionTool_h_Included
#define mitkEraseRegionTool_h_Included
#include "mitkSetRegionTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Fill the inside of a contour with 1
\sa SetRegionTool
\ingroup Interaction
\ingroup ToolManagerEtAl
Finds the outer contour of a shape in 2D (possibly including holes) and sets all
the inside pixels to 0 (erasing a segmentation).
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT EraseRegionTool : public SetRegionTool
{
public:
mitkClassMacro(EraseRegionTool, SetRegionTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
EraseRegionTool(); // purposely hidden
virtual ~EraseRegionTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkExtrudedContourInteractor.h b/Modules/Segmentation/Interactions/mitkExtrudedContourInteractor.h
index 258f5587ce..d47c277a8e 100644
--- a/Modules/Segmentation/Interactions/mitkExtrudedContourInteractor.h
+++ b/Modules/Segmentation/Interactions/mitkExtrudedContourInteractor.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __ExtrudedContourInteractor_H
#define __ExtrudedContourInteractor_H
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include <mitkInteractor.h>
#include <mitkNumericTypes.h>
#include <mitkContour.h>
#include <mitkDataNode.h>
namespace mitk {
//##Documentation
//## @brief Interactor for the creation of an mitk::Contour
//## @ingroup Interaction
class MITKSEGMENTATION_EXPORT ExtrudedContourInteractor : public mitk::Interactor
{
public:
mitkClassMacro(ExtrudedContourInteractor, Interactor);
mitkNewMacro2Param(Self, const char*, DataNode*);
itkGetObjectMacro(Contour, mitk::Contour);
itkGetObjectMacro(ContourNode, mitk::DataNode);
protected:
ExtrudedContourInteractor(const char * type, DataNode* dataNode);
virtual ~ExtrudedContourInteractor();
- virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent) override;
/**
* entry method for any interaction. Method is called if user
* presses the left mouse button down.
*/
virtual void Press (mitk::Point3D& op);
/**
* this method is finally called after user release the left mouse button
*/
virtual void Release (mitk::Point3D& op);
/**
* method is called when the user moves the mouse with left mouse button down
*/
virtual void Move (mitk::Point3D& op);
protected:
bool m_Positive;
bool m_Started;
mitk::Contour::Pointer m_Contour;
mitk::DataNode::Pointer m_ContourNode;
};
}
#endif //__ExtrudedContourInteractor_H
diff --git a/Modules/Segmentation/Interactions/mitkFastMarchingTool.h b/Modules/Segmentation/Interactions/mitkFastMarchingTool.h
index 591e461926..761545fcc5 100644
--- a/Modules/Segmentation/Interactions/mitkFastMarchingTool.h
+++ b/Modules/Segmentation/Interactions/mitkFastMarchingTool.h
@@ -1,184 +1,184 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFastMarchingTool_h_Included
#define mitkFastMarchingTool_h_Included
#include "mitkFeedbackContourTool.h"
#include "mitkLegacyAdaptors.h"
#include <MitkSegmentationExports.h>
#include "mitkDataNode.h"
#include "mitkPointSet.h"
#include "mitkToolCommand.h"
#include "mitkPositionEvent.h"
#include "mitkMessage.h"
#include "itkImage.h"
//itk filter
#include "itkFastMarchingImageFilter.h"
#include "itkBinaryThresholdImageFilter.h"
#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
#include "itkSigmoidImageFilter.h"
#include "itkCurvatureAnisotropicDiffusionImageFilter.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
class StateMachineAction;
class InteractionEvent;
/**
\brief FastMarching semgentation tool.
The segmentation is done by setting one or more seed points on the image
and adapting the time range and threshold. The pipeline is:
Smoothing->GradientMagnitude->SigmoidFunction->FastMarching->Threshold
The resulting binary image is seen as a segmentation of an object.
For detailed documentation see ITK Software Guide section 9.3.1 Fast Marching Segmentation.
*/
class MITKSEGMENTATION_EXPORT FastMarchingTool : public FeedbackContourTool
{
mitkNewMessageMacro(Ready);
public:
mitkClassMacro(FastMarchingTool, FeedbackContourTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/* typedefs for itk pipeline */
typedef float InternalPixelType;
typedef itk::Image< InternalPixelType, 2 > InternalImageType;
typedef unsigned char OutputPixelType;
typedef itk::Image< OutputPixelType, 2 > OutputImageType;
typedef itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType;
typedef itk::CurvatureAnisotropicDiffusionImageFilter< InternalImageType, InternalImageType > SmoothingFilterType;
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< InternalImageType, InternalImageType > GradientFilterType;
typedef itk::SigmoidImageFilter< InternalImageType, InternalImageType > SigmoidFilterType;
typedef itk::FastMarchingImageFilter< InternalImageType, InternalImageType > FastMarchingFilterType;
typedef FastMarchingFilterType::NodeContainer NodeContainer;
typedef FastMarchingFilterType::NodeType NodeType;
/* icon stuff */
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
/// \brief Set parameter used in Threshold filter.
void SetUpperThreshold(double);
/// \brief Set parameter used in Threshold filter.
void SetLowerThreshold(double);
/// \brief Set parameter used in Fast Marching filter.
void SetStoppingValue(double);
/// \brief Set parameter used in Gradient Magnitude filter.
void SetSigma(double);
/// \brief Set parameter used in Fast Marching filter.
void SetAlpha(double);
/// \brief Set parameter used in Fast Marching filter.
void SetBeta(double);
/// \brief Adds the feedback image to the current working image.
virtual void ConfirmSegmentation();
/// \brief Set the working time step.
virtual void SetCurrentTimeStep(int t);
/// \brief Clear all seed points.
void ClearSeeds();
/// \brief Updates the itk pipeline and shows the result of FastMarching.
void Update();
protected:
FastMarchingTool();
virtual ~FastMarchingTool();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
//virtual float CanHandleEvent( StateEvent const *stateEvent) const;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual void Initialize();
virtual void BuildITKPipeline();
/// \brief Add point action of StateMachine pattern
virtual bool OnAddPoint ( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Delete action of StateMachine pattern
virtual bool OnDelete ( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Reset all relevant inputs of the itk pipeline.
void Reset();
mitk::ToolCommand::Pointer m_ProgressCommand;
Image::Pointer m_ReferenceImage;
Image::Pointer m_ReferenceImageSlice;
bool m_NeedUpdate;
int m_CurrentTimeStep;
mitk::InteractionPositionEvent::Pointer m_PositionEvent;
float m_LowerThreshold; //used in Threshold filter
float m_UpperThreshold; //used in Threshold filter
float m_StoppingValue; //used in Fast Marching filter
float m_Sigma; //used in GradientMagnitude filter
float m_Alpha; //used in Sigmoid filter
float m_Beta; //used in Sigmoid filter
NodeContainer::Pointer m_SeedContainer; //seed points for FastMarching
InternalImageType::Pointer m_ReferenceImageSliceAsITK; //the reference image as itk::Image
mitk::DataNode::Pointer m_ResultImageNode;//holds the result as a preview image
mitk::DataNode::Pointer m_SeedsAsPointSetNode;//used to visualize the seed points
mitk::PointSet::Pointer m_SeedsAsPointSet;
ThresholdingFilterType::Pointer m_ThresholdFilter;
SmoothingFilterType::Pointer m_SmoothFilter;
GradientFilterType::Pointer m_GradientMagnitudeFilter;
SigmoidFilterType::Pointer m_SigmoidFilter;
FastMarchingFilterType::Pointer m_FastMarchingFilter;
private:
PlaneGeometry::Pointer m_WorkingPlane;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkFastMarchingTool3D.h b/Modules/Segmentation/Interactions/mitkFastMarchingTool3D.h
index 11b57b5f0d..d80548d0bc 100644
--- a/Modules/Segmentation/Interactions/mitkFastMarchingTool3D.h
+++ b/Modules/Segmentation/Interactions/mitkFastMarchingTool3D.h
@@ -1,171 +1,171 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFastMarchingTool3D_h_Included
#define mitkFastMarchingTool3D_h_Included
#include "mitkAutoSegmentationTool.h"
#include "mitkLegacyAdaptors.h"
#include <MitkSegmentationExports.h>
#include "mitkDataNode.h"
#include "mitkPointSet.h"
#include "mitkPointSetInteractor.h"
#include "mitkToolCommand.h"
#include "mitkMessage.h"
#include "itkImage.h"
//itk filter
#include "itkFastMarchingImageFilter.h"
#include "itkBinaryThresholdImageFilter.h"
#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
#include "itkSigmoidImageFilter.h"
#include "itkCurvatureAnisotropicDiffusionImageFilter.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief FastMarching semgentation tool.
The segmentation is done by setting one or more seed points on the image
and adapting the time range and threshold. The pipeline is:
Smoothing->GradientMagnitude->SigmoidFunction->FastMarching->Threshold
The resulting binary image is seen as a segmentation of an object.
For detailed documentation see ITK Software Guide section 9.3.1 Fast Marching Segmentation.
*/
class MITKSEGMENTATION_EXPORT FastMarchingTool3D : public AutoSegmentationTool
{
mitkNewMessageMacro(Ready);
public:
mitkClassMacro(FastMarchingTool3D, AutoSegmentationTool)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/* typedefs for itk pipeline */
typedef float InternalPixelType;
typedef itk::Image< InternalPixelType, 3 > InternalImageType;
typedef unsigned char OutputPixelType;
typedef itk::Image< OutputPixelType, 3 > OutputImageType;
typedef itk::BinaryThresholdImageFilter< InternalImageType, OutputImageType > ThresholdingFilterType;
typedef itk::CurvatureAnisotropicDiffusionImageFilter< InternalImageType, InternalImageType > SmoothingFilterType;
typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< InternalImageType, InternalImageType > GradientFilterType;
typedef itk::SigmoidImageFilter< InternalImageType, InternalImageType > SigmoidFilterType;
typedef itk::FastMarchingImageFilter< InternalImageType, InternalImageType > FastMarchingFilterType;
typedef FastMarchingFilterType::NodeContainer NodeContainer;
typedef FastMarchingFilterType::NodeType NodeType;
- bool CanHandle(BaseData* referenceData) const;
+ bool CanHandle(BaseData* referenceData) const override;
/* icon stuff */
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
+ us::ModuleResource GetIconResource() const override;
/// \brief Set parameter used in Threshold filter.
void SetUpperThreshold(double);
/// \brief Set parameter used in Threshold filter.
void SetLowerThreshold(double);
/// \brief Set parameter used in Fast Marching filter.
void SetStoppingValue(double);
/// \brief Set parameter used in Gradient Magnitude filter.
void SetSigma(double);
/// \brief Set parameter used in Fast Marching filter.
void SetAlpha(double);
/// \brief Set parameter used in Fast Marching filter.
void SetBeta(double);
/// \brief Adds the feedback image to the current working image.
virtual void ConfirmSegmentation();
/// \brief Set the working time step.
virtual void SetCurrentTimeStep(int t);
/// \brief Clear all seed points.
void ClearSeeds();
/// \brief Updates the itk pipeline and shows the result of FastMarching.
void Update();
protected:
FastMarchingTool3D();
virtual ~FastMarchingTool3D();
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual void Initialize();
/// \brief Add point action of StateMachine pattern
virtual void OnAddPoint ();
/// \brief Delete action of StateMachine pattern
virtual void OnDelete ();
/// \brief Reset all relevant inputs of the itk pipeline.
void Reset();
mitk::ToolCommand::Pointer m_ProgressCommand;
Image::Pointer m_ReferenceImage;
bool m_NeedUpdate;
int m_CurrentTimeStep;
float m_LowerThreshold; //used in Threshold filter
float m_UpperThreshold; //used in Threshold filter
float m_StoppingValue; //used in Fast Marching filter
float m_Sigma; //used in GradientMagnitude filter
float m_Alpha; //used in Sigmoid filter
float m_Beta; //used in Sigmoid filter
NodeContainer::Pointer m_SeedContainer; //seed points for FastMarching
InternalImageType::Pointer m_ReferenceImageAsITK; //the reference image as itk::Image
mitk::DataNode::Pointer m_ResultImageNode;//holds the result as a preview image
mitk::DataNode::Pointer m_SeedsAsPointSetNode;//used to visualize the seed points
mitk::PointSet::Pointer m_SeedsAsPointSet;
mitk::PointSetInteractor::Pointer m_SeedPointInteractor;
unsigned int m_PointSetAddObserverTag;
unsigned int m_PointSetRemoveObserverTag;
ThresholdingFilterType::Pointer m_ThresholdFilter;
SmoothingFilterType::Pointer m_SmoothFilter;
GradientFilterType::Pointer m_GradientMagnitudeFilter;
SigmoidFilterType::Pointer m_SigmoidFilter;
FastMarchingFilterType::Pointer m_FastMarchingFilter;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkFillRegionTool.h b/Modules/Segmentation/Interactions/mitkFillRegionTool.h
index 5342250b4d..b86aae31dd 100644
--- a/Modules/Segmentation/Interactions/mitkFillRegionTool.h
+++ b/Modules/Segmentation/Interactions/mitkFillRegionTool.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkFillRegionTool_h_Included
#define mitkFillRegionTool_h_Included
#include "mitkSetRegionTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Fill the inside of a contour with 1
\sa SetRegionTool
\ingroup Interaction
\ingroup ToolManagerEtAl
Finds the outer contour of a shape in 2D (possibly including holes) and sets all
the inside pixels to 1, filling holes in a segmentation.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT FillRegionTool : public SetRegionTool
{
public:
mitkClassMacro(FillRegionTool, SetRegionTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
FillRegionTool(); // purposely hidden
virtual ~FillRegionTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkLiveWireTool2D.h b/Modules/Segmentation/Interactions/mitkLiveWireTool2D.h
index 29a195a473..26165910d0 100644
--- a/Modules/Segmentation/Interactions/mitkLiveWireTool2D.h
+++ b/Modules/Segmentation/Interactions/mitkLiveWireTool2D.h
@@ -1,165 +1,165 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCorrectorTool2D_h_Included
#define mitkCorrectorTool2D_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkSegTool2D.h"
#include <mitkContourModel.h>
#include <mitkContourModelLiveWireInteractor.h>
#include <mitkImageLiveWireContourModelFilter.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief A 2D segmentation tool based on LiveWire approach.
The contour between the last user added point and the current mouse position
is computed by searching the shortest path according to specific features of
the image. The contour thus snappest to the boundary of objects.
\sa SegTool2D
\sa ImageLiveWireContourModelFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
\warning Only to be instantiated by mitk::ToolManager.
*/
class MITKSEGMENTATION_EXPORT LiveWireTool2D : public SegTool2D
{
public:
mitkClassMacro(LiveWireTool2D, SegTool2D);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
/// \brief Convert all current contour objects to binary segmentation image.
void ConfirmSegmentation();
/// \brief Delete all current contour objects.
void ClearSegmentation();
protected:
LiveWireTool2D();
virtual ~LiveWireTool2D();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
/// \brief Initialize tool
virtual bool OnInitLiveWire ( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Add a control point and finish current segment
virtual bool OnAddPoint ( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Actual LiveWire computation
virtual bool OnMouseMoved( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Check double click on first control point to finish the LiveWire tool
virtual bool OnCheckPoint( const InteractionEvent* interactionEvent );
/// \brief Finish LiveWire tool
virtual bool OnFinish( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Close the contour
virtual bool OnLastSegmentDelete( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Don't use dynamic cost map for LiveWire calculation
virtual bool OnMouseMoveNoDynamicCosts( StateMachineAction*, InteractionEvent* interactionEvent );
/// \brief Finish contour interaction.
void FinishTool();
///
/// \brief IsPositionEventInsideImageRegion
/// \param interactionEvent
/// \return
///
virtual bool IsPositionEventInsideImageRegion(InteractionPositionEvent *positionEvent, BaseData * data);
/** \brief Enable interaction with contours.
* Contours that are created by the tool can be edited using LiveWire functionality.
* Points can thus be inserted, moved or deleted.
* \param on true to have interaction enabled.
*/
void EnableContourLiveWireInteraction(bool on);
//the contour already set by the user
mitk::ContourModel::Pointer m_Contour;
//the corresponding datanode
mitk::DataNode::Pointer m_ContourModelNode;
//the current LiveWire computed contour
mitk::ContourModel::Pointer m_LiveWireContour;
//the corresponding datanode
mitk::DataNode::Pointer m_LiveWireContourNode;
// the contour for the editing portion
mitk::ContourModel::Pointer m_EditingContour;
//the corresponding datanode
mitk::DataNode::Pointer m_EditingContourNode;
// the corresponding contour interactor
mitk::ContourModelLiveWireInteractor::Pointer m_ContourInteractor;
//the current reference image
mitk::Image::Pointer m_WorkingSlice;
// the filter for live wire calculation
mitk::ImageLiveWireContourModelFilter::Pointer m_LiveWireFilter;
bool m_CreateAndUseDynamicCosts;
std::vector< std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer> > m_WorkingContours;
std::vector< std::pair<mitk::DataNode::Pointer, mitk::PlaneGeometry::Pointer> > m_EditingContours;
std::vector< mitk::ContourModelLiveWireInteractor::Pointer > m_LiveWireInteractors;
template<typename TPixel, unsigned int VImageDimension>
void FindHighestGradientMagnitudeByITK(itk::Image<TPixel, VImageDimension>* inputImage, itk::Index<3> &index, itk::Index<3> &returnIndex);
private:
void RemoveHelperObjects();
void ReleaseHelperObjects();
void ReleaseInteractors();
const PlaneGeometry* m_PlaneGeometry;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkOtsuTool3D.h b/Modules/Segmentation/Interactions/mitkOtsuTool3D.h
index a36b1829b7..af2a33b7b3 100644
--- a/Modules/Segmentation/Interactions/mitkOtsuTool3D.h
+++ b/Modules/Segmentation/Interactions/mitkOtsuTool3D.h
@@ -1,72 +1,72 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKOTSUTOOL3D_H
#define MITKOTSUTOOL3D_H
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include "itkImage.h"
namespace us {
class ModuleResource;
}
namespace mitk{
class Image;
class MITKSEGMENTATION_EXPORT OtsuTool3D : public AutoSegmentationTool
{
public:
mitkClassMacro(OtsuTool3D, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char* GetName() const;
- virtual const char** GetXPM() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char* GetName() const override;
+ virtual const char** GetXPM() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
void RunSegmentation( int regions, bool useValley, int numberOfBins);
void ConfirmSegmentation();
//void UpdateBinaryPreview(int regionID);
void UpdateBinaryPreview(std::vector<int> regionIDs);
void UpdateVolumePreview(bool volumeRendering);
void ShowMultiLabelResultNode(bool);
int GetNumberOfBins();
protected:
OtsuTool3D();
virtual ~OtsuTool3D();
template< typename TPixel, unsigned int VImageDimension>
void CalculatePreview( itk::Image< TPixel, VImageDimension>* itkImage, std::vector<int> regionIDs);
itk::SmartPointer<Image> m_OriginalImage;
//holds the user selected binary segmentation
mitk::DataNode::Pointer m_BinaryPreviewNode;
//holds the multilabel result as a preview image
mitk::DataNode::Pointer m_MultiLabelResultNode;
//holds the user selected binary segmentation masked original image
mitk::DataNode::Pointer m_MaskedImagePreviewNode;
};//class
}//namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkPaintbrushTool.h b/Modules/Segmentation/Interactions/mitkPaintbrushTool.h
index 6728f7cd7e..1a13e5cd45 100644
--- a/Modules/Segmentation/Interactions/mitkPaintbrushTool.h
+++ b/Modules/Segmentation/Interactions/mitkPaintbrushTool.h
@@ -1,112 +1,112 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPaintbrushTool_h_Included
#define mitkPaintbrushTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkFeedbackContourTool.h"
#include "mitkPointSet.h"
#include "mitkPointOperation.h"
#include "mitkLegacyAdaptors.h"
namespace mitk
{
class StateMachineAction;
class InteractionEvent;
class InteractionPositionEvent;
/**
\brief Paintbrush tool for InteractiveSegmentation
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Simple paintbrush drawing tool. Right now there are only circular pens of varying size.
\warning Only to be instantiated by mitk::ToolManager.
$Author: maleike $
*/
class MITKSEGMENTATION_EXPORT PaintbrushTool : public FeedbackContourTool
{
public:
// sent when the pen size is changed or should be updated in a GUI.
Message1<int> SizeChanged;
mitkClassMacro(PaintbrushTool, FeedbackContourTool);
void SetSize(int value);
protected:
PaintbrushTool(int paintingPixelValue = 1); // purposely hidden
virtual ~PaintbrushTool();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual bool OnMousePressed ( StateMachineAction*, InteractionEvent* );
virtual bool OnMouseMoved ( StateMachineAction*, InteractionEvent* );
virtual bool OnPrimaryButtonPressedMoved( StateMachineAction*, InteractionEvent* );
virtual bool MouseMoved(mitk::InteractionEvent* interactionEvent, bool leftMouseButtonPressed);
virtual bool OnMouseReleased( StateMachineAction*, InteractionEvent* );
virtual bool OnInvertLogic ( StateMachineAction*, InteractionEvent* );
/**
* \todo This is a possible place where to introduce
* different types of pens
*/
void UpdateContour( const InteractionPositionEvent* );
/**
* Little helper function. Returns the upper left corner of the given pixel.
*/
mitk::Point2D upperLeft(mitk::Point2D p);
/**
* Checks if the current slice has changed
*/
void CheckIfCurrentSliceHasChanged(const InteractionPositionEvent* event);
void OnToolManagerWorkingDataModified();
int m_PaintingPixelValue;
static int m_Size;
ContourModel::Pointer m_MasterContour;
int m_LastContourSize;
Image::Pointer m_WorkingSlice;
PlaneGeometry::Pointer m_CurrentPlane;
DataNode::Pointer m_WorkingNode;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkPickingTool.h b/Modules/Segmentation/Interactions/mitkPickingTool.h
index 0d0d0703a1..b249f0705b 100644
--- a/Modules/Segmentation/Interactions/mitkPickingTool.h
+++ b/Modules/Segmentation/Interactions/mitkPickingTool.h
@@ -1,98 +1,98 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPickingTool_h_Included
#define mitkPickingTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include "mitkDataStorage.h"
#include "mitkSinglePointDataInteractor.h"
#include "mitkPointSet.h"
#include "itkImage.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Extracts a single region from a segmentation image and creates a new image with same geometry of the input image.
The region is extracted in 3D space. This is done by performing region growing within the desired region.
Use shift click to add the seed point.
\ingroup ToolManagerEtAl
\sa mitk::Tool
\sa QmitkInteractiveSegmentation
*/
class MITKSEGMENTATION_EXPORT PickingTool : public AutoSegmentationTool
{
public:
mitkClassMacro(PickingTool, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual const char* GetName() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual const char* GetName() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual DataNode::Pointer GetPointSetNode();
mitk::DataNode* GetReferenceData();
mitk::DataNode* GetWorkingData();
mitk::DataStorage* GetDataStorage();
void ConfirmSegmentation();
protected:
PickingTool(); // purposely hidden
virtual ~PickingTool();
//Callback for point add event of PointSet
void OnPointAdded();
//Observer id
long m_PointSetAddObserverTag;
mitk::DataNode::Pointer m_ResultNode;
//itk regrowing
template < typename TPixel, unsigned int VImageDimension >
void StartRegionGrowing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::BaseGeometry* imageGeometry, mitk::PointSet::PointType seedPoint );
//seed point
PointSet::Pointer m_PointSet;
SinglePointDataInteractor::Pointer m_SeedPointInteractor;
DataNode::Pointer m_PointSetNode;
DataNode* m_WorkingData;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkPixelManipulationTool.h b/Modules/Segmentation/Interactions/mitkPixelManipulationTool.h
index a6e91f740a..35c213a457 100644
--- a/Modules/Segmentation/Interactions/mitkPixelManipulationTool.h
+++ b/Modules/Segmentation/Interactions/mitkPixelManipulationTool.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKPIXELMANIPULATIONTOOL_H
#define MITKPIXELMANIPULATIONTOOL_H
#include "mitkTool.h"
#include <MitkSegmentationExports.h>
#include "itkImage.h"
namespace mitk
{
class Image;
class MITKSEGMENTATION_EXPORT PixelManipulationTool : public Tool
{
public:
mitkClassMacro(PixelManipulationTool, Tool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetValue( int value );
int GetValue();
void SetFixedValue( int value );
int GetFixedValue();
- virtual const char* GetName() const;
- virtual const char** GetXPM() const;
+ virtual const char* GetName() const override;
+ virtual const char** GetXPM() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual void CalculateImage();
protected:
PixelManipulationTool();
virtual ~PixelManipulationTool();
virtual void OnRoiDataChanged();
void AddImageToDataStorage(itk::SmartPointer<mitk::Image> image);
template <typename TPixel, unsigned int VImageDimension>
void ITKPixelManipulation( itk::Image<TPixel, VImageDimension>* originalImage, Image* maskImage, Image* newImage, int newValue);
mitk::DataNode::Pointer m_OriginalImageNode;
int m_Value;
bool m_FixedValue;
};//clas
}//namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkRegionGrow3DTool.h b/Modules/Segmentation/Interactions/mitkRegionGrow3DTool.h
index fbe9c866c1..484b61bb46 100644
--- a/Modules/Segmentation/Interactions/mitkRegionGrow3DTool.h
+++ b/Modules/Segmentation/Interactions/mitkRegionGrow3DTool.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKREGIONGROW3DTOOL_H
#define MITKREGIONGROW3DTOOL_H
#include "mitkTool.h"
#include "mitkPointSet.h"
#include <MitkSegmentationExports.h>
#include "mitkStateEvent.h"
#include "itkImage.h"
namespace mitk{
class StateMachineAction;
class InteractionEvent;
class MITKSEGMENTATION_EXPORT RegionGrow3DTool : public Tool
{
public:
mitkClassMacro(RegionGrow3DTool, Tool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitk::Message1<int> UpperThresholdValueChanged;
mitk::Message1<int> LowerThresholdValueChanged;
mitk::Message1<int> SliderValueChanged;
mitk::Message1<bool> SeedButtonToggled;
- virtual const char* GetName() const;
- virtual const char** GetXPM() const;
+ virtual const char* GetName() const override;
+ virtual const char** GetXPM() const override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
void RunSegmentation();
void ConfirmSegmentation(std::string name, mitk::Color color);
void CancelSegmentation();
void InitializeLevelWindow();
void ChangeLevelWindow(int);
void SetSeedPoint(bool);
void SetCurrentRGDirectionIsUpwards(bool);
protected:
RegionGrow3DTool();
virtual ~RegionGrow3DTool();
void SetupPreviewNodeFor(mitk::DataNode* nodeToProceed);
void UpdatePreview();
template < typename TPixel, unsigned int VImageDimension >
void StartRegionGrowing( itk::Image< TPixel, VImageDimension >* itkImage, mitk::BaseGeometry* imageGeometry, mitk::PointSet::PointType seedPoint );
bool OnMouseReleased( StateMachineAction*, InteractionEvent* );
int m_SeedpointValue;
mitk::ScalarType m_RoiMax;
mitk::ScalarType m_RoiMin;
int m_LowerThreshold;
int m_UpperThreshold;
int m_DetectedLeakagePoint;
bool m_CurrentRGDirectionIsUpwards;
mitk::DataNode::Pointer m_PointSetNode;
mitk::DataNode::Pointer m_FeedbackNode;
mitk::DataNode::Pointer m_NodeToProceed;
mitk::DataNode::Pointer m_OriginalImageNode;
};//class
}//namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkRegionGrowingTool.h b/Modules/Segmentation/Interactions/mitkRegionGrowingTool.h
index c59b826768..d617b2f3a2 100644
--- a/Modules/Segmentation/Interactions/mitkRegionGrowingTool.h
+++ b/Modules/Segmentation/Interactions/mitkRegionGrowingTool.h
@@ -1,124 +1,124 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkRegionGrowingTool_h_Included
#define mitkRegionGrowingTool_h_Included
#include "mitkFeedbackContourTool.h"
#include "mitkLegacyAdaptors.h"
#include <MitkSegmentationExports.h>
struct mitkIpPicDescriptor;
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief A slice based region growing tool.
\sa FeedbackContourTool
\ingroup Interaction
\ingroup ToolManagerEtAl
When the user presses the mouse button, RegionGrowingTool will use the gray values at that position
to initialize a region growing algorithm (in the affected 2D slice).
By moving the mouse up and down while the button is still pressed, the user can change the parameters
of the region growing algorithm (selecting more or less of an object).
The current result of region growing will always be shown as a contour to the user.
After releasing the button, the current result of the region growing algorithm will be written to the
working image of this tool's ToolManager.
If the first click is <i>inside</i> a segmentation that was generated by region growing (recently),
the tool will try to cut off a part of the segmentation. For this reason a skeletonization of the segmentation
is generated and the optimal cut point is determined.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT RegionGrowingTool : public FeedbackContourTool
{
public:
mitkClassMacro(RegionGrowingTool, FeedbackContourTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
RegionGrowingTool(); // purposely hidden
virtual ~RegionGrowingTool();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual bool OnMousePressed ( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnMousePressedInside ( StateMachineAction*, InteractionEvent* interactionEvent, mitkIpPicDescriptor* workingPicSlice, int initialWorkingOffset);
virtual bool OnMousePressedOutside ( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnMouseMoved ( StateMachineAction*, InteractionEvent* interactionEvent );
virtual bool OnMouseReleased( StateMachineAction*, InteractionEvent* interactionEvent );
mitkIpPicDescriptor* PerformRegionGrowingAndUpdateContour(int timestep=0);
Image::Pointer m_ReferenceSlice;
Image::Pointer m_WorkingSlice;
ScalarType m_LowerThreshold;
ScalarType m_UpperThreshold;
ScalarType m_InitialLowerThreshold;
ScalarType m_InitialUpperThreshold;
Point2I m_LastScreenPosition;
int m_ScreenYDifference;
private:
mitkIpPicDescriptor* SmoothIPPicBinaryImage( mitkIpPicDescriptor* image, int &contourOfs, mitkIpPicDescriptor* dest = NULL );
void SmoothIPPicBinaryImageHelperForRows( mitkIpPicDescriptor* source, mitkIpPicDescriptor* dest, int &contourOfs, int* maskOffsets, int maskSize, int startOffset, int endOffset );
mitkIpPicDescriptor* m_OriginalPicSlice;
int m_SeedPointMemoryOffset;
ScalarType m_VisibleWindow;
ScalarType m_DefaultWindow;
ScalarType m_MouseDistanceScaleFactor;
int m_PaintingPixelValue;
int m_LastWorkingSeed;
bool m_FillFeedbackContour;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkSegTool2D.h b/Modules/Segmentation/Interactions/mitkSegTool2D.h
index 67034a31c6..c7f4a10c35 100644
--- a/Modules/Segmentation/Interactions/mitkSegTool2D.h
+++ b/Modules/Segmentation/Interactions/mitkSegTool2D.h
@@ -1,180 +1,180 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSegTool2D_h_Included
#define mitkSegTool2D_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkTool.h"
#include "mitkImage.h"
#include "mitkStateEvent.h"
#include "mitkInteractionPositionEvent.h"
#include "mitkPlanePositionManager.h"
#include "mitkRestorePlanePositionOperation.h"
#include "mitkInteractionConst.h"
#include <mitkDiffSliceOperation.h>
namespace mitk
{
class BaseRenderer;
/**
\brief Abstract base class for segmentation tools.
\sa Tool
\ingroup Interaction
\ingroup ToolManagerEtAl
Implements 2D segmentation specific helper methods, that might be of use to
all kind of 2D segmentation tools. At the moment these are:
- Determination of the slice where the user paints upon (DetermineAffectedImageSlice)
- Projection of a 3D contour onto a 2D plane/slice
SegTool2D tries to structure the interaction a bit. If you pass "PressMoveRelease" as the interaction type
of your derived tool, you might implement the methods OnMousePressed, OnMouseMoved, and OnMouseReleased.
Yes, your guess about when they are called is correct.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT SegTool2D : public Tool
{
public:
mitkClassMacro(SegTool2D, Tool);
/**
\brief Calculates for a given Image and PlaneGeometry, which slice of the image (in index corrdinates) is meant by the plane.
\return false, if no slice direction seems right (e.g. rotated planes)
\param affectedDimension The image dimension, which is constant for all points in the plane, e.g. Axial --> 2
\param affectedSlice The index of the image slice
*/
static bool DetermineAffectedImageSlice( const Image* image, const PlaneGeometry* plane, int& affectedDimension, int& affectedSlice );
/**
* @brief Updates the surface interpolation by extracting the contour form the given slice.
* @param slice the slice from which the contour should be extracted
* @param workingImage the segmentation image
* @param plane the plane in which the slice lies
* @param detectIntersection if true the slice is eroded before contour extraction. If the slice is empty after the erosion it is most
* likely an intersecting contour an will not be added to the SurfaceInterpolationController
*/
static void UpdateSurfaceInterpolation (const Image* slice, const Image* workingImage, const PlaneGeometry *plane, bool detectIntersection);
void SetShowMarkerNodes(bool);
/**
* \brief Enables or disables the 3D interpolation after writing back the 2D segmentation result, and defaults to true.
*/
void SetEnable3DInterpolation(bool);
protected:
SegTool2D(); // purposely hidden
SegTool2D(const char*); // purposely hidden
virtual ~SegTool2D();
struct SliceInformation
{
mitk::Image::Pointer slice;
mitk::PlaneGeometry* plane;
unsigned int timestep;
SliceInformation () {}
SliceInformation (mitk::Image* slice, mitk::PlaneGeometry* plane, unsigned int timestep)
{
this->slice = slice;
this->plane = plane;
this->timestep = timestep;
}
};
/**
* \brief Filters events that cannot be handle by 2D segmentation tools
*
* Current an event is discarded if it was not sent by a 2D renderwindow and if it is
* not of type InteractionPositionEvent
*/
- virtual bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode);
+ virtual bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode) override;
/**
\brief Extract the slice of an image that the user just scribbles on.
\return NULL if SegTool2D is either unable to determine which slice was affected, or if there was some problem getting the image data at that position.
*/
Image::Pointer GetAffectedImageSliceAs2DImage(const InteractionPositionEvent*, const Image* image);
/**
\brief Extract the slice of an image cut by given plane.
\return NULL if SegTool2D is either unable to determine which slice was affected, or if there was some problem getting the image data at that position.
*/
Image::Pointer GetAffectedImageSliceAs2DImage(const PlaneGeometry* planeGeometry, const Image* image, unsigned int timeStep);
/**
\brief Extract the slice of the currently selected working image that the user just scribbles on.
\return NULL if SegTool2D is either unable to determine which slice was affected, or if there was some problem getting the image data at that position,
or just no working image is selected.
*/
Image::Pointer GetAffectedWorkingSlice(const InteractionPositionEvent*);
/**
\brief Extract the slice of the currently selected reference image that the user just scribbles on.
\return NULL if SegTool2D is either unable to determine which slice was affected, or if there was some problem getting the image data at that position,
or just no reference image is selected.
*/
Image::Pointer GetAffectedReferenceSlice(const InteractionPositionEvent*);
void WriteBackSegmentationResult (const InteractionPositionEvent*, Image*);
void WriteBackSegmentationResult (const PlaneGeometry* planeGeometry, Image*, unsigned int timeStep);
void WriteBackSegmentationResult (std::vector<SliceInformation> sliceList, bool writeSliceToVolume = true);
void WriteSliceToVolume (SliceInformation sliceInfo);
/**
\brief Adds a new node called Contourmarker to the datastorage which holds a mitk::PlanarFigure.
By selecting this node the slicestack will be reoriented according to the PlanarFigure's Geometry
*/
int AddContourmarker();
void InteractiveSegmentationBugMessage( const std::string& message );
BaseRenderer* m_LastEventSender;
unsigned int m_LastEventSlice;
private:
//The prefix of the contourmarkername. Suffix is a consecutive number
const std::string m_Contourmarkername;
bool m_ShowMarkerNodes;
static bool m_SurfaceInterpolationEnabled;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkSegmentationsProcessingTool.h b/Modules/Segmentation/Interactions/mitkSegmentationsProcessingTool.h
index e22c209ddd..59d33585f4 100644
--- a/Modules/Segmentation/Interactions/mitkSegmentationsProcessingTool.h
+++ b/Modules/Segmentation/Interactions/mitkSegmentationsProcessingTool.h
@@ -1,101 +1,101 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSegmentationsProcessingTool_h_Included
#define mitkSegmentationsProcessingTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkTool.h"
#include "mitkDataNode.h"
namespace mitk
{
/**
\brief Batch processing of all selected segmentations/data
This class is undocumented. Ask the creator ($Author$) to supply useful comments.
*/
class MITKSEGMENTATION_EXPORT SegmentationsProcessingTool : public Tool
{
public:
mitkClassMacro(SegmentationsProcessingTool, Tool);
protected:
SegmentationsProcessingTool(); // purposely hidden
virtual ~SegmentationsProcessingTool();
- virtual const char* GetGroup() const;
+ virtual const char* GetGroup() const override;
/**
\brief Called when the tool gets activated
Will just call ProcessAllObjects and then deactivate this tool again.
*/
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
/**
\brief Loop over all working data items
Will call the following methods in turn
- StartProcessingAllData
- ProcessOneWorkingData(DataNode*) for each node in the working data list of our tool manager
- FinishProcessingAllData
Subclasses should override these methods as needed and provide meaningful implementations.
*/
virtual void ProcessAllObjects();
/**
\brief Subclasses should override this method
\sa ProcessAllObjects
*/
virtual void StartProcessingAllData();
/**
\brief Subclasses should override this method
\sa ProcessAllObjects
*/
virtual bool ProcessOneWorkingData( DataNode* node );
/**
\brief Subclasses should override this method
\sa ProcessAllObjects
*/
virtual void FinishProcessingAllData();
/**
\brief Sends an error message if there was an error during processing.
*/
virtual void SendErrorMessageIfAny();
/**
\brief Describes the error (if one occurred during processing).
*/
virtual std::string GetErrorMessage();
std::string m_FailedNodes;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkSetRegionTool.h b/Modules/Segmentation/Interactions/mitkSetRegionTool.h
index f63ffdc3ae..bc139eb00e 100644
--- a/Modules/Segmentation/Interactions/mitkSetRegionTool.h
+++ b/Modules/Segmentation/Interactions/mitkSetRegionTool.h
@@ -1,80 +1,80 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSetRegionTool_h_Included
#define mitkSetRegionTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkFeedbackContourTool.h"
namespace mitk
{
class Image;
class StateMachineAction;
class InteractionEvent;
/**
\brief Fills or erases a 2D region
\sa FeedbackContourTool
\sa ExtractImageFilter
\sa OverwriteSliceImageFilter
\ingroup Interaction
\ingroup ToolManagerEtAl
Finds the outer contour of a shape in 2D (possibly including holes) and sets all
the inside pixels to a specified value. This might fill holes or erase segmentations.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT SetRegionTool : public FeedbackContourTool
{
public:
mitkClassMacro(SetRegionTool, FeedbackContourTool);
protected:
SetRegionTool(int paintingPixelValue = 1); // purposely hidden
virtual ~SetRegionTool();
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
virtual bool OnMousePressed ( StateMachineAction*, InteractionEvent* );
virtual bool OnMouseReleased( StateMachineAction*, InteractionEvent* );
virtual bool OnInvertLogic ( StateMachineAction*, InteractionEvent* );
int m_PaintingPixelValue;
bool m_FillContour;
bool m_StatusFillWholeSlice;
ContourModel::Pointer m_SegmentationContourInWorldCoordinates;
ContourModel::Pointer m_WholeImageContourInWorldCoordinates;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkSubtractContourTool.h b/Modules/Segmentation/Interactions/mitkSubtractContourTool.h
index 1d5e4c8ac1..37ce93bf52 100644
--- a/Modules/Segmentation/Interactions/mitkSubtractContourTool.h
+++ b/Modules/Segmentation/Interactions/mitkSubtractContourTool.h
@@ -1,75 +1,75 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSubtractContourTool_h_Included
#define mitkSubtractContourTool_h_Included
#include "mitkContourTool.h"
#include <MitkSegmentationExports.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
/**
\brief Fill the inside of a contour with 1
\sa ContourTool
\ingroup Interaction
\ingroup ToolManagerEtAl
Fills a visible contour (from FeedbackContourTool) during mouse dragging. When the mouse button
is released, SubtractContourTool tries to extract a slice from the working image and fill in
the (filled) contour as a binary image. All inside pixels are set to 0.
While holding the CTRL key, the contour changes color and the pixels on the inside would be
filled with 1.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT SubtractContourTool : public ContourTool
{
public:
mitkClassMacro(SubtractContourTool, ContourTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual const char** GetXPM() const;
- virtual us::ModuleResource GetCursorIconResource() const;
- us::ModuleResource GetIconResource() const;
+ virtual const char** GetXPM() const override;
+ virtual us::ModuleResource GetCursorIconResource() const override;
+ us::ModuleResource GetIconResource() const override;
- virtual const char* GetName() const;
+ virtual const char* GetName() const override;
protected:
SubtractContourTool(); // purposely hidden
virtual ~SubtractContourTool();
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkTool.h b/Modules/Segmentation/Interactions/mitkTool.h
index a81e30365b..aa8d4c8c60 100644
--- a/Modules/Segmentation/Interactions/mitkTool.h
+++ b/Modules/Segmentation/Interactions/mitkTool.h
@@ -1,254 +1,254 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkTool_h_Included
#define mitkTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkStateMachine.h"
#include "mitkToolEvents.h"
#include "itkObjectFactoryBase.h"
#include "itkVersion.h"
#include "mitkToolFactoryMacro.h"
#include "mitkMessage.h"
#include "mitkDataNode.h"
#include "mitkNodePredicateProperty.h"
#include "mitkNodePredicateDataType.h"
#include "mitkNodePredicateDimension.h"
#include "mitkNodePredicateAnd.h"
#include "mitkNodePredicateOr.h"
#include "mitkNodePredicateNot.h"
#include <iostream>
#include <string>
#include <itkObject.h>
#include "mitkInteractionEventObserver.h"
#include "mitkEventStateMachine.h"
namespace us {
class ModuleResource;
}
namespace mitk
{
class ToolManager;
/**
\brief Base class of all tools used by mitk::ToolManager.
\sa ToolManager
\sa SegTool2D
\ingroup Interaction
\ingroup ToolManagerEtAl
There is a separate page describing the \ref QmitkInteractiveSegmentationTechnicalPage.
Every tool is a mitk::StateMachine, which can follow any transition pattern that it likes. One important thing to know is, that
every derived tool should always call SuperClass::Deactivated() in its own implementation of Deactivated, because mitk::Tool
resets the StateMachine in this method. Only if you are very sure that you covered all possible things that might happen to your
own tool, you should consider not to reset the StateMachine from time to time.
To learn about the MITK implementation of state machines in general, have a look at \ref InteractionPage.
To derive a non-abstract tool, you inherit from mitk::Tool (or some other base class further down the inheritance tree), and in your
own parameterless constructor (that is called from the itkFactorylessNewMacro that you use) you pass a StateMachine pattern name to the superclass.
Names for valid patterns can be found in StateMachine.xml (which might be enhanced by you).
You have to implement at least GetXPM() and GetName() to provide some identification.
Each Tool knows its ToolManager, which can provide the data that the tool should work on.
\warning Only to be instantiated by mitk::ToolManager (because SetToolManager has to be called). All other uses are unsupported.
$Author$
*/
class MITKSEGMENTATION_EXPORT Tool : public EventStateMachine
, public InteractionEventObserver
{
public:
typedef unsigned char DefaultSegmentationDataType;
/**
* \brief To let GUI process new events (e.g. qApp->processEvents() )
*/
Message<> GUIProcessEventsMessage;
/**
* \brief To send error messages (to be shown by some GUI)
*/
Message1<std::string> ErrorMessage;
/**
* \brief To send whether the tool is busy (to be shown by some GUI)
*/
Message1<bool> CurrentlyBusy;
/**
* \brief To send general messages (to be shown by some GUI)
*/
Message1<std::string> GeneralMessage;
mitkClassMacro(Tool, EventStateMachine);
// no New(), there should only be subclasses
/**
\brief Returns an icon in the XPM format.
This icon has to fit into some kind of button in most applications, so make it smaller than 25x25 pixels.
XPM is e.g. supported by The Gimp. But if you open any XPM file in your text editor, you will see that you could also "draw" it with an editor.
*/
virtual const char** GetXPM() const = 0;
/**
* \brief Returns the path of an icon.
*
* This icon is preferred to the XPM icon.
*/
virtual std::string GetIconPath() const { return ""; }
/**
* \brief Returns the path of a cursor icon.
*
*/
virtual us::ModuleResource GetCursorIconResource() const;
/**
* @brief Returns the tool button icon of the tool wrapped by a usModuleResource
* @return a valid ModuleResource or an invalid if this function
* is not reimplemented
*/
virtual us::ModuleResource GetIconResource() const;
/**
\brief Returns the name of this tool. Make it short!
This name has to fit into some kind of button in most applications, so take some time to think of a good name!
*/
virtual const char* GetName() const = 0;
/**
\brief Name of a group.
You can group several tools by assigning a group name. Graphical tool selectors might use this information to group tools. (What other reason could there be?)
*/
virtual const char* GetGroup() const;
virtual void InitializeStateMachine();
/**
* \brief Interface for GUI creation.
*
* This is the basic interface for creation of a GUI object belonging to one tool.
*
* Tools that support a GUI (e.g. for display/editing of parameters) should follow some rules:
*
* - A Tool and its GUI are two separate classes
* - There may be several instances of a GUI at the same time.
* - mitk::Tool is toolkit (Qt, wxWidgets, etc.) independent, the GUI part is of course dependent
* - The GUI part inherits both from itk::Object and some GUI toolkit class
* - The GUI class name HAS to be constructed like "toolkitPrefix" tool->GetClassName() + "toolkitPostfix", e.g. MyTool -> wxMyToolGUI
* - For each supported toolkit there is a base class for tool GUIs, which contains some convenience methods
* - Tools notify the GUI about changes using ITK events. The GUI must observe interesting events.
* - The GUI base class may convert all ITK events to the GUI toolkit's favoured messaging system (Qt -> signals)
* - Calling methods of a tool by its GUI is done directly.
* In some cases GUIs don't want to be notified by the tool when they cause a change in a tool.
* There is a macro CALL_WITHOUT_NOTICE(method()), which will temporarily disable all notifications during a method call.
*/
virtual itk::Object::Pointer GetGUI(const std::string& toolkitPrefix, const std::string& toolkitPostfix);
virtual NodePredicateBase::ConstPointer GetReferenceDataPreference() const;
virtual NodePredicateBase::ConstPointer GetWorkingDataPreference() const;
DataNode::Pointer CreateEmptySegmentationNode( Image* original, const std::string& organName, const mitk::Color& color );
DataNode::Pointer CreateSegmentationNode( Image* image, const std::string& organName, const mitk::Color& color );
virtual bool CanHandle(BaseData* referenceData) const;
protected:
friend class ToolManager;
virtual void SetToolManager(ToolManager*);
- void ConnectActionsAndFunctions();
+ void ConnectActionsAndFunctions() override;
/**
\brief Called when the tool gets activated (registered to mitk::GlobalInteraction).
Derived tools should call their parents implementation.
*/
virtual void Activated();
/**
\brief Called when the tool gets deactivated (unregistered from mitk::GlobalInteraction).
Derived tools should call their parents implementation.
*/
virtual void Deactivated();
Tool(); // purposely hidden
Tool( const char*); // purposely hidden
virtual ~Tool();
- virtual void Notify( InteractionEvent* interactionEvent,bool isHandled );
+ virtual void Notify( InteractionEvent* interactionEvent,bool isHandled ) override;
- bool FilterEvents(InteractionEvent* , DataNode* );
+ bool FilterEvents(InteractionEvent* , DataNode* ) override;
ToolManager* m_ToolManager;
private:
// for reference data
NodePredicateDataType::Pointer m_PredicateImages;
NodePredicateDimension::Pointer m_PredicateDim3;
NodePredicateDimension::Pointer m_PredicateDim4;
NodePredicateOr::Pointer m_PredicateDimension;
NodePredicateAnd::Pointer m_PredicateImage3D;
NodePredicateProperty::Pointer m_PredicateBinary;
NodePredicateNot::Pointer m_PredicateNotBinary;
NodePredicateProperty::Pointer m_PredicateSegmentation;
NodePredicateNot::Pointer m_PredicateNotSegmentation;
NodePredicateProperty::Pointer m_PredicateHelper;
NodePredicateNot::Pointer m_PredicateNotHelper;
NodePredicateAnd::Pointer m_PredicateImageColorful;
NodePredicateAnd::Pointer m_PredicateImageColorfulNotHelper;
NodePredicateAnd::Pointer m_PredicateReference;
// for working data
NodePredicateAnd::Pointer m_IsSegmentationPredicate;
std::string m_InteractorType;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkToolCommand.h b/Modules/Segmentation/Interactions/mitkToolCommand.h
index 6287a6daca..9d81b90327 100644
--- a/Modules/Segmentation/Interactions/mitkToolCommand.h
+++ b/Modules/Segmentation/Interactions/mitkToolCommand.h
@@ -1,89 +1,89 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitkToolCommand_H
#define _mitkToolCommand_H
#include "itkCommand.h"
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
namespace mitk {
/**
* \brief A command to get tool process feedback.
*
* \sa ProgressBar
*
*/
class MITKSEGMENTATION_EXPORT ToolCommand : public itk::Command
{
public:
typedef ToolCommand Self;
typedef itk::Command Superclass;
typedef itk::SmartPointer<Self> Pointer;
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Reacts on events from ITK filters.
*
*/
- void Execute(itk::Object *caller, const itk::EventObject & event);
+ void Execute(itk::Object *caller, const itk::EventObject & event) override;
/**
* \brief Not implemented...
*
*/
- void Execute(const itk::Object * object, const itk::EventObject & event);
+ void Execute(const itk::Object * object, const itk::EventObject & event) override;
/**
* \brief Add new steps to the progress bar.
*
*/
void AddStepsToDo(int steps);
/**
* \brief Sets the remaining progress to the progress bar when the optimization process is done.
*
*/
void SetProgress(int steps);
/**
* \brief Returns the current progress value.
*
*/
double GetCurrentProgressValue();
/**
* \brief Sets the stop processing flag, which is used to call ...
*
*/
void SetStopProcessing(bool value);
protected:
ToolCommand();
private:
double m_ProgressValue;
bool m_StopProcessing;
};
} // namespace mitk
#endif // _mitkToolCommand_H
diff --git a/Modules/Segmentation/Interactions/mitkToolEvents.h b/Modules/Segmentation/Interactions/mitkToolEvents.h
index 45981c2d0e..621069efce 100644
--- a/Modules/Segmentation/Interactions/mitkToolEvents.h
+++ b/Modules/Segmentation/Interactions/mitkToolEvents.h
@@ -1,294 +1,294 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_TOOL_EVENTS_H
#define MITK_TOOL_EVENTS_H
#pragma GCC visibility push(default)
#include <itkEventObject.h>
#pragma GCC visibility pop
namespace mitk {
/**
\brief Basic tool event without any parameters
Can simply be inherited using the itkEventMacro, e.g.
\code
namespace mitk
{
class MyTool : public Tool
{
public:
itkEventMacro(MySpecialEvent, ToolEvent);
[...]
protected:
// Invoke your event like this
void YourExampleMethod()
{
InvokeEvent( MySpecialEvent() );
}
};
}
\endcode
*/
#pragma GCC visibility push(default)
itkEventMacro( ToolEvent, itk::ModifiedEvent );
#pragma GCC visibility pop
/**
\brief Tool event with 1 parameter
Can store one parameter for use within an observer. To derive your own special events, use the mitkToolEventMacro1Param macro.
\code
namespace mitk
{
class MyTool : public Tool
{
public:
mitkToolEventMacro1Param(FooToolEvent, int);
[...]
protected:
// Invoke your event like this
void YourExampleMethod()
{
InvokeEvent( FooToolEvent(32) );
}
};
}
\endcode
*/
template <typename T>
class ParameterToolEvent : public ToolEvent
{
public:
typedef ParameterToolEvent Self;
typedef ToolEvent Superclass;
ParameterToolEvent( const T parameter )
: m_Parameter(parameter)
{
}
ParameterToolEvent(const Self& s)
: ToolEvent(s),
m_Parameter(s.m_Parameter)
{
}
virtual ~ParameterToolEvent()
{
}
- virtual const char * GetEventName() const
+ virtual const char * GetEventName() const override
{
return "ParameterToolEvent";
}
- virtual bool CheckEvent(const ::itk::EventObject* e) const
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{
return dynamic_cast<const Self*>(e);
}
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{
return new Self( m_Parameter );
}
const T GetParameter() const
{
return m_Parameter;
}
protected:
const T m_Parameter;
private:
ParameterToolEvent();
void operator=(const Self&);
};
/**
\brief Tool event with 1 parameter
Can store one parameter for use within an observer. To derive your own special events, use the mitkToolEventMacro1Param macro.
\code
namespace mitk
{
class MyTool : public Tool
{
public:
mitkToolEventMacro1Param(FooToolEvent, int);
[...]
protected:
// Invoke your event like this
void YourExampleMethod()
{
InvokeEvent( BarToolEvent(32, false) );
}
};
}
\endcode
*/
template <typename T, typename U>
class TwoParameterToolEvent : public ToolEvent
{
public:
typedef TwoParameterToolEvent Self;
typedef ToolEvent Superclass;
TwoParameterToolEvent( const T parameter1, const U parameter2 )
: m_Parameter1(parameter1),
m_Parameter2(parameter2)
{
}
TwoParameterToolEvent(const Self& s)
: ToolEvent(s),
m_Parameter1(s.m_Parameter1),
m_Parameter2(s.m_Parameter2)
{
}
virtual ~TwoParameterToolEvent()
{
}
- virtual const char * GetEventName() const
+ virtual const char * GetEventName() const override
{
return "TwoParameterToolEvent";
}
- virtual bool CheckEvent(const ::itk::EventObject* e) const
+ virtual bool CheckEvent(const ::itk::EventObject* e) const override
{
return dynamic_cast<const Self*>(e);
}
- virtual ::itk::EventObject* MakeObject() const
+ virtual ::itk::EventObject* MakeObject() const override
{
return new Self( m_Parameter1, m_Parameter2 );
}
const T GetParameter1() const
{
return m_Parameter1;
}
const T GetParameter2() const
{
return m_Parameter2;
}
protected:
const T m_Parameter1;
const U m_Parameter2;
private:
TwoParameterToolEvent();
void operator=(const Self&);
};
typedef ParameterToolEvent<int> IntegerToolEvent;
typedef ParameterToolEvent<float> FloatToolEvent;
typedef ParameterToolEvent<bool> BoolToolEvent;
} // namespace
// some macros to let tools define their own event classes as inner classes (should then inherit from something like FloatToolEvent
// inheritance, because it allows observers to distinguish events
#define mitkToolEventMacro( eventname, baseevent ) \
class eventname : public baseevent \
{ \
virtual const char * GetEventName() const \
{ \
return #eventname ; \
} \
};
#define mitkToolEventMacro1Param( eventname, paramtype1 ) \
class eventname : public ParameterToolEvent<paramtype1> \
{ \
public: \
virtual const char * GetEventName() const \
{ \
return #eventname "(" #paramtype1 ")" ; \
} \
\
eventname( const paramtype1 parameter ) \
: ParameterToolEvent<paramtype1>(parameter) \
{ \
} \
\
private: \
\
eventname();\
};
#define mitkToolEventMacro2Param( eventname, paramtype1, paramtype2 ) \
class eventname : public TwoParameterToolEvent<paramtype1, paramtype2> \
{ \
public: \
virtual const char * GetEventName() const \
{ \
return #eventname "(" #paramtype1 "," #paramtype2 ")" ; \
} \
\
eventname( const paramtype1 parameter1, const paramtype2 parameter2 ) \
: TwoParameterToolEvent<paramtype1,paramtype2>(parameter1, parameter2) \
{ \
} \
\
private: \
\
eventname();\
};
#endif
diff --git a/Modules/Segmentation/Interactions/mitkWatershedTool.h b/Modules/Segmentation/Interactions/mitkWatershedTool.h
index 68406c9432..c53a95e4af 100644
--- a/Modules/Segmentation/Interactions/mitkWatershedTool.h
+++ b/Modules/Segmentation/Interactions/mitkWatershedTool.h
@@ -1,95 +1,95 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkWatershedTool_h_Included
#define mitkWatershedTool_h_Included
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkAutoSegmentationTool.h"
#include <itkImage.h>
namespace us {
class ModuleResource;
}
namespace mitk
{
class Image;
/**
\brief Simple watershed segmentation tool.
\ingroup Interaction
\ingroup ToolManagerEtAl
Wraps ITK Watershed Filter into tool concept of MITK. For more information look into ITK documentation.
\warning Only to be instantiated by mitk::ToolManager.
$Darth Vader$
*/
class MITKSEGMENTATION_EXPORT WatershedTool : public AutoSegmentationTool
{
public:
mitkClassMacro(WatershedTool, AutoSegmentationTool);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void SetThreshold(double t) {
m_Threshold = t;
}
void SetLevel(double l) {
m_Level = l;
}
/** \brief Grabs the tool reference data and creates an ITK pipeline consisting of a GradientMagnitude
* image filter followed by a Watershed image filter. The output of the filter pipeline is then added
* to the data storage. */
void DoIt();
/** \brief Creates and runs an ITK filter pipeline consisting of the filters: GradientMagnitude-, Watershed- and CastImageFilter.
*
* \param originalImage The input image, which is delivered by the AccessByItk macro.
* \param segmentation A pointer to the output image, which will point to the pipeline output after execution.
*/
template <typename TPixel, unsigned int VImageDimension>
void ITKWatershed( itk::Image<TPixel, VImageDimension>* originalImage, itk::SmartPointer<mitk::Image>& segmentation );
- const char** GetXPM() const;
- const char* GetName() const;
- us::ModuleResource GetIconResource() const;
+ const char** GetXPM() const override;
+ const char* GetName() const override;
+ us::ModuleResource GetIconResource() const override;
protected:
WatershedTool(); // purposely hidden
virtual ~WatershedTool();
- virtual void Activated();
- virtual void Deactivated();
+ virtual void Activated() override;
+ virtual void Deactivated() override;
/** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */
double m_Threshold;
/** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */
double m_Level;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Rendering/mitkContourMapper2D.h b/Modules/Segmentation/Rendering/mitkContourMapper2D.h
index 9d5e5e8ed1..dd502ea104 100644
--- a/Modules/Segmentation/Rendering/mitkContourMapper2D.h
+++ b/Modules/Segmentation/Rendering/mitkContourMapper2D.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CONTOUR_MAPPER_2D_H_
#define MITK_CONTOUR_MAPPER_2D_H_
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkGLMapper.h"
namespace mitk {
class BaseRenderer;
class Contour;
/**
* @brief OpenGL-based mapper to display a mitk::Contour object in a 2D render window
*
*
* @ingroup Mapper
*/
class MITKSEGMENTATION_EXPORT ContourMapper2D : public GLMapper
{
public:
mitkClassMacro(ContourMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* reimplemented from Baseclass
*/
- virtual void Paint(BaseRenderer * renderer);
+ virtual void Paint(BaseRenderer * renderer) override;
/**
* return a refernce of the rendered data object
*/
const Contour* GetInput(void);
protected:
ContourMapper2D();
virtual ~ContourMapper2D();
};
} // namespace mitk
#endif /* MITKContourMapper2D_H_HEADER_INCLUDED */
diff --git a/Modules/Segmentation/Rendering/mitkContourSetMapper2D.h b/Modules/Segmentation/Rendering/mitkContourSetMapper2D.h
index 155f9ad966..6137bc6906 100644
--- a/Modules/Segmentation/Rendering/mitkContourSetMapper2D.h
+++ b/Modules/Segmentation/Rendering/mitkContourSetMapper2D.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CONTOUR_SET_MAPPER_2D_H_
#define MITK_CONTOUR_SET_MAPPER_2D_H_
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkGLMapper.h"
namespace mitk {
class BaseRenderer;
class ContourSet;
/**
* @brief OpenGL-based mapper to display a mitk::Contour object in a 2D render window
*
*
* @ingroup Mapper
*/
class MITKSEGMENTATION_EXPORT ContourSetMapper2D : public GLMapper
{
public:
mitkClassMacro(ContourSetMapper2D, GLMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* reimplemented from Baseclass
*/
- virtual void Paint(mitk::BaseRenderer * renderer);
+ virtual void Paint(mitk::BaseRenderer * renderer) override;
/**
* return a refernce of the rendered data object
*/
const mitk::ContourSet * GetInput(void);
protected:
ContourSetMapper2D();
virtual ~ContourSetMapper2D();
};
} // namespace mitk
#endif /* MITK_CONTOUR_SET_MAPPER_2D_H_ */
diff --git a/Modules/Segmentation/Rendering/mitkContourSetVtkMapper3D.h b/Modules/Segmentation/Rendering/mitkContourSetVtkMapper3D.h
index b088c8962c..7ab2455209 100644
--- a/Modules/Segmentation/Rendering/mitkContourSetVtkMapper3D.h
+++ b/Modules/Segmentation/Rendering/mitkContourSetVtkMapper3D.h
@@ -1,70 +1,70 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CONTOUR_SET_VTK_MAPPER_3D_H
#define MITK_CONTOUR_SET_VTK_MAPPER_3D_H
#include "mitkCommon.h"
#include <MitkSegmentationExports.h>
#include "mitkVtkMapper.h"
#include "mitkContourSet.h"
#include "mitkBaseRenderer.h"
#include <vtkPolyData.h>
class vtkPolyDataMapper;
class vtkAppendPolyData;
class vtkActor;
class vtkTubeFilter;
namespace mitk {
//##Documentation
//## @brief Vtk-based mapper for mitk::Contour
//## @ingroup Mapper
class MITKSEGMENTATION_EXPORT ContourSetVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(ContourSetVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::ContourSet* GetInput();
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
protected:
ContourSetVtkMapper3D();
virtual ~ContourSetVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
vtkPolyDataMapper* m_VtkPolyDataMapper;
vtkTubeFilter* m_TubeFilter;
vtkPolyData *m_ContourSet;
vtkActor *m_Actor;
};
} // namespace mitk
#endif // MITK_CONTOUR_VTK_MAPPER_3D_H
diff --git a/Modules/Segmentation/Rendering/mitkContourVtkMapper3D.h b/Modules/Segmentation/Rendering/mitkContourVtkMapper3D.h
index cb909a9b85..c1fb8cdd28 100644
--- a/Modules/Segmentation/Rendering/mitkContourVtkMapper3D.h
+++ b/Modules/Segmentation/Rendering/mitkContourVtkMapper3D.h
@@ -1,69 +1,69 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITK_CONTOUR_VTK_MAPPER_3D_H
#define MITK_CONTOUR_VTK_MAPPER_3D_H
#include <MitkSegmentationExports.h>
#include "mitkVtkMapper.h"
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
class vtkPolyDataMapper;
class vtkAppendPolyData;
class vtkActor;
class vtkTubeFilter;
namespace mitk {
class BaseRenderer;
class Contour;
/**
@brief Vtk-based mapper for mitk::Contour
@ingroup Mapper
*/
class MITKSEGMENTATION_EXPORT ContourVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(ContourVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::Contour* GetInput();
- virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer);
+ virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
protected:
ContourVtkMapper3D();
virtual ~ContourVtkMapper3D();
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
vtkSmartPointer<vtkPolyDataMapper> m_VtkPolyDataMapper;
vtkSmartPointer<vtkTubeFilter> m_TubeFilter;
vtkSmartPointer<vtkAppendPolyData> m_VtkPointList;
vtkSmartPointer<vtkPolyData> m_Contour;
vtkSmartPointer<vtkActor> m_Actor;
};
} // namespace mitk
#endif // MITK_CONTOUR_VTK_MAPPER_3D_H
diff --git a/Modules/Segmentation/Testing/mitkContourModelSetToImageFilterTest.cpp b/Modules/Segmentation/Testing/mitkContourModelSetToImageFilterTest.cpp
index 9a33e0ba36..efd5a5f731 100644
--- a/Modules/Segmentation/Testing/mitkContourModelSetToImageFilterTest.cpp
+++ b/Modules/Segmentation/Testing/mitkContourModelSetToImageFilterTest.cpp
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImage.h>
#include <mitkIOUtil.h>
#include <mitkContourModelSet.h>
#include <mitkContourModelSetToImageFilter.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkContourModelSetToImageFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkContourModelSetToImageFilterTestSuite);
MITK_TEST(TestFillContourSetIntoImage);
CPPUNIT_TEST_SUITE_END();
private:
mitk::ContourModelSetToImageFilter::Pointer m_ContourFiller;
public:
- void setUp()
+ void setUp() override
{
m_ContourFiller = mitk::ContourModelSetToImageFilter::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize ContourModelSetToImageFilter", m_ContourFiller.IsNotNull());
}
void TestFillContourSetIntoImage()
{
mitk::Image::Pointer refImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("ContourModel-Data/RefImage.nrrd"));
CPPUNIT_ASSERT_MESSAGE("Failed to load reference image", refImage.IsNotNull());
std::vector<itk::SmartPointer<mitk::BaseData> > readerOutput;
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("ContourModel-Data/Contours.cnt_set"));
mitk::ContourModelSet::Pointer cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
CPPUNIT_ASSERT_MESSAGE("Failed to load contours", cnt_set.IsNotNull());
m_ContourFiller->SetImage(refImage);
m_ContourFiller->SetInput(cnt_set);
m_ContourFiller->Update();
mitk::Image::Pointer filledImage = m_ContourFiller->GetOutput();
filledImage->DisconnectPipeline();
MITK_ASSERT_EQUAL(refImage, filledImage, "Error filling contours into image");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkContourModelSetToImageFilter)
diff --git a/Modules/Segmentation/Testing/mitkImageToContourFilterTest.cpp b/Modules/Segmentation/Testing/mitkImageToContourFilterTest.cpp
index aca004a722..01ec97ae4b 100644
--- a/Modules/Segmentation/Testing/mitkImageToContourFilterTest.cpp
+++ b/Modules/Segmentation/Testing/mitkImageToContourFilterTest.cpp
@@ -1,109 +1,109 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImage.h>
#include <mitkImageToContourFilter.h>
#include <mitkIOUtil.h>
#include <mitkSurface.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkImageToContourFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageToContourFilterTestSuite);
MITK_TEST(TestExtractContoursFromAnEmptySlice);
MITK_TEST(TestExtractASingleContourFromASlice);
MITK_TEST(TestExtractTwoContoursFromASingleSlice);
CPPUNIT_TEST_SUITE_END();
private:
mitk::Image::Pointer m_EmptySlice;
mitk::Image::Pointer m_SliceWithSingleContour;
mitk::Image::Pointer m_SliceWithTwoContours;
mitk::ImageToContourFilter::Pointer m_ContourExtractor;
public:
- void setUp()
+ void setUp() override
{
//Load the image
//TODO Move/create segmentation subfolder
m_EmptySlice = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/ImageToContour/EmptySlice.nrrd"));
CPPUNIT_ASSERT_MESSAGE("Failed to load image for test: [EmptySlice.nrrd]", m_EmptySlice.IsNotNull());
m_SliceWithSingleContour = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/ImageToContour/SliceWithSingleContour.nrrd"));
CPPUNIT_ASSERT_MESSAGE("Failed to load image for test: [SliceWithSingleContour.nrrd]", m_SliceWithSingleContour.IsNotNull());
m_SliceWithTwoContours = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/ImageToContour/SliceWithTwoContours.nrrd"));
CPPUNIT_ASSERT_MESSAGE("Failed to load image for test: [SliceWithTwoContours.nrrd]", m_SliceWithTwoContours.IsNotNull());
m_ContourExtractor = mitk::ImageToContourFilter::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize ImageToContourFilter", m_ContourExtractor.IsNotNull());
}
// Extract contours from an empty slice
void TestExtractContoursFromAnEmptySlice()
{
m_ContourExtractor->SetInput(m_EmptySlice);
m_ContourExtractor->Update();
mitk::Surface::Pointer emptyContour = m_ContourExtractor->GetOutput();
CPPUNIT_ASSERT_MESSAGE("Extracted contour is not empty", emptyContour->GetVtkPolyData()->GetNumberOfPoints() == 0);
}
// Extract a single contour from a slice
void TestExtractASingleContourFromASlice()
{
m_ContourExtractor->SetInput(m_SliceWithSingleContour);
m_ContourExtractor->Update();
CPPUNIT_ASSERT_MESSAGE("ImageToContourFilter has wrong number of outputs!", m_ContourExtractor->GetNumberOfOutputs() == 1);
mitk::Surface::Pointer contour = m_ContourExtractor->GetOutput();
mitk::Surface::Pointer referenceContour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/SingleContour.vtk"));
CPPUNIT_ASSERT_MESSAGE("Extracted contour has wrong number of points!", contour->GetVtkPolyData()->GetNumberOfPoints() ==
referenceContour->GetVtkPolyData()->GetNumberOfPoints());
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(contour->GetVtkPolyData()), *(referenceContour->GetVtkPolyData()), 0.000001, true));
}
// Extract multiple contours from a single slice
void TestExtractTwoContoursFromASingleSlice()
{
m_ContourExtractor->SetInput(m_SliceWithTwoContours);
m_ContourExtractor->Update();
CPPUNIT_ASSERT_MESSAGE("ImageToContourFilter has wrong number of outputs!", m_ContourExtractor->GetNumberOfOutputs() == 1);
mitk::Surface::Pointer contour = m_ContourExtractor->GetOutput(0);
mitk::Surface::Pointer referenceContour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/TwoContours.vtk"));
CPPUNIT_ASSERT_MESSAGE("Extracted contour1 has wrong number of points!", contour->GetVtkPolyData()->GetNumberOfPoints() ==
referenceContour->GetVtkPolyData()->GetNumberOfPoints());
CPPUNIT_ASSERT_MESSAGE("Extracted contour1 has wrong number of points!", contour->GetVtkPolyData()->GetNumberOfPolys() ==
referenceContour->GetVtkPolyData()->GetNumberOfPolys());
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(contour->GetVtkPolyData()), *(referenceContour->GetVtkPolyData()), 0.000001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkImageToContourFilter)
diff --git a/Modules/Segmentation/Testing/mitkManualSegmentationToSurfaceFilterTest.cpp b/Modules/Segmentation/Testing/mitkManualSegmentationToSurfaceFilterTest.cpp
index b3f359e422..91273c70b3 100644
--- a/Modules/Segmentation/Testing/mitkManualSegmentationToSurfaceFilterTest.cpp
+++ b/Modules/Segmentation/Testing/mitkManualSegmentationToSurfaceFilterTest.cpp
@@ -1,93 +1,93 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkTestingMacros.h>
#include <mitkTestingConfig.h>
#include <mitkTestFixture.h>
#include <mitkManualSegmentationToSurfaceFilter.h>
#include <mitkIOUtil.h>
class mitkManualSegmentationToSurfaceFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkManualSegmentationToSurfaceFilterTestSuite);
//Add tests with reference data.
//For now I only add reference for BallBinary, since
//other images do not really make sense.
//Note: .stl consumes much more memory and even loses
//some vertices and triangles during saving. Hence,
//.vtp is preferred as reference format.
MITK_PARAMETERIZED_TEST_2(Update_BallBinary_OutputEqualsReference,
"BallBinary30x30x30.nrrd",
"BallBinary30x30x30Reference.vtp");
MITK_PARAMETERIZED_TEST_2(Update_BallBinaryAndSmooth_OutputEqualsReference,
"BallBinary30x30x30.nrrd",
"BallBinary30x30x30SmoothReference.vtp");
CPPUNIT_TEST_SUITE_END();
private:
mitk::ManualSegmentationToSurfaceFilter::Pointer m_Filter;
mitk::Surface::Pointer m_ReferenceSurface;
public:
- void setUp()
+ void setUp() override
{
std::vector<std::string> parameter = GetTestParameter();
m_Filter = mitk::ManualSegmentationToSurfaceFilter::New();
if(parameter.size() == 2)
{
m_Filter->SetInput(mitk::IOUtil::LoadImage(GetTestDataFilePath(parameter.at(0))));
//For the tests which have reference data
m_ReferenceSurface = mitk::IOUtil::LoadSurface(GetTestDataFilePath(parameter.at(1)));
}
else
{
MITK_WARN << "No test run for parameter for unknown parameter.";
}
}
- void tearDown()
+ void tearDown() override
{
m_Filter = NULL;
m_ReferenceSurface = NULL;
}
void Update_BallBinary_OutputEqualsReference()
{
m_Filter->Update();
mitk::Surface::Pointer computedOutput = m_Filter->GetOutput();
MITK_ASSERT_EQUAL(computedOutput, m_ReferenceSurface, "Computed equals the reference?");
}
void Update_BallBinaryAndSmooth_OutputEqualsReference()
{
m_Filter->MedianFilter3DOn();
m_Filter->SetGaussianStandardDeviation(1.5);
m_Filter->InterpolationOn();
m_Filter->UseGaussianImageSmoothOn();
m_Filter->SetThreshold( 1 );
m_Filter->SetDecimate( mitk::ImageToSurfaceFilter::DecimatePro );
m_Filter->SetTargetReduction(0.05f);
m_Filter->SmoothOn();
m_Filter->Update();
mitk::Surface::Pointer computedOutput = m_Filter->GetOutput();
MITK_ASSERT_EQUAL(computedOutput, m_ReferenceSurface, "Computed equals the reference?");
}
};
MITK_TEST_SUITE_REGISTRATION(mitkManualSegmentationToSurfaceFilter)
diff --git a/Modules/SegmentationUI/Qmitk/QmitkFastMarchingTool3DGUI.h b/Modules/SegmentationUI/Qmitk/QmitkFastMarchingTool3DGUI.h
index a3752a5278..b1aac37c45 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkFastMarchingTool3DGUI.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkFastMarchingTool3DGUI.h
@@ -1,87 +1,87 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkFastMarchingTool3DGUI_h_Included
#define QmitkFastMarchingTool3DGUI_h_Included
#include "QmitkToolGUI.h"
#include <MitkSegmentationUIExports.h>
#include "mitkFastMarchingTool3D.h"
class ctkSliderWidget;
class ctkRangeWidget;
class QPushButton;
#include "QmitkStepperAdapter.h"
/**
\ingroup org_mitk_gui_qt_interactivesegmentation_internal
\brief GUI for mitk::FastMarchingTool.
\sa mitk::FastMarchingTool
*/
class MITKSEGMENTATIONUI_EXPORT QmitkFastMarchingTool3DGUI : public QmitkToolGUI
{
Q_OBJECT
public:
mitkClassMacro(QmitkFastMarchingTool3DGUI, QmitkToolGUI);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void OnThresholdChanged(int current);
protected slots:
void OnNewToolAssociated(mitk::Tool*);
void OnThresholdChanged(double, double);
void OnAlphaChanged(double);
void OnBetaChanged(double);
void OnSigmaChanged(double);
void OnStoppingValueChanged(double);
void OnConfirmSegmentation();
void Refetch();
void SetStepper(mitk::Stepper *);
void OnClearSeeds();
protected:
QmitkFastMarchingTool3DGUI();
virtual ~QmitkFastMarchingTool3DGUI();
- void BusyStateChanged(bool);
+ void BusyStateChanged(bool) override;
void Update();
ctkRangeWidget* m_slwThreshold;
ctkSliderWidget* m_slStoppingValue;
ctkSliderWidget* m_slSigma;
ctkSliderWidget* m_slAlpha;
ctkSliderWidget* m_slBeta;
QPushButton* m_btConfirm;
QPushButton* m_btClearSeeds;
mitk::FastMarchingTool3D::Pointer m_FastMarchingTool;
bool m_TimeIsConnected;
mitk::Stepper::Pointer m_TimeStepper;
void OnFastMarchingToolReady();
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkFastMarchingToolGUI.h b/Modules/SegmentationUI/Qmitk/QmitkFastMarchingToolGUI.h
index 3a147eb66e..d4b408e433 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkFastMarchingToolGUI.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkFastMarchingToolGUI.h
@@ -1,86 +1,86 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkFastMarchingToolGUI_h_Included
#define QmitkFastMarchingToolGUI_h_Included
#include "QmitkToolGUI.h"
#include <MitkSegmentationUIExports.h>
#include "mitkFastMarchingTool.h"
class ctkSliderWidget;
class ctkRangeWidget;
class QPushButton;
#include "QmitkStepperAdapter.h"
/**
\ingroup org_mitk_gui_qt_interactivesegmentation_internal
\brief GUI for mitk::FastMarchingTool.
\sa mitk::FastMarchingTool
*/
class MITKSEGMENTATIONUI_EXPORT QmitkFastMarchingToolGUI : public QmitkToolGUI
{
Q_OBJECT
public:
mitkClassMacro(QmitkFastMarchingToolGUI, QmitkToolGUI);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void OnThresholdChanged(int current);
protected slots:
void OnNewToolAssociated(mitk::Tool*);
void OnThresholdChanged(double, double);
void OnAlphaChanged(double);
void OnBetaChanged(double);
void OnSigmaChanged(double);
void OnStoppingValueChanged(double);
void OnConfirmSegmentation();
void Refetch();
void SetStepper(mitk::Stepper *);
void OnClearSeeds();
protected:
QmitkFastMarchingToolGUI();
virtual ~QmitkFastMarchingToolGUI();
void Update();
- void BusyStateChanged(bool);
+ void BusyStateChanged(bool) override;
ctkRangeWidget* m_slwThreshold;
ctkSliderWidget* m_slStoppingValue;
ctkSliderWidget* m_slSigma;
ctkSliderWidget* m_slAlpha;
ctkSliderWidget* m_slBeta;
QPushButton* m_btConfirm;
QPushButton* m_btClearSeeds;
mitk::FastMarchingTool::Pointer m_FastMarchingTool;
bool m_TimeIsConnected;
mitk::Stepper::Pointer m_TimeStepper;
void OnFastMarchingToolReady();
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkToolGUI.h b/Modules/SegmentationUI/Qmitk/QmitkToolGUI.h
index 1500b4ab42..cb9a81332e 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkToolGUI.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkToolGUI.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkToolGUI_h_Included
#define QmitkToolGUI_h_Included
#include <qwidget.h>
#include <MitkSegmentationUIExports.h>
#include "mitkCommon.h"
#include "mitkTool.h"
/**
\brief Base class for GUIs belonging to mitk::Tool classes.
\ingroup org_mitk_gui_qt_interactivesegmentation
Created through ITK object factory. TODO May be changed to a toolkit specific way later?
Last contributor: $Author$
*/
class MITKSEGMENTATIONUI_EXPORT QmitkToolGUI : public QWidget, public itk::Object
{
Q_OBJECT
public:
- mitkClassMacro(QmitkToolGUI, itk::Object);
+ mitkClassMacroItkParent(QmitkToolGUI, itk::Object);
void SetTool( mitk::Tool* tool );
// just make sure ITK won't take care of anything (especially not destruction)
- virtual void Register() const;
+ virtual void Register() const override;
virtual void UnRegister() const ITK_NOEXCEPT ITK_OVERRIDE;
- virtual void SetReferenceCount(int);
+ virtual void SetReferenceCount(int) override;
virtual ~QmitkToolGUI();
signals:
void NewToolAssociated( mitk::Tool* );
public slots:
protected slots:
protected:
mitk::Tool::Pointer m_Tool;
virtual void BusyStateChanged(bool) {};
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
index 803a3aca55..d58d811e6f 100755
--- a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
@@ -1,146 +1,146 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkToolSelectionBox_h_Included
#define QmitkToolSelectionBox_h_Included
#include "QmitkToolGUIArea.h"
#include <MitkSegmentationUIExports.h>
#include "mitkToolManager.h"
#include <QWidget>
#include <QButtonGroup>
#include <QGridLayout>
#include <map>
class QmitkToolGUI;
/**
\brief Display the tool selection state of a mitk::ToolManager
\sa mitk::ToolManager
\ingroup org_mitk_gui_qt_interactivesegmentation
\ingroup ToolManagerEtAl
There is a separate page describing the general design of QmitkInteractiveSegmentation: \ref QmitkInteractiveSegmentationTechnicalPage
This widget graphically displays the active tool of a mitk::ToolManager as a set
of toggle buttons. Each button show the identification of a Tool (icon and name).
When a button's toggle state is "down", the tool is activated. When a different button
is clicked, the active tool is switched. When you click an already active button, the
associated tool is deactivated with no replacement, which means that no tool is active
then.
When this widget is enabled/disabled it (normally) also enables/disables the tools. There
could be cases where two QmitkToolSelectionBox widgets are associated to the same ToolManager,
but if this happens, please look deeply into the code.
Last contributor: $Author: maleike $
*/
class MITKSEGMENTATIONUI_EXPORT QmitkToolSelectionBox : public QWidget
//!
{
Q_OBJECT
public:
enum EnabledMode { EnabledWithReferenceAndWorkingDataVisible, EnabledWithReferenceData, EnabledWithWorkingData, AlwaysEnabled };
QmitkToolSelectionBox(QWidget* parent = 0, mitk::DataStorage* storage = 0);
virtual ~QmitkToolSelectionBox();
mitk::ToolManager* GetToolManager();
void SetToolManager(mitk::ToolManager&); // no NULL pointer allowed here, a manager is required
void setTitle( const QString& title );
/**
You may specify a list of tool "groups" that should be displayed in this widget. Every Tool can report its group
as a string. This method will try to find the tool's group inside the supplied string \param toolGroups. If there is a match,
the tool is displayed. Effectively, you can provide a human readable list like "default, lymphnodevolumetry, oldERISstuff".
*/
void SetDisplayedToolGroups(const std::string& toolGroups = 0);
void OnToolManagerToolModified();
void OnToolManagerReferenceDataModified();
void OnToolManagerWorkingDataModified();
void OnToolGUIProcessEventsMessage();
void OnToolErrorMessage(std::string s);
void OnGeneralToolMessage(std::string s);
void RecreateButtons();
signals:
/// Whenever a tool is activated. id is the index of the active tool. Counting starts at 0, -1 indicates "no tool selected"
/// This signal is also emitted, when the whole QmitkToolSelectionBox get disabled. Then it will claim ToolSelected(-1)
/// When it is enabled again, there will be another ToolSelected event with the tool that is currently selected
void ToolSelected(int id);
public slots:
virtual void setEnabled( bool );
virtual void SetEnabledMode(EnabledMode mode);
virtual void SetLayoutColumns(int);
virtual void SetShowNames(bool);
virtual void SetGenerateAccelerators(bool);
virtual void SetToolGUIArea( QWidget* parentWidget );
protected slots:
void toolButtonClicked(int id);
void SetGUIEnabledAccordingToToolManagerState();
protected:
- void showEvent( QShowEvent* );
- void hideEvent( QHideEvent* );
+ void showEvent( QShowEvent* ) override;
+ void hideEvent( QHideEvent* ) override;
void SetOrUnsetButtonForActiveTool();
mitk::ToolManager::Pointer m_ToolManager;
bool m_SelfCall;
std::string m_DisplayedGroups;
/// stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
std::map<int,int> m_ButtonIDForToolID;
/// stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
std::map<int,int> m_ToolIDForButtonID;
int m_LayoutColumns;
bool m_ShowNames;
bool m_GenerateAccelerators;
QWidget* m_ToolGUIWidget;
QmitkToolGUI* m_LastToolGUI;
// store buttons in this group
QButtonGroup* m_ToolButtonGroup;
QGridLayout* m_ButtonLayout;
EnabledMode m_EnabledMode;
};
#endif
diff --git a/Modules/SurfaceInterpolation/Testing/mitkComputeContourSetNormalsFilterTest.cpp b/Modules/SurfaceInterpolation/Testing/mitkComputeContourSetNormalsFilterTest.cpp
index 3f8fccd63a..3f6c1abe7f 100644
--- a/Modules/SurfaceInterpolation/Testing/mitkComputeContourSetNormalsFilterTest.cpp
+++ b/Modules/SurfaceInterpolation/Testing/mitkComputeContourSetNormalsFilterTest.cpp
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImage.h>
#include <mitkIOUtil.h>
#include <mitkComputeContourSetNormalsFilter.h>
#include <mitkSurface.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <mitkExtractSliceFilter.h>
#include <mitkPlaneGeometry.h>
#include <vtkDebugLeaks.h>
class mitkComputeContourSetNormalsFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkComputeContourSetNormalsFilterTestSuite);
/// \todo Fix leaks of vtkObjects. Bug 18096.
vtkDebugLeaks::SetExitError(0);
MITK_TEST(TestComputeNormals);
MITK_TEST(TestComputeNormalsWithHole);
CPPUNIT_TEST_SUITE_END();
private:
mitk::ComputeContourSetNormalsFilter::Pointer m_ContourNormalsFilter;
public:
- void setUp()
+ void setUp() override
{
m_ContourNormalsFilter = mitk::ComputeContourSetNormalsFilter::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize ReduceContourSetFilter", m_ContourNormalsFilter.IsNotNull());
}
// Compute the normals for a regular contour
void TestComputeNormals()
{
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/SingleContour.vtk"));
m_ContourNormalsFilter->SetInput(contour);
m_ContourNormalsFilter->Update();
// Get the computed normals (basically lines)
mitk::Surface::Pointer normals = m_ContourNormalsFilter->GetNormalsAsSurface();
// Get the actual surface object which has the contours stored as normals internally
mitk::Surface::Pointer contourWithNormals = m_ContourNormalsFilter->GetOutput();
mitk::Surface::Pointer referenceContour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/ContourWithNormals.vtk"));
mitk::Surface::Pointer referenceNormals = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/ContourNormals.vtk"));
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(contourWithNormals->GetVtkPolyData()), *(referenceContour->GetVtkPolyData()), 0.000001, true));
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(normals->GetVtkPolyData()), *(referenceNormals->GetVtkPolyData()), 0.000001, true));
}
// Reduce contours with Douglas Peucker
void TestComputeNormalsWithHole()
{
mitk::Image::Pointer segmentationImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/Reference/LiverSegmentation.nrrd"));
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/ComputeNormals/ContourWithHoles.vtk"));
m_ContourNormalsFilter->SetInput(contour);
m_ContourNormalsFilter->SetSegmentationBinaryImage(segmentationImage);
m_ContourNormalsFilter->Update();
mitk::Surface::Pointer contourWithNormals = m_ContourNormalsFilter->GetOutput();
mitk::Surface::Pointer normals = m_ContourNormalsFilter->GetNormalsAsSurface();
mitk::Surface::Pointer contourReference = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/ContourWithHolesWithNormals.vtk"));
mitk::Surface::Pointer normalsReference = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/NormalsWithHoles.vtk"));
CPPUNIT_ASSERT_MESSAGE("Error computing normals", mitk::Equal(*(normals->GetVtkPolyData()), *(normalsReference->GetVtkPolyData()), 0.000001, true));
CPPUNIT_ASSERT_MESSAGE("Error computing normals",
contourWithNormals->GetVtkPolyData()->GetCellData()->GetNormals()->GetNumberOfTuples() == contourReference->GetVtkPolyData()->GetNumberOfPoints());
}
};
MITK_TEST_SUITE_REGISTRATION(mitkComputeContourSetNormalsFilter)
diff --git a/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp b/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
index 45a2b0a1b6..c0e67cb859 100644
--- a/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
+++ b/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImageAccessByItk.h>
#include <mitkCreateDistanceImageFromSurfaceFilter.h>
#include <mitkIOUtil.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <mitkComputeContourSetNormalsFilter.h>
#include <vtkDebugLeaks.h>
class mitkCreateDistanceImageFromSurfaceFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkCreateDistanceImageFromSurfaceFilterTestSuite);
vtkDebugLeaks::SetExitError(0);
MITK_TEST(TestCreateDistanceImageForLiver);
MITK_TEST(TestCreateDistanceImageForTube);
CPPUNIT_TEST_SUITE_END();
private:
std::vector<mitk::Surface::Pointer> contourList;
public:
- void setUp()
+ void setUp() override
{
}
template<typename TPixel, unsigned int VImageDimension>
void GetImageBase(itk::Image<TPixel, VImageDimension>* input, itk::ImageBase<3>::Pointer& result)
{
result->Graft(input);
}
// Interpolate the shape of a liver
void TestCreateDistanceImageForLiver()
{
// That's the number of available liver contours in MITK-Data
unsigned int NUMBER_OF_LIVER_CONTOURS = 18;
for (unsigned int i = 0; i <= NUMBER_OF_LIVER_CONTOURS; ++i)
{
std::stringstream s;
s << "SurfaceInterpolation/InterpolateLiver/LiverContourWithNormals_";
s << i;
s << ".vtk";
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath(s.str()));
contourList.push_back(contour);
}
mitk::Image::Pointer segmentationImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/Reference/LiverSegmentation.nrrd"));
mitk::ComputeContourSetNormalsFilter::Pointer m_NormalsFilter = mitk::ComputeContourSetNormalsFilter::New();
mitk::CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter = mitk::CreateDistanceImageFromSurfaceFilter::New();
itk::ImageBase<3>::Pointer itkImage = itk::ImageBase<3>::New();
AccessFixedDimensionByItk_1( segmentationImage, GetImageBase, 3, itkImage );
m_InterpolateSurfaceFilter->SetReferenceImage( itkImage.GetPointer() );
for (unsigned int j = 0; j < contourList.size(); j++)
{
m_NormalsFilter->SetInput(j, contourList.at(j));
m_InterpolateSurfaceFilter->SetInput(j, m_NormalsFilter->GetOutput(j));
}
m_InterpolateSurfaceFilter->Update();
mitk::Image::Pointer liverDistanceImage = m_InterpolateSurfaceFilter->GetOutput();
CPPUNIT_ASSERT(liverDistanceImage.IsNotNull());
mitk::Image::Pointer liverDistanceImageReference = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/Reference/LiverDistanceImage.nrrd"));
CPPUNIT_ASSERT_MESSAGE("LiverDistanceImages are not equal!", mitk::Equal(*(liverDistanceImageReference), *(liverDistanceImage), 0.0001, true));
}
void TestCreateDistanceImageForTube()
{
// That's the number of available contours with holes in MITK-Data
unsigned int NUMBER_OF_TUBE_CONTOURS = 5;
for (unsigned int i = 0; i < NUMBER_OF_TUBE_CONTOURS; ++i)
{
std::stringstream s;
s << "SurfaceInterpolation/InterpolateWithHoles/ContourWithHoles_";
s << i;
s << ".vtk";
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath(s.str()));
contourList.push_back(contour);
}
mitk::Image::Pointer segmentationImage = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/Reference/SegmentationWithHoles.nrrd"));
mitk::ComputeContourSetNormalsFilter::Pointer m_NormalsFilter = mitk::ComputeContourSetNormalsFilter::New();
mitk::CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter = mitk::CreateDistanceImageFromSurfaceFilter::New();
m_NormalsFilter->SetSegmentationBinaryImage(segmentationImage);
itk::ImageBase<3>::Pointer itkImage = itk::ImageBase<3>::New();
AccessFixedDimensionByItk_1( segmentationImage, GetImageBase, 3, itkImage );
m_InterpolateSurfaceFilter->SetReferenceImage( itkImage.GetPointer() );
for (unsigned int j = 0; j < contourList.size(); j++)
{
m_NormalsFilter->SetInput(j, contourList.at(j));
m_InterpolateSurfaceFilter->SetInput(j, m_NormalsFilter->GetOutput(j));
}
m_InterpolateSurfaceFilter->Update();
mitk::Image::Pointer holeDistanceImage = m_InterpolateSurfaceFilter->GetOutput();
CPPUNIT_ASSERT(holeDistanceImage.IsNotNull());
mitk::Image::Pointer holesDistanceImageReference = mitk::IOUtil::LoadImage(GetTestDataFilePath("SurfaceInterpolation/Reference/HolesDistanceImage.nrrd"));
CPPUNIT_ASSERT_MESSAGE("HolesDistanceImages are not equal!", mitk::Equal(*(holesDistanceImageReference), *(holeDistanceImage), 0.0001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkCreateDistanceImageFromSurfaceFilter)
diff --git a/Modules/SurfaceInterpolation/Testing/mitkPointCloudScoringFilterTest.cpp b/Modules/SurfaceInterpolation/Testing/mitkPointCloudScoringFilterTest.cpp
index 7282fe2e2d..c8493aea01 100644
--- a/Modules/SurfaceInterpolation/Testing/mitkPointCloudScoringFilterTest.cpp
+++ b/Modules/SurfaceInterpolation/Testing/mitkPointCloudScoringFilterTest.cpp
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkTestingMacros.h"
#include <mitkPointCloudScoringFilter.h>
#include <mitkTestFixture.h>
#include <mitkUnstructuredGrid.h>
#include <mitkIOUtil.h>
#include <vtkSmartPointer.h>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>
class mitkPointCloudScoringFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPointCloudScoringFilterTestSuite);
MITK_TEST(testPointCloudScoringFilterInitialization);
MITK_TEST(testInputs);
MITK_TEST(testOutput);
MITK_TEST(testScoring);
CPPUNIT_TEST_SUITE_END();
private:
mitk::UnstructuredGrid::Pointer m_UnstructuredGrid1;
mitk::UnstructuredGrid::Pointer m_UnstructuredGrid2;
public:
- void setUp()
+ void setUp() override
{
m_UnstructuredGrid1 = mitk::UnstructuredGrid::New();
m_UnstructuredGrid2 = mitk::UnstructuredGrid::New();
vtkSmartPointer<vtkUnstructuredGrid> vtkGrid1 = vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkUnstructuredGrid> vtkGrid2 = vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkPoints> points1 = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> points2 = vtkSmartPointer<vtkPoints>::New();
for(int i=0; i<3; i++)
{
for(int j=0; j<3; j++)
{
for(int k=0; k<3; k++)
{
mitk::Point3D point;
point[0]=i;
point[1]=j;
point[2]=k;
points1->InsertNextPoint(point[0],point[1],point[2]);
points2->InsertNextPoint(point[0]+i,point[1]+i,point[2]+i);
}
}
}
vtkGrid1->SetPoints(points1);
vtkGrid2->SetPoints(points2);
m_UnstructuredGrid1->SetVtkUnstructuredGrid(vtkGrid1);
m_UnstructuredGrid2->SetVtkUnstructuredGrid(vtkGrid2);
}
void testPointCloudScoringFilterInitialization()
{
mitk::PointCloudScoringFilter::Pointer testFilter = mitk::PointCloudScoringFilter::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of test object", testFilter.IsNotNull());
}
void testInputs()
{
mitk::PointCloudScoringFilter::Pointer testFilter = mitk::PointCloudScoringFilter::New();
testFilter->SetInput(0, m_UnstructuredGrid1);
testFilter->SetInput(1, m_UnstructuredGrid2);
mitk::UnstructuredGrid::Pointer uGrid1 = dynamic_cast<mitk::UnstructuredGrid*>(testFilter->GetInputs().at(0).GetPointer());
mitk::UnstructuredGrid::Pointer uGrid2 = dynamic_cast<mitk::UnstructuredGrid*>(testFilter->GetInputs().at(1).GetPointer());
CPPUNIT_ASSERT_MESSAGE("Testing the first input", uGrid1 == m_UnstructuredGrid1);
CPPUNIT_ASSERT_MESSAGE("Testing the second input", uGrid2 == m_UnstructuredGrid2);
}
void testOutput()
{
mitk::PointCloudScoringFilter::Pointer testFilter = mitk::PointCloudScoringFilter::New();
testFilter->SetInput(0, m_UnstructuredGrid1);
testFilter->SetInput(1, m_UnstructuredGrid2);
testFilter->Update();
CPPUNIT_ASSERT_MESSAGE("Testing mitkUnstructuredGrid generation!", testFilter->GetOutput() != NULL);
}
void testScoring()
{
mitk::PointCloudScoringFilter::Pointer testFilter = mitk::PointCloudScoringFilter::New();
testFilter->SetInput(0, m_UnstructuredGrid2);
testFilter->SetInput(1, m_UnstructuredGrid1);
testFilter->Update();
mitk::UnstructuredGrid::Pointer outpGrid = testFilter->GetOutput();
int numBefore = m_UnstructuredGrid1->GetVtkUnstructuredGrid()->GetNumberOfPoints();
int numAfter = outpGrid->GetVtkUnstructuredGrid()->GetNumberOfPoints();
CPPUNIT_ASSERT_MESSAGE("Testing grid scoring", numBefore > numAfter);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPointCloudScoringFilter)
diff --git a/Modules/SurfaceInterpolation/Testing/mitkReduceContourSetFilterTest.cpp b/Modules/SurfaceInterpolation/Testing/mitkReduceContourSetFilterTest.cpp
index ee34878c14..f6dd6118f4 100644
--- a/Modules/SurfaceInterpolation/Testing/mitkReduceContourSetFilterTest.cpp
+++ b/Modules/SurfaceInterpolation/Testing/mitkReduceContourSetFilterTest.cpp
@@ -1,74 +1,74 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkImage.h>
#include <mitkIOUtil.h>
#include <mitkReduceContourSetFilter.h>
#include <mitkSurface.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkReduceContourSetFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkReduceContourSetFilterTestSuite);
MITK_TEST(TestReduceContourWithNthPoint);
MITK_TEST(TestReduceContourWithDouglasPeuker);
CPPUNIT_TEST_SUITE_END();
private:
mitk::ReduceContourSetFilter::Pointer m_ContourReducer;
public:
- void setUp()
+ void setUp() override
{
m_ContourReducer = mitk::ReduceContourSetFilter::New();
CPPUNIT_ASSERT_MESSAGE("Failed to initialize ReduceContourSetFilter", m_ContourReducer.IsNotNull());
}
// Reduce contours with nth point
void TestReduceContourWithNthPoint()
{
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/SingleContour.vtk"));
m_ContourReducer->SetInput(contour);
m_ContourReducer->SetReductionType(mitk::ReduceContourSetFilter::NTH_POINT);
m_ContourReducer->SetStepSize(20);
m_ContourReducer->Update();
mitk::Surface::Pointer reducedContour = m_ContourReducer->GetOutput();
mitk::Surface::Pointer reference = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/ReducedContourNthPoint_20.vtk"));
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(reducedContour->GetVtkPolyData()), *(reference->GetVtkPolyData()), 0.000001, true));
}
// Reduce contours with Douglas Peucker
void TestReduceContourWithDouglasPeuker()
{
mitk::Surface::Pointer contour = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/TwoContours.vtk"));
m_ContourReducer->SetInput(contour);
m_ContourReducer->SetReductionType(mitk::ReduceContourSetFilter::DOUGLAS_PEUCKER);
m_ContourReducer->Update();
mitk::Surface::Pointer reducedContour = m_ContourReducer->GetOutput();
mitk::Surface::Pointer reference = mitk::IOUtil::LoadSurface(GetTestDataFilePath("SurfaceInterpolation/Reference/ReducedContourDouglasPeucker.vtk"));
CPPUNIT_ASSERT_MESSAGE("Unequal contours", mitk::Equal(*(reducedContour->GetVtkPolyData()), *(reference->GetVtkPolyData()), 0.000001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkReduceContourSetFilter)
diff --git a/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.h b/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.h
index 73fbe99ed8..a24e0ca67d 100644
--- a/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.h
+++ b/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.h
@@ -1,113 +1,113 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkComputeContourSetNormalsFilter_h_Included
#define mitkComputeContourSetNormalsFilter_h_Included
#include <MitkSurfaceInterpolationExports.h>
#include "mitkSurfaceToSurfaceFilter.h"
#include "mitkProgressBar.h"
#include "mitkSurface.h"
#include "vtkCellArray.h"
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
#include "vtkDoubleArray.h"
#include "vtkMath.h"
#include "vtkCellData.h"
#include "vtkLine.h"
#include "mitkImage.h"
namespace mitk {
/**
\brief Filter to compute the normales for contours based on vtkPolygons
This filter takes a number of extracted contours and computes the normals for each
contour edge point. The normals can be accessed by calling:
filter->GetOutput(i)->GetVtkPolyData()->GetCellData()->GetNormals();
See also the method GetNormalsAsSurface()
Note: If a segmentation binary image is provided this filter assures that the computed normals
do not point into the segmentation image
$Author: fetzer$
*/
class MITKSURFACEINTERPOLATION_EXPORT ComputeContourSetNormalsFilter : public SurfaceToSurfaceFilter
{
public:
mitkClassMacro(ComputeContourSetNormalsFilter,SurfaceToSurfaceFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*
\brief Returns the computed normals as a surface
*/
mitk::Surface::Pointer GetNormalsAsSurface();
//Resets the filter, i.e. removes all inputs and outputs
void Reset();
void SetMaxSpacing(double);
/**
\brief Set whether the mitkProgressBar should be used
\a Parameter true for using the progress bar, false otherwise
*/
void SetUseProgressBar(bool);
/**
\brief Set the stepsize which the progress bar should proceed
\a Parameter The stepsize for progressing
*/
void SetProgressStepSize(unsigned int stepSize);
void SetSegmentationBinaryImage(mitk::Image* segmentationImage)
{
m_SegmentationBinaryImage = segmentationImage;
}
protected:
ComputeContourSetNormalsFilter();
virtual ~ComputeContourSetNormalsFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
private:
//The segmentation out of which the contours were extracted. Can be used to determine the direction of the normals
mitk::Image::Pointer m_SegmentationBinaryImage;
double m_MaxSpacing;
unsigned int m_NegativeNormalCounter;
unsigned int m_PositiveNormalCounter;
bool m_UseProgressBar;
unsigned int m_ProgressStepSize;
};//class
}//namespace
#endif
diff --git a/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.h b/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.h
index 429afb7363..b2914e9a01 100644
--- a/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.h
+++ b/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.h
@@ -1,184 +1,184 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkCreateDistanceImageFromSurfaceFilter_h_Included
#define mitkCreateDistanceImageFromSurfaceFilter_h_Included
#include <MitkSurfaceInterpolationExports.h>
#include "mitkImageSource.h"
#include "mitkSurface.h"
#include "mitkProgressBar.h"
#include "vnl/vnl_vector_fixed.h"
#include "itkImageBase.h"
#include <Eigen/Dense>
namespace mitk {
/**
\brief This filter interpolates the 3D surface for a segmented area. The basis for the interpolation
are the edge-points of contours that are drawn into an image.
The interpolation itself is performed via Radial Basis Function Interpolation.
ATTENTION:
This filter needs beside the edge points of the delineated contours additionally the normals for each
edge point.
\sa mitkSurfaceInterpolationController
Based on the contour edge points and their normal this filter calculates a distance function with the following
properties:
- Putting a point into the distance function that lies inside the considered surface gives a negativ scalar value
- Putting a point into the distance function that lies outside the considered surface gives a positive scalar value
- Putting a point into the distance function that lies exactly on the considered surface gives the value zero
With this interpolated distance function a distance image will be created. The desired surface can then be extract e.g.
with the marching cubes algorithm. (Within the distance image the surface goes exactly where the pixelvalues are zero)
Note that the obtained distance image has always an isotropig spacing. The size (in this case volume) of the image can be
adjusted by calling SetDistanceImageVolume(unsigned int volume) which specifies the number ob pixels enclosed by the image.
\ingroup Process
$Author: fetzer$
*/
class MITKSURFACEINTERPOLATION_EXPORT CreateDistanceImageFromSurfaceFilter : public ImageSource
{
public:
typedef vnl_vector_fixed<double,3> PointType;
typedef itk::Image<double, 3> DistanceImageType;
typedef DistanceImageType::IndexType IndexType;
typedef std::vector< PointType > NormalList;
typedef std::vector< PointType > CenterList;
typedef std::vector<Surface::Pointer> SurfaceList;
mitkClassMacro(CreateDistanceImageFromSurfaceFilter,ImageSource);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
using Superclass::SetInput;
//Methods copied from mitkSurfaceToSurfaceFilter
virtual void SetInput( const mitk::Surface* surface );
virtual void SetInput( unsigned int idx, const mitk::Surface* surface );
virtual const mitk::Surface* GetInput();
virtual const mitk::Surface* GetInput( unsigned int idx );
virtual void RemoveInputs(mitk::Surface* input);
/**
\brief Set the size of the output distance image. The size is specified by the image's volume
(i.e. in this case how many pixels are enclosed by the image)
If non is set, the volume will be 500000 pixels.
*/
itkSetMacro(DistanceImageVolume, unsigned int);
void PrintEquationSystem();
//Resets the filter, i.e. removes all inputs and outputs
void Reset();
/**
\brief Set whether the mitkProgressBar should be used
\a Parameter true for using the progress bar, false otherwise
*/
void SetUseProgressBar(bool);
/**
\brief Set the stepsize which the progress bar should proceed
\a Parameter The stepsize for progressing
*/
void SetProgressStepSize(unsigned int stepSize);
void SetReferenceImage( itk::ImageBase<3>::Pointer referenceImage );
protected:
CreateDistanceImageFromSurfaceFilter();
virtual ~CreateDistanceImageFromSurfaceFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
private:
void CreateSolutionMatrixAndFunctionValues();
double CalculateDistanceValue(PointType p);
void FillDistanceImage ();
/**
* \brief This method fills the given variables with the minimum and
* maximum coordinates that contain all input-points in index- and
* world-coordinates.
*
* This method iterates over all input-points and transforms them from
* world-coordinates to index-coordinates using the transform of the
* reference-Image.
* Next, the minimal and maximal index-coordinates are determined that
* span an area that contains all given input-points.
* These index-coordinates are then transformed back to world-coordinates.
*
* These minimal and maximal points are then set to the given variables.
*/
void DetermineBounds( DistanceImageType::PointType &minPointInWorldCoordinates,
DistanceImageType::PointType &maxPointInWorldCoordinates,
DistanceImageType::IndexType &minPointInIndexCoordinates,
DistanceImageType::IndexType &maxPointInIndexCoordinates );
void PreprocessContourPoints();
void CreateEmptyDistanceImage();
//Datastructures for the interpolation
CenterList m_Centers;
NormalList m_Normals;
Eigen::MatrixXd m_SolutionMatrix;
Eigen::VectorXd m_FunctionValues;
Eigen::VectorXd m_Weights;
DistanceImageType::Pointer m_DistanceImageITK;
itk::ImageBase<3>::Pointer m_ReferenceImage;
double m_DistanceImageSpacing;
double m_DistanceImageDefaultBufferValue;
unsigned int m_DistanceImageVolume;
bool m_UseProgressBar;
unsigned int m_ProgressStepSize;
};
}//namespace
#endif
diff --git a/Modules/SurfaceInterpolation/mitkPointCloudScoringFilter.h b/Modules/SurfaceInterpolation/mitkPointCloudScoringFilter.h
index 0bc3ba55cf..bac9e79f62 100644
--- a/Modules/SurfaceInterpolation/mitkPointCloudScoringFilter.h
+++ b/Modules/SurfaceInterpolation/mitkPointCloudScoringFilter.h
@@ -1,89 +1,89 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPointCloudScoringFilter_h_Included
#define mitkPointCloudScoringFilter_h_Included
#include <MitkSurfaceInterpolationExports.h>
#include <mitkUnstructuredGridToUnstructuredGridFilter.h>
namespace mitk
{
class UnstructuredGrid;
/**
* @brief Scores an UnstructuredGrid as good as one matches to the other.
*
* The result UnstructureGrid of the filter are the points where the distance to
* the closest point of the other UnstructuredGrid is higher than the average
* distance from all points to their closest neighbours of the other
* UnstructuredGrid.
* The second input is the UnstructuredGrid, which you want to score. All Points
* of the output UnstructuredGrid are from the second input.
*/
class MITKSURFACEINTERPOLATION_EXPORT PointCloudScoringFilter:
public UnstructuredGridToUnstructuredGridFilter
{
public:
typedef std::pair<int, double> ScorePair;
mitkClassMacro( PointCloudScoringFilter, UnstructuredGridToUnstructuredGridFilter)
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** Number of Points of the scored UnstructuredGrid. These points are far away
* from their neighbours */
itkGetMacro(NumberOfOutpPoints, int)
/** A vector in which the point IDs and their distance to their neighbours
* is stored */
itkGetMacro(FilteredScores, std::vector< ScorePair >)
protected:
/** is called by the Update() method */
- virtual void GenerateData();
+ virtual void GenerateData() override;
/** Defines the output */
- virtual void GenerateOutputInformation();
+ virtual void GenerateOutputInformation() override;
/** Constructor */
PointCloudScoringFilter();
/** Destructor */
virtual ~PointCloudScoringFilter();
private:
/** The output UnstructuredGrid containing the scored points, which are far
* aways from their neighbours */
mitk::UnstructuredGrid::Pointer m_OutpGrid;
/** The Point IDs and their distance to their neighbours */
std::vector< ScorePair > m_FilteredScores;
/** The number of points which are far aways from their neighbours */
int m_NumberOfOutpPoints;
};
}
#endif
diff --git a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
index 5a07e7efd5..40774720d9 100644
--- a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
+++ b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
@@ -1,129 +1,129 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkReduceContourSetFilter_h_Included
#define mitkReduceContourSetFilter_h_Included
#include <MitkSurfaceInterpolationExports.h>
#include "mitkSurfaceToSurfaceFilter.h"
#include "mitkSurface.h"
#include "mitkProgressBar.h"
#include "vtkSmartPointer.h"
#include "vtkPolyData.h"
#include "vtkPolygon.h"
#include "vtkPoints.h"
#include "vtkCellArray.h"
#include "vtkMath.h"
#include <stack>
namespace mitk {
/**
\brief A filter that reduces the number of points of contours represented by a mitk::Surface
The type of the reduction can be set via SetReductionType. The two ways provided by this filter is the
\li NTH_POINT Algorithm which reduces the contours according to a certain stepsize
\li DOUGLAS_PEUCKER Algorithm which incorpates an error tolerance into the reduction.
Stepsize and error tolerance can be set via SetStepSize and SetTolerance.
Additional if more than one input contour is provided this filter tries detect contours which occur just because
of an intersection. These intersection contours are eliminated. In oder to ensure a correct elimination the min and max
spacing of the original image must be provided.
The output is a mitk::Surface.
$Author: fetzer$
*/
class MITKSURFACEINTERPOLATION_EXPORT ReduceContourSetFilter : public SurfaceToSurfaceFilter
{
public:
enum Reduction_Type
{
NTH_POINT, DOUGLAS_PEUCKER
};
struct LineSegment
{
unsigned int StartIndex;
unsigned int EndIndex;
};
mitkClassMacro(ReduceContourSetFilter,SurfaceToSurfaceFilter);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkSetMacro(MinSpacing, double);
itkSetMacro(MaxSpacing, double);
itkSetMacro(ReductionType, Reduction_Type);
itkSetMacro(StepSize, unsigned int);
itkSetMacro(Tolerance, double);
itkGetMacro(NumberOfPointsAfterReduction, unsigned int);
//Resets the filter, i.e. removes all inputs and outputs
void Reset();
/**
\brief Set whether the mitkProgressBar should be used
\a Parameter true for using the progress bar, false otherwise
*/
void SetUseProgressBar(bool);
/**
\brief Set the stepsize which the progress bar should proceed
\a Parameter The stepsize for progressing
*/
void SetProgressStepSize(unsigned int stepSize);
protected:
ReduceContourSetFilter();
virtual ~ReduceContourSetFilter();
- virtual void GenerateData();
- virtual void GenerateOutputInformation();
+ virtual void GenerateData() override;
+ virtual void GenerateOutputInformation() override;
private:
void ReduceNumberOfPointsByNthPoint (vtkIdType cellSize, vtkIdType* cell, vtkPoints* points, vtkPolygon* reducedPolygon, vtkPoints* reducedPoints);
void ReduceNumberOfPointsByDouglasPeucker (vtkIdType cellSize, vtkIdType* cell, vtkPoints* points, vtkPolygon* reducedPolygon, vtkPoints* reducedPoints);
bool CheckForIntersection (vtkIdType* currentCell, vtkIdType currentCellSize, vtkPoints* currentPoints, /*vtkIdType numberOfIntersections, vtkIdType* intersectionPoints,*/ unsigned int currentInputIndex);
double m_MinSpacing;
double m_MaxSpacing;
Reduction_Type m_ReductionType;
unsigned int m_StepSize;
double m_Tolerance;
unsigned int m_MaxSegmentLenght;
bool m_UseProgressBar;
unsigned int m_ProgressStepSize;
unsigned int m_NumberOfPointsAfterReduction;
};//class
}//namespace
#endif
diff --git a/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h b/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
index b20a6da5f6..1acb2344ff 100644
--- a/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
+++ b/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
@@ -1,259 +1,259 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkSurfaceInterpolationController_h_Included
#define mitkSurfaceInterpolationController_h_Included
#include "mitkCommon.h"
#include <MitkSurfaceInterpolationExports.h>
#include "mitkRestorePlanePositionOperation.h"
#include "mitkSurface.h"
#include "mitkInteractionConst.h"
#include "mitkColorProperty.h"
#include "mitkProperties.h"
#include "mitkCreateDistanceImageFromSurfaceFilter.h"
#include "mitkReduceContourSetFilter.h"
#include "mitkComputeContourSetNormalsFilter.h"
#include "mitkDataNode.h"
#include "mitkDataStorage.h"
#include "mitkWeakPointer.h"
#include "vtkPolygon.h"
#include "vtkPoints.h"
#include "vtkCellArray.h"
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
#include "vtkAppendPolyData.h"
#include "vtkMarchingCubes.h"
#include "vtkImageData.h"
#include "mitkVtkRepresentationProperty.h"
#include "vtkProperty.h"
#include "mitkImageTimeSelector.h"
#include "mitkProgressBar.h"
namespace mitk
{
class MITKSURFACEINTERPOLATION_EXPORT SurfaceInterpolationController : public itk::Object
{
public:
- mitkClassMacro(SurfaceInterpolationController, itk::Object);
- itkFactorylessNewMacro(Self);
- itkCloneMacro(Self);
+ mitkClassMacroItkParent(SurfaceInterpolationController, itk::Object)
+ itkFactorylessNewMacro(Self)
+ itkCloneMacro(Self)
struct ContourPositionInformation {
Surface::Pointer contour;
Vector3D contourNormal;
Point3D contourPoint;
};
typedef std::vector<ContourPositionInformation> ContourPositionInformationList;
typedef std::vector<ContourPositionInformationList> ContourPositionInformationVec2D;
//typedef std::map<mitk::Image*, ContourPositionInformationList> ContourListMap;
typedef std::map<mitk::Image*, ContourPositionInformationVec2D> ContourListMap;
static SurfaceInterpolationController* GetInstance();
void SetCurrentTimeStep( unsigned int ts )
{
if ( m_CurrentTimeStep != ts )
{
m_CurrentTimeStep = ts;
if ( m_SelectedSegmentation )
{
this->ReinitializeInterpolation();
}
}
};
unsigned int GetCurrentTimeStep()
{
return m_CurrentTimeStep;
};
/**
* @brief Adds a new extracted contour to the list
* @param newContour the contour to be added. If a contour at that position
* already exists the related contour will be updated
*/
void AddNewContour (Surface::Pointer newContour);
/**
* @brief Removes the contour for a given plane for the current selected segmenation
* @param contourInfo the contour which should be removed
* @return true if a contour was found and removed, false if no contour was found
*/
bool RemoveContour (ContourPositionInformation contourInfo );
/**
* @brief Adds new extracted contours to the list. If one or more contours at a given position
* already exist they will be updated respectively
* @param newContours the list of the contours
*/
void AddNewContours (std::vector<Surface::Pointer> newContours);
/**
* @brief Returns the contour for a given plane for the current selected segmenation
* @param ontourInfo the contour which should be returned
* @return the contour as an mitk::Surface. If no contour is available at the give position NULL is returned
*/
const mitk::Surface* GetContour (ContourPositionInformation contourInfo );
/**
* @brief Returns the number of available contours for the current selected segmentation
* @return the number of contours
*/
unsigned int GetNumberOfContours();
/**
* Interpolates the 3D surface from the given extracted contours
*/
void Interpolate ();
mitk::Surface::Pointer GetInterpolationResult();
/**
* Sets the minimum spacing of the current selected segmentation
* This is needed since the contour points we reduced before they are used to interpolate the surface
*/
void SetMinSpacing(double minSpacing);
/**
* Sets the minimum spacing of the current selected segmentation
* This is needed since the contour points we reduced before they are used to interpolate the surface
*/
void SetMaxSpacing(double maxSpacing);
/**
* Sets the volume i.e. the number of pixels that the distance image should have
* By evaluation we found out that 50.000 pixel delivers a good result
*/
void SetDistanceImageVolume(unsigned int distImageVolume);
/**
* @brief Get the current selected segmentation for which the interpolation is performed
* @return the current segmentation image
*/
mitk::Image::Pointer GetCurrentSegmentation();
Surface* GetContoursAsSurface();
void SetDataStorage(DataStorage::Pointer ds);
/**
* Sets the current list of contourpoints which is used for the surface interpolation
* @param segmentation The current selected segmentation
* \deprecatedSince{2014_03}
*/
DEPRECATED (void SetCurrentSegmentationInterpolationList(mitk::Image::Pointer segmentation));
/**
* Sets the current list of contourpoints which is used for the surface interpolation
* @param segmentation The current selected segmentation
*/
void SetCurrentInterpolationSession(mitk::Image::Pointer currentSegmentationImage);
/**
* Removes the segmentation and all its contours from the list
* @param segmentation The segmentation to be removed
* \deprecatedSince{2014_03}
*/
DEPRECATED (void RemoveSegmentationFromContourList(mitk::Image* segmentation));
/**
* @brief Remove interpolation session
* @param segmentationImage the session to be removed
*/
void RemoveInterpolationSession(mitk::Image::Pointer segmentationImage);
/**
* Replaces the current interpolation session with a new one. All contours form the old
* session will be applied to the new session. This only works if the two images have the
* geometry
* @param oldSession the session which should be replaced
* @param newSession the new session which replaces the old one
* @return true it the the replacement was successful, false if not (e.g. the image's geometry differs)
*/
bool ReplaceInterpolationSession(mitk::Image::Pointer oldSession, mitk::Image::Pointer newSession);
/**
* @brief Removes all sessions
*/
void RemoveAllInterpolationSessions();
/**
* @brief Reinitializes the interpolation using the provided contour data
* @param contours a mitk::Surface which contains the contours as polys in the vtkPolyData
*/
void ReinitializeInterpolation(mitk::Surface::Pointer contours);
mitk::Image* GetImage();
/**
* Estimates the memory which is needed to build up the equationsystem for the interpolation.
* \returns The percentage of the real memory which will be used by the interpolation
*/
double EstimatePortionOfNeededMemory();
unsigned int GetNumberOfInterpolationSessions();
protected:
SurfaceInterpolationController();
~SurfaceInterpolationController();
template<typename TPixel, unsigned int VImageDimension> void GetImageBase(itk::Image<TPixel, VImageDimension>* input, itk::ImageBase<3>::Pointer& result);
private:
void ReinitializeInterpolation();
void OnSegmentationDeleted(const itk::Object *caller, const itk::EventObject &event);
void AddToInterpolationPipeline(ContourPositionInformation contourInfo );
ReduceContourSetFilter::Pointer m_ReduceFilter;
ComputeContourSetNormalsFilter::Pointer m_NormalsFilter;
CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter;
Surface::Pointer m_Contours;
vtkSmartPointer<vtkPolyData> m_PolyData;
mitk::DataStorage::Pointer m_DataStorage;
ContourListMap m_ListOfInterpolationSessions;
mitk::Surface::Pointer m_InterpolationResult;
unsigned int m_CurrentNumberOfReducedContours;
mitk::Image* m_SelectedSegmentation;
std::map<mitk::Image*, unsigned long> m_SegmentationObserverTags;
unsigned int m_CurrentTimeStep;
};
}
#endif
diff --git a/Modules/ToFHardware/Kinect/mitkKinectController.h b/Modules/ToFHardware/Kinect/mitkKinectController.h
index 0b5d2a920e..a6c6c48a48 100644
--- a/Modules/ToFHardware/Kinect/mitkKinectController.h
+++ b/Modules/ToFHardware/Kinect/mitkKinectController.h
@@ -1,94 +1,94 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkKinectController_h
#define __mitkKinectController_h
#include <MitkKinectExports.h>
#include "mitkCommon.h"
#include "mitkToFConfig.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Interface to the Kinect camera
*
*
* @ingroup ToFHardware
*/
class MITKKINECT_EXPORT KinectController : public itk::Object
{
public:
- mitkClassMacro( KinectController , itk::Object );
+ mitkClassMacroItkParent( KinectController , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
unsigned int GetCaptureWidth() const;
unsigned int GetCaptureHeight() const;
bool GetUseIR() const;
void SetUseIR(bool useIR);
/*!
\brief opens a connection to the Kinect camera.
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OpenCameraConnection();
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief updates the camera. The update function of the hardware interface is called only when new data is available
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool UpdateCamera();
/*!
\brief acquire new distance data from the Kinect camera
\param distances pointer to memory location where distances should be stored
*/
void GetDistances(float* distances);
void GetAmplitudes(float* amplitudes);
void GetIntensities(float* intensities);
/*!
\brief acquire new rgb data from the Kinect camera
\param rgb pointer to memory location where rgb information should be stored
*/
void GetRgb(unsigned char* rgb);
/*!
\brief convenience method for faster access to distance and rgb data
\param distances pointer to memory location where distances should be stored
\param rgb pointer to memory location where rgb information should be stored
*/
void GetAllData(float* distances, float* amplitudes, unsigned char* rgb);
protected:
KinectController();
~KinectController();
private:
class KinectControllerPrivate;
KinectControllerPrivate *d;
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h b/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
index a2d688946e..d01dfef12d 100644
--- a/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
+++ b/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
@@ -1,107 +1,107 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkKinectV2Controller_h
#define __mitkKinectV2Controller_h
#include <MitkKinectV2Exports.h>
#include <mitkCommon.h>
#include "mitkToFConfig.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
namespace mitk
{
/**
* @brief Interface to the Kinect 2 camera. Currently, the Microsoft SDK is used.
*
* @ingroup ToFHardware
*/
class MITKKINECTV2_EXPORT KinectV2Controller : public itk::Object
{
public:
- mitkClassMacro( KinectV2Controller , itk::Object );
+ mitkClassMacroItkParent( KinectV2Controller , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
int GetRGBCaptureWidth() const;
int GetRGBCaptureHeight() const;
int GetDepthCaptureWidth() const;
int GetDepthCaptureHeight() const;
/**
\brief Setup MultiFrameReader of Kinect V2.
* This reader can acquire different types of data. Here it is used
* to acquire depth, RGB and infrared images.
*/
bool InitializeMultiFrameReader();
/*!
\brief opens a connection to the Kinect V2 camera.
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OpenCameraConnection();
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief updates the camera. The update function of the hardware interface is called only when new data is available
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool UpdateCamera();
/*!
\brief acquire new distance data from the Kinect camera
\param distances pointer to memory location where distances should be stored
*/
void GetDistances(float* distances);
void GetAmplitudes(float* amplitudes);
void GetIntensities(float* intensities);
vtkSmartPointer<vtkPolyData> GetVtkPolyData();
void SetGenerateTriangularMesh(bool flag);
void SetTriangulationThreshold(double triangulationThreshold);
/*!
\brief acquire new rgb data from the Kinect camera
\param rgb pointer to memory location where rgb information should be stored
*/
void GetRgb(unsigned char* rgb);
/*!
\brief convenience method for faster access to distance and rgb data
\param distances pointer to memory location where distances should be stored
\param rgb pointer to memory location where rgb information should be stored
*/
void GetAllData(float* distances, float* amplitudes, unsigned char* rgb);
protected:
KinectV2Controller();
~KinectV2Controller();
private:
class KinectV2ControllerPrivate;
KinectV2ControllerPrivate *d;
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESAController.h b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESAController.h
index a0fb3db970..35ccca2428 100644
--- a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESAController.h
+++ b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESAController.h
@@ -1,141 +1,141 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFCameraMESAController_h
#define __mitkToFCameraMESAController_h
#include <MitkMESASR4000ModuleExports.h>
#include "mitkCommon.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Virtual interface and base class for all MESA Time-of-Flight devices. Wraps MESA API provided in library
* Provides methods for accessing current distance, amplitude, intensity and raw data.
* Allows to set parameters like modulation frequency and integration time.
*
* @ingroup ToFHardware
*/
class MITKMESASR4000_EXPORT ToFCameraMESAController : public itk::Object
{
public:
- mitkClassMacro( ToFCameraMESAController , itk::Object );
+ mitkClassMacroItkParent( ToFCameraMESAController , itk::Object );
/*!
\brief opens a connection to the ToF camera. Has to be implemented by the sub class
*/
virtual bool OpenCameraConnection() = 0;
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief Gets the current amplitude array from the device
\param amplitudeArray float array where the amplitude data will be saved
*/
virtual bool GetAmplitudes(float* amplitudeArray);
/*!
\brief Gets the current intensity array from the device
\param intensityArray float array where the intensity data will be saved
*/
virtual bool GetIntensities(float* intensityArray);
/*!
\brief Gets the current distance array from the device
\param distanceArray float array where the distance data will be saved
*/
virtual bool GetDistances(float* distanceArray);
/*!
\brief calls update on the camera -> a new ToF-image is aquired
*/
virtual bool UpdateCamera();
/*!
\brief Returns the currently set modulation frequency.
\return modulation frequency
*/
virtual int GetModulationFrequency() = 0;
/*!
\brief Sets the modulation frequency of the ToF device.
The method automatically calculates a valid value from the given frequency to
make sure that only valid frequencies are used.
\param modulationFrequency modulation frequency
\return frequency set after validation step
*/
virtual int SetModulationFrequency(unsigned int modulationFrequency) = 0;
/*!
\brief Returns the currently set integration time.
\return integration time
*/
virtual int GetIntegrationTime() = 0;
/*!
\brief Sets the integration time of the ToF device.
The method automatically calculates a valid value from the given integration time to
make sure that only valid times are used.
\param integrationTime integration time
\return integration time set after validation step
*/
virtual int SetIntegrationTime(unsigned int integrationTime) = 0;
/*!
\brief set input file name used by MESA player classes
*/
virtual void SetInputFileName(std::string inputFileName);
/*!
\brief Access the resolution of the image in x direction
\return widht of image in pixel
*/
itkGetMacro(CaptureWidth, unsigned int);
/*!
\brief Access the resolution of the image in y direction
\return height of image in pixel
*/
itkGetMacro(CaptureHeight, unsigned int);
protected:
ToFCameraMESAController();
~ToFCameraMESAController();
/*!
\brief Method printing the current error message to the console and returning whether the previous command was successful
\param error error number returned by the MESA function
\return flag indicating if an error occured (false) or not (true)
*/
bool ErrorText(int error);
char m_MESAError[128]; ///< member holding the current error text
int m_MESARes; ///< holds the current result message provided by MESA
int m_PixelNumber; ///< holds the number of pixels contained in the image
int m_NumberOfBytes; ///< holds the number of bytes contained in the image
unsigned int m_CaptureWidth; ///< holds the width of the image in pixel
unsigned int m_CaptureHeight; ///< holds the height of the image in pixel
int m_NumImg; ///< holds the number of images the camera provided (distance, intensity, etc)
float m_MaxRangeFactor; ///< holds the factor to calculate the real distance depends on the modulation frequency
bool m_ConnectionCheck; ///< flag showing whether the camera is connected (true) or not (false)
std::string m_InputFileName; ///< input file name used by MESA player classes
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkThreadedToFRawDataReconstruction.h b/Modules/ToFHardware/PMD/mitkThreadedToFRawDataReconstruction.h
index 0c205d0c74..1258f369d1 100644
--- a/Modules/ToFHardware/PMD/mitkThreadedToFRawDataReconstruction.h
+++ b/Modules/ToFHardware/PMD/mitkThreadedToFRawDataReconstruction.h
@@ -1,120 +1,120 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkThreadedToFRawDataReconstruction_h
#define __mitkThreadedToFRawDataReconstruction_h
// mitk includes
#include "mitkImageSource.h"
#include <MitkPMDExports.h>
// itk includes
#include <itkBarrier.h>
#include <itkFastMutexLock.h>
// vtk includes
#include "vtkShortArray.h"
namespace mitk
{
struct ThreadDataStruct
{
std::vector<std::vector<short> > m_InputData;
std::vector<float*> m_OutputData;
unsigned int m_DataSize;
unsigned int m_LineWidth;
unsigned int m_FrameHeight;
unsigned int m_ModulationFrequency;
itk::Barrier::Pointer m_Barrier; ///< barrier to synchronize ends of threads
itk::FastMutexLock::Pointer m_ImageDataMutex; ///< mutex for coordinated access to image data
itk::FastMutexLock::Pointer m_ThreadDataMutex; ///< mutex to control access to images
};
class MITKPMD_EXPORT ThreadedToFRawDataReconstruction : public itk::ProcessObject
{
public:
- mitkClassMacro( ThreadedToFRawDataReconstruction , itk::ProcessObject );
+ mitkClassMacroItkParent( ThreadedToFRawDataReconstruction , itk::ProcessObject );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro(Init, bool);
void SetChannelData(vtkShortArray* sourceData);
void Initialize(int width, int height, int modulationFrequency, int sourceDataSize );
void GetDistances(float* dist);
void GetAmplitudes(float* ampl);
void GetIntensities(float* inten);
void GetAllData(float* dist, float* ampl, float* inten);
void Update();
protected:
/*!
\brief standard constructor
*/
ThreadedToFRawDataReconstruction();
/*!
\brief standard destructor
*/
~ThreadedToFRawDataReconstruction();
/*!
\brief method generating the outputs of this filter. Called in the updated process of the pipeline.
This method generates the two outputs of the ToFImageSource: The distance and the intensity image
*/
virtual void GenerateData();
/*!
\brief method configures the camera output and prepares the thread data struct for threaded data
generation
*/
virtual void BeforeThreadedGenerateData();
/*!
\brief threader callback function for multi threaded data generation
*/
static ITK_THREAD_RETURN_TYPE ThreadedGenerateDataCallbackFunction(void* data);
/*!
\brief Method to reduce image size from original controller size to output size (200x200px)
and rotate the image. This is needed due to defect pixel rows at the rim of the chip
*/
void ResizeOutputImage(float* in, float* out);
// member variables
int m_StackSize; ///<
int m_Width;
int m_Height;
int m_ImageSize;
int m_SourceDataSize;
vtkShortArray* m_SourceData;
bool m_Init;
float* m_CISDist; ///< holds the distance information from for one distance image slice
float* m_CISAmpl; ///< holds the amplitude information from for one amplitude image slice
float* m_CISInten; ///< holds the intensity information from for one intensity image slice
float* m_ThreadedCISDist;
float* m_ThreadedCISAmpl;
float* m_ThreadedCISInten;
itk::MultiThreader::Pointer m_Threader;
ThreadDataStruct* m_ThreadData;
};
} //end mitk namespace
#endif // __mitkThreadedToFRawDataReconstruction_h
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDController.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDController.h
index e7186a4070..02989d0d12 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDController.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDController.h
@@ -1,199 +1,199 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFCameraPMDController_h
#define __mitkToFCameraPMDController_h
#include <MitkPMDExports.h>
#include "mitkCommon.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Virtual interface and base class for all PMD Time-of-Flight devices. Wraps PMD API provided in PMDSDK2
* Provides methods for accessing current distance, amplitude, intensity and raw data.
* Allows to set parameters like modulation frequency and integration time.
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDController : public itk::Object
{
public:
- mitkClassMacro( ToFCameraPMDController , itk::Object );
+ mitkClassMacroItkParent( ToFCameraPMDController , itk::Object );
/*!
\brief opens a connection to the ToF camera. Has to be implemented by the sub class
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OpenCameraConnection() = 0;
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief Gets the current amplitude array from the device
\param amplitudeArray float array where the amplitude data will be saved
*/
virtual bool GetAmplitudes(float* amplitudeArray);
/*!
\brief Calculates the current amplitude data from the raw source data using the processing plugin of the PMDSDK
\param sourceData raw data array
\param amplitudeArray float array where the amplitude data will be saved
*/
virtual bool GetAmplitudes(char* sourceData, float* amplitudeArray);
/*!
\brief Gets the current intensity array from the device
\param intensityArray float array where the intensity data will be saved
*/
virtual bool GetIntensities(float* intensityArray);
/*!
\brief Calculates the current intensity data from the raw source data using the processing plugin of the PMDSDK
\param sourceData raw data array
\param intensityArray float array where the intensity data will be saved
*/
virtual bool GetIntensities(char* sourceData, float* intensityArray);
/*!
\brief Gets the current distance array from the device
\param distanceArray float array where the distance data will be saved
*/
virtual bool GetDistances(float* distanceArray);
/*!
\brief Calculates the current distance data from the raw source data using the processing plugin of the PMDSDK
\param sourceData raw data array
\param distanceArray float array where the distance data will be saved
*/
virtual bool GetDistances(char* sourceData, float* distanceArray);
/*!
\brief Gets the PMD raw data from the ToF device.
\param sourceDataArray array where the raw data will be saved
*/
virtual bool GetSourceData(char* sourceDataArray);
/*!
\brief Convenience method to get the PMD raw data from the ToF device as short array.
\param sourceData array where the short raw data will be saved
*/
bool GetShortSourceData(short* sourceData);
/*!
\brief calls update on the camera -> a new ToF-image is aquired
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool UpdateCamera();
/*!
\brief Returns the currently set modulation frequency.
\return modulation frequency
*/
virtual int GetModulationFrequency();
/*!
\brief Sets the modulation frequency of the ToF device.
The method automatically calculates a valid value from the given frequency to
make sure that only valid frequencies are used.
\param modulationFrequency modulation frequency
\return frequency set after validation step
*/
virtual int SetModulationFrequency(unsigned int modulationFrequency);
/*!
\brief Returns the currently set integration time.
\return integration time
*/
virtual int GetIntegrationTime();
/*!
\brief Sets the integration time of the ToF device.
The method automatically calculates a valid value from the given integration time to
make sure that only valid times are used.
\param integrationTime integration time
\return integration time set after validation step
*/
virtual int SetIntegrationTime(unsigned int integrationTime);
/*!
\brief set input file name used by PMD player classes
*/
virtual void SetInputFileName(std::string inputFileName);
/*!
\brief Access the resolution of the image in x direction
\return widht of image in pixel
*/
itkGetMacro(CaptureWidth, unsigned int);
/*!
\brief Access the resolution of the image in y direction
\return height of image in pixel
*/
itkGetMacro(CaptureHeight, unsigned int);
/*!
\brief Access the chosen width of the resulting image in x direction
\return widht of image in pixel
*/
itkGetMacro(InternalCaptureWidth, unsigned int);
/*!
\brief Access the chosen width of the resulting image in y direction
\return height of image in pixel
*/
itkGetMacro(InternalCaptureHeight, unsigned int);
itkGetMacro(SourceDataStructSize, int);
protected:
ToFCameraPMDController();
~ToFCameraPMDController();
/*!
\brief Method printing the current error message to the console and returning whether the previous command was successful
\param error error number returned by the PMD function
\return flag indicating if an error occured (false) or not (true)
*/
bool ErrorText(int error);
/*
\brief Abstract method that should be used to transform the camera output (e.g. flip / rotate / select region of interest).
To be implemented by subclasses
\param input data array of original size (m_CaptureWidth x m_CaptureHeight)
\param rotated output data array of reduced size (m_InternalCaptureWidth x m_InternalCaputureHeight)
\param isDist flag indicating whether the input contains PMD distance information
*/
virtual void TransformCameraOutput(float* in, float* out, bool isDist)=0;
char m_PMDError[128]; ///< member holding the current error text
int m_PMDRes; ///< holds the current result message provided by PMD
int m_PixelNumber; ///< holds the number of pixels contained in the image
int m_NumberOfBytes; ///< holds the number of bytes contained in the image
unsigned int m_CaptureWidth; ///< holds the width of the image in pixel as it is originally acquired by the camera
unsigned int m_CaptureHeight; ///< holds the height of the image in pixel as it is originally acquired by the camera
unsigned int m_InternalCaptureWidth; ///< holds the width of the image in pixel as it is requested by the user (cf. TransformCameraOutput()) Default: m_CaptureWidth
unsigned int m_InternalCaptureHeight; ///< holds the height of the image in pixel as is it requested by the user (cf. TransformCameraOutput()) Default: m_CaptureHeight
int m_SourceDataSize; ///< size of the original PMD source data
int m_SourceDataStructSize; ///< size of the PMD source data struct and the PMD source data
bool m_ConnectionCheck; ///< flag showing whether the camera is connected (true) or not (false)
std::string m_InputFileName; ///< input file name used by PMD player classes
char *m_SourcePlugin; ///< holds name of source plugin to be loaded (e.g. camcube3.W64.pap for CamCube 3.0 on Win64 platform)
char *m_SourceParam; ///< holds source parameter(s)
char *m_ProcPlugin; ///< holds name of processing plugin to be loaded (e.g. camcubeproc.W64.pap for CamCube 3.0 on Win64 platform)
char *m_ProcParam; ///< holds processing parameter(s)
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFCameraDevice.h b/Modules/ToFHardware/mitkToFCameraDevice.h
index 3c5f5e5c89..76d86759e0 100644
--- a/Modules/ToFHardware/mitkToFCameraDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraDevice.h
@@ -1,234 +1,234 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFCameraDevice_h
#define __mitkToFCameraDevice_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkStringProperty.h"
#include "mitkProperties.h"
#include "mitkPropertyList.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
// Microservices
#include <mitkServiceInterface.h>
namespace mitk
{
/**
* @brief Virtual interface and base class for all Time-of-Flight devices.
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFCameraDevice : public itk::Object
{
public:
- mitkClassMacro(ToFCameraDevice, itk::Object);
+ mitkClassMacroItkParent(ToFCameraDevice, itk::Object);
/*!
\brief Opens a connection to the ToF camera. Has to be implemented
in the specialized inherited classes.
\return True for success.
*/
virtual bool OnConnectCamera() = 0;
/**
* @brief ConnectCamera Internally calls OnConnectCamera() of the
* respective device implementation.
* @return True for success.
*/
virtual bool ConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera() = 0;
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera() = 0;
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief returns true if the camera is connected and started
*/
virtual bool IsCameraActive();
/*!
\brief returns true if the camera is connected
*/
virtual bool IsCameraConnected();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera() = 0;
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence) = 0;
/*!
\brief gets the intensity data from the ToF camera as a greyscale image
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence) = 0;
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence) = 0;
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=NULL) = 0;
/*!
\brief get the currently set capture width
\return capture width
*/
itkGetMacro(CaptureWidth, int);
/*!
\brief get the currently set capture height
\return capture height
*/
itkGetMacro(CaptureHeight, int);
/*!
\brief get the currently set source data size
\return source data size
*/
itkGetMacro(SourceDataSize, int);
/*!
\brief get the currently set buffer size
\return buffer size
*/
itkGetMacro(BufferSize, int);
/*!
\brief get the currently set max buffer size
\return max buffer size
*/
itkGetMacro(MaxBufferSize, int);
/*!
\brief set a bool property in the property list
*/
void SetBoolProperty( const char* propertyKey, bool boolValue );
/*!
\brief set an int property in the property list
*/
void SetIntProperty( const char* propertyKey, int intValue );
/*!
\brief set a float property in the property list
*/
void SetFloatProperty( const char* propertyKey, float floatValue );
/*!
\brief set a string property in the property list
*/
void SetStringProperty( const char* propertyKey, const char* stringValue );
/*!
\brief set a BaseProperty property in the property list
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief get a BaseProperty from the property list
*/
virtual BaseProperty* GetProperty( const char *propertyKey );
/*!
\brief get a bool from the property list
*/
bool GetBoolProperty(const char *propertyKey, bool& boolValue);
/*!
\brief get a string from the property list
*/
bool GetStringProperty(const char *propertyKey, std::string& string);
/*!
\brief get an int from the property list
*/
bool GetIntProperty(const char *propertyKey, int& integer);
virtual int GetRGBCaptureWidth();
virtual int GetRGBCaptureHeight();
protected:
ToFCameraDevice();
~ToFCameraDevice();
/*!
\brief method for allocating memory for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void AllocatePixelArrays();
/*!
\brief method for cleanup memory allocated for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void CleanupPixelArrays();
float* m_IntensityArray; ///< float array holding the intensity image
float* m_DistanceArray; ///< float array holding the distance image
float* m_AmplitudeArray; ///< float array holding the amplitude image
int m_BufferSize; ///< buffer size of the image buffer needed for loss-less acquisition of range data
int m_MaxBufferSize; ///< maximal buffer size needed for initialization of data arrays. Default value is 100.
int m_CurrentPos; ///< current position in the buffer which will be retrieved by the Get methods
int m_FreePos; ///< current position in the buffer which will be filled with data acquired from the hardware
int m_CaptureWidth; ///< width of the range image (x dimension)
int m_CaptureHeight; ///< height of the range image (y dimension)
int m_PixelNumber; ///< number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
int m_RGBImageWidth; ///< width of the RGB image (x dimension)
int m_RGBImageHeight; ///< height of the RGB image (y dimension)
int m_RGBPixelNumber; ///< number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight)
int m_SourceDataSize; ///< size of the PMD source data
itk::MultiThreader::Pointer m_MultiThreader; ///< itk::MultiThreader used for thread handling
itk::FastMutexLock::Pointer m_ImageMutex; ///< mutex for images provided by the range camera
itk::FastMutexLock::Pointer m_CameraActiveMutex; ///< mutex for the cameraActive flag
int m_ThreadID; ///< ID of the started thread
bool m_CameraActive; ///< flag indicating if the camera is currently active or not. Caution: thread safe access only!
bool m_CameraConnected; ///< flag indicating if the camera is successfully connected or not. Caution: thread safe access only!
int m_ImageSequence; ///< counter for acquired images
PropertyList::Pointer m_PropertyList; ///< a list of the corresponding properties
};
} //END mitk namespace
/**
ToFCameraDevice is declared a MicroService interface. See
MicroService documenation for more details.
*/
MITK_DECLARE_SERVICE_INTERFACE(mitk::ToFCameraDevice, "org.mitk.services.ToFCameraDevice")
#endif
diff --git a/Modules/ToFHardware/mitkToFCameraMITKPlayerController.h b/Modules/ToFHardware/mitkToFCameraMITKPlayerController.h
index 99714dcd49..b86ec3adaf 100644
--- a/Modules/ToFHardware/mitkToFCameraMITKPlayerController.h
+++ b/Modules/ToFHardware/mitkToFCameraMITKPlayerController.h
@@ -1,145 +1,145 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFCameraMITKPlayerController_h
#define __mitkToFCameraMITKPlayerController_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkFileReader.h"
#include "mitkImage.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Controller for playing ToF images saved in MITK (.pic) format
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFCameraMITKPlayerController : public itk::Object
{
public:
- mitkClassMacro( ToFCameraMITKPlayerController , itk::Object );
+ mitkClassMacroItkParent( ToFCameraMITKPlayerController , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/*!
\brief opens a connection to the ToF camera
\return Returns 'true' if connection could be established and 'false' otherwise
*/
virtual bool OpenCameraConnection();
/*!
\brief closes the connection to the camera
\return Returns 'true' if connection could be closed (i.e. only if a connection was established before) and 'false' otherwise
*/
virtual bool CloseCameraConnection();
/*!
\brief gets the current amplitude frame from the input
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
*/
virtual void GetAmplitudes(float* amplitudeArray);
/*!
\brief gets the current intensity frame from the input as a greyscale image
*/
virtual void GetIntensities(float* intensityArray);
/*!
\brief gets the current distance frame from the inpug measuring the distance between the camera and the different object points in millimeters
*/
virtual void GetDistances(float* distanceArray);
/*!
\brief gets the current RGB frame from the input if available
*/
virtual void GetRgb(unsigned char* rgbArray);
/*!
\brief updates the current image frames from input
*/
virtual void UpdateCamera();
virtual void SetInputFileName(std::string inputFileName);
itkGetMacro(PixelNumber, int);
itkGetMacro(RGBPixelNumber, int);
itkGetMacro(CaptureWidth, int);
itkGetMacro(CaptureHeight, int);
itkGetMacro(RGBCaptureWidth, int);
itkGetMacro(RGBCaptureHeight, int);
itkGetMacro( DistanceImageFileName, std::string );
itkGetMacro( AmplitudeImageFileName, std::string );
itkGetMacro( IntensityImageFileName, std::string );
itkGetMacro( RGBImageFileName, std::string );
itkSetMacro( DistanceImageFileName, std::string );
itkSetMacro( AmplitudeImageFileName, std::string );
itkSetMacro( IntensityImageFileName, std::string );
itkSetMacro( RGBImageFileName, std::string );
enum ToFImageType{ ToFImageType3D, ToFImageType2DPlusT };
protected:
ToFCameraMITKPlayerController();
~ToFCameraMITKPlayerController();
int m_PixelNumber; ///< holds the number of pixels contained in the image
int m_RGBPixelNumber; ///< same for RGB image
int m_NumberOfBytes; ///< holds the number of bytes contained in the image
int m_NumberOfRGBBytes; ///< same for RGB image
int m_CaptureWidth; ///< holds the width of the image
int m_CaptureHeight; ///< holds the height of the image
int m_RGBCaptureWidth; ///< same for RGB image which can be different then depth etc.
int m_RGBCaptureHeight; ///< same for RGB image which can be different then depth etc.
bool m_ConnectionCheck; ///< flag showing whether the camera is connected (true) or not (false)
std::string m_InputFileName;
ToFImageType m_ToFImageType; ///< type of the ToF image to be played: 3D Volume (ToFImageType3D), temporal 2D image stack (ToFImageType2DPlusT)
Image::Pointer m_DistanceImage;
Image::Pointer m_AmplitudeImage;
Image::Pointer m_IntensityImage;
Image::Pointer m_RGBImage;
std::vector<bool> m_ImageStatus;
FILE* m_DistanceInfile; ///< file holding the distance data
FILE* m_AmplitudeInfile; ///< file holding the amplitude data
FILE* m_IntensityInfile; ///< file holding the intensity data
FILE* m_RGBInfile; ///< file holding the rgb data
float* m_IntensityArray; ///< member holding the current intensity frame
float* m_DistanceArray; ///< member holding the current distance frame
float* m_AmplitudeArray; ///< member holding the current amplitude frame
unsigned char* m_RGBArray; ///< member holding the current rgb frame
std::string m_DistanceImageFileName; ///< file name of the distance image to be played
std::string m_AmplitudeImageFileName; ///< file name of the amplitude image to be played
std::string m_IntensityImageFileName; ///< file name of the intensity image to be played
std::string m_RGBImageFileName; ///< file name of the rgb image to be played
long m_PixelStartInFile;
int m_CurrentFrame;
int m_NumOfFrames;
private:
void AccessData(int frame, Image::Pointer image, float* &data);
void CleanUp();
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFDeviceFactoryManager.h b/Modules/ToFHardware/mitkToFDeviceFactoryManager.h
index f44a3253dc..b98fdabec8 100644
--- a/Modules/ToFHardware/mitkToFDeviceFactoryManager.h
+++ b/Modules/ToFHardware/mitkToFDeviceFactoryManager.h
@@ -1,65 +1,65 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFDeviceListener_h
#define __mitkToFDeviceListener_h
#include <MitkToFHardwareExports.h>
#include "mitkToFCameraDevice.h"
//Microservices
#include <usServiceReference.h>
namespace mitk
{
struct IToFDeviceFactory;
/**
* @brief ToFDeviceListener
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFDeviceFactoryManager: public itk::Object
{
public:
- mitkClassMacro( ToFDeviceFactoryManager, itk::Object );
+ mitkClassMacroItkParent( ToFDeviceFactoryManager, itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
std::vector<std::string> GetRegisteredDeviceFactories();
std::vector<std::string> GetConnectedDevices();
ToFCameraDevice* GetInstanceOfDevice(int index);
protected:
ToFDeviceFactoryManager();
~ToFDeviceFactoryManager();
std::vector<std::string> m_RegisteredFactoryNames;
std::vector<us::ServiceReference<IToFDeviceFactory> > m_RegisteredFactoryRefs;
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFImageRecorder.h b/Modules/ToFHardware/mitkToFImageRecorder.h
index 265c142248..1655a3009b 100644
--- a/Modules/ToFHardware/mitkToFImageRecorder.h
+++ b/Modules/ToFHardware/mitkToFImageRecorder.h
@@ -1,180 +1,180 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkToFImageRecorder_h
#define mitkToFImageRecorder_h
#include "MitkToFHardwareExports.h"
#include <mitkCommon.h>
#include "mitkToFCameraDevice.h"
#include "mitkToFImageCsvWriter.h"
#include "mitkToFNrrdImageWriter.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkFastMutexLock.h>
#include <itkCommand.h>
namespace mitk
{
/**
* @brief Recorder class for ToF images
*
* This class represents a recorder for ToF data. A ToFCameraDevice is used to acquire the data. The acquired images
* are then added to a ToFImageWriter that performs the actual writing.
*
* Recording can be performed either frame-based or continuously.
*
* @warning It is currently not guaranteed that all acquired images are recorded, since the recording
* is done in a newly spawned thread. However, in practise only very few images are lost. See bug #12997
* for more details.
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFImageRecorder : public itk::Object
{
public:
ToFImageRecorder();
~ToFImageRecorder();
- mitkClassMacro( ToFImageRecorder , itk::Object );
+ mitkClassMacroItkParent( ToFImageRecorder , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro( DistanceImageFileName, std::string );
itkGetMacro( AmplitudeImageFileName, std::string );
itkGetMacro( IntensityImageFileName, std::string );
itkGetMacro( RGBImageFileName, std::string );
itkGetMacro( ToFCaptureWidth, int );
itkGetMacro( ToFCaptureHeight, int );
itkGetMacro( RGBCaptureWidth, int );
itkGetMacro( RGBCaptureHeight, int );
itkGetMacro( DistanceImageSelected, bool );
itkGetMacro( AmplitudeImageSelected, bool );
itkGetMacro( IntensityImageSelected, bool );
itkGetMacro( RGBImageSelected, bool );
itkGetMacro( NumOfFrames, int );
itkGetMacro( FileFormat, std::string );
itkSetMacro( DistanceImageFileName, std::string );
itkSetMacro( AmplitudeImageFileName, std::string );
itkSetMacro( IntensityImageFileName, std::string );
itkSetMacro(RGBImageFileName, std::string );
itkSetMacro( DistanceImageSelected, bool );
itkSetMacro( AmplitudeImageSelected, bool );
itkSetMacro( IntensityImageSelected, bool );
itkSetMacro( RGBImageSelected, bool );
itkSetMacro( NumOfFrames, int );
itkSetMacro( FileFormat, std::string );
enum RecordMode{ PerFrames, Infinite };
/*!
\brief Returns the currently set RecordMode
\return record mode: PerFrames ("Record specified number of frames"), Infinite ("Record until abort is required")
*/
ToFImageRecorder::RecordMode GetRecordMode();
/*!
\brief Set the RecordMode
\param recordMode: PerFrames ("Record specified number of frames"), Infinite ("Record until abort is required")
*/
void SetRecordMode(ToFImageRecorder::RecordMode recordMode);
/*!
\brief Set the device used for acquiring ToF images
\param aToFCameraDevice ToF camera device used.
*/
void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
/*!
\brief Get the device used for acquiring ToF images
\return ToF camera device used.
*/
ToFCameraDevice* GetCameraDevice();
/*!
\brief Get the type of image to be recorded
\return ToF image type: ToFImageType3D (0) or ToFImageType2DPlusT (1)
*/
ToFImageWriter::ToFImageType GetToFImageType();
/*!
\brief Set the type of image to be recorded
\param toFImageType type of the ToF image: ToFImageType3D (0) or ToFImageType2DPlusT (1)
*/
void SetToFImageType(ToFImageWriter::ToFImageType toFImageType);
/*!
\brief Starts the recording by spawning a Thread which streams the data to a file. Aborting of the record process is controlled by the m_Abort flag
*/
void StartRecording();
/*!
\brief Stops the recording by setting the m_Abort flag to false
*/
void StopRecording();
/*!
\brief Wait until thread is terinated
*/
void WaitForThreadBeingTerminated();
protected:
/*!
\brief Thread method acquiring data via the ToFCameraDevice and recording it to file via the ToFImageWriter
*/
static ITK_THREAD_RETURN_TYPE RecordData(void* pInfoStruct);
// data acquisition
ToFCameraDevice::Pointer m_ToFCameraDevice; ///< ToFCameraDevice used for acquiring the images
int m_ToFCaptureWidth; ///< width (x-dimension) of the images to record.
int m_ToFCaptureHeight; ///< height (y-dimension) of the images to record.
int m_ToFPixelNumber; ///< number of pixels (widht*height) of the images to record
int m_RGBCaptureWidth; ///< width (x-dimension) of the images to record.
int m_RGBCaptureHeight; ///< height (y-dimension) of the images to record.
int m_RGBPixelNumber; ///< number of pixels (widht*height) of the images to record
int m_SourceDataSize; ///< size of the source data provided by the device
int m_ImageSequence; ///< number of images currently acquired
float* m_IntensityArray; ///< array holding the intensity data
float* m_DistanceArray; ///< array holding the distance data
float* m_AmplitudeArray; ///< array holding the amplitude data
unsigned char* m_RGBArray; ///< array holding the RGB data if available (e.g. for Kinect)
char* m_SourceDataArray; ///< array holding the source data
// data writing
ToFImageWriter::Pointer m_ToFImageWriter; ///< image writer writing the acquired images to a file
std::string m_DistanceImageFileName; ///< file name for saving the distance image
std::string m_AmplitudeImageFileName; ///< file name for saving the amplitude image
std::string m_IntensityImageFileName; ///< file name for saving the intensity image
std::string m_RGBImageFileName; ///< file name for saving the rgb image
int m_NumOfFrames; ///< number of frames to be recorded by this recorder
ToFImageWriter::ToFImageType m_ToFImageType; ///< type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)
ToFImageRecorder::RecordMode m_RecordMode; ///< mode of recording the images: specified number of frames (PerFrames) or infinite (Infinite)
std::string m_FileFormat; ///< file format for saving images. If .csv is chosen, ToFImageCsvWriter is used
bool m_DistanceImageSelected; ///< flag indicating if distance image should be recorded
bool m_AmplitudeImageSelected; ///< flag indicating if amplitude image should be recorded
bool m_IntensityImageSelected; ///< flag indicating if intensity image should be recorded
bool m_RGBImageSelected; ///< flag indicating if rgb image should be recorded
// threading
itk::MultiThreader::Pointer m_MultiThreader; ///< member for thread-handling (ITK-based)
int m_ThreadID; ///< ID of the thread recording the data
itk::FastMutexLock::Pointer m_AbortMutex; ///< mutex for thread-safe data access of abort flag
bool m_Abort; ///< flag controlling the abort mechanism of the recording procedure. For thread-safety only use in combination with m_AbortMutex
private:
};
} //END mitk namespace
#endif //mitkToFImageRecorder_h
diff --git a/Modules/ToFHardware/mitkToFImageWriter.h b/Modules/ToFHardware/mitkToFImageWriter.h
index bb08f4db96..6d035fc240 100644
--- a/Modules/ToFHardware/mitkToFImageWriter.h
+++ b/Modules/ToFHardware/mitkToFImageWriter.h
@@ -1,137 +1,137 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __mitkToFImageWriter_h
#define __mitkToFImageWriter_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkToFImageGrabber.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Writer class for ToF images
*
* This writer class allows streaming of ToF data into a file. The .pic file format is used for writing the data.
* Image information is included in the header of the pic file.
* Writer can simultaneously save "distance", "intensity" and "amplitude" image.
* Images can be written as 3D volume (ToFImageType::ToFImageType3D) or temporal image stack (ToFImageType::ToFImageType2DPlusT)
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFImageWriter : public itk::Object
{
public:
ToFImageWriter();
~ToFImageWriter();
- mitkClassMacro( ToFImageWriter , itk::Object );
+ mitkClassMacroItkParent( ToFImageWriter , itk::Object );
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
itkGetMacro( DistanceImageFileName, std::string );
itkGetMacro( AmplitudeImageFileName, std::string );
itkGetMacro( IntensityImageFileName, std::string );
itkGetMacro( RGBImageFileName, std::string );
itkGetMacro( Extension, std::string );
itkGetMacro( ToFCaptureWidth, int );
itkGetMacro( ToFCaptureHeight, int );
itkGetMacro( RGBCaptureWidth, int );
itkGetMacro( RGBCaptureHeight, int );
itkGetMacro( DistanceImageSelected, bool );
itkGetMacro( AmplitudeImageSelected, bool );
itkGetMacro( IntensityImageSelected, bool );
itkGetMacro( RGBImageSelected, bool );
itkSetMacro( DistanceImageFileName, std::string );
itkSetMacro( AmplitudeImageFileName, std::string );
itkSetMacro( IntensityImageFileName, std::string );
itkSetMacro( RGBImageFileName, std::string );
itkSetMacro( Extension, std::string );
itkSetMacro( ToFCaptureWidth, int );
itkSetMacro( ToFCaptureHeight, int );
itkSetMacro( RGBCaptureWidth, int );
itkSetMacro( RGBCaptureHeight, int );
itkSetMacro( DistanceImageSelected, bool );
itkSetMacro( AmplitudeImageSelected, bool );
itkSetMacro( IntensityImageSelected, bool );
itkSetMacro( RGBImageSelected, bool );
enum ToFImageType{ ToFImageType3D, ToFImageType2DPlusT };
/*!
\brief Get the type of image to be written
\return ToF image type: ToFImageType3D (0) or ToFImageType2DPlusT (1)
*/
ToFImageWriter::ToFImageType GetToFImageType();
/*!
\brief Set the type of image to be written
\param toFImageType type of the ToF image: ToFImageType3D (0) or ToFImageType2DPlusT (1)
*/
void SetToFImageType(ToFImageWriter::ToFImageType toFImageType);
/*!
\brief Open file(s) for writing
*/
virtual void Open(){};
/*!
\brief Close file(s) add .pic header and write
*/
virtual void Close(){};
/*!
\brief Add new data to file.
*/
virtual void Add(float* distanceFloatData, float* amplitudeFloatData, float* intensityFloatData, unsigned char* rgbData=0){};
protected:
/*!
\brief Checks file name if file extension exists. If not an error message is returned
*/
void CheckForFileExtension(std::string& fileName);
// member variables
std::string m_DistanceImageFileName; ///< file name for saving the distance image
std::string m_AmplitudeImageFileName; ///< file name for saving the amplitude image
std::string m_IntensityImageFileName; ///< file name for saving the intensity image
std::string m_RGBImageFileName; ///< file name for saving the RGB image
std::string m_Extension; ///< file extension used for saving images
int m_ToFCaptureWidth; ///< width (x-dimension) of the images to record.
int m_ToFCaptureHeight; ///< height (y-dimension) of the images to record.
int m_ToFPixelNumber; ///< number of pixels (widht*height) of the images to record
int m_ToFImageSizeInBytes; ///< size of the image to save in bytes
int m_RGBCaptureWidth; ///< width (x-dimension) of the images to record.
int m_RGBCaptureHeight; ///< height (y-dimension) of the images to record.
int m_RGBPixelNumber; ///< number of pixels (widht*height) of the images to record
int m_RGBImageSizeInBytes; ///< size of the image to save in bytes
int m_NumOfFrames; ///< number of frames written to the image. Used for pic header.
ToFImageWriter::ToFImageType m_ToFImageType; ///< type of image to be recorded: ToFImageType3D (0) or ToFImageType2DPlusT (1)
bool m_DistanceImageSelected; ///< flag indicating if distance image should be recorded
bool m_AmplitudeImageSelected; ///< flag indicating if amplitude image should be recorded
bool m_IntensityImageSelected; ///< flag indicating if intensity image should be recorded
bool m_RGBImageSelected; ///< flag indicating if RGB image should be recorded
private:
};
} //END mitk namespace
#endif // __mitkToFImageWriter_h
diff --git a/Modules/TubeGraph/include/mitkCircularProfileTubeElement.h b/Modules/TubeGraph/include/mitkCircularProfileTubeElement.h
index 9523cc252c..dad0026c69 100644
--- a/Modules/TubeGraph/include/mitkCircularProfileTubeElement.h
+++ b/Modules/TubeGraph/include/mitkCircularProfileTubeElement.h
@@ -1,71 +1,71 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_CircularProfileTubeElement_H
#define _MITK_CircularProfileTubeElement_H
#include <MitkTubeGraphExports.h>
#include "mitkTubeElement.h"
namespace mitk {
/**
* \brief Class for elements which describes tubular structur with a circular cross section.
*/
class MITKTUBEGRAPH_EXPORT CircularProfileTubeElement: virtual public TubeElement {
public:
CircularProfileTubeElement();
CircularProfileTubeElement(float x, float y, float z, float d = 0.0f );
CircularProfileTubeElement(const Point3D, float d = 0.0f);
~CircularProfileTubeElement();
/**
* Set the 3D position of the element.
*/
- void SetCoordinates(Point3D coordinates);
+ void SetCoordinates(Point3D coordinates) override;
/**
* Returns the 3D position of the element.
*/
- const Point3D& GetCoordinates() const;
+ const Point3D& GetCoordinates() const override;
/**
* Set the diameter of the circle.
*/
void SetDiameter(float d);
/**
* Returns the diameter of the circle.
*/
const float GetDiameter() const;
/**
* Comparison operation between this object and the given object.
* @param right The object to compare with.
* @return true, if the object is the same;false, if not.
*/
- bool operator==(const TubeElement& right) const;
+ bool operator==(const TubeElement& right) const override;
private:
Point3D m_coordinates;
float m_diameter;
};//class
}//namespace
#endif
diff --git a/Modules/TubeGraph/include/mitkTubeGraphDataInteractor.h b/Modules/TubeGraph/include/mitkTubeGraphDataInteractor.h
index 3a22c3306e..3207ece03f 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphDataInteractor.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphDataInteractor.h
@@ -1,124 +1,124 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkTubeGraphDataInteractor3D_h_
#define mitkTubeGraphDataInteractor3D_h_
#include <MitkTubeGraphExports.h>
#include <mitkBaseRenderer.h>
#include <mitkDataInteractor.h>
#include "mitkTubeGraph.h"
#include "mitkTubeGraphProperty.h"
namespace mitk
{
// Define events for TubeGraph interaction notifications
itkEventMacro( SelectionChangedTubeGraphEvent, itk::AnyEvent );
/**
* \brief
*
* \ingroup Interaction
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKTUBEGRAPH_EXPORT TubeGraphDataInteractor: public DataInteractor
{
public:
mitkClassMacro(TubeGraphDataInteractor, DataInteractor);
itkNewMacro(Self);
/**
* Describes, which activation modes are available based on the
* currently picked tube:
*
* \li <b>None</b> means "no tube is active"
* \li <b>Single</b> means "only the picked tube is active"
* \li <b>ToRoot</b> means "all tubes from the picked on down to the root of the tube graph are active"
* \li <b>ToPeriphery</b> means "all tubes included in the subgraph of the currently picked vessel are active"
* \li <b>Points</b> means "shortes path between two picked tubes are active"
* \li <b>Multiple</b> means "all picked tubes are active"
*/
enum ActivationMode
{
None = 0,
Single,
ToRoot,
ToPeriphery,
Points,
Multiple
};
enum ActionMode
{
AttributationMode = 0,
AnnotationMode,
EditMode,
RootMode,
InformationMode
};
void SetActivationMode(const ActivationMode& activationMode);
ActivationMode GetActivationMode();
void SetActionMode(const ActionMode& actionMode);
ActionMode GetActionMode();
void ResetPickedTubes();
protected:
TubeGraphDataInteractor();
virtual ~TubeGraphDataInteractor();
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
- virtual void ConnectActionsAndFunctions();
+ virtual void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
*/
- virtual void DataNodeChanged();
+ virtual void DataNodeChanged() override;
/**
* Initializes the movement, stores starting position.
*/
virtual bool CheckOverTube (const InteractionEvent *);
virtual bool SelectTube (StateMachineAction*, InteractionEvent*);
virtual bool DeselectTube (StateMachineAction*, InteractionEvent*);
void SelectTubesByActivationModus();
void UpdateActivation();
private:
std::vector<TubeGraph::TubeDescriptorType> GetTubesToRoot();
std::vector<TubeGraph::TubeDescriptorType> GetTubesBetweenPoints();
std::vector<TubeGraph::TubeDescriptorType> GetPathToPeriphery();
std::vector<TubeGraph::TubeDescriptorType> GetPathBetweenTubes(const TubeGraph::TubeDescriptorType& start,const TubeGraph::TubeDescriptorType& end);
TubeGraph::Pointer m_TubeGraph;
TubeGraphProperty::Pointer m_TubeGraphProperty;
TubeGraph::TubeDescriptorType m_LastPickedTube;
TubeGraph::TubeDescriptorType m_SecondLastPickedTube;
ActivationMode m_ActivationMode;
ActionMode m_ActionMode;
};
}
#endif
diff --git a/Modules/TubeGraph/include/mitkTubeGraphIO.h b/Modules/TubeGraph/include/mitkTubeGraphIO.h
index eeb929a486..a9d1e615b1 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphIO.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphIO.h
@@ -1,77 +1,77 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_TUBE_GRAPH_IO_H_
#define _MITK_TUBE_GRAPH_IO_H_
#include <mitkAbstractFileIO.h>
#include <mitkCustomMimeType.h>
#include <mitkIOMimeTypes.h>
#include "mitkTubeGraph.h"
class TiXmlElement;
namespace mitk
{
/**
* @brief reader and writer for xml representations of mitk::TubeGraph
*
* @ingroup IO
*/
class TubeGraphIO : public mitk::AbstractFileIO
{
public:
TubeGraphIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
- virtual std::vector<BaseData::Pointer> Read();
+ virtual std::vector<BaseData::Pointer> Read() override;
- virtual ConfidenceLevel GetReaderConfidenceLevel() const;
+ virtual ConfidenceLevel GetReaderConfidenceLevel() const override;
// -------------- AbstractFileWriter -------------
- virtual void Write();
- virtual ConfidenceLevel GetWriterConfidenceLevel() const;
+ virtual void Write() override;
+ virtual ConfidenceLevel GetWriterConfidenceLevel() const override;
static CustomMimeType TUBEGRAPH_MIMETYPE() // tsf
{
CustomMimeType mimeType(TUBEGRAPH_MIMETYPE_NAME());
mimeType.AddExtension("tsf");
mimeType.SetCategory("Graphs");
mimeType.SetComment("MITK Tube Graph Structure File");
return mimeType;
}
static std::string TUBEGRAPH_MIMETYPE_NAME()
{
static std::string name = mitk::IOMimeTypes::DEFAULT_BASE_NAME() + ".graphs.tubular-sructure";
return name;
}
private:
- TubeGraphIO* IOClone() const;
+ TubeGraphIO* IOClone() const override;
TubeGraphIO(const TubeGraphIO& other);
const BoundingBox::Pointer ComputeBoundingBox(TubeGraph::Pointer graph ) const;
};
}
#endif //_MITK_SURFACE_VTK_IO_H_
diff --git a/Modules/TubeGraph/include/mitkTubeGraphObjectFactory.h b/Modules/TubeGraph/include/mitkTubeGraphObjectFactory.h
index 29f8732650..08bd367365 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphObjectFactory.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphObjectFactory.h
@@ -1,57 +1,57 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TubeGraphObjectFactory_H_INCLUDED
#define TubeGraphObjectFactory_H_INCLUDED
#include <MitkTubeGraphExports.h>
#include <mitkCoreObjectFactory.h>
namespace mitk {
class MITKTUBEGRAPH_EXPORT TubeGraphObjectFactory : public CoreObjectFactoryBase
{
public:
mitkClassMacro(TubeGraphObjectFactory, CoreObjectFactoryBase);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
- virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId);
- virtual void SetDefaultProperties(mitk::DataNode* node);
- virtual const char* GetFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap();
- virtual const char* GetSaveFileExtensions();
- virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap();
+ virtual Mapper::Pointer CreateMapper(mitk::DataNode* node, MapperSlotId slotId) override;
+ virtual void SetDefaultProperties(mitk::DataNode* node) override;
+ virtual const char* GetFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetFileExtensionsMap() override;
+ virtual const char* GetSaveFileExtensions() override;
+ virtual mitk::CoreObjectFactoryBase::MultimapType GetSaveFileExtensionsMap() override;
void RegisterIOFactories();
protected:
TubeGraphObjectFactory();
private:
void CreateFileExtensionsMap();
std::string m_ExternalFileExtensions;
std::string m_InternalFileExtensions;
std::string m_SaveFileExtensions;
MultimapType m_FileExtensionsMap;
MultimapType m_SaveFileExtensionsMap;
};
}
#endif
diff --git a/Modules/TubeGraph/include/mitkTubeGraphProperty.h b/Modules/TubeGraph/include/mitkTubeGraphProperty.h
index f7eae87011..cc0ac57901 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphProperty.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphProperty.h
@@ -1,156 +1,156 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mitk_TubeGraphProperty_h
#define _mitk_TubeGraphProperty_h
#include <MitkTubeGraphExports.h>
#include <mitkBaseProperty.h>
#include <mitkColorProperty.h>
#include "mitkTubeGraph.h"
#include <itkObject.h>
#include <vector>
#include <map>
namespace mitk
{
/**
* \brief Property for tube graphs
*/
class MITKTUBEGRAPH_EXPORT TubeGraphProperty :public BaseProperty
{
public:
mitkClassMacro( TubeGraphProperty, BaseProperty );
itkNewMacro( TubeGraphProperty );
struct LabelGroup
{
struct Label
{
std::string labelName;
bool isVisible;
Color labelColor;
};
std::string labelGroupName;
std::vector< Label* > labels;
};
///////////////TYPEDEF///////////////
typedef TubeGraph::TubeDescriptorType TubeDescriptorType;
typedef std::vector< TubeGraphProperty::LabelGroup* > LabelGroupSetType;
typedef std::pair<TubeDescriptorType , std::string> TubeToLabelGroupType;
/////////////////////////////////////
struct Annotation
{
std::string name;
std::string description;
TubeDescriptorType tube;
};
/**
* Checks, if a given tube is visible
* @param tube the tube id of the tube to check
* @returns true, if the tube with id is visible or false otherwise
*/
bool IsTubeVisible(const TubeDescriptorType& tube);
/**
* Sets a tube active.
* @param tube the tube id of the tube, which has to be set active
* @param active true, if the tube should be active or false if not.
*/
void SetTubeActive(const TubeDescriptorType& tube, const bool& active);
/**
* Sets tubes active.
*
*/
void SetTubesActive(std::vector<TubeDescriptorType>& tubes);
/**
* Checks, if a given tube is activated
* @param id the tube id of the tube to check
* @returns true, if the tube with id is active or false otherwise
*/
bool IsTubeActive(const TubeDescriptorType& tube);
std::vector< TubeDescriptorType > GetActiveTubes();
Color GetColorOfTube(const TubeDescriptorType& tube);
void SetTubesToLabels(std::map<TubeToLabelGroupType, std::string> tubeToLabelMap);
std::map<TubeToLabelGroupType, std::string> GetTubesToLabels();
/**
* Deactivates all tubes
*/
void DeactivateAllTubes();
void AddAnnotation(Annotation* annotation);
Annotation* GetAnnotationByName(std::string annotation);
std::vector<Annotation*> GetAnnotations();
void RemoveAnnotation(Annotation* annotation);
void AddLabelGroup(LabelGroup* labelGroup, unsigned int position); //Add LG by name and vec<labelName>??
void RemoveLabelGroup(LabelGroup* labelGroup);
LabelGroupSetType GetLabelGroups();
unsigned int GetNumberOfLabelGroups();
unsigned int GetIndexOfLabelGroup(LabelGroup* labelGroup);
LabelGroup* GetLabelGroupByName(std::string labelGroup);
void SetLabelVisibility (LabelGroup::Label* label, bool isVisible);
void SetLabelColor(LabelGroup::Label* label, Color color);
void RenameLabel(LabelGroup* labelGroup, LabelGroup::Label* label, std::string newName);
void SetLabelForActivatedTubes(LabelGroup* labelGroup, LabelGroup::Label* label);
LabelGroup::Label* GetLabelByName(LabelGroup* labelGroup, std::string labelName);
- virtual std::string GetValueAsString() const;
+ virtual std::string GetValueAsString() const override;
protected:
TubeGraphProperty();
TubeGraphProperty(const TubeGraphProperty& other);
virtual ~TubeGraphProperty();
private:
std::vector< TubeDescriptorType > m_ActiveTubes;
LabelGroupSetType m_LabelGroups;
std::map< TubeToLabelGroupType, std::string > m_TubeToLabelsMap;
std::vector<Annotation*> m_Annotations;
bool TubeDescriptorsCompare(const TubeDescriptorType& tube1, const TubeDescriptorType& tube2);
// purposely not implemented
TubeGraphProperty& operator=(const TubeGraphProperty&);
- virtual bool IsEqual(const BaseProperty& property) const;
- virtual bool Assign(const BaseProperty& property);
- virtual itk::LightObject::Pointer InternalClone() const;
+ virtual bool IsEqual(const BaseProperty& property) const override;
+ virtual bool Assign(const BaseProperty& property) override;
+ virtual itk::LightObject::Pointer InternalClone() const override;
};
}//namespace mitk
#endif /* _mitk_TubeGraphProperty_h */
diff --git a/Modules/TubeGraph/include/mitkTubeGraphVtkMapper3D.h b/Modules/TubeGraph/include/mitkTubeGraphVtkMapper3D.h
index 59a431832b..b20081b991 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphVtkMapper3D.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphVtkMapper3D.h
@@ -1,121 +1,121 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef TubeGraphVtkMapper3D_H_HEADER_INCLUDED
#define TubeGraphVtkMapper3D_H_HEADER_INCLUDED
#include <MitkTubeGraphExports.h>
#include <mitkLocalStorageHandler.h>
#include "mitkVtkMapper3D.h"
#include "mitkTubeGraphProperty.h"
#include "mitkTubeGraph.h"
#include "mitkCircularProfileTubeElement.h"
#include <vtkActor.h>
#include <vtkAppendPolyData.h>
#include <vtkAssembly.h>
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
namespace mitk
{
/**
* 3D Mapper for mitk::Graph< TubeGraphVertex, TubeGraphEdge >. This mapper creates tubes
* around each tubular structure by using vtkTubeFilter.
*
*/
class MITKTUBEGRAPH_EXPORT TubeGraphVtkMapper3D : public VtkMapper3D
{
public:
/* Typedefs */
typedef TubeGraph::EdgeDescriptorType EdgeDescriptorType;
typedef TubeGraph::VertexDescriptorType VertexDescriptorType;
mitkClassMacro(TubeGraphVtkMapper3D, VtkMapper3D);
itkNewMacro(Self);
/**
* Returns the input data object of the given filter. In this
* case, a mitk::Graph< TubeGraphVertex, TubeGraphEdge > is returned.
*/
virtual const TubeGraph* GetInput();
- virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer);
+ virtual vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
protected:
TubeGraphVtkMapper3D();
virtual ~TubeGraphVtkMapper3D();
/**
* This method is called, each time a specific renderer is updated.
*/
- virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer);
+ virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
/**
* Generate vtkPolyData containing the tube centerlines and
* sets these as input for a vtkTubeFilter, which generates tubes
* around the edges. Also generates vtkActors for each vertex. Here
* the vtkPolyData are vtkSphereSources. All poly data will be clipped
* with each other on an furcation. So you get end-caps and connecting
* pieces from the spheres. Clipping the tubes with each other avoids
* structures within the general view.
*/
virtual void GenerateTubeGraphData(mitk::BaseRenderer* renderer);
/**
* Render only the visual information like color or visibility new.
*/
virtual void RenderTubeGraphPropertyInformation(mitk::BaseRenderer* renderer);
/**
* Converts a single tube into a vtkPolyData. Each point of the
* tube surface is labeled with the tube id.
*/
void GeneratePolyDataForTube(TubeGraphEdge& edge, const TubeGraph::Pointer& graph, const TubeGraphProperty::Pointer& graphProperty, mitk::BaseRenderer* renderer);
void GeneratePolyDataForFurcation(TubeGraphVertex& vertex, const TubeGraph::Pointer& graph, mitk::BaseRenderer* renderer);
void ClipPolyData(TubeGraphVertex& vertex, const TubeGraph::Pointer& graph, const TubeGraphProperty::Pointer& graphProperty, mitk::BaseRenderer* renderer);
private:
bool ClipStructures();
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkSmartPointer<vtkAssembly> m_vtkTubeGraphAssembly;
std::map<TubeGraph::TubeDescriptorType, vtkSmartPointer<vtkActor> > m_vtkTubesActorMap;
std::map<TubeGraph::VertexDescriptorType, vtkSmartPointer<vtkActor> > m_vtkSpheresActorMap;
itk::TimeStamp m_lastGenerateDataTime;
itk::TimeStamp m_lastRenderDataTime;
LocalStorage()
{
m_vtkTubeGraphAssembly = vtkSmartPointer<vtkAssembly>::New();
}
~LocalStorage()
{
}
};
LocalStorageHandler<LocalStorage> m_LSH;
};
} // namespace
#endif
diff --git a/Modules/TubeGraph/include/mitkUndirectedGraph.h b/Modules/TubeGraph/include/mitkUndirectedGraph.h
index 21bfda5473..3c2055d975 100644
--- a/Modules/TubeGraph/include/mitkUndirectedGraph.h
+++ b/Modules/TubeGraph/include/mitkUndirectedGraph.h
@@ -1,171 +1,171 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_UndirectedGraph_H
#define _MITK_UndirectedGraph_H
#include <mitkBaseData.h>
#include <boost/graph/adjacency_list.hpp>
/* definition of basic boost::graph properties */
enum vertex_properties_t { vertex_properties };
enum edge_properties_t { edge_properties };
namespace boost {
BOOST_INSTALL_PROPERTY(vertex, properties);
BOOST_INSTALL_PROPERTY(edge, properties);
}
namespace mitk {
/**
* \brief Template class for undirected graphs.Paramters should be the vertex and edge classes, which contains the information.
*/
template < class TVertex, class TEdge >
class UndirectedGraph : public BaseData
{
public:
//--- Typedefs ---//
typedef TVertex VertexType;
typedef TEdge EdgeType;
/**
* Creating the graph type
* listS: Represents the OutEdgeList as a std::list
* vecS: Represents the VertexList as a std::vector
* undirectedS: Representation for an undirected graph
* VertexProperty: Defines that all vertex are represented by VertexType
* EdgeProperty: Defines that all edges are represented by EdgeType
*/
typedef boost::adjacency_list<
boost::listS,
boost::vecS,
boost::undirectedS, // undirected graph
boost::property<vertex_properties_t, VertexType>,
boost::property<edge_properties_t, EdgeType>
> GraphType;
/* a bunch of graph-specific typedefs */
typedef typename boost::graph_traits<GraphType>::vertex_descriptor VertexDescriptorType;
typedef typename boost::graph_traits<GraphType>::edge_descriptor EdgeDescriptorType;
typedef typename boost::graph_traits<GraphType>::vertex_iterator VertexIteratorType;
typedef typename boost::graph_traits<GraphType>::edge_iterator EdgeIteratorType;
typedef typename boost::graph_traits<GraphType>::adjacency_iterator AdjacenyIteratorType;
typedef typename boost::graph_traits<GraphType>::out_edge_iterator OutEdgeIteratorType;
typedef typename boost::graph_traits<GraphType>::in_edge_iterator InEdgeIteratorType;
//--- Macros ---//
mitkClassMacro( UndirectedGraph, BaseData );
itkNewMacro( Self );
// virtual methods that need to be implemented
- virtual void UpdateOutputInformation()
+ virtual void UpdateOutputInformation() override
{
if ( this->GetSource() )
this->GetSource()->UpdateOutputInformation();
}
- virtual void SetRequestedRegionToLargestPossibleRegion(){}
- virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(){ return false; }
- virtual bool VerifyRequestedRegion(){ return true; }
- virtual void SetRequestedRegion(const itk::DataObject *data ){}
+ virtual void SetRequestedRegionToLargestPossibleRegion() override{}
+ virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override{ return false; }
+ virtual bool VerifyRequestedRegion() override{ return true; }
+ virtual void SetRequestedRegion(const itk::DataObject *data ) override{}
/** Add a new vertex to the graph */
VertexDescriptorType AddVertex(const VertexType& vertexData);
/** Remove the vertex from the graph */
void RemoveVertex(const VertexDescriptorType& vertex);
/** Get the vertex data of the given vertex descriptor */
VertexType GetVertex(const VertexDescriptorType& vertex);
/** Set the vertex data of the given vertex descriptor */
void SetVertex(const VertexDescriptorType& vertex, const VertexType& vertexData);
/**Returns the descriptor if the vertex exist in the graph, otherwise undefined*/
VertexDescriptorType GetVertexDescriptor (const VertexType& vertexData) const;
/** Add a new edge between the given vertices to the graph */
EdgeDescriptorType AddEdge(const VertexDescriptorType& vertexA, const VertexDescriptorType& vertexB, const EdgeType& edgeData);
/** Remove the edge from the graph */
void RemoveEdge(const EdgeDescriptorType& edge);
/** Get the edge data of the given edge descriptor */
EdgeType GetEdge(const EdgeDescriptorType& edge);
/** Set the edge data of the given edge descriptor */
void SetEdge(const EdgeDescriptorType& edge, const EdgeType& edgeData);
/**Returns the descriptor if the edge exist in the graph, otherwise undefined*/
EdgeDescriptorType GetEdgeDescriptor (const EdgeType& edgeData) const;
/** Get parent and target vertex of the given edge*/
std::pair< VertexType, VertexType > GetVerticesOfAnEdge (const EdgeDescriptorType& edge)const;
/** Returns the edge descriptor from the edge which has the given vertices as source and target */
EdgeDescriptorType GetEdgeDescriptorByVerices (const VertexDescriptorType& vertexA, const VertexDescriptorType& vertexB)const;
/** Get all edges of the given vertex */
std::vector< EdgeType > GetAllEdgesOfAVertex (const VertexDescriptorType& vertex)const;
/** Get overall number of vertices in the graph */
int GetNumberOfVertices() const;
/** get overall number of edges in the graph */
int GetNumberOfEdges() const;
/** get vector containing all the vertices of the graph*/
std::vector< VertexType > GetVectorOfAllVertices() const;
/** get vector containing all the edges of the network */
std::vector< EdgeType > GetVectorOfAllEdges() const;
/** clear the graph */
- void Clear();
+ void Clear() override;
/** get the graph */
const GraphType& GetGraph() const;
UndirectedGraph< VertexType, EdgeType >& operator=(const UndirectedGraph< VertexType, EdgeType >& rhs);
protected:
UndirectedGraph();
UndirectedGraph(const UndirectedGraph< VertexType, EdgeType >& graph);
virtual ~UndirectedGraph();
GraphType m_Graph;
private:
/** property access for vertices */
VertexType& properties(const VertexDescriptorType& vertex);
/** property access for vertices */
const VertexType& properties(const VertexDescriptorType& vertex) const;
/** property access for edges */
EdgeType& properties(const EdgeDescriptorType& edge);
/** property access for edges */
const EdgeType& properties(const EdgeDescriptorType& edge) const;
};
} // namespace mitk
#include "mitkUndirectedGraph.txx"
#endif /* _MITK_UndirectedGraph_H */
diff --git a/Modules/TubeGraph/src/IO/mitkTubeGraphModuleActivator.cpp b/Modules/TubeGraph/src/IO/mitkTubeGraphModuleActivator.cpp
index 0d360bec07..1affb289e7 100644
--- a/Modules/TubeGraph/src/IO/mitkTubeGraphModuleActivator.cpp
+++ b/Modules/TubeGraph/src/IO/mitkTubeGraphModuleActivator.cpp
@@ -1,47 +1,47 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include "mitkTubeGraphIO.h"
namespace mitk
{
/**
\brief Registers services for tube graph module.
*/
class TubeGraphActivator : public us::ModuleActivator
{
std::vector<AbstractFileIO*> m_FileIOs;
public:
- void Load(us::ModuleContext* /*context*/)
+ void Load(us::ModuleContext* /*context*/) override
{
m_FileIOs.push_back(new TubeGraphIO());
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
for(std::vector<mitk::AbstractFileIO*>::iterator iter = m_FileIOs.begin(), endIter = m_FileIOs.end(); iter != endIter; ++iter)
{
delete *iter;
}
}
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::TubeGraphActivator)
diff --git a/Modules/US/USControlInterfaces/mitkUSAbstractControlInterface.h b/Modules/US/USControlInterfaces/mitkUSAbstractControlInterface.h
index d7a561c9a4..eb3c06165b 100644
--- a/Modules/US/USControlInterfaces/mitkUSAbstractControlInterface.h
+++ b/Modules/US/USControlInterfaces/mitkUSAbstractControlInterface.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSAbstractControlInterface_H_HEADER_INCLUDED_
#define MITKUSAbstractControlInterface_H_HEADER_INCLUDED_
#include <mitkCommon.h>
#include <MitkUSExports.h>
namespace itk {
template<class T> class SmartPointer;
}
namespace mitk {
class USDevice;
/**
* \brief Superclass for all ultrasound device control interfaces.
* Defines an interface for activating and deactivating a control interface.
*/
class MITKUS_EXPORT USAbstractControlInterface : public itk::Object
{
public:
- mitkClassMacro(USAbstractControlInterface, itk::Object);
+ mitkClassMacroItkParent(USAbstractControlInterface, itk::Object);
/**
* Method must be implemented in every control interface to handle all
* activities which should be done on activating and deactivating the
* concrete control interface.
* \param isActive whether the control interface should be activated or deactivated
*/
virtual void SetIsActive( bool isActive ) = 0;
/**
* Method must be implemented in every control interface to tell the caller
* if the interface is currently activated or deactivated.
* \return whether the control interface is active or not
*/
virtual bool GetIsActive( ) = 0;
protected:
USAbstractControlInterface( itk::SmartPointer<USDevice> device );
virtual ~USAbstractControlInterface( );
itk::SmartPointer<USDevice> m_Device;
};
} // namespace mitk
#endif // MITKUSAbstractControlInterface_H_HEADER_INCLUDED_
diff --git a/Modules/US/USFilters/mitkUSImageSource.h b/Modules/US/USFilters/mitkUSImageSource.h
index 996160eb7c..e9ddd32118 100644
--- a/Modules/US/USFilters/mitkUSImageSource.h
+++ b/Modules/US/USFilters/mitkUSImageSource.h
@@ -1,102 +1,102 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSImageSource_H_HEADER_INCLUDED_
#define MITKUSImageSource_H_HEADER_INCLUDED_
// ITK
#include <itkProcessObject.h>
// MITK
#include <MitkUSExports.h>
#include <mitkCommon.h>
#include "mitkBasicCombinationOpenCVImageFilter.h"
#include "mitkOpenCVToMitkImageFilter.h"
#include "mitkImageToOpenCVImageFilter.h"
// OpenCV
#include "cv.h"
namespace mitk {
/**
* \brief This is an abstract superclass for delivering USImages.
* Each subclass must implement the method mitk::USImageSource::GetNextRawImage().
* The public method mitk::USImageSource::GetNextImage() can the be used to
* get the next image from the image source. This image will be filtered by
* the filter set with mitk::USImageSource::SetImageFilter().
*
* \ingroup US
*/
class MITKUS_EXPORT USImageSource : public itk::Object
{
public:
static const char* IMAGE_PROPERTY_IDENTIFIER;
- mitkClassMacro(USImageSource, itk::Object);
+ mitkClassMacroItkParent(USImageSource, itk::Object);
itkGetMacro(ImageFilter, mitk::BasicCombinationOpenCVImageFilter::Pointer);
void PushFilter(AbstractOpenCVImageFilter::Pointer filter);
bool RemoveFilter(AbstractOpenCVImageFilter::Pointer filter);
bool GetIsFilterInThePipeline(AbstractOpenCVImageFilter::Pointer filter);
/**
* \brief Retrieves the next frame. This will typically be the next frame
* in a file or the last cached file in a device. The image is filtered if
* a filter was set by mitk::USImageSource::SetImageFilter().
*
* \return pointer to the next USImage (filtered if set)
*/
mitk::Image::Pointer GetNextImage( );
protected:
USImageSource();
virtual ~USImageSource();
/**
* \brief Set the given OpenCV image matrix to the next image received
* from the device or file.
*
* The standard implementation calls the overloaded function with an
* mitk::Image and converts this image to OpenCV then. One should reimplement
* this method for a better performance if an image filter is set.
*/
virtual void GetNextRawImage( cv::Mat& );
/**
* \brief Set mitk::Image to the next image received from the device or file.
* This method must be implemented in every subclass.
*/
virtual void GetNextRawImage( mitk::Image::Pointer& ) = 0;
/**
* \brief Used to convert from OpenCV Images to MITK Images.
*/
mitk::OpenCVToMitkImageFilter::Pointer m_OpenCVToMitkFilter;
/**
* \brief Used to convert from MITK Images to OpenCV Images.
*/
mitk::ImageToOpenCVImageFilter::Pointer m_MitkToOpenCVFilter;
private:
/**
* \brief Filter is executed during mitk::USImageVideoSource::GetNextImage().
*/
BasicCombinationOpenCVImageFilter::Pointer m_ImageFilter;
int m_CurrentImageId;
};
} // namespace mitk
#endif /* MITKUSImageSource_H_HEADER_INCLUDED_ */
diff --git a/Modules/US/USFilters/mitkUSImageVideoSource.h b/Modules/US/USFilters/mitkUSImageVideoSource.h
index 7f61c0ba9f..50d5c801ed 100644
--- a/Modules/US/USFilters/mitkUSImageVideoSource.h
+++ b/Modules/US/USFilters/mitkUSImageVideoSource.h
@@ -1,221 +1,221 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSImageVideoSource_H_HEADER_INCLUDED_
#define MITKUSImageVideoSource_H_HEADER_INCLUDED_
// ITK
#include <itkProcessObject.h>
// MITK
#include "mitkUSImageSource.h"
#include "mitkConvertGrayscaleOpenCVImageFilter.h"
#include "mitkCropOpenCVImageFilter.h"
#include "mitkBasicCombinationOpenCVImageFilter.h"
// OpenCV
#include <highgui.h>
namespace mitk {
/**
* \brief This class can be pointed to a video file or a videodevice and delivers USImages.
*
* Images are in color by default, but can be set to greyscale via SetColorOutput(false),
* which significantly improves performance.
*
* Images can also be cropped to a region of interest, further increasing performance.
*
* \ingroup US
*/
class MITKUS_EXPORT USImageVideoSource : public mitk::USImageSource
{
public:
- mitkClassMacro(USImageVideoSource, itk::ProcessObject);
+ mitkClassMacroItkParent(USImageVideoSource, itk::ProcessObject);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/**
* \brief Defines a region of interest by top left and bottom right corner.
*/
struct USImageRoi
{
int topLeftX;
int topLeftY;
int bottomRightX;
int bottomRightY;
USImageRoi()
: topLeftX(0), topLeftY(0), bottomRightX(0), bottomRightY(0) { };
USImageRoi(unsigned int topLeftX, unsigned int topLeftY, unsigned int bottomRightX, unsigned int bottomRightY)
: topLeftX(topLeftX), topLeftY(topLeftY), bottomRightX(bottomRightX), bottomRightY(bottomRightY) { };
};
/**
* \brief Defines a region of interest by distances to the four image borders.
*/
struct USImageCropping
{
unsigned int top;
unsigned int bottom;
unsigned int left;
unsigned int right;
USImageCropping()
: top(0), bottom(0), left(0), right(0) { };
USImageCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
: top(top), bottom(bottom), left(left), right(right) { };
};
/**
* \brief Opens a video file for streaming. If nothing goes wrong, the
* VideoSource is ready to deliver images after calling this function.
*/
void SetVideoFileInput(std::string path);
/**
* \brief Opens a video device for streaming. Takes the Device id. Try -1 for "grab the first you can get"
* which works quite well if only one device is available. If nothing goes wrong, the
* VideoSource is ready to deliver images after calling this function.
*/
void SetCameraInput(int deviceID);
void ReleaseInput();
/**
* \brief Sets the output image to rgb or grayscale.
* Output is color by default
* and can be set to color by passing true, or to grayscale again by passing false.
*/
void SetColorOutput(bool isColor);
/**
* \brief Defines the cropping area.
* The rectangle will be justified to the image borders if the given
* rectangle is larger than the video source. If a correct rectangle is
* given, the dimensions of the output image will be equal to those of the
* rectangle.
*/
void SetRegionOfInterest(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY);
/**
* \brief Defines the cropping area.
* The rectangle will be justified to the image borders if the given
* rectangle is larger than the video source. If a correct rectangle is
* given, the dimensions of the output image will be equal to those of the
* rectangle.
*
* \param regionOfInterest struct defining x and y coordinates of top left and bottom right corner
*/
void SetRegionOfInterest(USImageRoi regionOfInterest);
/**
* \brief Defines the cropping area.
* The rectangle will be justified to the image borders if the given
* rectangle is larger than the video source. If a correct rectangle is
* given, the dimensions of the output image will be equal to those of the
* rectangle.
*
* \param cropping struct defining distances to the four image borders
*/
void SetCropping(USImageCropping cropping);
/**
* /brief Removes the region of interest.
* Produced images will be uncropped after call of this method.
*/
void RemoveRegionOfInterest();
/**
* \brief This is a workaround for a problem that happens with some video device drivers.
*
* If you encounter OpenCV Warnings that buffer sizes do not match while calling getNextFrame,
* then do the following: Using the drivers control panel to force a certain resolution, then call
* this method with the same Dimensions after opening the device.
* Before retrieving images one should call mitk::USImageVideoSource::isReady().
*/
void OverrideResolution(int width, int height);
// Getter & Setter
itkGetMacro(IsVideoReady, bool);
itkGetMacro(ResolutionOverride, bool);
itkSetMacro(ResolutionOverride, bool);
itkGetMacro(IsGreyscale,bool);
itkGetMacro(ResolutionOverrideWidth,int);
itkGetMacro(ResolutionOverrideHeight,int);
int GetImageHeight();
int GetImageWidth();
USImageCropping GetCropping();
USImageRoi GetRegionOfInterest();
/**
* \brief Returns true if images can be delivered.
*
* Only if true is returned one can retrieve images via
* mitk::USImageVideoSource::GetNextImage().
* If false is returned, behaviour is undefined.
*/
bool GetIsReady();
protected:
USImageVideoSource();
virtual ~USImageVideoSource();
/**
* \brief Next image is gathered from the image source.
*
* \param[out] image an OpenCV-Matrix containing this image
*/
virtual void GetNextRawImage( cv::Mat& image );
/**
* \brief Next image is gathered from the image source.
*
* \param[out] image an mitk::Image containing this image
*/
virtual void GetNextRawImage( mitk::Image::Pointer& image );
/**
* \brief The source of the video, managed internally
*/
cv::VideoCapture* m_VideoCapture;
/**
* \brief If true, a frame can be grabbed anytime.
*/
bool m_IsVideoReady;
/**
* \brief If true, image output will be greyscale.
*/
bool m_IsGreyscale;
/**
* \brief If true, image will be cropped according to settings of crop filter.
*/
bool m_IsCropped;
/**
* These Variables determined whether Resolution Override is on, what dimensions to use.
*/
int m_ResolutionOverrideWidth;
int m_ResolutionOverrideHeight;
bool m_ResolutionOverride;
ConvertGrayscaleOpenCVImageFilter::Pointer m_GrayscaleFilter;
CropOpenCVImageFilter::Pointer m_CropFilter;
};
} // namespace mitk
#endif /* MITKUSImageVideoSource_H_HEADER_INCLUDED_ */
diff --git a/Modules/US/USModel/mitkUSDevicePersistence.h b/Modules/US/USModel/mitkUSDevicePersistence.h
index b70e97961e..984b808e5b 100644
--- a/Modules/US/USModel/mitkUSDevicePersistence.h
+++ b/Modules/US/USModel/mitkUSDevicePersistence.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSDevicePersistence_H_HEADER_INCLUDED_
#define MITKUSDevicePersistence_H_HEADER_INCLUDED_
// MITK
#include <mitkCommon.h>
#include <mitkUSVideoDevice.h>
// ITK
#include <itkObjectFactory.h>
// QT
#include <QSettings>
namespace mitk {
/**Documentation
* TODO
*/
class USDevicePersistence : public itk::Object
{
public:
- mitkClassMacro(USDevicePersistence, itk::Object);
+ mitkClassMacroItkParent(USDevicePersistence, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
void StoreCurrentDevices();
std::vector<mitk::USDevice::Pointer> RestoreLastDevices();
protected:
USDevicePersistence();
virtual ~USDevicePersistence(){}
QString USVideoDeviceToString(mitk::USVideoDevice::Pointer d);
mitk::USVideoDevice::Pointer StringToUSVideoDevice(QString s);
QSettings m_devices;
void split(std::string& text, std::string& separators, std::vector<std::string>& words);
};
} // namespace mitk
#endif
diff --git a/Modules/US/USModel/mitkUSImageMetadata.h b/Modules/US/USModel/mitkUSImageMetadata.h
index 8e8e24179f..5b8cda448f 100644
--- a/Modules/US/USModel/mitkUSImageMetadata.h
+++ b/Modules/US/USModel/mitkUSImageMetadata.h
@@ -1,90 +1,90 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSIMAGEMETADATA_H_HEADER_INCLUDED_
#define MITKUSIMAGEMETADATA_H_HEADER_INCLUDED_
#include <MitkUSExports.h>
#include <mitkCommon.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk {
/**Documentation
* \brief This class encapsulates all necessary metadata to describe a US Image.
* \ingroup US
*
* \deprecated Deprecated since 2014-06
*/
class MITKUS_EXPORT USImageMetadata : public itk::Object
{
public:
- mitkClassMacro(USImageMetadata, itk::Object);
+ mitkClassMacroItkParent(USImageMetadata, itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
//## getter and setter ##
itkGetMacro(DeviceManufacturer, std::string);
itkSetMacro(DeviceManufacturer, std::string);
itkGetMacro(DeviceModel, std::string);
itkSetMacro(DeviceModel, std::string);
itkGetMacro(DeviceComment, std::string);
itkSetMacro(DeviceComment, std::string);
itkGetMacro(ProbeName, std::string);
itkSetMacro(ProbeName, std::string);
itkGetMacro(ProbeFrequency, std::string);
itkSetMacro(ProbeFrequency, std::string);
itkGetMacro(Zoom, std::string);
itkSetMacro(Zoom, std::string);
itkGetMacro(DeviceIsVideoOnly, bool);
itkSetMacro(DeviceIsVideoOnly, bool);
itkGetMacro(DeviceIsCalibrated, bool);
itkSetMacro(DeviceIsCalibrated, bool);
itkGetMacro(DeviceClass, std::string);
itkSetMacro(DeviceClass, std::string);
// The following constants define how metadata is written to and read from an mitk image
// when defining new properties, add them here, define them in the cpp, and add them to
// USImage's getMetadata and setMetadata methods as well
static const char* PROP_DEV_MANUFACTURER;
static const char* PROP_DEV_MODEL;
static const char* PROP_DEV_COMMENT;
static const char* PROP_DEV_ISVIDEOONLY;
static const char* PROP_DEV_ISCALIBRATED;
static const char* PROP_PROBE_NAME;
static const char* PROP_PROBE_FREQUENCY;
static const char* PROP_ZOOM;
static const char* PROP_DEVICE_CLASS;
protected:
/**
* \brief Creates a new metadata object with all fields set to default values.
*/
USImageMetadata();
virtual ~USImageMetadata();
std::string m_DeviceManufacturer;
std::string m_DeviceModel;
std::string m_DeviceComment;
std::string m_ProbeName;
std::string m_ProbeFrequency;
std::string m_Zoom;
std::string m_DeviceClass;
bool m_DeviceIsVideoOnly;
bool m_DeviceIsCalibrated;
};
} // namespace mitk
#endif
diff --git a/Modules/US/USModel/mitkUSProbe.h b/Modules/US/USModel/mitkUSProbe.h
index 3ee3e966e5..27d77baaad 100644
--- a/Modules/US/USModel/mitkUSProbe.h
+++ b/Modules/US/USModel/mitkUSProbe.h
@@ -1,66 +1,66 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKUSProbe_H_HEADER_INCLUDED_
#define MITKUSProbe_H_HEADER_INCLUDED_
#include <MitkUSExports.h>
#include <mitkCommon.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk {
/**Documentation
* \brief Right now, the US Probe is only a fancy name for a string. Later, it could handle probe specific parameters
* like the current frequency etc. It is able to compare itself to other probes for device managment though.
*
* \ingroup US
*/
//Be sure to check the isEqualTo() method if you expand this class to see if it needs work!
class MITKUS_EXPORT USProbe : public itk::Object
{
public:
- mitkClassMacro(USProbe,itk::Object);
+ mitkClassMacroItkParent(USProbe,itk::Object);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
mitkNewMacro1Param(Self, std::string);
/**
* \brief Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONLY
* be sure to sufficiently extend this method along with further capabilities probes.
*/
bool IsEqualToProbe(mitk::USProbe::Pointer probe);
//## getter and setter ##
itkGetMacro(Name, std::string);
itkSetMacro(Name, std::string);
protected:
USProbe();
USProbe(std::string identifier);
virtual ~USProbe();
std::string m_Name;
};
} // namespace mitk
#endif
diff --git a/Modules/VtkShaders/src/mitkVtkShaderProgram.h b/Modules/VtkShaders/src/mitkVtkShaderProgram.h
index bbdedb9fca..4d2215a17c 100644
--- a/Modules/VtkShaders/src/mitkVtkShaderProgram.h
+++ b/Modules/VtkShaders/src/mitkVtkShaderProgram.h
@@ -1,62 +1,62 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKVTKSHADERPROGRAM_H_
#define _MITKVTKSHADERPROGRAM_H_
#include <mitkIShaderRepository.h>
#include <vtkShaderProgram2.h>
#include <vtkSmartPointer.h>
namespace mitk {
/**
* \brief SHADERTODO
*/
class VtkShaderProgram : public IShaderRepository::ShaderProgram
{
public:
mitkClassMacro( VtkShaderProgram, IShaderRepository::ShaderProgram )
itkFactorylessNewMacro( Self )
/**
* Constructor
*/
VtkShaderProgram();
/**
* Destructor
*/
virtual ~VtkShaderProgram();
- virtual void Activate();
- virtual void Deactivate();
+ virtual void Activate() override;
+ virtual void Deactivate() override;
void SetVtkShaderProgram(vtkSmartPointer<vtkShaderProgram2> p);
vtkSmartPointer<vtkShaderProgram2> GetVtkShaderProgram() const;
itk::TimeStamp& GetShaderTimestampUpdate();
private:
vtkSmartPointer<vtkShaderProgram2> m_VtkShaderProgram;
itk::TimeStamp m_ShaderTimestampUpdate;
};
} //end of namespace mitk
#endif
diff --git a/Modules/VtkShaders/src/mitkVtkShaderRepository.h b/Modules/VtkShaders/src/mitkVtkShaderRepository.h
index a8ac7f456c..09bb99f8b0 100644
--- a/Modules/VtkShaders/src/mitkVtkShaderRepository.h
+++ b/Modules/VtkShaders/src/mitkVtkShaderRepository.h
@@ -1,175 +1,175 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITKVTKSHADERREPOSITORY_H_
#define _MITKVTKSHADERREPOSITORY_H_
#include "mitkIShaderRepository.h"
#include <vtkShaderProgram2.h>
#include <vtkXMLShader.h>
class vtkXMLDataElement;
class vtkXMLMaterial;
class vtkProperty;
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 VtkShaderRepository : public IShaderRepository
{
protected:
class Shader : public IShaderRepository::Shader
{
public:
- mitkClassMacro( Shader, itk::Object )
+ mitkClassMacro( Shader, IShaderRepository::Shader )
itkFactorylessNewMacro( Self )
class Uniform : public itk::Object
{
public:
- mitkClassMacro( Uniform, itk::Object )
+ mitkClassMacroItkParent( Uniform, itk::Object )
itkFactorylessNewMacro( 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<Uniform::Pointer> uniforms;
/**
* Constructor
*/
Shader();
/**
* Destructor
*/
~Shader();
void SetVertexShaderCode(const std::string& code);
std::string GetVertexShaderCode() const;
void SetFragmentShaderCode(const std::string& code);
std::string GetFragmentShaderCode() const;
void SetGeometryShaderCode(const std::string& code);
std::string GetGeometryShaderCode() const;
std::list<Uniform::Pointer> GetUniforms() const;
private:
friend class VtkShaderRepository;
std::string m_VertexShaderCode;
std::string m_FragmentShaderCode;
std::string m_GeometryShaderCode;
void LoadXmlShader(std::istream& stream);
};
void LoadShaders();
Shader::Pointer GetShaderImpl(const std::string& name) const;
private:
std::list<Shader::Pointer> shaders;
static int shaderId;
static const bool debug;
public:
/**
* Constructor
*/
VtkShaderRepository();
/**
* Destructor
*/
~VtkShaderRepository();
- ShaderProgram::Pointer CreateShaderProgram();
+ ShaderProgram::Pointer CreateShaderProgram() override;
- std::list<IShaderRepository::Shader::Pointer> GetShaders() const;
+ std::list<IShaderRepository::Shader::Pointer> GetShaders() const override;
- IShaderRepository::Shader::Pointer GetShader(const std::string& name) const;
+ IShaderRepository::Shader::Pointer GetShader(const std::string& name) const override;
- IShaderRepository::Shader::Pointer GetShader(int id) const;
+ IShaderRepository::Shader::Pointer GetShader(int id) const override;
/** \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) const;
+ void AddDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite) const override;
/** \brief Applies shader and shader specific variables of the specified DataNode
* to the VTK object by updating the shader variables of its vtkProperty.
*/
- int LoadShader(std::istream& stream, const std::string& name);
+ int LoadShader(std::istream& stream, const std::string& name) override;
- bool UnloadShader(int id);
+ bool UnloadShader(int id) override;
void UpdateShaderProgram(mitk::IShaderRepository::ShaderProgram* shaderProgram,
- DataNode* node, BaseRenderer* renderer) const;
+ DataNode* node, BaseRenderer* renderer) const override;
};
} //end of namespace mitk
#endif
diff --git a/Modules/VtkShaders/src/mitkVtkShadersActivator.cpp b/Modules/VtkShaders/src/mitkVtkShadersActivator.cpp
index 61f76d33b3..fd209cbb69 100644
--- a/Modules/VtkShaders/src/mitkVtkShadersActivator.cpp
+++ b/Modules/VtkShaders/src/mitkVtkShadersActivator.cpp
@@ -1,59 +1,59 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include <mitkVtkShaderRepository.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include <usModuleEvent.h>
#include <usModule.h>
#include <usModuleResource.h>
#include <usModuleResourceStream.h>
#include <memory>
namespace mitk
{
class VtkShadersActivator : public us::ModuleActivator
{
public:
VtkShadersActivator()
{
}
~VtkShadersActivator()
{
}
- void Load(us::ModuleContext* context)
+ void Load(us::ModuleContext* context) override
{
m_VtkShaderRepository.reset(new VtkShaderRepository);
context->RegisterService<IShaderRepository>(m_VtkShaderRepository.get());
}
- void Unload(us::ModuleContext*)
+ void Unload(us::ModuleContext*) override
{
m_VtkShaderRepository.reset(NULL);
}
private:
VtkShadersActivator(const VtkShadersActivator&);
VtkShadersActivator& operator=(const VtkShadersActivator&);
std::auto_ptr<VtkShaderRepository> m_VtkShaderRepository;
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::VtkShadersActivator)
diff --git a/Modules/VtkShaders/src/vtkXMLMaterial.h b/Modules/VtkShaders/src/vtkXMLMaterial.h
index b561c09d7b..7f921d501b 100644
--- a/Modules/VtkShaders/src/vtkXMLMaterial.h
+++ b/Modules/VtkShaders/src/vtkXMLMaterial.h
@@ -1,122 +1,122 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*=========================================================================
Program: Visualization Toolkit
Module: vtkXMLMaterial.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkXMLMaterial - encapsulates a VTK Material description.
// .SECTION Description
// vtkXMLMaterial encapsulates VTK Material description. It keeps a pointer
// to vtkXMLDataElement that defines the material and provides
// access to Shaders/Properties defined in it.
// .SECTION Thanks
// Shader support in VTK includes key contributions by Gary Templet at
// Sandia National Labs.
#ifndef __vtkXMLMaterial_h
#define __vtkXMLMaterial_h
#include "vtkRenderingCoreModule.h" // For export macro
#include "vtkObject.h"
class vtkXMLDataElement;
class vtkXMLMaterialInternals;
class vtkXMLShader;
class vtkXMLMaterial : public vtkObject
{
public:
static vtkXMLMaterial* New();
vtkTypeMacro(vtkXMLMaterial, vtkObject);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description:
// Create a new instance. It searches for the material
// using the following order: first, check the MaterialLibrary; second,
// treat the name as an absolute path and try to locate it; third,
// search the Material repository. Returns null is it fails to
// locate the material.
static vtkXMLMaterial* CreateInstance(const char* name);
// Description:
// Get number of elements of type Property.
int GetNumberOfProperties();
// Description:
// Get number of elements of type Texture.
int GetNumberOfTextures();
// Description:
// Get number of Vertex shaders.
int GetNumberOfVertexShaders();
// Description:
// Get number of fragment shaders.
int GetNumberOfFragmentShaders();
int GetNumberOfGeometryShaders();
// Description:
// Get the ith vtkXMLDataElement of type <Property />.
vtkXMLDataElement* GetProperty(int id=0);
// Description:
// Get the ith vtkXMLDataElement of type <Texture />.
vtkXMLDataElement* GetTexture(int id=0);
// Description:
// Get the ith vtkXMLDataElement of type <VertexShader />.
vtkXMLShader* GetVertexShader(int id=0);
// Description:
// Get the ith vtkXMLDataElement of type <FragmentShader />.
vtkXMLShader* GetFragmentShader(int id=0);
vtkXMLShader* GetGeometryShader(int id=0);
// Description:
// Get/Set the XML root element that describes this material.
vtkGetObjectMacro(RootElement, vtkXMLDataElement);
void SetRootElement(vtkXMLDataElement*);
// Description:
// Get the style the shaders.
// \post valid_result: result==1 || result==2
int GetShaderStyle();
protected:
vtkXMLMaterial();
~vtkXMLMaterial();
vtkXMLDataElement* RootElement;
vtkXMLMaterialInternals* Internals;
private:
vtkXMLMaterial(const vtkXMLMaterial&); // Not implemented.
void operator=(const vtkXMLMaterial&); // Not implemented.
};
#endif
diff --git a/Modules/VtkShaders/src/vtkXMLMaterialParser.h b/Modules/VtkShaders/src/vtkXMLMaterialParser.h
index 8975f4b0ea..920bd10842 100644
--- a/Modules/VtkShaders/src/vtkXMLMaterialParser.h
+++ b/Modules/VtkShaders/src/vtkXMLMaterialParser.h
@@ -1,139 +1,139 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*=========================================================================
Program: Visualization Toolkit
Module: vtkXMLMaterialParser.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
* Copyright 2004 Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the
* U.S. Government. Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that this Notice and any
* statement of authorship are reproduced on all copies.
*/
// .NAME vtkXMLMaterialParser - Parses VTK Material file
//
// .SECTION Description
// vtkXMLMaterialParser parses a VTK Material file and provides that file's
// description of a number of vertex and fragment shaders along with data
// values specified for data members of vtkProperty. This material is to be
// applied to an actor through it's vtkProperty and augments VTK's concept
// of a vtkProperty to include explicitly include vertex and fragment shaders
// and parameter settings for those shaders. This effectively makes reflectance
// models and other shaders a material property. If no shaders are specified
// VTK should default to standard rendering.
//
// .SECTION Design
// vtkXMLMaterialParser provides access to 3 distinct types of first-level
// vtkXMLDataElements that describe a VTK material. These elements are as
// follows:
//
// vtkProperty - describe values for vtkProperty data members
//
// vtkVertexShader - a vertex shader and enough information to
// install it into the hardware rendering pipeline including values for
// specific shader parameters and structures.
//
// vtkFragmentShader - a fragment shader and enough information to
// install it into the hardware rendering pipeline including values for
// specific shader parameters and structures.
//
// The design of the material file closely follows that of vtk's xml
// descriptions of it's data sets. This allows use of the very handy
// vtkXMLDataElement which provides easy access to an xml element's
// attribute values. Inlined data is currently not handled.
//
// Ideally this class would be a Facade to a DOM parser, but VTK only
// provides access to expat, a SAX parser. Other vtk classes that parse
// xml files are tuned to read vtkDataSets and don't provide the functionality
// to handle generic xml data. As such they are of little use here.
//
// This class may be extended for better data handling or may become a
// Facade to a DOM parser should on become part of the VTK code base.
// .SECTION Thanks
// Shader support in VTK includes key contributions by Gary Templet at
// Sandia National Labs.
#ifndef __vtkXMLMaterialParser_h
#define __vtkXMLMaterialParser_h
#include "vtkRenderingCoreModule.h" // For export macro
#include "vtkXMLParser.h"
class vtkXMLMaterial;
class vtkXMLMaterialParserInternals;
class vtkXMLMaterialParser : public vtkXMLParser
{
public:
static vtkXMLMaterialParser *New();
vtkTypeMacro(vtkXMLMaterialParser,vtkXMLParser);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description:
// Set/Get the vtkXMLMaterial representation of the parsed material.
vtkGetObjectMacro(Material, vtkXMLMaterial);
void SetMaterial(vtkXMLMaterial*);
// Description:
// Overridden to initialize the internal structures before
// the parsing begins.
- virtual int Parse();
- virtual int Parse(const char* inputString);
- virtual int Parse(const char* inputString, unsigned int length);
+ virtual int Parse() override;
+ virtual int Parse(const char* inputString) override;
+ virtual int Parse(const char* inputString, unsigned int length) override;
// Description:
// Overridden to clean up internal structures before the chunk-parsing
// begins.
- virtual int InitializeParser();
+ virtual int InitializeParser() override;
protected:
vtkXMLMaterialParser();
~vtkXMLMaterialParser();
// Description:
// Event for handling the start of an element
- virtual void StartElement(const char* name, const char** atts);
+ virtual void StartElement(const char* name, const char** atts) override;
// Description:
// Event for handling the end of an element
- virtual void EndElement(const char*);
+ virtual void EndElement(const char*) override;
// Description:
// Handle character data, not yet implemented
- virtual void CharacterDataHandler( const char* data, int length );
+ virtual void CharacterDataHandler( const char* data, int length ) override;
vtkXMLMaterial* Material;
vtkXMLMaterialParserInternals* Internals;
private:
vtkXMLMaterialParser(const vtkXMLMaterialParser&); // Not implemented
void operator=(const vtkXMLMaterialParser&); // Not implemented
};
#endif
diff --git a/Modules/VtkShaders/src/vtkXMLShader.h b/Modules/VtkShaders/src/vtkXMLShader.h
index 5dcfa4d0e9..b112f23f58 100644
--- a/Modules/VtkShaders/src/vtkXMLShader.h
+++ b/Modules/VtkShaders/src/vtkXMLShader.h
@@ -1,129 +1,129 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
/*=========================================================================
Program: Visualization Toolkit
Module: vtkXMLShader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkXMLShader - encapsulates a Shader XML description.
// .SECTION Description
// vtkXMLShader encapsulates the XML description for a Shader.
// It provides convenient access to various attributes/properties
// of a shader.
// .SECTION Thanks
// Shader support in VTK includes key contributions by Gary Templet at
// Sandia National Labs.
#ifndef __vtkXMLShader_h
#define __vtkXMLShader_h
#include "vtkRenderingCoreModule.h" // For export macro
#include "vtkObject.h"
class vtkXMLDataElement;
class vtkXMLShader : public vtkObject
{
public:
static vtkXMLShader* New();
vtkTypeMacro(vtkXMLShader, vtkObject);
- void PrintSelf(ostream& os, vtkIndent indent);
+ void PrintSelf(ostream& os, vtkIndent indent) override;
// Description:
// Get/Set the XML root element that describes this shader.
vtkGetObjectMacro(RootElement, vtkXMLDataElement);
void SetRootElement(vtkXMLDataElement*);
// Description:
// Returns the type of the shader as defined in the XML description.
int GetScope();
// Description:
// Returns the style of the shader as optionaly defined in the XML
// description. If not present, default style is 1. "style=2" means it is
// a shader without a main(). In style 2, the "main" function for the vertex
// shader part is void propFuncVS(void), the main function for the fragment
// shader part is void propFuncFS(). This is useful when combining a shader
// at the actor level and a shader defines at the renderer level, like
// the depth peeling pass.
// \post valid_result: result==1 || result==2
int GetStyle();
// Description:
// Get the name of the Shader.
const char* GetName();
// Description:
// Get the entry point to the shader code as defined in the XML.
const char* GetEntry();
// Description:
// Get the shader code.
const char* GetCode();
// Description:
// Returns an null terminate array of the pointers to space sepatared Args
// defined in the XML description.
const char** GetArgs();
// Description:
// Searches the file in the VTK_MATERIALS_DIRS.
// Note that this allocates new memory for the string.
// The caller must delete it.
static char* LocateFile(const char* filename);
//BTX
enum ScopeCodes
{
SCOPE_NONE=0,
SCOPE_MIXED,
SCOPE_VERTEX,
SCOPE_FRAGMENT,
SCOPE_GEOMETRY
};
//ETX
protected:
vtkXMLShader();
~vtkXMLShader();
char* Code; // cache for the code.
vtkSetStringMacro(Code);
vtkXMLDataElement* RootElement;
vtkXMLDataElement* SourceLibraryElement;
void SetSourceLibraryElement(vtkXMLDataElement*);
char** Args;
void CleanupArgs();
private:
vtkXMLShader(const vtkXMLShader&); // Not implemented.
void operator=(const vtkXMLShader&); // Not implemented.
};
#endif
diff --git a/Modules/XNAT/include/mitkXnatSessionTracker.h b/Modules/XNAT/include/mitkXnatSessionTracker.h
index e0f8ca6692..6f364c93df 100644
--- a/Modules/XNAT/include/mitkXnatSessionTracker.h
+++ b/Modules/XNAT/include/mitkXnatSessionTracker.h
@@ -1,54 +1,54 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef MITKXNATSESSIONTRACKER_H
#define MITKXNATSESSIONTRACKER_H
#include "usServiceTracker.h"
#include "MitkXNATExports.h"
#include "mitkXnatSession.h"
namespace mitk {
class MITKXNAT_EXPORT XnatSessionTracker : public QObject, public us::ServiceTracker<ctkXnatSession>
{
Q_OBJECT
public:
XnatSessionTracker(us::ModuleContext* context);
signals:
void Opened(ctkXnatSession*);
void AboutToBeClosed(ctkXnatSession*);
private:
typedef us::ServiceTracker<ctkXnatSession> Superclass;
us::ModuleContext* m_Context;
- virtual TrackedType AddingService(const ServiceReferenceType &reference);
- virtual void RemovedService(const ServiceReferenceType& reference, TrackedType tracked);
+ virtual TrackedType AddingService(const ServiceReferenceType &reference) override;
+ virtual void RemovedService(const ServiceReferenceType& reference, TrackedType tracked) override;
private slots:
void SessionOpened();
void SessionAboutToBeClosed();
};
} // end of namespace mitk
#endif // MITKXNATSESSIONTRACKER_H
diff --git a/Utilities/mbilog/mbilogBackendCout.h b/Utilities/mbilog/mbilogBackendCout.h
index d76beccb5f..f4697f6bf7 100644
--- a/Utilities/mbilog/mbilogBackendCout.h
+++ b/Utilities/mbilog/mbilogBackendCout.h
@@ -1,68 +1,68 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _mbilogBackendCout_H
#define _mbilogBackendCout_H
#include <iostream>
#include "mbilogExports.h"
#include "mbilogTextBackendBase.h"
#include "mbilogLogMessage.h"
#include "mbilogLoggingTypes.h"
namespace mbilog{
/**
* \brief Default backend of the mbi logging mechanism. This backend is used if no other backend is registered.
* The backend formats the logging messages to a normal string and writes them to std::cout.
* \ingroup mbilog
*/
class MBILOG_EXPORT BackendCout : public TextBackendBase
{
public:
BackendCout();
virtual ~BackendCout();
/** \brief This method is called by the mbi logging mechanism if the object is registered in
* the mbi logging mechanism and a logging message is emitted. The method formats the
* logging messages to a normal string (depending on formatting mode) and writes it to std::cout.
*
* \param logMessage Logging message.
*/
- virtual void ProcessMessage(const mbilog::LogMessage &l );
+ virtual void ProcessMessage(const mbilog::LogMessage &l ) override;
/** \brief Sets the formatting mode. If true long messages will be displayed. Default is false (short/smart messages).
* Long messages provide all informations and are also capable to be postproccessed (e.g. in a web viewer).
*/
void SetFull(bool full);
- virtual OutputType GetOutputType() const;
+ virtual OutputType GetOutputType() const override;
private:
/** \brief The formatting mode of this backend. True is full/long message formatting mode. False is short/smart
* message formatting mode
*/
bool m_useFullOutput;
};
}
#endif

File Metadata

Mime Type
application/octet-stream
Expires
Tue, Oct 8, 6:21 PM (1 d, 21 h)
Storage Engine
chunks
Storage Format
Chunks
Storage Handle
SIn5kESfg0hW
Default Alt Text
(4 MB)

Event Timeline