Commit 9f09c18a authored by Oliver Zettining's avatar Oliver Zettining Committed by Cristina Precup
Browse files

format segmentation files - Cristina Precup

parent f924ccfd
...@@ -30,10 +30,7 @@ ...@@ -30,10 +30,7 @@
#include "modules/itk/core/genericimagerepresentationitk.h" #include "modules/itk/core/genericimagerepresentationitk.h"
#include <itkIntTypes.h> #include <itkIntTypes.h>
#include <itkGradientMagnitudeImageFilter.h>
#include <itkWatershedImageFilter.h>
#include <itkCastImageFilter.h> #include <itkCastImageFilter.h>
#include <itkConnectedThresholdImageFilter.h> #include <itkConnectedThresholdImageFilter.h>
#include <itkMaskImageFilter.h> #include <itkMaskImageFilter.h>
...@@ -45,7 +42,7 @@ ...@@ -45,7 +42,7 @@
/** /**
* Executes the specified segmentation on the data. * Executes the specified segmentation on the data.
* \param MA_baseType base type of input image * \param MA_baseType base type of input image
* \param MA_returnType base type of ouput image * \param MA_returnType base type of output image
* \param MA_numChannels number of channels of input image * \param MA_numChannels number of channels of input image
* \param MA_dimensionality dimensionality of images * \param MA_dimensionality dimensionality of images
* \param MD_filterBody additional stuff to execute between filter definition and execution * \param MD_filterBody additional stuff to execute between filter definition and execution
...@@ -54,27 +51,25 @@ ...@@ -54,27 +51,25 @@
{ \ { \
GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue()); \ GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue()); \
if (itkRep != 0) { \ if (itkRep != 0) { \
typedef GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ItkImageType InputImageType; \ typedef GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ItkImageType InputImageType; \
typedef GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::ItkImageType OutputImageType; \ typedef GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::ItkImageType OutputImageType; \
itk::MA_filterType<InputImageType, OutputImageType>::Pointer filter = itk::MA_filterType<InputImageType, OutputImageType>::New(); \ itk::MA_filterType<InputImageType, OutputImageType>::Pointer filter = itk::MA_filterType<InputImageType, OutputImageType>::New(); \
typedef itk::Image<itk::IdentifierType, MA_dimensionality> LabelImageType; \ typedef itk::Image<itk::IdentifierType, MA_dimensionality> LabelImageType; \
typedef itk::MaskImageFilter< OutputImageType, OutputImageType > MaskFilterType;\ typedef itk::MaskImageFilter< OutputImageType, OutputImageType > MaskFilterType;\
MaskFilterType::Pointer maskFilter = MaskFilterType::New();\ MaskFilterType::Pointer maskFilter = MaskFilterType::New();\
MD_filterBody \ MD_filterBody \
filter->SetInput(itkRep->getItkImage()); \ filter->SetInput(itkRep->getItkImage()); \
filter->Update(); \ filter->Update(); \
maskFilter->SetInput(itkRep->getItkImage()); \ maskFilter->SetInput(itkRep->getItkImage()); \
maskFilter->SetMaskImage(filter->GetOutput());\ maskFilter->SetMaskImage(filter->GetOutput());\
itk::CastImageFilter<OutputImageType, OutputImageType>::Pointer caster = itk::CastImageFilter<OutputImageType, OutputImageType>::New(); \ itk::CastImageFilter<OutputImageType, OutputImageType>::Pointer caster = itk::CastImageFilter<OutputImageType, OutputImageType>::New(); \
caster->SetInput(maskFilter->GetOutput()); \ caster->SetInput(maskFilter->GetOutput()); \
caster->Update(); \ caster->Update(); \
\ \
GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::create(id, caster->GetOutput()); \ GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::create(id, caster->GetOutput()); \
} \ } \
} }
#define DISPATCH_ITK_SEGMENTATION_BRD(MA_WTP, MA_baseType, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \ #define DISPATCH_ITK_SEGMENTATION_BRD(MA_WTP, MA_baseType, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
tgtAssert(MA_WTP._numChannels == 1, "ItkSegmentation only supports single-channel images.") \ tgtAssert(MA_WTP._numChannels == 1, "ItkSegmentation only supports single-channel images.") \
PERFORM_ITK_SEGMENTATION(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) PERFORM_ITK_SEGMENTATION(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody)
...@@ -106,11 +101,10 @@ ...@@ -106,11 +101,10 @@
tgtAssert(false, "Should not reach this - wrong base type in WeaklyTypedPointer!"); \ tgtAssert(false, "Should not reach this - wrong base type in WeaklyTypedPointer!"); \
} \ } \
/** /**
* Dispatches the execution for the ITK filter \a MA_filterType for the image \a MA_localRep. * Dispatches the execution for the ITK filter \a MA_filterType for the image \a MA_localRep.
* \param MA_localRep local representation of the image to apply the filter to * \param MA_localRep local representation of the image to apply the filter to
* \param MA_filterType type name if the ITK filter to use (within itk:: namespace) * \param MA_filterType type name of the ITK filter to use (within itk:: namespace)
* \param MD_filterBody additional stuff to execute between filter definition and execution * \param MD_filterBody additional stuff to execute between filter definition and execution
*/ */
#define DISPATCH_ITK_SEGMENTATION(MA_localRep, MA_filterType, MD_filterBody) \ #define DISPATCH_ITK_SEGMENTATION(MA_localRep, MA_filterType, MD_filterBody) \
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
namespace campvis { namespace campvis {
/** /**
* Performs watershed image filter on input image using ITK. * Performs segmentation on input image using ITK.
*/ */
class ItkSegmentation : public AbstractProcessor { class ItkSegmentation : public AbstractProcessor {
public: public:
...@@ -62,7 +62,7 @@ namespace campvis { ...@@ -62,7 +62,7 @@ namespace campvis {
virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; }; virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
DataNameProperty p_sourceImageID; ///< ID for input volume DataNameProperty p_sourceImageID; ///< ID for input volume
DataNameProperty p_targetImageID; ///< ID for output gradient volume DataNameProperty p_targetImageID; ///< ID for segmented output volume
GenericOptionProperty<std::string> p_segmentationType; ///< Segmentation type GenericOptionProperty<std::string> p_segmentationType; ///< Segmentation type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment