diff --git a/Core/Code/Algorithms/mitkConvert2Dto3DImageFilter.cpp b/Core/Code/Algorithms/mitkConvert2Dto3DImageFilter.cpp index d4f1f782f1..6beddfd17f 100644 --- a/Core/Code/Algorithms/mitkConvert2Dto3DImageFilter.cpp +++ b/Core/Code/Algorithms/mitkConvert2Dto3DImageFilter.cpp @@ -1,87 +1,88 @@ /*=================================================================== 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 "mitkImageAccessByItk.h" #include "mitkITKImageImport.h" #include "mitkConvert2Dto3DImageFilter.h" mitk::Convert2Dto3DImageFilter::Convert2Dto3DImageFilter() { } mitk::Convert2Dto3DImageFilter::~Convert2Dto3DImageFilter() { } void mitk::Convert2Dto3DImageFilter::GenerateData() { mitk::Image::ConstPointer inputImage = this->GetInput(); mitk::Image::Pointer resultImage = this->GetOutput(); AccessFixedDimensionByItk_1(inputImage,ItkConvert2DTo3D, 2, resultImage); resultImage->SetGeometry( inputImage->GetGeometry()); } template void mitk::Convert2Dto3DImageFilter::ItkConvert2DTo3D( itk::Image* itkImage, mitk::Image::Pointer &mitkImage) { typedef itk::Image itkImageType3D; + typedef itkImageType3D::SizeType::SizeValueType sizeVal; // Create a new ITK image typename itkImageType3D::Pointer outputImage = itkImageType3D::New(); typename itkImageType3D::RegionType myRegion; typename itkImageType3D::SizeType mySize; typename itkImageType3D::IndexType myIndex; typename itkImageType3D::SpacingType mySpacing; mySpacing[0] = itkImage->GetSpacing()[0]; mySpacing[1] = itkImage->GetSpacing()[1]; mySpacing[2] = 1; myIndex[0] = 0; myIndex[1] = 0; myIndex[2] = 0; mySize[0] = itkImage->GetLargestPossibleRegion().GetSize()[0]; mySize[1] = itkImage->GetLargestPossibleRegion().GetSize()[1]; mySize[2] = 1; myRegion.SetSize( mySize); myRegion.SetIndex( myIndex ); outputImage->SetSpacing(mySpacing); outputImage->SetRegions( myRegion); outputImage->Allocate(); // Copy Values: - for (int x = 0; x index2D; index2D[0] = x; index2D[1] = y; itk::Index<3> index3D; index3D[0] = x; index3D[1] = y; index3D[2] = 0; outputImage->SetPixel(index3D, itkImage->GetPixel(index2D)); } } mitk::CastToMitkImage(outputImage, mitkImage); }