[vtkusers] using vtkImageConstantPad to ensure a closed surface after vtkContourFilter
Mark Gooding
mark.gooding at gmail.com
Wed Jan 10 09:27:13 EST 2007
On 09/01/07, Dean Inglis <dean.inglis at sympatico.ca> wrote:
> why are you using vtkStructuredPoints and not vtkImageData?
not really contemplated that. I've read up a little on it now. Thanks.
> I think your general approach is correct, and you may be
> running into a problem with setting the unsigned char
> array with an external c++ array (PointerToData). One thing
> to try is to DeepCopy the "made up" vtkStructuredPoints
> with a new one to separate the pipeline from the c++ array pointer:
Yep. Tried that, although I copied the result of the threshold rather
than the data array, and then applied the vtkImageConstantPad. Was
getting some bizarre results! (See
http://www.robots.ox.ac.uk/~gooding/vtkbizarre.html ).
Now I have it working! I think the problem was with:
int* volextent = ObjectImageThreshold->GetOutput()->GetWholeExtent();
volextent[0]--;
volextent[1]++;
...
the first line copies a pointer to the Threshold output extent. This
is then changed, thus changing the threshold output extent and making
it an unhappy bunny! Doing the following works because the values are
copied not the pointer.
int volextent[6];
ObjectImageThreshold->GetOutput()->GetWholeExtent(volextent);
volextent[0]--;
volextent[1]++;
...
I assume that vtkImageConstantPad is copying the data values, so that
setting the unsigned char array with the c++ array won't be a problem
later on (eg. if I want to use the c++ array - I hope it won't have
been modified as a result of the padding). I guess if it is a problem
I'll have to resort to a deepcopy as well as the change above.
Cheers,
Mark
More information about the vtkusers
mailing list