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() ...@@ -49,21 +49,14 @@ ComplexInputImageParameter::GetImage()
{ {
//////////////////////// Filename case: //////////////////////// Filename case:
// A new valid filename has been given : a reader is created // A new valid filename has been given : a reader is created
m_PreviousFileName = m_FileName;
typedef otb::ImageFileReader<TOutputImage> ReaderType; typedef otb::ImageFileReader<TOutputImage> ReaderType;
typename ReaderType::Pointer reader = ReaderType::New(); typename ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(m_FileName); reader->SetFileName(m_FileName);
try reader->UpdateOutputInformation();
{
reader->UpdateOutputInformation();
}
catch(itk::ExceptionObject &)
{
this->ClearValue();
}
m_Image = reader->GetOutput(); m_Image = reader->GetOutput();
m_Reader = reader; m_Reader = reader;
m_PreviousFileName = m_FileName;
// Pay attention, don't return m_Image because it is a ImageBase... // Pay attention, don't return m_Image because it is a ImageBase...
return reader->GetOutput(); return reader->GetOutput();
......
...@@ -52,27 +52,10 @@ ComplexInputImageParameter::SetFromFileName(const std::string& filename) ...@@ -52,27 +52,10 @@ ComplexInputImageParameter::SetFromFileName(const std::string& filename)
// - Done in the reader // - Done in the reader
// - allow appending additional information to the filename // - allow appending additional information to the filename
// myfile.tif:2 for example, or myfile.tif:nocarto // myfile.tif:2 for example, or myfile.tif:nocarto
if (!filename.empty()) m_FileName = filename;
{ m_UseFilename = true;
ComplexFloatVectorReaderType::Pointer reader = ComplexFloatVectorReaderType::New(); SetActive(true);
return true;
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;
} }
......
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