[Insight-users] When to set image spacing?

Luis Ibanez luis.ibanez at kitware.com
Sat Aug 8 23:07:15 EDT 2009


Hi David,

Thanks for reinstalling the files.

The problem is that you are not calling FillBuffer()
so the buffer of your image is not initialized.

You are only calling SetPixel() in  a couple of pixels
but all the others are left at the random values that
the memory buffer may have had.


Just call:

     image->FillBuffer( 0 );

after you call image->Allocate();


    Regards,


          Luis


---------------------------------------------------------------
On Sat, Aug 8, 2009 at 8:36 PM, David Doria
<daviddoria+itk at gmail.com<daviddoria%2Bitk at gmail.com>
> wrote:

>
> On Sat, Aug 8, 2009 at 7:18 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>
>>
>> Hi David,
>>
>> The settings of Origin, Spacing and Direction are independent
>> of the memory allocation process. You could do it after or before.
>>
>>
>> There shouldn't be any difference between an image for which
>> you assigned the spacing before Allocate() and the one for which
>> you assigned the spacing after Allocate().
>>
>>
>> Something else should be going on here...
>>
>>
>> Have you verified the values of spacing by opening the .vtk
>> files with a text editor ?
>>
>> BTW: I couldn't get to the two links that you posted.
>>
>>
>>      Regards,
>>
>>
>>              Luis
>>
>
> Ah sorry, I goofed and moved the files on my webserver. The files are here:
> http://www.rpi.edu/~doriad/ITK_List/SetImageSpacing/<http://www.rpi.edu/%7Edoriad/ITK_List/SetImageSpacing/>
>
> As a side note - is there a way to have a user accessible web space for
> things like this? It seems like it would be a good idea if two years later
> when someone reads a post the files still be available, rather than people
> (like myself) forgetting to leave files where they will be available, or
> student accounts disappearing upon graduation, or other web hosting services
> dying, etc. Something like http://www.itk.org/ListFiles - maybe the files
> can even have a little link of which list message they belong to or
> something? Just a thought...
>
> Back to the problem -
>
> good.cpp produces good.vtk
> bad.cpp produces bad.vtk
>
> The only difference (at least that I intended and can detect) is the
> placement of setting the image spacing. I examined the ascii header of the
> vtk files and they look to be the same, but the content of the files is
> binary so I can't check it manually. In paraview the two files look very
> different though.
>
> 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 ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090808/3a650a26/attachment-0001.htm>


More information about the Insight-users mailing list