Commit b918caac authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Merge branch 'itk-module-fixes' into 'development'

Itk Module Fixes
parents d2b9f459 8f5c41db
......@@ -5,8 +5,8 @@
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// Technische Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
......@@ -97,20 +97,25 @@ namespace campvis {
// what source could be. Thank god, there exists macro magic to create the 56
// different templated conversion codes.
#define CONVERT_ITK_TO_GENERIC_LOCAL(basetype, numchannels, dimensionality) \
if (const GenericImageRepresentationItk<basetype, 1, 3>* tester = dynamic_cast< const GenericImageRepresentationItk<basetype, 1, 3>* >(source)) { \
typedef GenericImageRepresentationItk<basetype, 1, 3>::ItkImageType ImageType; \
typedef ImageType::PixelType PixelType; \
const PixelType* pixelData = tester->getItkImage()->GetBufferPointer(); \
if (const GenericImageRepresentationItk<basetype, numchannels, dimensionality>* tester = dynamic_cast< const GenericImageRepresentationItk<basetype, numchannels, dimensionality>* >(source)) { \
typedef typename GenericImageRepresentationItk<basetype, numchannels, dimensionality>::ItkImageType ItkImageType; \
typedef typename ItkImageType::PixelType ItkElementType; \
typedef typename GenericImageRepresentationItk<basetype, numchannels, dimensionality>::ElementType ElementType; \
const ItkElementType* pixelData = tester->getItkImage()->GetBufferPointer(); \
\
ImageType::RegionType region; \
ItkImageType::RegionType region; \
region = tester->getItkImage()->GetBufferedRegion(); \
\
ImageType::SizeType s = region.GetSize(); \
tgt::svec3 size(s[0], s[1], s[2]); \
ItkImageType::SizeType s = region.GetSize(); \
tgt::svec3 size(s[0], 1, 1); \
if (dimensionality >= 2) \
size.y = s[1]; \
if (dimensionality == 3) \
size.z = s[2]; \
\
PixelType* pixelDataCopy = new PixelType[tgt::hmul(size)]; \
memcpy(pixelDataCopy, pixelData, tgt::hmul(size) * TypeTraits<basetype, 1>::elementSize); \
return GenericImageRepresentationLocal<PixelType, 1>::create(const_cast<ImageData*>(source->getParent()), pixelDataCopy); \
ElementType* pixelDataCopy = new ElementType[tgt::hmul(size)]; \
memcpy(pixelDataCopy, pixelData, tgt::hmul(size) * TypeTraits<basetype, numchannels>::elementSize); \
return GenericImageRepresentationLocal<basetype, numchannels>::create(const_cast<ImageData*>(source->getParent()), pixelDataCopy); \
}
#define DISPATCH_ITK_TO_GENERIC_LOCAL_CONVERSION_ND(numchannels, dimensionality) \
......
......@@ -30,6 +30,7 @@
#include "core/tools/typetraits.h"
#include "core/tools/weaklytypedpointer.h"
#include "modules/itk/core/itktypetraits.h"
#include <../voreen-4.3/voreen-snapshot/ext/boost/include/boost/mpl/aux_/na_fwd.hpp>
#include <itkImage.h>
#include <itkImportImageFilter.h>
......@@ -270,20 +271,20 @@ namespace campvis {
return 0;
}
if (const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* tester = dynamic_cast< const GenericImageRepresentationLocal<BASETYPE, 1>* >(source)) {
typename itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::Pointer importer = itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::New();
if (const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* tester = dynamic_cast< const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* >(source)) {
typename itk::ImportImageFilter<ItkElementType, DIMENSIONALITY>::Pointer importer = itk::ImportImageFilter<ItkElementType, DIMENSIONALITY>::New();
typename itk::Image<BASETYPE, DIMENSIONALITY>::SizeType size;
typename ItkImageType::SizeType size;
size[0] = tester->getSize().x;
if (source->getDimensionality() >= 2)
if (DIMENSIONALITY >= 2)
size[1] = tester->getSize().y;
if (source->getDimensionality() >= 3)
if (DIMENSIONALITY >= 3)
size[2] = tester->getSize().z;
typename itk::Image<BASETYPE, DIMENSIONALITY>::IndexType start;
typename ItkImageType::IndexType start;
start.Fill(0);
typename itk::Image<BASETYPE, DIMENSIONALITY>::RegionType region;
typename ItkImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
importer->SetRegion(region);
......@@ -291,8 +292,8 @@ namespace campvis {
importer->SetSpacing(tester->getParent()->getMappingInformation().getVoxelSize().elem);
importer->SetOrigin(tester->getParent()->getMappingInformation().getOffset().elem);
typedef typename itk::Image<BASETYPE, DIMENSIONALITY>::PixelType PixelType;
const PixelType* pixelData = tester->getImageData();
typedef typename ItkImageType::PixelType PixelType;
const PixelType* pixelData = reinterpret_cast<const PixelType*>(tester->getImageData());
importer->SetImportPointer(const_cast<PixelType*>(pixelData), tester->getNumElements(), false);
importer->Update();
......
......@@ -29,7 +29,7 @@
#include "tgt/tgt_math.h"
#include "tgt/vector.h"
#include <itkCovariantVector.h>
#include <itkVector.h>
#include "core/tools/typetraits.h"
......@@ -60,19 +60,19 @@ namespace {
template<typename BASETYPE>
struct ItkTypeTraitsHelperOfBasetypePerChannel<BASETYPE, 2> {
typedef itk::CovariantVector< BASETYPE, 2 > ItkElementType;
typedef itk::Vector< BASETYPE, 2 > ItkElementType;
};
template<typename BASETYPE>
struct ItkTypeTraitsHelperOfBasetypePerChannel<BASETYPE, 3> {
typedef itk::CovariantVector< BASETYPE, 3 > ItkElementType;
typedef itk::Vector< BASETYPE, 3 > ItkElementType;
};
template<typename BASETYPE>
struct ItkTypeTraitsHelperOfBasetypePerChannel<BASETYPE, 4> {
typedef itk::CovariantVector< BASETYPE, 4 > ItkElementType;
typedef itk::Vector< BASETYPE, 4 > ItkElementType;
};
......
......@@ -40,6 +40,7 @@
#include "core/datastructures/imagedata.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
// In this class we want to use various ITK filters. Each filter needs the same ITK boilerplate
// code to be written before and after calling the filter. Futhermore, we need to distinguish
// between the different input base types, since ITK doesn't know runtime type inference.
......@@ -59,8 +60,8 @@
{ \
GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue()); \
if (itkRep != 0) { \
typedef GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ItkImageType InputImageType; \
typedef GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::ItkImageType OutputImageType; \
typedef typename GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ItkImageType InputImageType; \
typedef typename GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::ItkImageType OutputImageType; \
itk::MA_filterType<InputImageType, OutputImageType>::Pointer filter = itk::MA_filterType<InputImageType, OutputImageType>::New(); \
\
MD_filterBody \
......@@ -71,13 +72,10 @@
} \
}
// Multi-channel images not supported by most ITK processors...
#define DISPATCH_ITK_FILTER_BRD(MA_WTP, MA_baseType, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
switch (MA_WTP._numChannels) { \
case 1 : PERFORM_ITK_FILTER_SPECIFIC(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 2 : PERFORM_ITK_FILTER_SPECIFIC(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 3 : PERFORM_ITK_FILTER_SPECIFIC(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 4 : PERFORM_ITK_FILTER_SPECIFIC(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
}
tgtAssert(MA_WTP._numChannels == 1, "ItkImageFilter only supports single-channel images.") \
PERFORM_ITK_FILTER_SPECIFIC(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody)
#define DISPATCH_ITK_FILTER_RD(MA_WTP, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
switch (MA_WTP._baseType) { \
......@@ -146,9 +144,9 @@
do { \
WeaklyTypedPointer wtp = MA_localRep->getWeaklyTypedPointer(); \
switch (MA_localRep->getDimensionality()) { \
case 1: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 1, MA_filterType, MD_filterBody) break; \
case 2: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 2, MA_filterType, MD_filterBody) break; \
case 3: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 3, MA_filterType, MD_filterBody) break; \
default: tgtAssert(false, "Unsupported dimensionality!"); break; \
} \
} while (0)
......@@ -162,9 +160,9 @@
do { \
WeaklyTypedPointer wtp = MA_localRep->getWeaklyTypedPointer(); \
switch (MA_localRep->getDimensionality()) { \
case 1: DISPATCH_ITK_FILTER_D(wtp, 1, MA_filterType, MD_filterBody) break; \
case 2: DISPATCH_ITK_FILTER_D(wtp, 2, MA_filterType, MD_filterBody) break; \
case 3: DISPATCH_ITK_FILTER_D(wtp, 3, MA_filterType, MD_filterBody) break; \
default: tgtAssert(false, "Unsupported dimensionality!"); break; \
} \
} while (0)
......@@ -215,7 +213,7 @@ namespace campvis {
void ItkImageFilter::updateResult(DataContainer& data) {
ImageRepresentationLocal::ScopedRepresentation input(data, p_sourceImageID.getValue());
if (input != 0 && input->getParent()->getNumChannels() == 1) {
if (input != 0 && input->getParent()->getNumChannels() == 1 && (input->getDimensionality() == 2 || input->getDimensionality() == 3)) {
ImageData* id = new ImageData(input->getDimensionality(), input->getSize(), 1);
if (p_filterMode.getOptionValue() == "median") {
......@@ -226,6 +224,8 @@ namespace campvis {
);
}
else if (p_filterMode.getOptionValue() == "gauss") {
// disable known false-positive warning in ITK code when using GCC:
#pragma GCC diagnostic ignored "-Warray-bounds"
DISPATCH_ITK_FILTER(input, DiscreteGaussianImageFilter, \
filter->SetUseImageSpacing(false); \
filter->SetVariance(p_sigma.getValue()); \
......@@ -248,9 +248,10 @@ namespace campvis {
filter->SetConductanceParameter(p_conductance.getValue()); \
);
}
else if (p_filterMode.getOptionValue() == "laplacianSharpening") {
if (p_filterMode.getOptionValue() == "laplacianSharpening") {
DISPATCH_ITK_FILTER(input, LaplacianSharpeningImageFilter, /* nothing here */);
}
data.addData(p_targetImageID.getValue(), id);
}
else {
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// 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 "itkimagefilterkernel.h"
#include "tgt/glmath.h"
#include "tgt/logmanager.h"
#include "modules/itk/core/genericimagerepresentationitk.h"
#include <itkBinaryBallStructuringElement.h>
#include <itkBinaryMorphologicalClosingImageFilter.h>
#include <itkBinaryMorphologicalOpeningImageFilter.h>
#include <tbb/tbb.h>
#include "core/datastructures/imagedata.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
// In this class we want to use various ITK filters. Each filter needs the same ITK boilerplate
// code to be written before and after calling the filter. Futhermore, we need to distinguish
// between the different input base types, since ITK doesn't know runtime type inference.
// Hence, we define various handy macros that will assemble the necessary C++ code for using the
// corresponding ITK filters within this processor. Good luck!
/**
* Executes the specified filter on the data specified filter.
* \param MA_baseType base type of input image
* \param MA_returnType base type of ouput image
* \param MA_numChannels number of channels of input image
* \param MA_dimensionality dimensionality of images
* \param MA_filterType type name if the ITK filter to use (within itk:: namespace)
* \param MD_filterBody additional stuff to execute between filter definition and execution
*/
#define PERFORM_ITK_FILTER_KERNEL(MA_baseType, MA_returnType, MA_numChannels, MA_dimensionality, MA_filterType, MD_filterBody) \
{ \
GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue()); \
if (itkRep != 0) { \
typedef GenericImageRepresentationItk<MA_baseType, MA_numChannels, MA_dimensionality>::ItkImageType InputImageType; \
typedef GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::ItkImageType OutputImageType; \
typedef itk::BinaryBallStructuringElement<MA_baseType, MA_dimensionality> StructuringElementType; \
\
StructuringElementType structuringElement; structuringElement.SetRadius(p_kernelSize.getValue()); \
structuringElement.CreateStructuringElement(); \
itk::MA_filterType<InputImageType, OutputImageType, StructuringElementType>::Pointer filter = itk::MA_filterType<InputImageType, OutputImageType, StructuringElementType>::New(); \
\
MD_filterBody \
\
filter->SetKernel(structuringElement); \
filter->SetInput(itkRep->getItkImage()); \
filter->Update(); \
GenericImageRepresentationItk<MA_returnType, MA_numChannels, MA_dimensionality>::create(id, filter->GetOutput()); \
} \
}
#define DISPATCH_ITK_FILTER_BRD(MA_WTP, MA_baseType, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
switch (MA_WTP._numChannels) { \
case 1 : PERFORM_ITK_FILTER_KERNEL(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 2 : PERFORM_ITK_FILTER_KERNEL(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 3 : PERFORM_ITK_FILTER_KERNEL(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
case 4 : PERFORM_ITK_FILTER_KERNEL(MA_baseType, MA_returnType, 1, MA_dimensionality, MA_filterType, MD_filterBody) break; \
}
#define DISPATCH_ITK_FILTER_RD(MA_WTP, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
switch (MA_WTP._baseType) { \
case WeaklyTypedPointer::UINT8: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint8_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT8: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int8_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::UINT16: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint16_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT16: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int16_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::UINT32: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint32_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT32: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int32_t, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::FLOAT: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, float, MA_returnType, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
default: \
tgtAssert(false, "Should not reach this - wrong base type in WeaklyTypedPointer!"); \
} \
#define DISPATCH_ITK_FILTER_D(MA_WTP, MA_dimensionality, MA_filterType, MD_filterBody) \
switch (MA_WTP._baseType) { \
case WeaklyTypedPointer::UINT8: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint8_t, uint8_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT8: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int8_t, int8_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::UINT16: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint16_t, uint16_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT16: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int16_t, int16_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::UINT32: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, uint32_t, uint32_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::INT32: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, int32_t, int32_t, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
case WeaklyTypedPointer::FLOAT: \
DISPATCH_ITK_FILTER_BRD(MA_WTP, float, float, MA_dimensionality, MA_filterType, MD_filterBody) \
break; \
default: \
tgtAssert(false, "Should not reach this - wrong base type in WeaklyTypedPointer!"); \
} \
/**
* Dispatches the execution for the ITK filter \a MA_filterType with the output base type
* of \a MA_returnType for the image \a MA_localRep.
* \param MA_localRep local representation of the image to apply the filter to
* \param MA_returnType base type of ouput image
* \param MA_filterType type name if the ITK filter to use (within itk:: namespace)
* \param MD_filterBody additional stuff to execute between filter definition and execution
*/
#define DISPATCH_ITK_FILTER_WITH_EXTRA_RETURN_TYPE(MA_localRep, MA_returnType, MA_filterType, MD_filterBody) \
do { \
WeaklyTypedPointer wtp = MA_localRep->getWeaklyTypedPointer(); \
switch (MA_localRep->getDimensionality()) { \
case 1: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 1, MA_filterType, MD_filterBody) break; \
case 2: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 2, MA_filterType, MD_filterBody) break; \
case 3: DISPATCH_ITK_FILTER_RD(wtp, MA_returnType, 3, MA_filterType, MD_filterBody) break; \
} \
} while (0)
/**
* 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_filterType type name if the ITK filter to use (within itk:: namespace)
* \param MD_filterBody additional stuff to execute between filter definition and execution
*/
#define DISPATCH_ITK_FILTER(MA_localRep, MA_filterType, MD_filterBody) \
do { \
WeaklyTypedPointer wtp = MA_localRep->getWeaklyTypedPointer(); \
switch (MA_localRep->getDimensionality()) { \
case 1: DISPATCH_ITK_FILTER_D(wtp, 1, MA_filterType, MD_filterBody) break; \
case 2: DISPATCH_ITK_FILTER_D(wtp, 2, MA_filterType, MD_filterBody) break; \
case 3: DISPATCH_ITK_FILTER_D(wtp, 3, MA_filterType, MD_filterBody) break; \
} \
} while (0)
// ================================================================================================
// = Macros defined, let the party begin! =
// ================================================================================================
namespace campvis {
static const GenericOption<std::string> filterModes[2] = {
GenericOption<std::string>("opening", "Opening"),
GenericOption<std::string>("closing", "Closing")
};
const std::string ItkImageFilterKernel::loggerCat_ = "CAMPVis.modules.classification.ItkImageFilterKernel";
ItkImageFilterKernel::ItkImageFilterKernel()
: AbstractProcessor()
, p_sourceImageID("InputVolume", "Input Volume ID", "volume", DataNameProperty::READ)
, p_targetImageID("OutputGradients", "Output Gradient Volume ID", "gradients", DataNameProperty::WRITE)
, p_filterMode("FilterMode", "Filter Mode", filterModes, 2, AbstractProcessor::INVALID_RESULT | AbstractProcessor::INVALID_PROPERTIES)
, p_kernelSize("KernelSize", "Kernel Size", 3, 3, 15)
{
addProperty(&p_sourceImageID);
addProperty(&p_targetImageID);
addProperty(&p_filterMode);
addProperty(&p_kernelSize);
}
ItkImageFilterKernel::~ItkImageFilterKernel() {
}
void ItkImageFilterKernel::updateResult(DataContainer& data) {
ImageRepresentationLocal::ScopedRepresentation input(data, p_sourceImageID.getValue());
if (input != 0 && input->getParent()->getNumChannels() == 1) {
ImageData* id = new ImageData(input->getDimensionality(), input->getSize(), 1);
if (p_filterMode.getOptionValue() == "opening") {
DISPATCH_ITK_FILTER(input, BinaryMorphologicalOpeningImageFilter, /* nothing here */);
}
else if (p_filterMode.getOptionValue() == "closing") {
DISPATCH_ITK_FILTER(input, BinaryMorphologicalClosingImageFilter, /* nothing here */);
}
data.addData(p_targetImageID.getValue(), id);
}
else {
LDEBUG("No suitable input image found.");
}
validate(INVALID_RESULT);
}
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// 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 ITKIMAGEFILTERKERNEL_H__
#define ITKIMAGEFILTERKERNEL_H__
#include <string>
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/optionproperty.h"
#include "modules/preprocessing/tools/abstractimagefilter.h"
namespace campvis {
/**
* Performs different filter operations on images.
*/
class ItkImageFilterKernel : public AbstractProcessor {
public:
/**
* Constructs a new ItkImageFilterKernel Processor
**/
ItkImageFilterKernel();
/**
* Destructor
**/
virtual ~ItkImageFilterKernel();
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "ItkImageFilterKernel"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Creates the gradient volume for the given intensity volume."; };
/// \see AbstractProcessor::getAuthor()
virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
/// \see AbstractProcessor::getProcessorState()
virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
DataNameProperty p_sourceImageID; ///< ID for input volume
DataNameProperty p_targetImageID; ///< ID for output gradient volume
GenericOptionProperty<std::string> p_filterMode; ///< Filter mode
IntProperty p_kernelSize;
protected:
/// \see AbstractProcessor::updateResult
virtual void updateResult(DataContainer& dataContainer);
static const std::string loggerCat_;
};
}
#endif // ITKIMAGEFILTERKERNEL_H__
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