[Insight-developers] ITK v4: Why is NeighborhoodOperatorImageType restricted to signed types?

Bill Lorensen bill.lorensen at gmail.com
Fri Jun 10 15:26:02 EDT 2011


2004 is a long time ago. I can't recall. I'll have to look at the code.

Also I cc'ed the list in case someone else remembers.

Bill

On Fri, Jun 10, 2011 at 3:21 PM, Cory Quammen <cquammen at cs.unc.edu> wrote:
> Hi Bill,
>
> I'm working with the NeighborhoodOperatorImageType and ran into a
> problem with a exception that is thrown if the output pixel type is
> not signed. Can you recall why you added that exception?
>
> A specific use case for allowing this filter to operate on unsigned
> types would be the convolution of an unsigned char image with an
> unsigned char kernel.
>
> Thanks,
> Cory
>
> patronum:include cquammen$ git show ca27839eaa8a6f39326142d9de1302c1430e70b5
> commit ca27839eaa8a6f39326142d9de1302c1430e70b5
> Author: Bill Lorensen <bill.lorensen at gmail.com>
> Date:   Sat Jun 5 08:27:00 2004 -0400
>
>    ENH: throw an exception if output pixel type is not signed.
>
> diff --git a/Code/BasicFilters/itkNeighborhoodOperatorImageFilter.txx
> b/Code/BasicFilters/itkNeighborhoodOperatorImageFilter.txx
> index 6573c1c..9ac807e 100644
> --- a/Code/BasicFilters/itkNeighborhoodOperatorImageFilter.txx
> +++ b/Code/BasicFilters/itkNeighborhoodOperatorImageFilter.txx
> @@ -93,6 +93,11 @@ NeighborhoodOperatorImageFilter<TInputImage, TOutputImage>
>   BFC faceCalculator;
>   FaceListType faceList;
>
> +  // This filter can only operate on data types that are signed.
> +  if (!NumericTraits<OutputPixelType>::is_signed)
> +    {
> +    itkExceptionMacro( << "This filter can only create images of
> signed data type.");
> +    }
>   // Allocate output
>   OutputImageType *output = this->GetOutput();
>
>
>
> --
> Cory Quammen
> Computer Integrated Systems for Microscopy and Manipulation (CISMM)
> Department of Computer Science
> University of North Carolina at Chapel Hill
> http://www.cs.unc.edu/~cquammen
>


More information about the Insight-developers mailing list