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

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

fixed ITK module for linux

parent 63ea46dc
......@@ -31,6 +31,7 @@
#define GENERICIMAGEREPRESENTATIONITK_H__
#include "core/datastructures/abstractimagerepresentation.h"
#include "core/datastructures/genericimagerepresentationlocal.h"
#include "core/tools/typetraits.h"
#include "core/tools/weaklytypedpointer.h"
#include "modules/itk/core/itktypetraits.h"
......@@ -275,19 +276,19 @@ namespace campvis {
}
if (const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* tester = dynamic_cast< const GenericImageRepresentationLocal<BASETYPE, 1>* >(source)) {
itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::Pointer importer = itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::New();
typename itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::Pointer importer = itk::ImportImageFilter<BASETYPE, DIMENSIONALITY>::New();
itk::Image<BASETYPE, DIMENSIONALITY>::SizeType size;
typename itk::Image<BASETYPE, DIMENSIONALITY>::SizeType size;
size[0] = tester->getSize().x;
if (source->getDimensionality() >= 2)
size[1] = tester->getSize().y;
if (source->getDimensionality() >= 3)
size[2] = tester->getSize().z;
itk::Image<BASETYPE, DIMENSIONALITY>::IndexType start;
typename itk::Image<BASETYPE, DIMENSIONALITY>::IndexType start;
start.Fill(0);
itk::Image<BASETYPE, DIMENSIONALITY>::RegionType region;
typename itk::Image<BASETYPE, DIMENSIONALITY>::RegionType region;
region.SetSize(size);
region.SetIndex(start);
importer->SetRegion(region);
......@@ -300,7 +301,7 @@ namespace campvis {
importer->SetImportPointer(const_cast<PixelType*>(pixelData), tester->getNumElements(), false);
importer->Update();
ItkImageType::Pointer itkImage = importer->GetOutput();
typename ItkImageType::Pointer itkImage = importer->GetOutput();
if (itkImage.IsNotNull())
return ThisType::create(const_cast<ImageData*>(tester->getParent()), itkImage); // const_cast perfectly valid here
else
......@@ -312,7 +313,7 @@ namespace campvis {
template<typename BASETYPE, size_t NUMCHANNELS, size_t DIMENSIONALITY>
GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>* campvis::GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::clone(ImageData* newParent) const {
ItkImageType::Pointer newItkImage = _itkImage->Clone();
typename ItkImageType::Pointer newItkImage = _itkImage->Clone();
return ThisType::create(newParent, newItkImage);
}
......@@ -346,7 +347,7 @@ namespace campvis {
template<typename BASETYPE, size_t NUMCHANNELS, size_t DIMENSIONALITY>
typename GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::ItkImageType::ConstPointer campvis::GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>::getItkImage() const {
return ItkImageType::ConstPointer(_itkImage);
return typename ItkImageType::ConstPointer(_itkImage);
}
}
......
......@@ -58,24 +58,24 @@ namespace campvis {
// ================================================================================================
template<typename T>
static typename itk::Image<T, 3>::Pointer ItkWrapper::convertImageFromCampvisToItk(const ImageData* image) {
typename itk::Image<T, 3>::Pointer ItkWrapper::convertImageFromCampvisToItk(const ImageData* image) {
tgtAssert(image != 0, "Image must not be 0.");
const GenericImageRepresentationLocal<T, 1>* representation = image->getRepresentation< GenericImageRepresentationLocal<T, 1> >();
if (representation == 0)
return 0;
itk::ImportImageFilter<T, 3>::Pointer importer = itk::ImportImageFilter<T, 3>::New();
typename itk::ImportImageFilter<T, 3>::Pointer importer = itk::ImportImageFilter<T, 3>::New();
itk::Image<T, 3>::SizeType size;
typename itk::Image<T, 3>::SizeType size;
size[0] = image->getSize().x;
size[1] = image->getSize().y;
size[2] = image->getSize().z;
itk::Image<T, 3>::IndexType start;
typename itk::Image<T, 3>::IndexType start;
start.Fill(0);
itk::Image<T, 3>::RegionType region;
typename itk::Image<T, 3>::RegionType region;
region.SetSize(size);
region.SetIndex(start);
importer->SetRegion(region);
......@@ -96,16 +96,16 @@ namespace campvis {
typedef typename itk::Image<T, 3>::PixelType PixelType;
const PixelType* pixelData = image->GetBufferPointer();
itk::Image<T, 3>::RegionType region;
typename itk::Image<T, 3>::RegionType region;
region = image->GetBufferedRegion();
itk::Image<T, 3>::SizeType s = region.GetSize();
typename itk::Image<T, 3>::SizeType s = region.GetSize();
tgt::svec3 size(s[0], s[1], s[2]);
itk::Image<T, 3>::SpacingType sp = image->GetSpacing();
typename itk::Image<T, 3>::SpacingType sp = image->GetSpacing();
tgt::vec3 spacing(sp[0], sp[1], sp[2]);
itk::Image<T, 3>::PointType o = image->GetOrigin();
typename itk::Image<T, 3>::PointType o = image->GetOrigin();
tgt::vec3 offset(o[0], o[1], o[2]);
ImageData* toReturn = new ImageData(3, size, 1);
......
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