diff --git a/Modules/MitkAlgorithmsExt/CMakeLists.txt b/Modules/MitkAlgorithmsExt/CMakeLists.txt index 489d42de55..f340741922 100644 --- a/Modules/MitkAlgorithmsExt/CMakeLists.txt +++ b/Modules/MitkAlgorithmsExt/CMakeLists.txt @@ -1,9 +1,10 @@ MITK_CREATE_MODULE(MitkAlgorithmsExt DEPENDS MitkDataTypesExt + PACKAGE_DEPENDS ANN WARNINGS_AS_ERRORS ) if(BUILD_TESTING) add_subdirectory(Testing) endif() diff --git a/Modules/MitkAlgorithmsExt/Testing/CMakeLists.txt b/Modules/MitkAlgorithmsExt/Testing/CMakeLists.txt index 153cd81e2e..6a6d9d417f 100644 --- a/Modules/MitkAlgorithmsExt/Testing/CMakeLists.txt +++ b/Modules/MitkAlgorithmsExt/Testing/CMakeLists.txt @@ -1 +1,3 @@ MITK_CREATE_MODULE_TESTS() + +mitkAddCustomModuleTest(mitkLabeledImageToSurfaceFilterTest_BinaryBall mitkLabeledImageToSurfaceFilterTest ${MITK_DATA_DIR}/BallBinary30x30x30.pic.gz) diff --git a/Modules/MitkAlgorithmsExt/Testing/files.cmake b/Modules/MitkAlgorithmsExt/Testing/files.cmake index 55d8b7cd5a..9a9b325349 100644 --- a/Modules/MitkAlgorithmsExt/Testing/files.cmake +++ b/Modules/MitkAlgorithmsExt/Testing/files.cmake @@ -1,6 +1,9 @@ set(MODULE_TESTS mitkAutoCropImageFilterTest.cpp mitkBoundingObjectCutterTest.cpp mitkSimpleHistogramTest.cpp ) +set(MODULE_CUSTOM_TESTS + mitkLabeledImageToSurfaceFilterTest.cpp +) diff --git a/Modules/MitkExt/Testing/mitkLabeledImageToSurfaceFilterTest.cpp b/Modules/MitkAlgorithmsExt/Testing/mitkLabeledImageToSurfaceFilterTest.cpp similarity index 100% rename from Modules/MitkExt/Testing/mitkLabeledImageToSurfaceFilterTest.cpp rename to Modules/MitkAlgorithmsExt/Testing/mitkLabeledImageToSurfaceFilterTest.cpp diff --git a/Modules/MitkAlgorithmsExt/files.cmake b/Modules/MitkAlgorithmsExt/files.cmake index 3c38c376f1..a55ffaf480 100644 --- a/Modules/MitkAlgorithmsExt/files.cmake +++ b/Modules/MitkAlgorithmsExt/files.cmake @@ -1,20 +1,24 @@ set(CPP_FILES mitkAutoCropImageFilter.cpp mitkBoundingObjectCutter.cpp mitkBoundingObjectToSegmentationFilter.cpp + mitkGeometryClipImageFilter.cpp mitkHeightFieldSurfaceClipImageFilter.cpp + mitkLabeledImageToSurfaceFilter.cpp mitkMaskAndCutRoiImageFilter.cpp mitkMaskImageFilter.cpp mitkMovieGenerator.cpp mitkNonBlockingAlgorithm.cpp mitkPadImageFilter.cpp + mitkPlaneLandmarkProjector.cpp + mitkPointLocator.cpp mitkSimpleHistogram.cpp mitkSimpleUnstructuredGridHistogram.cpp ) if(WIN32 AND NOT MINGW) list(APPEND CPP_FILES mitkMovieGeneratorWin32.cpp ) endif() diff --git a/Modules/MitkExt/Algorithms/mitkGeometryClipImageFilter.cpp b/Modules/MitkAlgorithmsExt/mitkGeometryClipImageFilter.cpp similarity index 100% rename from Modules/MitkExt/Algorithms/mitkGeometryClipImageFilter.cpp rename to Modules/MitkAlgorithmsExt/mitkGeometryClipImageFilter.cpp diff --git a/Modules/MitkExt/Algorithms/mitkGeometryClipImageFilter.h b/Modules/MitkAlgorithmsExt/mitkGeometryClipImageFilter.h similarity index 97% rename from Modules/MitkExt/Algorithms/mitkGeometryClipImageFilter.h rename to Modules/MitkAlgorithmsExt/mitkGeometryClipImageFilter.h index cb8eecb492..e938841c0e 100644 --- a/Modules/MitkExt/Algorithms/mitkGeometryClipImageFilter.h +++ b/Modules/MitkAlgorithmsExt/mitkGeometryClipImageFilter.h @@ -1,182 +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 MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22 #define MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22 #include "mitkCommon.h" -#include "MitkExtExports.h" +#include "MitkAlgorithmsExtExports.h" #include "mitkImageToImageFilter.h" #include "mitkImageTimeSelector.h" #include "mitkGeometryData.h" namespace itk { template class ITK_EXPORT Image; } namespace mitk { //##Documentation //## @brief Filter for clipping an image with a Geometry2D //## //## The given geometry for clipping can be either a Geometry2D //## or a TimeGeometry containing multiple instances //## of Geometry2D //## //## \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 MitkExt_EXPORT GeometryClipImageFilter : public ImageToImageFilter +class MitkAlgorithmsExt_EXPORT GeometryClipImageFilter : public ImageToImageFilter { public: mitkClassMacro(GeometryClipImageFilter, ImageToImageFilter); itkNewMacro(Self); /** * Set the geometry to be used for clipping * * The given geometry for clipping must be a Geometry2D. */ void SetClippingGeometry(const mitk::Geometry3D* aClippingGeometry); /** * Set the geometry to be used for clipping * * The given geometry for clipping must a * TimeGeometry containing multiple instances * of Geometry2D */ void SetClippingGeometry(const mitk::TimeGeometry* aClippingGeometry); const mitk::Geometry3D* 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 GenerateOutputInformation(); virtual void GenerateData(); template < typename TPixel, unsigned int VImageDimension > friend void _InternalComputeClippedImage(itk::Image* itkImage, mitk::GeometryClipImageFilter* geometryClipper, const mitk::Geometry2D* clippingGeometry2D); mitk::Geometry3D::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/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp b/Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.cpp similarity index 99% rename from Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp rename to Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.cpp index c0999a0aaa..abeee6c26b 100644 --- a/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.cpp +++ b/Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.cpp @@ -1,364 +1,362 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include mitk::LabeledImageToSurfaceFilter::LabeledImageToSurfaceFilter() : m_GaussianStandardDeviation(1.5), m_GenerateAllLabels(true), m_Label(1), m_BackgroundLabel(0) { } mitk::LabeledImageToSurfaceFilter::~LabeledImageToSurfaceFilter() { } void mitk::LabeledImageToSurfaceFilter::GenerateOutputInformation() { Superclass::GenerateOutputInformation(); // // check which labels are available in the image // m_AvailableLabels = this->GetAvailableLabels(); m_IdxToLabels.clear(); // // if we don't want to generate surfaces for all labels // we have to remove all labels except m_Label and m_BackgroundLabel // from the list of available labels // if ( ! m_GenerateAllLabels ) { LabelMapType tmp; LabelMapType::iterator it; it = m_AvailableLabels.find( m_Label ); if ( it != m_AvailableLabels.end() ) tmp[m_Label] = it->second; else tmp[m_Label] = 0; it = m_AvailableLabels.find( m_BackgroundLabel ); if ( it != m_AvailableLabels.end() ) tmp[m_BackgroundLabel] = it->second; else tmp[m_BackgroundLabel] = 0; m_AvailableLabels = tmp; } // // check for the number of labels: if the whole image is filled, no // background is available and thus the numberOfOutpus is equal to the // number of available labels in the image (which is a special case). // If we have background voxels, the number of outputs is one less than // then number of available labels. // unsigned int numberOfOutputs = 0; if ( m_AvailableLabels.find( m_BackgroundLabel ) == m_AvailableLabels.end() ) numberOfOutputs = m_AvailableLabels.size(); else numberOfOutputs = m_AvailableLabels.size() - 1; if ( numberOfOutputs == 0 ) { itkWarningMacro("Number of outputs == 0"); } // // determine the number of time steps of the input image // mitk::Image* image = ( mitk::Image* )GetInput(); unsigned int numberOfTimeSteps = image->GetTimeGeometry()->CountTimeSteps(); // // set the number of outputs to the number of labels used. // initialize the output surfaces accordingly (incl. time steps) // this->SetNumberOfIndexedOutputs( numberOfOutputs ); this->SetNumberOfRequiredOutputs( numberOfOutputs ); for ( unsigned int i = 0 ; i < numberOfOutputs; ++i ) { if ( ! this->GetOutput( i ) ) { mitk::Surface::Pointer output = static_cast( this->MakeOutput(0).GetPointer() ); assert ( output.IsNotNull() ); output->Expand( numberOfTimeSteps ); this->SetNthOutput( i, output.GetPointer() ); } } } void mitk::LabeledImageToSurfaceFilter::GenerateData() { mitk::Image* image = ( mitk::Image* )GetInput(); if ( image == NULL ) { itkWarningMacro("Image is NULL"); return; } mitk::Image::RegionType outputRegion = image->GetRequestedRegion(); m_IdxToLabels.clear(); if ( this->GetNumberOfOutputs() == 0 ) return; // // traverse the known labels and create surfaces for them. // unsigned int currentOutputIndex = 0; for ( LabelMapType::iterator it = m_AvailableLabels.begin() ; it != m_AvailableLabels.end() ; ++it ) { if ( it->first == m_BackgroundLabel ) continue; if ( ( it->second == 0 ) && m_GenerateAllLabels ) continue; assert ( currentOutputIndex < this->GetNumberOfOutputs() ); mitk::Surface::Pointer surface = this->GetOutput( currentOutputIndex ); assert( surface.IsNotNull() ); int tstart=outputRegion.GetIndex(3); int tmax=tstart+outputRegion.GetSize(3); //GetSize()==1 - will aber 0 haben, wenn nicht zeitaufgeloet int t; for( t=tstart; t < tmax; ++t) { vtkImageData *vtkimagedata = image->GetVtkImageData( t ); CreateSurface( t,vtkimagedata,surface.GetPointer(), it->first ); } m_IdxToLabels[ currentOutputIndex ] = it->first; currentOutputIndex++; } } void mitk::LabeledImageToSurfaceFilter::CreateSurface( int time, vtkImageData *vtkimage, mitk::Surface * surface, mitk::LabeledImageToSurfaceFilter::LabelType label ) { vtkImageChangeInformation *indexCoordinatesImageFilter = vtkImageChangeInformation::New(); indexCoordinatesImageFilter->SetInputData(vtkimage); indexCoordinatesImageFilter->SetOutputOrigin(0.0,0.0,0.0); vtkImageThreshold* threshold = vtkImageThreshold::New(); threshold->SetInputConnection( indexCoordinatesImageFilter->GetOutputPort() ); //indexCoordinatesImageFilter->Delete(); threshold->SetInValue( 100 ); threshold->SetOutValue( 0 ); threshold->ThresholdBetween( label, label ); threshold->SetOutputScalarTypeToUnsignedChar(); threshold->ReleaseDataFlagOn(); vtkImageGaussianSmooth *gaussian = vtkImageGaussianSmooth::New(); gaussian->SetInputConnection( threshold->GetOutputPort() ); //threshold->Delete(); gaussian->SetDimensionality( 3 ); gaussian->SetRadiusFactor( 0.49 ); gaussian->SetStandardDeviation( GetGaussianStandardDeviation() ); gaussian->ReleaseDataFlagOn(); gaussian->UpdateInformation(); gaussian->Update(); //MarchingCube -->create Surface vtkMarchingCubes *skinExtractor = vtkMarchingCubes::New(); skinExtractor->ReleaseDataFlagOn(); skinExtractor->SetInputConnection(gaussian->GetOutputPort());//RC++ indexCoordinatesImageFilter->Delete(); skinExtractor->SetValue(0, 50); vtkPolyData *polydata; skinExtractor->Update(); polydata = skinExtractor->GetOutput(); polydata->Register(NULL);//RC++ skinExtractor->Delete(); if (m_Smooth) { vtkSmoothPolyDataFilter *smoother = vtkSmoothPolyDataFilter::New(); //read poly1 (poly1 can be the original polygon, or the decimated polygon) smoother->SetInputData(polydata);//RC++ smoother->SetNumberOfIterations( m_SmoothIteration ); smoother->SetRelaxationFactor( m_SmoothRelaxation ); smoother->SetFeatureAngle( 60 ); smoother->FeatureEdgeSmoothingOff(); smoother->BoundarySmoothingOff(); smoother->SetConvergence( 0 ); polydata->Delete();//RC-- smoother->Update(); polydata = smoother->GetOutput(); polydata->Register(NULL);//RC++ smoother->Delete(); } //decimate = to reduce number of polygons if(m_Decimate==DecimatePro) { vtkDecimatePro *decimate = vtkDecimatePro::New(); decimate->SplittingOff(); decimate->SetErrorIsAbsolute(5); decimate->SetFeatureAngle(30); decimate->PreserveTopologyOn(); decimate->BoundaryVertexDeletionOff(); decimate->SetDegree(10); //std-value is 25! decimate->SetInputData(polydata);//RC++ decimate->SetTargetReduction(m_TargetReduction); decimate->SetMaximumError(0.002); polydata->Delete();//RC-- decimate->Update(); polydata = decimate->GetOutput(); polydata->Register(NULL);//RC++ decimate->Delete(); } if(polydata->GetNumberOfPoints() > 0) { mitk::Vector3D spacing = GetInput()->GetGeometry(time)->GetSpacing(); vtkPoints * points = polydata->GetPoints(); vtkMatrix4x4 *vtkmatrix = vtkMatrix4x4::New(); GetInput()->GetGeometry(time)->GetVtkTransform()->GetMatrix(vtkmatrix); double (*matrix)[4] = vtkmatrix->Element; unsigned int i,j; for(i=0;i<3;++i) for(j=0;j<3;++j) matrix[i][j]/=spacing[j]; unsigned int n = points->GetNumberOfPoints(); double point[3]; for (i = 0; i < n; i++) { points->GetPoint(i, point); mitkVtkLinearTransformPoint(matrix,point,point); points->SetPoint(i, point); } vtkmatrix->Delete(); } surface->SetVtkPolyData(polydata, time); polydata->UnRegister(NULL); gaussian->Delete(); threshold->Delete(); } template < typename TPixel, unsigned int VImageDimension > void GetAvailableLabelsInternal( itk::Image* image, mitk::LabeledImageToSurfaceFilter::LabelMapType& availableLabels ) { typedef itk::Image ImageType; typedef itk::ImageRegionIterator< ImageType > ImageRegionIteratorType; availableLabels.clear(); ImageRegionIteratorType it( image, image->GetLargestPossibleRegion() ); it.GoToBegin(); mitk::LabeledImageToSurfaceFilter::LabelMapType::iterator labelIt; while( ! it.IsAtEnd() ) { labelIt = availableLabels.find( ( mitk::LabeledImageToSurfaceFilter::LabelType ) ( it.Get() ) ); if ( labelIt == availableLabels.end() ) { availableLabels[ ( mitk::LabeledImageToSurfaceFilter::LabelType ) ( it.Get() ) ] = 1; } else { labelIt->second += 1; } ++it; } } #define InstantiateAccessFunction_GetAvailableLabelsInternal(pixelType, dim) \ template void GetAvailableLabelsInternal(itk::Image*, mitk::LabeledImageToSurfaceFilter::LabelMapType&); InstantiateAccessFunctionForFixedDimension(GetAvailableLabelsInternal, 3); mitk::LabeledImageToSurfaceFilter::LabelMapType mitk::LabeledImageToSurfaceFilter::GetAvailableLabels() { mitk::Image::Pointer image = ( mitk::Image* )GetInput(); LabelMapType availableLabels; AccessFixedDimensionByItk_1( image, GetAvailableLabelsInternal, 3, availableLabels ); return availableLabels; } void mitk::LabeledImageToSurfaceFilter::CreateSurface(int, vtkImageData*, mitk::Surface*, const ScalarType) { itkWarningMacro( "This function should never be called!" ); assert(false); } mitk::LabeledImageToSurfaceFilter::LabelType mitk::LabeledImageToSurfaceFilter::GetLabelForNthOutput( const unsigned int& idx ) { IdxToLabelMapType::iterator it = m_IdxToLabels.find( idx ); if ( it != m_IdxToLabels.end() ) { return it->second; } else { itkWarningMacro( "Unknown index encountered: " << idx << ". There are " << this->GetNumberOfOutputs() << " outputs available." ); return itk::NumericTraits::max(); } } mitk::ScalarType mitk::LabeledImageToSurfaceFilter::GetVolumeForNthOutput( const unsigned int& i ) { return GetVolumeForLabel( GetLabelForNthOutput( i ) ); } mitk::ScalarType mitk::LabeledImageToSurfaceFilter::GetVolumeForLabel( const mitk::LabeledImageToSurfaceFilter::LabelType& label ) { // get the image spacing mitk::Image* image = ( mitk::Image* )GetInput(); const float* spacing = image->GetSlicedGeometry()->GetFloatSpacing(); // get the number of voxels encountered for the given label, // calculate the volume and return it. LabelMapType::iterator it = m_AvailableLabels.find( label ); if ( it != m_AvailableLabels.end() ) { return static_cast(it->second) * ( spacing[0] * spacing[1] * spacing[2] / 1000.0f ); } else { itkWarningMacro( "Unknown label encountered: " << label ); return 0.0; } } - - diff --git a/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.h b/Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.h similarity index 97% rename from Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.h rename to Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.h index 1b923bcf9d..93c851f92f 100644 --- a/Modules/MitkExt/Algorithms/mitkLabeledImageToSurfaceFilter.h +++ b/Modules/MitkAlgorithmsExt/mitkLabeledImageToSurfaceFilter.h @@ -1,174 +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_labeled_image_to_surface_filter__h_ #define _mitk_labeled_image_to_surface_filter__h_ #include -#include "MitkExtExports.h" +#include "MitkAlgorithmsExtExports.h" #include #include 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 MitkExt_EXPORT LabeledImageToSurfaceFilter : public ImageToSurfaceFilter +class MitkAlgorithmsExt_EXPORT LabeledImageToSurfaceFilter : public ImageToSurfaceFilter { public: mitkClassMacro( LabeledImageToSurfaceFilter, ImageToSurfaceFilter ); itkNewMacro( Self ); typedef int LabelType; typedef std::map LabelMapType; typedef std::map 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::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 GenerateOutputInformation(); 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/MitkExt/DataManagement/mitkPlaneLandmarkProjector.cpp b/Modules/MitkAlgorithmsExt/mitkPlaneLandmarkProjector.cpp similarity index 100% rename from Modules/MitkExt/DataManagement/mitkPlaneLandmarkProjector.cpp rename to Modules/MitkAlgorithmsExt/mitkPlaneLandmarkProjector.cpp diff --git a/Modules/MitkExt/DataManagement/mitkPlaneLandmarkProjector.h b/Modules/MitkAlgorithmsExt/mitkPlaneLandmarkProjector.h similarity index 93% rename from Modules/MitkExt/DataManagement/mitkPlaneLandmarkProjector.h rename to Modules/MitkAlgorithmsExt/mitkPlaneLandmarkProjector.h index 2c6ac51ffb..3d6e8882f5 100644 --- a/Modules/MitkExt/DataManagement/mitkPlaneLandmarkProjector.h +++ b/Modules/MitkAlgorithmsExt/mitkPlaneLandmarkProjector.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 MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C #define MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C #include "mitkLandmarkProjector.h" -#include "MitkExtExports.h" +#include "MitkAlgorithmsExtExports.h" #include "mitkPointSet.h" namespace mitk { //##Documentation //## @brief Thin-plate-spline-based landmark-based curved geometry //## //## @ingroup Geometry -class MitkExt_EXPORT PlaneLandmarkProjector : public LandmarkProjector +class MitkAlgorithmsExt_EXPORT PlaneLandmarkProjector : public LandmarkProjector { public: mitkClassMacro(PlaneLandmarkProjector, LandmarkProjector); itkNewMacro(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); protected: PlaneLandmarkProjector(); virtual ~PlaneLandmarkProjector(); virtual void ComputeCompleteAbstractTransform(); mitk::PlaneGeometry::ConstPointer m_ProjectionPlane; }; } // namespace mitk #endif /* MITKPLANELANDMARKPROJECTOR_H_HEADER_INCLUDED_C1C68A2C */ diff --git a/Modules/MitkExt/Algorithms/mitkPointLocator.cpp b/Modules/MitkAlgorithmsExt/mitkPointLocator.cpp similarity index 99% rename from Modules/MitkExt/Algorithms/mitkPointLocator.cpp rename to Modules/MitkAlgorithmsExt/mitkPointLocator.cpp index 7c550fb45a..3932f0e8d3 100644 --- a/Modules/MitkExt/Algorithms/mitkPointLocator.cpp +++ b/Modules/MitkAlgorithmsExt/mitkPointLocator.cpp @@ -1,259 +1,258 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY 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 "mitkPointLocator.h" #include #include mitk::PointLocator::PointLocator() : m_SearchTreeInitialized(false), m_VtkPoints(NULL), m_MitkPoints(NULL), m_ItkPoints(NULL), m_ANNK(1), m_ANNDimension(3), m_ANNEpsilon(0), m_ANNDataPoints(NULL), m_ANNQueryPoint(NULL), m_ANNPointIndexes(NULL), m_ANNDistances(NULL), m_ANNTree(NULL) { } mitk::PointLocator::~PointLocator() { if ( m_SearchTreeInitialized ) DestroyANN(); } void mitk::PointLocator::SetPoints( vtkPointSet* pointSet ) { if ( pointSet == NULL ) { itkWarningMacro("Points are NULL!"); return; } vtkPoints* points = pointSet->GetPoints(); if(m_VtkPoints) { if ( (m_VtkPoints == points) && (m_VtkPoints->GetMTime() == points->GetMTime()) ) { return; //no need to recalculate search tree } } m_VtkPoints = points; size_t size = points->GetNumberOfPoints(); if ( m_ANNDataPoints != NULL ) delete[] m_ANNDataPoints; m_ANNDataPoints = annAllocPts( size, m_ANNDimension ); m_IndexToPointIdContainer.clear(); m_IndexToPointIdContainer.resize( size ); for( vtkIdType i = 0; (unsigned)i < size; ++i ) { double* currentPoint = points->GetPoint( i ); (m_ANNDataPoints[i])[0] = currentPoint[0]; (m_ANNDataPoints[i])[1] = currentPoint[1]; (m_ANNDataPoints[i])[2] = currentPoint[2]; m_IndexToPointIdContainer[i] = i; } InitANN(); } void mitk::PointLocator::SetPoints( mitk::PointSet* points ) { if ( points == NULL ) { itkWarningMacro("Points are NULL!"); return; } if(m_MitkPoints) { if ( (m_MitkPoints == points) && (m_MitkPoints->GetMTime() == points->GetMTime()) ) { return; //no need to recalculate search tree } } m_MitkPoints = points; size_t size = points->GetSize(); if ( m_ANNDataPoints != NULL ) delete[] m_ANNDataPoints; m_ANNDataPoints = annAllocPts( size, m_ANNDimension ); m_IndexToPointIdContainer.clear(); m_IndexToPointIdContainer.resize( size ); size_t counter = 0; mitk::PointSet::PointsContainer* pointsContainer = points->GetPointSet()->GetPoints(); mitk::PointSet::PointsContainer::Iterator it; mitk::PointSet::PointType currentPoint; mitk::PointSet::PointsContainer::ElementIdentifier currentId; for( it = pointsContainer->Begin(); it != pointsContainer->End(); ++it, ++counter ) { currentPoint = it->Value(); currentId = it->Index(); (m_ANNDataPoints[counter])[0] = currentPoint[0]; (m_ANNDataPoints[counter])[1] = currentPoint[1]; (m_ANNDataPoints[counter])[2] = currentPoint[2]; m_IndexToPointIdContainer[counter] = currentId; } InitANN(); } void mitk::PointLocator::SetPoints( ITKPointSet* pointSet ) { if ( pointSet == NULL ) { itkWarningMacro("Points are NULL!"); return; } if(m_ItkPoints) { if ( (m_ItkPoints == pointSet) && (m_ItkPoints->GetMTime() == pointSet->GetMTime()) ) { return; //no need to recalculate search tree } } m_ItkPoints = pointSet; size_t size = pointSet->GetNumberOfPoints(); if ( m_ANNDataPoints != NULL ) delete[] m_ANNDataPoints; m_ANNDataPoints = annAllocPts( size, m_ANNDimension ); m_IndexToPointIdContainer.clear(); m_IndexToPointIdContainer.resize( size ); size_t counter = 0; ITKPointSet::PointsContainerConstPointer pointsContainer = pointSet->GetPoints(); ITKPointSet::PointsContainer::ConstIterator it; ITKPointSet::PointType currentPoint; ITKPointSet::PointsContainer::ElementIdentifier currentId; for( it = pointsContainer->Begin(); it != pointsContainer->End(); ++it, ++counter ) { currentPoint = it->Value(); currentId = it->Index(); (m_ANNDataPoints[counter])[0] = currentPoint[0]; (m_ANNDataPoints[counter])[1] = currentPoint[1]; (m_ANNDataPoints[counter])[2] = currentPoint[2]; m_IndexToPointIdContainer[counter] = currentId; } InitANN(); } mitk::PointLocator::IdType mitk::PointLocator::FindClosestPoint( const double point[3] ) { m_ANNQueryPoint[0] = point[0]; m_ANNQueryPoint[1] = point[1]; m_ANNQueryPoint[2] = point[2]; return FindClosestANNPoint( m_ANNQueryPoint ); } mitk::PointLocator::IdType mitk::PointLocator::FindClosestPoint( double x, double y, double z ) { m_ANNQueryPoint[0] = x; m_ANNQueryPoint[1] = y; m_ANNQueryPoint[2] = z; return FindClosestANNPoint( m_ANNQueryPoint ); } mitk::PointLocator::IdType mitk::PointLocator::FindClosestPoint( mitk::PointSet::PointType point ) { m_ANNQueryPoint[0] = point[0]; m_ANNQueryPoint[1] = point[1]; m_ANNQueryPoint[2] = point[2]; return FindClosestANNPoint( m_ANNQueryPoint ); } mitk::PointLocator::IdType mitk::PointLocator::FindClosestANNPoint( const ANNpoint& point) { if ( ! m_SearchTreeInitialized ) return -1; m_ANNTree->annkSearch(point, m_ANNK, m_ANNPointIndexes, m_ANNDistances); return m_IndexToPointIdContainer[m_ANNPointIndexes[0]]; } mitk::PointLocator::DistanceType mitk::PointLocator::GetMinimalDistance( mitk::PointSet::PointType point ) { m_ANNQueryPoint[0] = point[0]; m_ANNQueryPoint[1] = point[1]; m_ANNQueryPoint[2] = point[2]; return GetMinimalDistance( m_ANNQueryPoint ); } mitk::PointLocator::DistanceType mitk::PointLocator::GetMinimalDistance( const ANNpoint& point) { if ( ! m_SearchTreeInitialized ) return -1; m_ANNTree->annkSearch(point, m_ANNK, m_ANNPointIndexes, m_ANNDistances); return m_ANNDistances[0]; } void mitk::PointLocator::InitANN() { if ( m_SearchTreeInitialized ) DestroyANN(); m_ANNQueryPoint = annAllocPt( m_ANNDimension ); m_ANNPointIndexes = new ANNidx[m_ANNK]; m_ANNDistances = new ANNdist[m_ANNK]; m_ANNTree = new ANNkd_tree( m_ANNDataPoints, m_IndexToPointIdContainer.size(), m_ANNDimension ); m_SearchTreeInitialized = true; } void mitk::PointLocator::DestroyANN() { m_SearchTreeInitialized = false; if ( m_ANNQueryPoint != NULL ) annDeallocPt( m_ANNQueryPoint ); if ( m_ANNDataPoints != NULL ) annDeallocPts( m_ANNDataPoints ); if ( m_ANNPointIndexes != NULL ) delete[] m_ANNPointIndexes; if ( m_ANNDistances != NULL ) delete[] m_ANNDistances; if ( m_ANNTree != NULL ) delete m_ANNTree; } bool mitk::PointLocator::FindClosestPointAndDistance( mitk::PointSet::PointType point, IdType* id, DistanceType* dist ) { m_ANNQueryPoint[0] = point[0]; m_ANNQueryPoint[1] = point[1]; m_ANNQueryPoint[2] = point[2]; m_ANNTree->annkSearch( m_ANNQueryPoint, m_ANNK, m_ANNPointIndexes, m_ANNDistances); *id = m_IndexToPointIdContainer[m_ANNPointIndexes[0]]; *dist = m_ANNDistances[0]; return true; } - diff --git a/Modules/MitkExt/Algorithms/mitkPointLocator.h b/Modules/MitkAlgorithmsExt/mitkPointLocator.h similarity index 98% rename from Modules/MitkExt/Algorithms/mitkPointLocator.h rename to Modules/MitkAlgorithmsExt/mitkPointLocator.h index 9e14433131..1dd08bfb0b 100644 --- a/Modules/MitkExt/Algorithms/mitkPointLocator.h +++ b/Modules/MitkAlgorithmsExt/mitkPointLocator.h @@ -1,225 +1,225 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; 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 -#include "MitkExtExports.h" +#include "MitkAlgorithmsExtExports.h" #include "mitkPointSet.h" #include //forward declarations class vtkPointSet; class ANNkd_tree; namespace mitk { /** * Convenience wrapper around ANN to provide fast nearest neighbour searches. * Usage: set your points via SetPoints( vtkPointSet* Points ) or SetPoints(mitk::PointSet*). * Then, you may query the closest point to an arbitrary coordinate by FindClosestPoint(). * There is no further call to update etc. needed. * Currently only calls for 1 nearest neighbour are supported. Feel free to add functions * for K nearest neighbours. * NOTE: At least 1 point must be contained in the point set. */ -class MitkExt_EXPORT PointLocator : public itk::Object +class MitkAlgorithmsExt_EXPORT PointLocator : public itk::Object { public: mitkClassMacro( PointLocator, Object ); itkNewMacro( Self ); typedef int IdType; typedef ScalarType DistanceType; typedef float PixelType; typedef double CoordRepType; typedef itk::DefaultStaticMeshTraits MeshTraits; typedef itk::PointSet 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 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/MitkDataTypesExt/files.cmake b/Modules/MitkDataTypesExt/files.cmake index 3dd016ce39..927c2fb273 100644 --- a/Modules/MitkDataTypesExt/files.cmake +++ b/Modules/MitkDataTypesExt/files.cmake @@ -1,39 +1,40 @@ set(CPP_FILES mitkAffineDataInteractor3D.cpp mitkApplyDiffImageOperation.cpp mitkBoundingObject.cpp mitkBoundingObjectGroup.cpp mitkCellOperation.cpp mitkColorSequence.cpp mitkColorSequenceCycleH.cpp mitkColorSequenceRainbow.cpp mitkCompressedImageContainer.cpp mitkCone.cpp mitkCuboid.cpp mitkCylinder.cpp mitkDataStorageSelection.cpp mitkEllipsoid.cpp mitkGridRepresentationProperty.cpp mitkGridVolumeMapperProperty.cpp mitkLabeledImageLookupTable.cpp mitkLabeledImageVolumeCalculator.cpp mitkLineOperation.cpp + mitkLookupTableSource.cpp mitkMesh.cpp mitkMultiStepper.cpp mitkOrganTypeProperty.cpp mitkPlane.cpp mitkSurfaceDeformationDataInteractor3D.cpp mitkUnstructuredGrid.cpp mitkUnstructuredGridSource.cpp mitkVideoSource.cpp Internal/mitkColorConversions.cpp ) set(RESOURCE_FILES Interactions/AffineInteraction3D.xml Interactions/AffineTranslationConfig.xml Interactions/AffineRotationConfig.xml Interactions/AffineDeformationConfig.xml ) diff --git a/Modules/MitkExt/Algorithms/mitkLookupTableSource.cpp b/Modules/MitkDataTypesExt/mitkLookupTableSource.cpp similarity index 100% rename from Modules/MitkExt/Algorithms/mitkLookupTableSource.cpp rename to Modules/MitkDataTypesExt/mitkLookupTableSource.cpp diff --git a/Modules/MitkExt/Algorithms/mitkLookupTableSource.h b/Modules/MitkDataTypesExt/mitkLookupTableSource.h similarity index 96% rename from Modules/MitkExt/Algorithms/mitkLookupTableSource.h rename to Modules/MitkDataTypesExt/mitkLookupTableSource.h index f351d27ea6..fe444f35aa 100644 --- a/Modules/MitkExt/Algorithms/mitkLookupTableSource.h +++ b/Modules/MitkDataTypesExt/mitkLookupTableSource.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 MITKLOOKUPTABLESOURCE_H_HEADER_INCLUDED #define MITKLOOKUPTABLESOURCE_H_HEADER_INCLUDED #include "mitkLookupTable.h" -#include "MitkExtExports.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 MitkExt_EXPORT LookupTableSource : public itk::ProcessObject +class MitkDataTypesExt_EXPORT LookupTableSource : public itk::ProcessObject { public: mitkClassMacro( LookupTableSource, itk::ProcessObject ) itkNewMacro( 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 ); /** * 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); /** * Generates the input requested region simply by calling the equivalent * method of the superclass. */ void GenerateInputRequestedRegion(); /** * 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/MitkExt/Testing/CMakeLists.txt b/Modules/MitkExt/Testing/CMakeLists.txt index f1f1627392..7e6f78073c 100644 --- a/Modules/MitkExt/Testing/CMakeLists.txt +++ b/Modules/MitkExt/Testing/CMakeLists.txt @@ -1,5 +1,4 @@ MITK_CREATE_MODULE_TESTS() -mitkAddCustomModuleTest(mitkLabeledImageToSurfaceFilterTest_BinaryBall mitkLabeledImageToSurfaceFilterTest ${MITK_DATA_DIR}/BallBinary30x30x30.pic.gz) mitkAddCustomModuleTest(mitkImageToSurfaceFilterTest_BinaryBall mitkImageToSurfaceFilterTest ${MITK_DATA_DIR}/BallBinary30x30x30.nrrd) diff --git a/Modules/MitkExt/Testing/files.cmake b/Modules/MitkExt/Testing/files.cmake index bfacf4997d..0c6948debb 100644 --- a/Modules/MitkExt/Testing/files.cmake +++ b/Modules/MitkExt/Testing/files.cmake @@ -1,28 +1,27 @@ set(MODULE_TESTS mitkDataNodeExtTest.cpp mitkExternalToolsTest.cpp # mitkPipelineSmartPointerCorrectnessTest.cpp mitkPlaneFitTest.cpp mitkPointLocatorTest.cpp ) set(MODULE_IMAGE_TESTS mitkCylindricToCartesianFilterTest.cpp #only runs on images ) set(MODULE_SURFACE_TESTS mitkSurfaceToImageFilterTest.cpp #only runs on surfaces ) set(MODULE_CUSTOM_TESTS - mitkLabeledImageToSurfaceFilterTest.cpp mitkImageToSurfaceFilterTest.cpp ) set(MODULE_TESTIMAGES US4DCyl.nrrd Pic3D.nrrd Pic2DplusT.nrrd BallBinary30x30x30.nrrd Png2D-bw.png ) set(MODULE_TESTSURFACES binary.stl ball.stl ) diff --git a/Modules/MitkExt/files.cmake b/Modules/MitkExt/files.cmake index eebd4fb81e..a65eb78547 100644 --- a/Modules/MitkExt/files.cmake +++ b/Modules/MitkExt/files.cmake @@ -1,86 +1,81 @@ set(CPP_FILES Algorithms/vtkPointSetSlicer.cxx Algorithms/mitkAngleCorrectByPointFilter.cpp Algorithms/mitkCylindricToCartesianFilter.cpp - Algorithms/mitkGeometryClipImageFilter.cpp Algorithms/mitkGeometryDataSource.cpp Algorithms/mitkImageToLookupTableFilter.cpp Algorithms/mitkInterpolateLinesFilter.cpp - Algorithms/mitkLabeledImageToSurfaceFilter.cpp - Algorithms/mitkLookupTableSource.cpp Algorithms/mitkMeshSource.cpp Algorithms/mitkPlaneCutFilter.cpp Algorithms/mitkPlaneFit.cpp Algorithms/mitkPlanesPerpendicularToLinesFilter.cpp - Algorithms/mitkPointLocator.cpp Algorithms/mitkPointSetToCurvedGeometryFilter.cpp Algorithms/mitkPointSetToGeometryDataFilter.cpp Algorithms/mitkPointSetIndexToWorldTransformFilter.cpp Algorithms/mitkSurfaceIndexToWorldTransformFilter.cpp Algorithms/mitkPolygonToRingFilter.cpp Algorithms/mitkProbeFilter.cpp Algorithms/mitkUnstructuredGridHistogram.cpp Algorithms/mitkVolumeVisualizationImagePreprocessor.cpp DataManagement/mitkAffineTransformationOperation.cpp DataManagement/mitkColorSequenceHalfTones.cpp DataManagement/mitkDelegateManager.cpp DataManagement/mitkDrawOperation.cpp DataManagement/mitkExternAbstractTransformGeometry.cpp DataManagement/mitkFrameOfReferenceUIDManager.cpp DataManagement/mitkItkBaseDataAdapter.cpp DataManagement/mitkObjectSet.cpp - DataManagement/mitkPlaneLandmarkProjector.cpp DataManagement/mitkPropertyManager.cpp DataManagement/mitkSeedsImage.cpp DataManagement/mitkSeedsImageLookupTableSource.cpp DataManagement/mitkSphereLandmarkProjector.cpp # DataManagement/mitkUSLookupTableSource.cpp DataManagement/vtkObjectSet.cpp IO/mitkObjFileIOFactory.cpp IO/mitkObjFileReader.cpp IO/mitkPACSPlugin.cpp IO/mitkParRecFileIOFactory.cpp IO/mitkParRecFileReader.cpp IO/mitkPropertyListExportToXmlFile.cpp IO/mitkPropertyListImportFromXmlFile.cpp IO/mitkStlVolumeTimeSeriesIOFactory.cpp IO/mitkStlVolumeTimeSeriesReader.cpp IO/mitkUnstructuredGridVtkWriter.cpp IO/mitkUnstructuredGridVtkWriterFactory.cpp IO/mitkVtkUnstructuredGridIOFactory.cpp IO/mitkVtkUnstructuredGridReader.cpp IO/mitkVtkVolumeTimeSeriesIOFactory.cpp IO/mitkVtkVolumeTimeSeriesReader.cpp Interactions/mitkConferenceEventMapper.cpp Interactions/mitkConnectPointsInteractor.cpp #Interactions/mitkCoordinateSupplier.cpp #Interactions/mitkDisplayCoordinateOperation.cpp #Interactions/mitkDisplayInteractor.cpp Interactions/mitkAffineInteractor3D.cpp Interactions/mitkDisplayPointSetInteractor.cpp #Interactions/mitkDisplayVectorInteractor.cpp Interactions/mitkInteractionDebug.cpp Interactions/mitkInteractionDebugger.cpp Interactions/mitkPointInteractor.cpp Interactions/mitkPointSelectorInteractor.cpp #Interactions/mitkPositionTracker.cpp Interactions/mitkSeedsInteractor.cpp Interactions/mitkSocketClient.cpp Interactions/mitkSurfaceDeformationInteractor3D.cpp Interactions/mitkSurfaceInteractor.cpp # Interactions/mitkCreateSurfaceTool.cpp Rendering/mitkImageBackground2D.cpp Rendering/mitkLineMapper2D.cpp # Rendering/mitkLineVtkMapper3D.cpp Rendering/mitkNativeRenderWindowInteractor.cpp ) set(RESOURCE_FILES Interactions/AffineInteraction3D.xml Interactions/AffineTranslationConfig.xml Interactions/AffineRotationConfig.xml Interactions/AffineDeformationConfig.xml )