2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 0c372554 authored by schultezub's avatar schultezub
Browse files

* fixed image conversion ITK -> local

* added gauss and sobel filter to ItkImageFilter

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@415 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 8e11cd81
......@@ -127,8 +127,8 @@ 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<uint8_t, 1, 3>* tester = dynamic_cast< const GenericImageRepresentationItk<uint8_t, 1, 3>* >(source)) { \
typedef GenericImageRepresentationItk<uint8_t, 1, 3>::ItkImageType ImageType; \
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(); \
\
......@@ -139,7 +139,7 @@ namespace campvis {
tgt::svec3 size(s[0], s[1], s[2]); \
\
PixelType* pixelDataCopy = new PixelType[tgt::hmul(size)]; \
memcpy(pixelDataCopy, pixelData, tgt::hmul(size) * TypeTraits<uint8_t, 1>::elementSize); \
memcpy(pixelDataCopy, pixelData, tgt::hmul(size) * TypeTraits<basetype, 1>::elementSize); \
return new GenericImageRepresentationLocal<PixelType, 1>(const_cast<ImageData*>(source->getParent()), pixelDataCopy); \
}
......
......@@ -38,7 +38,7 @@
#include "modules/advancedusvis/processors/advancedusfusion.h"
#include "modules/preprocessing/processors/gradientvolumegenerator.h"
#include "modules/preprocessing/processors/lhhistogram.h"
#include "modules/preprocessing/processors/imagefilter.h"
#include "modules/itk/processors/itkimagefilter.h"
namespace campvis {
class AdvancedUsVis : public VisualizationPipeline {
......@@ -72,7 +72,7 @@ namespace campvis {
GradientVolumeGenerator _gvg;
LHHistogram _lhh;
AdvancedUsFusion _usFusion;
ImageFilter _usFilter;
ItkImageFilter _usFilter;
MWheelToNumericPropertyEventHandler _wheelHandler;
TransFuncWindowingEventHandler _tfWindowingHandler;
......
......@@ -34,7 +34,8 @@
#include "modules/itk/core/genericimagerepresentationitk.h"
#include <itkMedianImageFilter.h>
#include <itkDiscreteGaussianImageFilter.h>
#include <itkSobelEdgeDetectionImageFilter.h>
#include "tbb/include/tbb/tbb.h"
......@@ -94,8 +95,34 @@ namespace campvis {
}
}
else if (p_filterMode.getOptionValue() == "gauss") {
GenericImageRepresentationItk<uint8_t, 1, 3>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue());
if (itkRep != 0) {
typedef GenericImageRepresentationItk<uint8_t, 1, 3>::ItkImageType ImageType;
itk::DiscreteGaussianImageFilter<ImageType, ImageType>::Pointer filter = itk::DiscreteGaussianImageFilter<ImageType, ImageType>::New();
filter->SetUseImageSpacing(false);
filter->SetVariance(p_sigma.getValue());
filter->SetInput(itkRep->getItkImage());
filter->Update();
new GenericImageRepresentationItk<uint8_t, 1, 3>(id, filter->GetOutput());
id->getRepresentation<ImageRepresentationLocal>();
}
}
else if (p_filterMode.getOptionValue() == "sobel") {
GenericImageRepresentationItk<uint8_t, 1, 3>::ScopedRepresentation itkRep(data, p_sourceImageID.getValue());
if (itkRep != 0) {
typedef GenericImageRepresentationItk<uint8_t, 1, 3>::ItkImageType InputImageType;
typedef GenericImageRepresentationItk<float, 1, 3>::ItkImageType OutputImageType;
itk::SobelEdgeDetectionImageFilter<InputImageType, OutputImageType>::Pointer filter = itk::SobelEdgeDetectionImageFilter<InputImageType, OutputImageType>::New();
filter->SetInput(itkRep->getItkImage());
filter->Update();
new GenericImageRepresentationItk<float, 1, 3>(id, filter->GetOutput());
id->getRepresentation<ImageRepresentationLocal>();
}
}
data.addData(p_targetImageID.getValue(), id);
......
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