[Insight-users] SubtractImageFilter - Modification
Christian Werner
christian.werner at rwth-aachen.de
Sat May 1 17:22:10 EDT 2010
Forget it. I had a typo. Maybe I just quit programming for today and
finally take a rest... :)
Christian Werner wrote:
> Hi!
>
> I need a slightly modified version of the itkSubtractImageFilter that
> caps the result at 0, such that all negative values will become 0
> instead. I know I could do that with the actual SubtractImageFilter
> followed by a ShiftScaleImageFilter, but it is important that this is
> a one-pass filter since we are working with extremely large (up to
> 1GB) data.
>
> I usually program in vtk and from time to time need some itk filters,
> so I don't have much clue about how to do that. Since this tiny little
> itzy bitzy special subtraction is the only thing I need and I don't
> have the time to really dive into "How to program ITK Filters that
> rock", I just looked at the code of the itkSubtractImageFilter. It
> seemed as if I could achieve what I want with changing a single line.
> I did that and replaced every occurence of "SubtractImageFilter" with
> "SubtractImageFilter2" (where the '2' denotes that this is a specially
> tailored, next-generation filter).
>
> Then the time came to test out that new filter. I included it just
> like any other itk filter:
>
> #include "itkSubtractImageFilter2.h".
>
> The compiler had no problem with that (it finds this header). But when
> trying to instantiate a SubtractImageFilter2:
>
> 130 typedef itk::SubtractImageFilter2<ImageType, ImageType, ImageType>
> SubtractFilterType;
> 131 typename SubtractFilterType::Pointer subtractFilter =
> SubtractFilterType::New();
>
> I get:
>
> /home/christian/programming/pv-plugins/IO/vtkMeasureObjects.cxx:130:
> error: expected initializer before ‘<’ token
> /home/christian/programming/pv-plugins/IO/vtkMeasureObjects.cxx:131:
> error: ‘SubtractFilterType’ has not been declared
>
> which indicates that there is no SubtractImageFilter2. If I simply
> remove the "2" in the include and in line 130, everything is compiled
> just fine.
>
> It seems more has to be done to announce a new itk Filter. I have
> attached the filter.
>
> Any ideas?
>
>
> Best regards,
> Christian
> ------------------------------------------------------------------------
>
> _____________________________________
> 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://www.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-users
More information about the Insight-users
mailing list