[Insight-developers] itkVTKPolyDataReader.h reads ascii only--- why?

Magnotta, Vincent A vincent-magnotta at uiowa.edu
Sat Oct 23 11:21:18 EDT 2010


Alex,

We may want to consider if these readers/writers should also support spatial objects which should be able to handle all of these datatypes. We have started to discuss refactoring of SpatialObjects and should keep I/O and compatibility with VTK on our radar.


Vince


----------------------
Associate Professor 
Department of Radiology 
0453-D JCP 
200 Hawkins Drive 
Iowa City, IA 52242 
E-mail: vincent-magnotta at uiowa.edu 
Phone: 319-356-8255 Fax: 319-353-6275 
Website: http://www.radiology.uiowa.edu 



-----Original Message-----
From: insight-developers-bounces at itk.org on behalf of Alexandre GOUAILLARD
Sent: Sat 10/23/2010 12:27 AM
To: wanlin
Cc: Insight-developers at itk.org; Luis Ibanez
Subject: Re: [Insight-developers] itkVTKPolyDataReader.h reads ascii only--- why?
 
hi wanlin,

I have a design issue with polylinecell.
I understand the need for vizualization, and why it is in VTK.
I do not see the need for computation. Do you have algorithms/filters
that requires polylines?

In term of structure, it could be possible to add this feature to
itk::Mesh, but almost impossible to add it to an itk:QuadEdgeMesh. The
reason is that itk::Mesh has a "polygon soup + links" structure (like
vtkPolydata) where you can add pretty much whatever you want, while
QuadEdgeMesh has an edge-based structure which supposes each edge is
unique and not part of a poly-edge structure.

Now, If you have filters that use those polylines, I could take a look
to see if we can find a better design. With this code anyway, you
cannot deal with polyline separately as it is identified as a
polygon_cell at the cell interface level (we would need to add the
POLYLINE_CELL in the celltype enum, and then return this type in the
corresponding methods of itkpolylinecell.h).

If you just want to be able to read files that contains polylines (vtk
for example), the reader could read them and pass them through as
edges.

If you want to write them, the writer could check for aligned edges
(edges that share a point with another edge, but no other face) and
pass those edges as polyline (if the output format support them, i.e.
at the formatWriter level).

Please let me know what is your usage in ITK filters of this feature.

regards,

alex.



