[vtkusers] Problem with vtkPolyDataToImageStencil in 5.8

David Gobbi david.gobbi at gmail.com
Tue Mar 6 10:48:26 EST 2012


You'd have to use SetLines() instead of SetPolys().  And for
polylines, the final point in the polyline has to connect to the first
line to create a closed loop, so polylines cell arrays need an extra
entry as compared to polygon cell arrays.

On Tue, Mar 6, 2012 at 8:36 AM, Jothybasu Selvaraj <jothybasu at gmail.com> wrote:
> I ma creating the polydat per conoutr like this
>
> vtkSmartPointer<vtkPolyData>polydataContour=
>
>      vtkSmartPointer<vtkPolyData>::New();
>
> polydataContour->Initialize();
>
> polydataContour->SetPolys( cells );//vtkCellArray
>
> polydataContour->SetPoints( points);//vtkPoints
>
>
> How should I do that?
>
> Thanks very much
>
> Jothy
>
>
> On Tue, Mar 6, 2012 at 3:31 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>
>> The contours must be polylines, not polygons, or it won't work.
>>
>> On Tue, Mar 6, 2012 at 6:29 AM, Jothybasu Selvaraj <jothybasu at gmail.com>
>> wrote:
>> > Yes, I have one contour for each z slice as a vtkPolyData. I will try
>> > removing that.
>> >
>> > Thanks
>> >
>> >
>> > On Tue, Mar 6, 2012 at 1:26 PM, David Gobbi <david.gobbi at gmail.com>
>> > wrote:
>> >>
>> >> Do you have one contour for each Z slice?  If so, then try removing
>> >> the Extrude filter from your pipeline.
>> >>
>> >>
>> >> On Tue, Mar 6, 2012 at 2:51 AM, Jothybasu Selvaraj
>> >> <jothybasu at gmail.com>
>> >> wrote:
>> >> > Another point here,
>> >> >
>> >> > I am creating a vtkPolyData for each contour and then adding it to
>> >> > the
>> >> > vtkAppendPolydataFilter, then the output of vtkAppenPolydataFilter is
>> >> > set as
>> >> > input to vtkPolydataToImageStencil.
>> >> >
>> >> > Could this make any difference?
>> >> >
>> >> > Thanks
>> >> >
>> >> > Jothy
>> >> >
>> >> >
>> >> > On Mon, Mar 5, 2012 at 7:49 PM, Jothybasu Selvaraj
>> >> > <jothybasu at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> No, it doesn't fix the problem.
>> >> >>
>> >> >> But it seems to work fine for contours with z-spacing in steps of
>> >> >> 1mm.
>> >> >>
>> >> >> It is working well for a dataset with 3mm spacing but fails for 2.5
>> >> >> mm.
>> >> >>
>> >> >> Maybe I need to test it thoroughly. Can I use those cxx and .h from
>> >> >> 5.6
>> >> >> in
>> >> >> 5.8, that would be a easy workaround.
>> >> >>
>> >> >> Thanks
>> >> >>
>> >> >> Jothy
>> >> >>
>> >> >>
>> >> >> On Mon, Mar 5, 2012 at 4:01 PM, David Gobbi <david.gobbi at gmail.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> Hi Jothy,
>> >> >>>
>> >> >>> It underwent significant changes, but the only change I can think
>> >> >>> of that might have affected your pipeline is the way that it does
>> >> >>> rounding, it used to use a Floor() method that provided a small
>> >> >>> tolerance even if you did SetTolerance(0).  Try calling
>> >> >>> SetTolerance(1e-6) on your PolyDataToImageStencil object, it
>> >> >>> might help.
>> >> >>>
>> >> >>>  - David
>> >> >>>
>> >> >>> On Mon, Mar 5, 2012 at 3:17 AM, Jothybasu Selvaraj
>> >> >>> <jothybasu at gmail.com>
>> >> >>> wrote:
>> >> >>> > Hi all,
>> >> >>> >
>> >> >>> > I was able to create a mesh using the following pipeline in 5.6
>> >> >>> > and
>> >> >>> > it
>> >> >>> > worked well
>> >> >>> >
>> >> >>> >
>> >> >>> >
>> >> >>> >
>> >> >>> > vtkPolyDataToImageStencil->vtkLinearExtrusionFilter->vtkImageStencil->vtkDiscreteMarchingCubes
>> >> >>> >
>> >> >>> > Now, I have updated vtk to 5.8 and I am getting gaps in the mesh
>> >> >>> > along
>> >> >>> > the z
>> >> >>> > axis. I am really puzzled, I have tried with different data sets
>> >> >>> > as
>> >> >>> > well.
>> >> >>> >
>> >> >>> > I have read somewhere that vtkPolyDataToImageStencil had some
>> >> >>> > changes
>> >> >>> > in
>> >> >>> > 5.8, does it has anything to do with this problem, or am I doing
>> >> >>> > anything wrong?
>> >> >>> >
>> >> >>> > I have contours of constant z-spacing.
>> >> >>> >
>> >> >>> > Any hints?
>> >> >>> >
>> >> >>> > Thanks
>> >> >>> >
>> >> >>> > --
>> >> >>> > Jothy
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Jothy
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Jothy
>> >> >
>> >
>> >
>> >
>> >
>> > --
>> > Jothy
>> >
>
>
>
>
> --
> Jothy
>



More information about the vtkusers mailing list