[Insight-users] Re: Writing 3D image from text file?

Luis Ibanez luis.ibanez at kitware.com
Fri Dec 29 11:14:39 EST 2006


Hi Ekta,

What are the x,y,z coordinates representing ?

Points in space ?

Would you like to see them as pixels turned on in a 3D image ?

You could do

1) Create an image whose physical extent covers all the points.
2) Initialize the image pixels to zero
3) Do a for loop over all the points and invoke the image method
    PhysicalPointToIndex(), then take that index and invoke the
    image method SetPixe(index,value) in order to set the pixel to
    a high value.
4) Write the image to a file using the ImageFileWriter



Regards,


    Luis



---------------
Ekta Amar wrote:
> Hello Luis,
>  
> Is there any way I can read a text file having x, y, and z co-ordinates 
> and write it as a 3D image?
>  
> I'm able to read a text file but I'm not getting how can I make/write  a 
> 3D image from that text file.
>  
> I tried using Image2.cxx example which explains reading from a file but 
> when I'm using .txt file to read it is giving me error, which I can 
> understand is not correct format.
>  
> Is there a way I can read text file and create a 3D image from that.
>  
> Please help me,
>  
> Thanks,
> Ekta
>  


More information about the Insight-users mailing list