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);
QString qstring_cast(const T &val)
boost::shared_ptr< class Image > ImagePtr
cstring_cast_Placeholder cstring_cast(const T &val)
std::string string_cast(const T &val)
static vtkImageDataPtr getVTKFromITK(itkImageType::ConstPointer input)
void reportWarning(QString msg)
static QString getCachePath()
return path to a folder that is used during execution, will be cleared at start and stop...
SmartPointer< Self > Pointer
vtkSmartPointer< class vtkMetaImageWriter > vtkMetaImageWriterPtr
static itkImageType::ConstPointer getITKfromVTKImage(vtkImageDataPtr image)
QString changeExtension(QString name, QString ext)
static itkImageType::ConstPointer getITKfromSSCImage(ImagePtr image)
static vtkImageDataPtr execute_itk_GrayscaleFillholeImageFilter(vtkImageDataPtr input)
Namespace for all CustusX production code.