Commit 253d5d52 authored by Julien Michel's avatar Julien Michel
Browse files

ENH: Add the SetNthElement method

parent 57eac0cb
......@@ -74,6 +74,9 @@ public:
/** Get one specific stored image. */
FloatVectorImageType* GetNthImage(unsigned int i) const;
/** Set one specific image. */
void SetNthImage(unsigned int i, ImageBaseType * img);
/** Set the list of image. */
void SetImageList(FloatVectorImageListType* imList);
......
......@@ -231,6 +231,31 @@ InputImageListParameter::SetImageList(FloatVectorImageListType* imList)
this->Modified();
}
void InputImageListParameter::SetNthImage(unsigned int i, ImageBaseType * img)
{
if(m_ImageList->Size()<i)
{
itkExceptionMacro(<< "No image "<<i<<". Only "<<m_ImageList->Size()<<" images available.");
}
try
{
img->UpdateOutputInformation();
}
catch(itk::ExceptionObject &)
{
return;
}
// Try to build a new ParameterInputImage
InputImageParameter::Pointer tmpInputImageParameter = InputImageParameter::New();
tmpInputImageParameter->SetImage(img);
m_InputImageParameterVector[i] = tmpInputImageParameter;
m_ImageList->SetNthElement(i,tmpInputImageParameter->GetFloatVectorImage());
}
void
InputImageListParameter::AddImage(ImageBaseType* image)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment