Skip to content

Commit

Permalink
COMP: backward incompatible ITK change renaming FileModeType
Browse files Browse the repository at this point in the history
New name is FileModeEnum, see InsightSoftwareConsortium/ITK@33daf94
  • Loading branch information
Simon Rit committed Dec 9, 2019
1 parent 3ef15e5 commit 8d213df
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions applications/rtkspectralonestep/rtkspectralonestep.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
itk::ImageIOBase::Pointer GetFileHeader(const std::string &filename)
{
itk::ImageIOBase::Pointer reader =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(filename.c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(filename.c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
if (!reader)
{
itkGenericExceptionMacro(<< "Could not read " << filename);
Expand Down
4 changes: 4 additions & 0 deletions include/rtkGgoFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ GetProjectionsFileNamesFromGgo(const TArgsInfo & args_info)
for (const auto & fn : fileNames)
{
itk::ImageIOBase::Pointer imageio =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(fn.c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(fn.c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif

if (imageio.IsNull())
{
Expand Down
12 changes: 12 additions & 0 deletions include/rtkImagXGeometryReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ ImagXGeometryReader<TInputImage>::GetGeometryForAI1p5()

// Create and set ImageIO
itk::ImageIOBase::Pointer imageIO =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(m_ProjectionsFileNames[0].c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_ProjectionsFileNames[0].c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
imageIO = itk::GDCMImageIO::New();
dynamic_cast<itk::GDCMImageIO *>(imageIO.GetPointer())->LoadPrivateTagsOn();

Expand Down Expand Up @@ -478,7 +482,11 @@ ImagXGeometryReader<TInputImage>::getAIversion()
{
// Create and set ImageIO
itk::ImageIOBase::Pointer imageIO =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(m_ProjectionsFileNames[0].c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_ProjectionsFileNames[0].c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif

imageIO = itk::GDCMImageIO::New();
dynamic_cast<itk::GDCMImageIO *>(imageIO.GetPointer())->LoadPrivateTagsOn();
Expand Down Expand Up @@ -547,7 +555,11 @@ ImagXGeometryReader<TInputImage>::GenerateData()
for (unsigned int noProj = 0; noProj < m_ProjectionsFileNames.size(); noProj++)
{
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(m_ProjectionsFileNames[0].c_str(),
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::FileModeType::ReadMode);
#endif
using ReaderType = itk::ImageFileReader<TInputImage>;
typename ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(m_ProjectionsFileNames[noProj]);
Expand Down
4 changes: 4 additions & 0 deletions include/rtkOraLookupTableImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ OraLookupTableImageFilter<TOutputImage>::BeforeThreadedGenerateData()
int fileIdx = this->GetOutput()->GetRequestedRegion().GetIndex()[2];
itk::ImageIOBase::Pointer reader;
reader =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(m_FileNames[fileIdx].c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_FileNames[fileIdx].c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
if (!reader)
{
itkExceptionMacro("Error reading file " << m_FileNames[fileIdx]);
Expand Down
4 changes: 4 additions & 0 deletions include/rtkProjectionsReader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ ProjectionsReader<TOutputImage>::GenerateOutputInformation(void)
firstTime = false;

itk::ImageIOBase::Pointer imageIO =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(m_FileNames[0].c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_FileNames[0].c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif

if (imageIO == nullptr)
itkGenericExceptionMacro(<< "Cannot create ImageIOFactory for file " << m_FileNames[0].c_str());
Expand Down
4 changes: 4 additions & 0 deletions src/rtkOraGeometryReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ OraGeometryReader::GenerateData()
itk::ImageIOBase::Pointer reader;

reader =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(projectionsFileName.c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(projectionsFileName.c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
if (!reader)
{
itkExceptionMacro("Error reading file " << projectionsFileName);
Expand Down
4 changes: 4 additions & 0 deletions src/rtkXRadGeometryReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ rtk::XRadGeometryReader ::GenerateData()
// Read image information which contains geometry information
rtk::XRadImageIOFactory::RegisterOneFactory();
itk::ImageIOBase::Pointer reader =
#if (ITK_VERSION_MAJOR==5) && (ITK_VERSION_MINOR>=1)
itk::ImageIOFactory::CreateImageIO(m_ImageFileName.c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_ImageFileName.c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
if (!reader)
itkExceptionMacro(<< m_ImageFileName << " is not an XRad file.");
reader->SetFileName(m_ImageFileName);
Expand Down

0 comments on commit 8d213df

Please sign in to comment.