15 #include "itkImageFileReader.h"
16 #include "vtkMetaImageWriter.h"
22 #include <itkGrayscaleFillholeImageFilter.h>
31 return AlgorithmHelper::getITKfromVTKImageViaFile(image);
48 itkImageType::ConstPointer AlgorithmHelper::getITKfromVTKImageViaFile(
vtkImageDataPtr input)
52 std::cout <<
"getITKfromSSCImage(): NO image!!!" << std::endl;
53 return itkImageType::ConstPointer();
56 double minVal = input->GetScalarRange()[0];
57 double maxVal = input->GetScalarRange()[1];
59 if(maxVal > SHRT_MAX || minVal < SHRT_MIN)
61 +
" min: " +
qstring_cast(minVal) +
" See bug #363 if this needs to be fixed");
64 QDir().mkpath(tempFolder);
69 QString filename = tempFolder +
"/"+
qstring_cast(writer.GetPointer())+
".mhd";
72 writer->SetInputData(input);
74 writer->SetCompression(
false);
78 typedef itk::ImageFileReader<itkImageType> ReaderType;
79 ReaderType::Pointer reader = ReaderType::New();
80 #if ITK_VERSION_MAJOR==3
89 itkImageType::ConstPointer retval = reader->GetOutput();
91 QFile(filename).remove();
102 itkToVtkFilter->SetInput(input);
103 itkToVtkFilter->Update();
106 rawResult->DeepCopy(itkToVtkFilter->GetOutput());
116 typedef itk::GrayscaleFillholeImageFilter<itkImageType, itkImageType> FilterType;
117 FilterType::Pointer filter = FilterType::New();
119 filter->SetInput(itkImage);