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

Alexandre GOUAILLARD agouaillard at gmail.com
Sat Oct 23 12:38:17 EDT 2010


hi wanlin,

as you have a gmail account, you re all set.

you can go there:

http://itk.org/Wiki/ITK/Gerrit/Primer

for more info specific to the way we use gerrit in ITK.

let me now under which name you registered so I can add you once I
will have modified the code and put it in there.

alex.


On Sat, Oct 23, 2010 at 10:57 PM, wanlin <wanlinzhu at gmail.com> wrote:
>
> Thanks Alex. I am very glad to  review it. I have a github account, but how
> can i get an account in ITK gerrit?
>
>
> kind regards
>
> wanlin
>
> On Sun, Oct 24, 2010 at 12:44 AM, Alexandre GOUAILLARD
> <agouaillard at gmail.com> wrote:
>>
>> alright,
>>
>> from what you write, my understanding is that you do not need polyline
>> in ITK, you just need to support reading polylines from a vtk file,
>> and possibly write a "polyline" from itk to a vtk file.
>>
>> > From your suggestion, we could read many edges to represent a polyline,
>> > I
>> > think it is doable. But there are some potential problems
>> > 1. time-consuming for searching for aligned edges when processing
>> > polylines
>> > or write them.
>> > 2. How do discriminate the start and end points for a polyline.(sometime
>> > may
>> > be the order is useful).
>>
>> 1. not a problem.
>> 2. should not be a problem either.
>>
>> I'm going to modify your code to do that.
>>
>> Once it's done, I ll put everything in gerrit for review.
>>
>> You might want to get an account in ITK gerrit to be able to review
>> that code ( I would welcome your review very much indeed ).
>>
>> regards.
>>
>> alex.
>> BTW: the readMeshTest and the ReadWriteMeshTest seem to be redundant,
>> unless you have strong objection, I will kill the ReadMeshTest.
>>
> Just do it.
>>
>> On Sat, Oct 23, 2010 at 4:13 PM, wanlin <wanlinzhu at gmail.com> wrote:
>> >
>> >
>> > On Sat, Oct 23, 2010 at 4:27 PM, Alexandre GOUAILLARD
>> > <agouaillard at gmail.com> wrote:
>> >>
>> >> 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?
>> >>
>> > You are right. I don't have algorithm/filters depends on itkpolyline at
>> > the
>> > moment. it is there because
>> > 1. there is a vtkPolyline.
>> > 2. Support vtk file obtained from MedINRIA (*.fib, but it is vtk binary
>> > file).
>> >
>> >> 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.
>> >>
>> > From your suggestion, we could read many edges to represent a polyline,
>> > I
>> > think it is doable. But there are some potential problems
>> > 1. time-consuming for searching for aligned edges when processing
>> > polylines
>> > or write them.
>> > 2. How do discriminate the start and end points for a polyline.(sometime
>> > may
>> > be the order is useful).
>> >
>> >
>> > kind regards
>> >
>> > wanlin
>> >
>> >> 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
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>


More information about the Insight-developers mailing list