[vtkusers] Overriding vtkSimpleImageToImageFilter in Activiz
Scott Johnson
Scott.Johnson at neuwave.com
Thu Jul 19 10:28:32 EDT 2012
Because of the lack of response maybe I should word this differentlyz;
Has anyone successfully created a custom image filter sub-classing from Activiz 5.8 classes vtkSimpleImageFilter, vtkImageAlgorithm, vtkImageInPlaceFilter, or ...?
If so, can you post a simple example?
Thanks
-- Scott
From: Scott Johnson
Sent: Wednesday, July 18, 2012 10:56 AM
To: vtkusers at vtk.org
Subject: Overriding vtkSimpleImageToImageFilter in Activiz
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/20120719/ba49a52e/attachment.htm>
More information about the vtkusers
mailing list