[vtkusers] importing image data into VTK from textfile (mimics)

michiel mentink michael.mentink at st-hughs.ox.ac.uk
Wed Jan 27 05:27:51 EST 2010


thank you, since the data is in an ascii file, I'll try the
vtkDelimitedTextReader.

By the way, when I look for "vtkDelimitedTextReader class" in google, I
arrive at
a very meager
http://www.vtk.org/doc/nightly/html/classvtkDelimitedTextReader.html

The actual class description can be found at:
http://noodle.med.yale.edu/vtk5/classvtkDelimitedTextReader.html#_details

Is this some kind of error?

cheers, Michael


On Mon, Jan 25, 2010 at 5:06 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

> On Mon, Jan 25, 2010 at 11:38 AM, michiel mentink
> <michael.mentink at st-hughs.ox.ac.uk> wrote:
> > for clarity:
> >
> > that should be a series of segmented volume. The file has got multiple
> > slices
> > with segmented pixels on them, so I need to create a VTK volume with
> correct
> > x, y and z spacing.
> >
> > Michael
> >
> > On Mon, Jan 25, 2010 at 4:36 PM, michiel mentink
> > <michael.mentink at st-hughs.ox.ac.uk> wrote:
> >>
> >> I'd like to import image data into VTK from a textfile.
> >> The file is an exported segmented image, coming from MIMICS.
> >>
> >> The textfile has this data:
> >>
> >> 82.5000000000000    -119.687500000000    35.2119100000000    251
> >> 82.1875000000000    -119.375000000000    35.2119100000000    201
> >> 82.5000000000000    -119.375000000000    35.2119100000000    239
> >> 82.8125000000000    -119.375000000000    35.2119100000000    226
> >> 82.1875000000000    -119.062500000000    35.2119100000000    195
> >> 82.5000000000000    -119.062500000000    35.2119100000000    213
> >> 82.8125000000000    -119.062500000000    35.2119100000000    201
> >> 83.1250000000000    -119.062500000000    35.2119100000000    163
> >> 82.1875000000000    -118.750000000000    35.2119100000000    176
> >> 82.5000000000000    -118.750000000000    35.2119100000000    176
> >> 82.8125000000000    -118.750000000000    35.2119100000000    176
> >>
> >> with values for x, y, z and image intensity.
> >>
> >> How do I import this data into VTK?
> >>
> >> I guess I have to read everything into an array first, create an empty
> >> image
> >> and then copy the pixel values into that empty image?
> >> How do I set the inter pixel spacing and inter slice spacing?
> >>
> >> Kind regards,
> >>
> >> Michael
> >
>
> To actually read the file, see these examples:
> http://www.vtk.org/Wiki/VTK/Examples#Input_and_Output
>
> namely vtkParticleReader and vtkDelimitedTextReader.
>
> I don't see a header in that file you've given us. So I guess you'd
> have to know the structure of the file ahead of time.
>
> To create the vtkImageData, you can use
> ImageData->SetExtent(xmin, xmax, ymin, ymax, zmin, zmax)
> and
> ImageData->SetSpacing(x, y, z)
>
> This assumes it is axis aligned. If it is not, you'll have to use
> vtkStructuredPoints
>
> Hope that helps,
>
> 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/20100127/acd247d0/attachment.htm>


More information about the vtkusers mailing list