[Insight-developers] Does WarpImage Filter need updating

Tom Vercauteren tom.vercauteren at gmail.com
Mon Jan 5 04:10:33 EST 2009


Hey Hans,

This also makes sense to me. By the way, It might be a good thing to
modify SetOutputParametersFromImage to take as input an ImageBase
rather than an OutputImageType. It would make it more generic and
easier to use. For backward compatibility reasons we might however
need to keep the current function in the API.

This could be done by replacing

  void SetOutputParametersFromImage ( typename OutputImageType::Pointer Image )
    {
    this->SetOutputOrigin ( Image->GetOrigin() );
    this->SetOutputSpacing ( Image->GetSpacing() );
    this->SetOutputDirection ( Image->GetDirection() );
    this->SetOutputStartIndex ( Image->GetLargestPossibleRegion().GetIndex() );
    this->SetSize ( Image->GetLargestPossibleRegion().GetSize() );
    }


by something like

  typedef ImageBase< itkGetStaticConstMacro( ImageDimension ) > ImageBaseType;

  void SetOutputParametersFromImage ( const ImageBaseType * Image )
    {
    this->SetOutputOrigin ( Image->GetOrigin() );
    this->SetOutputSpacing ( Image->GetSpacing() );
    this->SetOutputDirection ( Image->GetDirection() );
    this->SetOutputStartIndex ( Image->GetLargestPossibleRegion().GetIndex() );
    this->SetSize ( Image->GetLargestPossibleRegion().GetSize() );
    }

  void SetOutputParametersFromImage ( typename OutputImageType::Pointer Image )
    {
    const ImageBaseType * imageptr = Image.GetPointer();
    this->SetOutputParametersFromImage( imageptr );
    }


Regards,
Tom

On Mon, Jan 5, 2009 at 8:10 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Hi Hans,
>
> Your suggested changes sound quite reasonable.
> It makes sense for the WrapImageFilter to have an API similar to the
> ResampleImageFilter.
>
> Thanks for looking at this,
>
>
>    Luis
>
>
> -----------------------
> Hans Johnson wrote:
>>
>> All,
>>
>> I've been doing some code refactorings to make sure that whenenver an
>> itkResampleImageFilter is used that Origin/Spacing/Direction/Size/StartIndex
>> are all set.    While looking at the code, it occurred to me that the
>> itkWarpImageFilter should also follow the same semantics as the
>> ResampleImageFilter and provide a very similar interface.
>> In particular, the itkWarpImageFilter does not currently allow you to set
>> the OutputStartIndex, and it also does not contain a member function called
>> SetOutputParametersFromImage.
>>
>> Does anyone have an objection to adding a SetOutputParametersFromImage and
>> SetOutputStartIndex to the itkWarpImageFilter?
>>
>> Hans
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>


More information about the Insight-developers mailing list