36 #include "itkImageFileReader.h" 37 #include "vtkMetaImageWriter.h" 43 #include <itkGrayscaleFillholeImageFilter.h> 52 return AlgorithmHelper::getITKfromVTKImageViaFile(image);
69 itkImageType::ConstPointer AlgorithmHelper::getITKfromVTKImageViaFile(
vtkImageDataPtr input)
73 std::cout <<
"getITKfromSSCImage(): NO image!!!" << std::endl;
74 return itkImageType::ConstPointer();
77 double minVal = input->GetScalarRange()[0];
78 double maxVal = input->GetScalarRange()[1];
80 if(maxVal > SHRT_MAX || minVal < SHRT_MIN)
82 +
" min: " +
qstring_cast(minVal) +
" See bug #363 if this needs to be fixed");
85 QDir().mkpath(tempFolder);
90 QString filename = tempFolder +
"/"+
qstring_cast(writer.GetPointer())+
".mhd";
93 writer->SetInputData(input);
95 writer->SetCompression(
false);
99 typedef itk::ImageFileReader<itkImageType> ReaderType;
100 ReaderType::Pointer reader = ReaderType::New();
101 #if ITK_VERSION_MAJOR==3 110 itkImageType::ConstPointer retval = reader->GetOutput();
112 QFile(filename).remove();
123 itkToVtkFilter->SetInput(input);
124 itkToVtkFilter->Update();
127 rawResult->DeepCopy(itkToVtkFilter->GetOutput());
137 typedef itk::GrayscaleFillholeImageFilter<itkImageType, itkImageType> FilterType;
138 FilterType::Pointer filter = FilterType::New();
140 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.