[vtkusers] Traversing through Image with x,y,z coordinates

Jérôme jerome.velut at gmail.com
Sun Mar 21 09:09:33 EDT 2010


Hi,
I found two things in your code that may create the described problem:
- in your loop over pixels, the in and out pointers are incremented twice.
First in the component subloop with inPtr++
  and second when finishing the Y loop with inPtr += incY. Finally, the
pointer will point out of the extent.
- If you have multithreading enabled, the outExtent is splitted in the
number of threads you are able to launch. I think that the inExtent is not
changed, but you are using it as initial pointer position.

Try this:
- remove the increment incY (and incZ if you want to try 3D) [lines 101-102
and 104-105]
- initialize the inPtr regarding the outExt, and not the inExt [lines 79-81]

HTH
Jerome

2010/3/20 Christian Werner <christian.werner at rwth-aachen.de>

> Hi David!
>
> Here is a complete working copy with everything you need. Unpack it in a
> seperate directory. Run cmake && make then start the program with the
> labelMe.bmp as argument which is also included. The result will be called
> result.bmp.
>
> The result looks different from my first posting though, that was the
> ParaView output. Still something goes wrong, the image seems to be split in
> to halfes, an upper and a lower which both contain the input image squeezed.
>
>
> Best regards,
> Christian
>
>
>
>
> David Doria wrote:
>
>> On Fri, Mar 19, 2010 at 3:58 PM, Christian Werner
>> <christian.werner at rwth-aachen.de> wrote:
>>
>>
>>> Hello!
>>>
>>> I am about to build a nice BinaryRemoveRegions filter that will scrap
>>> away
>>> groups of pixels that are below/above a certain size. I took the
>>> vtkMedian
>>> Filter as a template and cropped it down to the most basic code which
>>> traverses through the image in X-Y-Z order. There I wanted to check if
>>> everything goes fine by simple copying the input image to the output
>>> image.
>>> Unfortunately, the pointers to the InData are corrupt. You can see the
>>> result of the copying attached.
>>>
>>> It is pretty sure that the inData pointers are corrupt, and not the
>>> outData
>>> pointers since I managed to draw pixels every Xth row/column with correct
>>> results. I have attached the code.
>>>
>>> Could somebody give me a hint of what is causing this malfunction? Note
>>> that
>>> the actual x/y/z coordinates are crucial for my algorithm, because I have
>>> to
>>> check for neighboring pixels in all directions.
>>>
>>>
>>> Best regards,
>>> Christian
>>>
>>>
>>
>> Can you attach the header file and the test/example code?
>>
>> Thanks,
>>
>> David
>>
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100321/d3f448a9/attachment.htm>


More information about the vtkusers mailing list