On Mon, Oct 18, 2010 at 7:57 PM, wanlin <wanlinzhu at gmail.com> wrote:
>
>
> On Mon, Oct 18, 2010 at 8:29 PM, Alexandre GOUAILLARD
> <agouaillard at gmail.com> wrote:
>>
>> hi wanlin.
>>
>> I just reviewed your code.
>> Everything seems fine from this quick first review and I updated your
>> IJ paper with it.
>>
> Thank you very much.
>
>> It's a wonderful contribution, and I will put it as a candidate for
>> integration in itk v4.
>>
> It's cool. Thanks again.
>
>>
>> Before I do that though, can you tell me more about PolylineCell ? The
>> code seems to be heavily inspired by the triangle cell, any specific
>> design point (or question) you would have before i go deeper into it?
>
>
> While PolylineCell is almost the same as PolygonCell ( i copied and changed
> from it) except that the topology of this cell is not closed (i know it is
> ugly but a streamline like polyline cell type is useful, at least for me).
> The purpose of this class is to read streamline type data (currently only
> vtk polydata support it), such as fiber bundles obtained from DTI
> tractography algorithm. I know the streamline could be represented by
> DTITubeSpatialObject, but it is not derived from CellInterface, which
> prevent me from using it. Do you have a better idea so we could not add
> PolylineCell?
>
>>
>> Also, I will template your tests and examples over the meshtype to
>> reduce the number of lines by 2, unless you have strong objection
>> against it.
>>
> I totally agree with it.
>
>>
>> Finally, I don't understand the part on the third page about the data
>> type (pixeltype), could you point me to the example you are mentioning
>> in the paper?
>>
> Do you refer to this sentence "One of tests shows how it works"? in page 2?
> Sorry for the confusion. One of the data type defined in vtk polydata is
> COLOR_SCALARS dataName nValues
> c00 c01 ... c0(nValues-1)
> c10 c11 ... c1(nValues-1)
> So the number of elements in the pixelType is determined when reading a
> file. So we use itk::Array or itk::VariableLengthVector as the pixel type.
> In the test PolylineReadWriteTest, we defined
> itk::VariableLengthVector<float> as pixel type since the test data
> fibers.vtk contains COLOR_SCALARS.
>
> Finally, i have a question in terms of GIFTI data format, which requires
> gifticlib (http://www.nitrc.org/frs/?group_id=75). I am not sure the third
> party software policy of itk, therefore i didn't include the support into
> this version of submission. Do you think we could put gifticlib into
> Utilities for supporting GIFTI IO? Or we could do it latter when this
> functionality was required.
>
>
> Many thanks for your help
>
>
> wanlin
>
>> thanks again for this contribution.
>>
>> regards,
>>
>> alex.
>>
>>
>> On Thu, Oct 14, 2010 at 12:19 PM, Alexandre GOUAILLARD
>> <agouaillard at gmail.com> wrote:
>> > hi wanlin, all,
>> >
>> > mesh IO is in my pile of to-be-reviewed. I m goign to put it on the
>> > top of my pile, and address it early next week. If everything goes
>> > alright, I would push the code in ITK v4 before the end of next week.
>> >
>> > thanks for the contribution.
>> >
>> > alex.
>> >
>> >
>> > On Thu, Oct 14, 2010 at 7:26 AM, wanlin <wanlinzhu at gmail.com> wrote:
>> >> Hi, Brain,
>> >>             Reading binary legacy vtk polydata has been implemented in
>> >> http://www.insight-journal.org/browse/publication/761
>> >> Would you like try it?
>> >>
>> >>
>> >>
>> >> On Wed, Oct 13, 2010 at 11:15 AM, Luis Ibanez <luis.ibanez at kitware.com>
>> >> wrote:
>> >>>
>> >>> Hi Brain,
>> >>>
>> >>> Since this is an existing class, Jeff could simply
>> >>>
>> >>> 1) create a Git branch in his local repository,
>> >>> 2) make the necessary changes to the class,
>> >>> 3) add the proper test for reading binary vtk files,
>> >>> 4) run Experimental build until green,
>> >>> 5) and then push the branch to Gerrit for review.
>> >>>
>> >>>
>> >>> Please let us now if you or Jeff run into any
>> >>> problems.
>> >>>
>> >>> I'm sure many people will appreciate having
>> >>> the binary read functionality in this reader.
>> >>>
>> >>>
>> >>>      Luis
>> >>>
>> >>>
>> >>> --------------------------------------------
>> >>> On Wed, Oct 13, 2010 at 5:00 PM, brian avants <stnava at gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Luis
>> >>>>
>> >>>> I think we can add the binary I/O capabilities to these classes, if
>> >>>> it's not done elsewhere, already.   Jeff Duda will probably do this
>> >>>> --- what's the recommended approach, currently, for adding
>> >>>> functionality like this to the toolkit?
>> >>>>
>> >>>> agreed that xml support is a bit ambitious.
>> >>>>
>> >>>> Brian
>> >>>>
>> >>>> On Wed, Oct 13, 2010 at 4:49 PM, Luis Ibanez
>> >>>> <luis.ibanez at kitware.com>
>> >>>> wrote:
>> >>>> >
>> >>>> > Hi Brian,
>> >>>> >
>> >>>> > This reader was implemented as a helper class for
>> >>>> > other initiatives.
>> >>>> >
>> >>>> > Managing only ASCII was the first easy way to get
>> >>>> > it done.
>> >>>> >
>> >>>> > Binary just need to be added to its capabilities.
>> >>>> >
>> >>>> >
>> >>>> > Would you be interested in modifying the class
>> >>>> > and adding the Binary reading capability ?
>> >>>> >
>> >>>> >
>> >>>> > -
>> >>>> >
>> >>>> > The support for XML is a more difficult proposition.
>> >>>> > The implementation in VTK relies on a hierarchy
>> >>>> > of helper classes.  It can certainly be done in ITK
>> >>>> > but it will require several weeks of effort.
>> >>>> >
>> >>>> >
>> >>>> > I would suggest to deal only with the Binary
>> >>>> > reading capability initially.
>> >>>> >
>> >>>> >
>> >>>> >      Luis
>> >>>> >
>> >>>> >
>> >>>> > ----------------------------------------------------------------
>> >>>> > On Wed, Oct 13, 2010 at 2:38 PM, brian avants <stnava at gmail.com>
>> >>>> > wrote:
>> >>>> >>
>> >>>> >> Hi Everyone
>> >>>> >>
>> >>>> >> I updated git-itk this morning.  Am trying to read a vtk mesh and
>> >>>> >> apply a transformation to it.  I get the error below that says,
>> >>>> >> basically, "File format is BINARY but only ASCII files can be
>> >>>> >> read".
>> >>>> >> Is there a good reason for this limitation?    Is it not true that
>> >>>> >> vtk
>> >>>> >> files can be of type ASCII, binary or xml?   Should all of those
>> >>>> >> be
>> >>>> >> supported?   Should the filter(s) be named
>> >>>> >> itkVTKAsciiPolyDataReader/Writer?    Finally, is anyone working on
>> >>>> >> this or is the solution in the software pipeline?
>> >>>> >>
>> >>>> >> Thanks!
>> >>>> >>
>> >>>> >> Brian
>> >>>> >>
>> >>>> >>
>> >>>> >> Input object: Mesh.vtk
>> >>>> >> Error during Update()
>> >>>> >>
>> >>>> >> itk::ExceptionObject (0x101abc640)
>> >>>> >> Location: "void
>> >>>> >> itk::VTKPolyDataReader<TOutputMesh>::GenerateData()
>> >>>> >> [with TOutputMesh = itk::Mesh<double, 3u,
>> >>>> >> itk::DefaultStaticMeshTraits<double, 3u, 3u, float, float, double>
>> >>>> >> >]"
>> >>>> >> File: /Users/brianavants/code/ITK/Code/IO/itkVTKPolyDataReader.txx
>> >>>> >> Line: 107
>> >>>> >> Description: itk::ERROR: VTKPolyDataReader(0x101abc4b0): Error
>> >>>> >> reading
>> >>>> >> file: WM.vtk
>> >>>> >> File format is BINARY but only ASCII files can be read.
>> >>>> >> _______________________________________________
>> >>>> >> Powered by www.kitware.com
>> >>>> >>
>> >>>> >> Visit other Kitware open-source projects at
>> >>>> >> http://www.kitware.com/opensource/opensource.html
>> >>>> >>
>> >>>> >> Kitware offers ITK Training Courses, for more information visit:
>> >>>> >> http://kitware.com/products/protraining.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-developers
>> >>>> >
>> >>>> >
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> ß®???
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> Powered by www.kitware.com
>> >>>
>> >>> Visit other Kitware open-source projects at
>> >>> http://www.kitware.com/opensource/opensource.html
>> >>>
>> >>> Kitware offers ITK Training Courses, for more information visit:
>> >>> http://kitware.com/products/protraining.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-developers
>> >>>
>> >>
>> >>
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Kitware offers ITK Training Courses, for more information visit:
>> >> http://kitware.com/products/protraining.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-developers
>> >>
>> >>
>> >
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.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-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101023/af56d545/attachment-0001.htm>


More information about the Insight-developers mailing list