Skip to content
Snippets Groups Projects
Commit 9119f3f3 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: use the same behavior for InputImage and ComplexInputImage

parent 15192b63
No related branches found
No related tags found
No related merge requests found
......@@ -49,21 +49,14 @@ ComplexInputImageParameter::GetImage()
{
//////////////////////// Filename case:
// A new valid filename has been given : a reader is created
m_PreviousFileName = m_FileName;
typedef otb::ImageFileReader<TOutputImage> ReaderType;
typename ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(m_FileName);
try
{
reader->UpdateOutputInformation();
}
catch(itk::ExceptionObject &)
{
this->ClearValue();
}
reader->UpdateOutputInformation();
m_Image = reader->GetOutput();
m_Reader = reader;
m_PreviousFileName = m_FileName;
// Pay attention, don't return m_Image because it is a ImageBase...
return reader->GetOutput();
......
......@@ -52,27 +52,10 @@ ComplexInputImageParameter::SetFromFileName(const std::string& filename)
// - Done in the reader
// - allow appending additional information to the filename
// myfile.tif:2 for example, or myfile.tif:nocarto
if (!filename.empty())
{
ComplexFloatVectorReaderType::Pointer reader = ComplexFloatVectorReaderType::New();
try
{
reader->SetFileName(filename);
reader->UpdateOutputInformation();
}
catch(itk::ExceptionObject & /*err*/)
{
return false;
}
// the specified filename is valid => store the value
m_FileName = filename;
m_UseFilename = true;
SetActive(true);
return true;
}
return false;
m_FileName = filename;
m_UseFilename = true;
SetActive(true);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment