[vtkusers] Overriding vtkSimpleImageToImageFilter in Activiz

Scott Johnson Scott.Johnson at neuwave.com
Wed Jul 18 11:56:08 EDT 2012


Hello,

I am using Windows 7 x64 with Activiz 5.8 Visual Studio 2008.

I am attempting to scan an image and replace a specific pixel value with another.  To do this I thought I would try to override vtkSimpleImageToImageFilter.  I looked at the C++ code for vtkSimpleImageFilterExample and came up with the following:

    public class ReplacePixel : vtkSimpleImageToImageFilter
    {
        private ushort _pixelValue;

        public void SimpleExecute(vtkImageData input, vtkImageData output)
        {
            Console.WriteLine("input type = {0}  output type = {1}  Dimensions ({2},{3},{4}) Pixel={5}",
                input.GetScalarTypeAsString(), output.GetScalarTypeAsString(),
                input.GetDimensions()[0], input.GetDimensions()[1], input.GetDimensions()[2],
                PixelValue);
        }

        public ushort PixelValue
        {
            get
            {
                return _pixelValue;
            }

            set
            {
                _pixelValue = value;
            }
        }
    }

When I attempt to compile VS gives the following error:
error CS1729: 'Kitware.VTK.vtkSimpleImageToImageFilter' does not contain a constructor that takes '0' arguments

The error persists if I define a simple zero argument constructor for ReplacePixel.

I am instantiating Replace pixel like this:
ReplacePixel removeValue = (ReplacePixel)ReplacePixel.New();

I couldn't find any examples for creating my own filter in Activiz.  Pointers would be appreciated.  Worst case, is there a better way to iterate through all of the pixels in a vtkImageData without using filters?  I'm guessing it somehow involves GetScalarPointer.

Thanks

                                -- Scott

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120718/c69ccd11/attachment.htm>


More information about the vtkusers mailing list