thank you, since the data is in an ascii file, I'll try the vtkDelimitedTextReader.<br><br>By the way, when I look for "vtkDelimitedTextReader class" in google, I arrive at<br>a very meager <br><a href="http://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html">http://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html</a><br>
<br>The actual class description can be found at: <br><a href="http://noodle.med.yale.edu/vtk5/classvtkDelimitedTextReader.html#_details">http://noodle.med.yale.edu/vtk5/classvtkDelimitedTextReader.html#_details</a><br><br>
Is this some kind of error?<br><br>cheers, Michael<br><br><br><div class="gmail_quote">On Mon, Jan 25, 2010 at 5:06 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Mon, Jan 25, 2010 at 11:38 AM, michiel mentink<br>
<div><div></div><div class="h5"><<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>> wrote:<br>
> for clarity:<br>
><br>
> that should be a series of segmented volume. The file has got multiple<br>
> slices<br>
> with segmented pixels on them, so I need to create a VTK volume with correct<br>
> x, y and z spacing.<br>
><br>
> Michael<br>
><br>
> On Mon, Jan 25, 2010 at 4:36 PM, michiel mentink<br>
> <<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>> wrote:<br>
>><br>
>> I'd like to import image data into VTK from a textfile.<br>
>> The file is an exported segmented image, coming from MIMICS.<br>
>><br>
>> The textfile has this data:<br>
>><br>
>> 82.5000000000000 -119.687500000000 35.2119100000000 251<br>
>> 82.1875000000000 -119.375000000000 35.2119100000000 201<br>
>> 82.5000000000000 -119.375000000000 35.2119100000000 239<br>
>> 82.8125000000000 -119.375000000000 35.2119100000000 226<br>
>> 82.1875000000000 -119.062500000000 35.2119100000000 195<br>
>> 82.5000000000000 -119.062500000000 35.2119100000000 213<br>
>> 82.8125000000000 -119.062500000000 35.2119100000000 201<br>
>> 83.1250000000000 -119.062500000000 35.2119100000000 163<br>
>> 82.1875000000000 -118.750000000000 35.2119100000000 176<br>
>> 82.5000000000000 -118.750000000000 35.2119100000000 176<br>
>> 82.8125000000000 -118.750000000000 35.2119100000000 176<br>
>><br>
>> with values for x, y, z and image intensity.<br>
>><br>
>> How do I import this data into VTK?<br>
>><br>
>> I guess I have to read everything into an array first, create an empty<br>
>> image<br>
>> and then copy the pixel values into that empty image?<br>
>> How do I set the inter pixel spacing and inter slice spacing?<br>
>><br>
>> Kind regards,<br>
>><br>
>> Michael<br>
><br>
<br>
</div></div>To actually read the file, see these examples:<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples#Input_and_Output" target="_blank">http://www.vtk.org/Wiki/VTK/Examples#Input_and_Output</a><br>
<br>
namely vtkParticleReader and vtkDelimitedTextReader.<br>
<br>
I don't see a header in that file you've given us. So I guess you'd<br>
have to know the structure of the file ahead of time.<br>
<br>
To create the vtkImageData, you can use<br>
ImageData->SetExtent(xmin, xmax, ymin, ymax, zmin, zmax)<br>
and<br>
ImageData->SetSpacing(x, y, z)<br>
<br>
This assumes it is axis aligned. If it is not, you'll have to use<br>
vtkStructuredPoints<br>
<br>
Hope that helps,<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>