Skip to content
Snippets Groups Projects
Commit d5e2970c authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ENH: correct error in attribut cleaning

parent 297fb2ea
No related branches found
No related tags found
No related merge requests found
...@@ -29,10 +29,14 @@ namespace Wrapper ...@@ -29,10 +29,14 @@ namespace Wrapper
InputImageParameter::InputImageParameter() InputImageParameter::InputImageParameter()
{ {
std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl;
this->SetName("Input Image"); this->SetName("Input Image");
this->SetKey("in"); this->SetKey("in");
m_FileName=""; m_FileName="";
this->ClearValue(); this->ClearValue();
std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl;
} }
InputImageParameter::~InputImageParameter() InputImageParameter::~InputImageParameter()
...@@ -42,6 +46,7 @@ InputImageParameter::~InputImageParameter() ...@@ -42,6 +46,7 @@ InputImageParameter::~InputImageParameter()
void void
InputImageParameter::SetFromFileName(const std::string& filename) InputImageParameter::SetFromFileName(const std::string& filename)
{ {
std::cout<<this<<" InputImageParameter::SetFromFileName"<<std::endl;
// First clear previous file choosen // First clear previous file choosen
this->ClearValue(); this->ClearValue();
...@@ -58,7 +63,6 @@ InputImageParameter::SetFromFileName(const std::string& filename) ...@@ -58,7 +63,6 @@ InputImageParameter::SetFromFileName(const std::string& filename)
} }
catch(itk::ExceptionObject & err) catch(itk::ExceptionObject & err)
{ {
this->ClearValue();
} }
// the specified filename is valid => store the value // the specified filename is valid => store the value
...@@ -71,6 +75,7 @@ InputImageParameter::SetFromFileName(const std::string& filename) ...@@ -71,6 +75,7 @@ InputImageParameter::SetFromFileName(const std::string& filename)
FloatVectorImageType* FloatVectorImageType*
InputImageParameter::GetImage() InputImageParameter::GetImage()
{ {
std::cout<<this<<" GetImage<FloatVectorImageType>"<<std::endl;
return this->GetImage<FloatVectorImageType>(); return this->GetImage<FloatVectorImageType>();
} }
...@@ -79,6 +84,11 @@ template <class TOutputImage> ...@@ -79,6 +84,11 @@ template <class TOutputImage>
TOutputImage * TOutputImage *
InputImageParameter::GetImage() InputImageParameter::GetImage()
{ {
std::cout<<this<<" InputImageParameter::GetImage inside"<<std::endl;
std::cout<<this<<" InputImageParameter::GetImage m_FileName "<<m_FileName<<std::endl;
std::cout<<this<<" InputImageParameter::GetImage m_FileName.empty() "<<m_FileName.empty()<<std::endl;
std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl;
// 2 cases : the user set a filename vs. the user set an image // 2 cases : the user set a filename vs. the user set an image
//////////////////////// Filename case: //////////////////////// Filename case:
if( !m_FileName.empty() ) if( !m_FileName.empty() )
...@@ -104,7 +114,8 @@ InputImageParameter::GetImage() ...@@ -104,7 +114,8 @@ InputImageParameter::GetImage()
//////////////////////// Image case: //////////////////////// Image case:
else else
{ {
if( m_Image.IsNull()) std::cout<<this<<" GetImage<FloatVectorImageType>"<<std::endl;
if( m_Image.IsNull() )
{ {
itkExceptionMacro("No input image or filename detected..."); itkExceptionMacro("No input image or filename detected...");
} }
...@@ -213,6 +224,7 @@ InputImageParameter::GetImage() ...@@ -213,6 +224,7 @@ InputImageParameter::GetImage()
} }
} }
std::cout<<this<<" InputImageParameter::GetImage outside"<<std::endl;
} }
...@@ -1632,6 +1644,7 @@ template <class TInputImage> ...@@ -1632,6 +1644,7 @@ template <class TInputImage>
void void
InputImageParameter::SetImage(TInputImage* image) InputImageParameter::SetImage(TInputImage* image)
{ {
std::cout<<this<<" InputImageParameter::SetImage"<<std::endl;
m_Image = image; m_Image = image;
} }
...@@ -1648,9 +1661,10 @@ InputImageParameter::HasValue() const ...@@ -1648,9 +1661,10 @@ InputImageParameter::HasValue() const
void void
InputImageParameter::ClearValue() InputImageParameter::ClearValue()
{ {
m_Image = ImageBaseType::New(); std::cout<<this<<" InputImageParameter::ClearValue"<<std::endl;
m_Reader = NULL; m_Image = NULL;
m_Caster = NULL; m_Reader = NULL;
m_Caster = NULL;
} }
......
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