[Insight-developers] ITK v4: Why is NeighborhoodOperatorImageType restricted to signed types?
Jim Miller
millerjv at gmail.com
Sat Jun 11 12:05:53 EDT 2011
I would guess it is because the filter was used to compute derivatives.
The exception is probably too restrictive. I am not sure that we can devise
a suitable test. Whether the output pixel type is signed is a function of
the sign of the elements of the kernel and the sign of the pixels in the
image. The inner product can take on different signs as a function of the
signs and magnitude of the elements of the kernel and the pixels in the
image.
On Fri, Jun 10, 2011 at 3:26 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
> 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
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110611/98b03dd7/attachment.htm>
More information about the Insight-developers
mailing list