I am trying to load NIFTI volume images using Qt and ITK. Could you, please, provide some sample code for this issue?
Thank you in advance.
How about this:
QString fileName = QFileDialog::getOpenFileName(
this, tr("Open File"), "C:\\", tr("NIFTI Images (*.nii *.nii.gz *.hdr)"));
if (fileName.isNull()) //user cancelled
return;
typedef itk::Image< short, 3 > ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(fileName.toStdString());
reader->Update();
ImageType::Pointer image=reader->GetOutput();