[vtkusers] Make Smooth Isosurfaces

Bill Lorensen bill.lorensen at gmail.com
Fri Oct 30 23:40:17 EDT 2009


How is the mesh created? Do you specify the number of tetrahedra or
are they used for the analysis?

On Fri, Oct 30, 2009 at 6:11 PM, Sanket Jain <jainsanket1 at gmail.com> wrote:
> I did not understand what you meant by conversion. I assume you meant
> converting my geometry and data into vtk file. Below is a description of
> what I am doing. Maybe this helps to narrow down the problem.
>
> Actually there is no comsol file format. COMSOL is a software which can be
> linked with MATLAB (Like a toolbox; but its a seperate software). I create
> my FEM model in COMSOL and compute the solutions. Since, MATLAB and COMSOL
> are connected, I can take the mesh points, connections and solutions
> (scalars) from COMSOL and save them as .vtk file (unstructured grid) using
> my custom .m file (attached).
>
> Also, I have another custom method of solving the FEM problem which is also
> MATLAB based. So, for 1 problem I have 2 sets of scalars and one set of mesh
> points and connections (geometry). I save vtk file from the scalars from
> alternate method using the same . m file
>
> Therefore, I have 2 vtk files (both unstructured grid) with same geometry
> but different scalars. But, when I visualise both of them in VTK (and
> paraview), I have these rough surfaces.
>
> I am attaching both these vtk files for your reference. Also, I am attaching
> .m file which reads a .mat file (either data_COMSOL or data_CUSTOM) and
> writes these corresponding .vtk files.
>
> Let me know if I have confused you. I will be happy to clarify my
> explanation.
>
> Sanket Jain
>
> On Fri, Oct 30, 2009 at 3:51 PM, Sanket Jain <jainsanket1 at gmail.com> wrote:
>>
>> No the comsol file is not open format. You will require COMSOL software to
>> view it. Anyways, I will check the scalar values and then if the problem
>> still persists, i will update you with my work.
>>
>> Sanket
>>
>> On Fri, Oct 30, 2009 at 2:11 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>>
>>> So, my guess is that there is something wrong in your conversion. Is
>>> the comsol file format an open format? Is there a description? If so,
>>> can you provide the comsol file you are trying to convert?
>>>
>>> Bill
>>>
>>> On Fri, Oct 30, 2009 at 1:22 PM, Sanket Jain <jainsanket1 at gmail.com>
>>> wrote:
>>> > Yes, I generated the isosurface in comsol. It looks smoother than in
>>> > VTK. I
>>> > have attached an view for the isosurface. It looks similar when I
>>> > rotate the
>>> > isosurface for different view.
>>> >
>>> > Sanket
>>> >
>>> > On Fri, Oct 30, 2009 at 12:13 PM, Bill Lorensen
>>> > <bill.lorensen at gmail.com>
>>> > wrote:
>>> >>
>>> >> The file and data seem OK. I looked at it in paraview and I see the
>>> >> same sort of "rough" isosurfaces that you see.  Can you generate an
>>> >> isosurface in COMSOL for comparison?
>>> >>
>>> >> Bill
>>> >>
>>> >> On Fri, Oct 30, 2009 at 12:36 PM, Bill Lorensen
>>> >> <bill.lorensen at gmail.com>
>>> >> wrote:
>>> >> > If the outside of your mesh is a "box", that is all you will see.
>>> >> >
>>> >> > I'll take a look.
>>> >> >
>>> >> > Bill
>>> >> >
>>> >> > On Fri, Oct 30, 2009 at 12:27 PM, Sanket Jain
>>> >> > <jainsanket1 at gmail.com>
>>> >> > wrote:
>>> >> >> When I open the unstructured grid file in paraview, I get a opaque
>>> >> >> border of
>>> >> >> my geometry. When I decrease the opacity, I just see a hollow box.
>>> >> >> I
>>> >> >> cannot
>>> >> >> see my mesh inside the box. I think there is some problem with the
>>> >> >> file. But
>>> >> >> I compared my file with the format for writing unstructured grid
>>> >> >> and it
>>> >> >> looks correct to me. Do you mind having a look at the file
>>> >> >> (attached)?
>>> >> >> I
>>> >> >> know this might be asking for too much help. I really appreciate
>>> >> >> your
>>> >> >> efforts to help me.
>>> >> >>
>>> >> >> Sanket
>>> >> >>
>>> >> >> On Fri, Oct 30, 2009 at 11:17 AM, Bill Lorensen
>>> >> >> <bill.lorensen at gmail.com>
>>> >> >> wrote:
>>> >> >>>
>>> >> >>> I mean the unstructured grid (the geometry).
>>> >> >>>
>>> >> >>> On Fri, Oct 30, 2009 at 12:10 PM, Sanket Jain
>>> >> >>> <jainsanket1 at gmail.com>
>>> >> >>> wrote:
>>> >> >>> > Ok. I will recheck my matlab program which writes the vtk file
>>> >> >>> > and
>>> >> >>> > get
>>> >> >>> > back
>>> >> >>> > to you.
>>> >> >>> >
>>> >> >>> > For Paraview, did you mean only the mesh points without the
>>> >> >>> > scalar
>>> >> >>> > values? I
>>> >> >>> > checked the unstructured grid with scalars on them. They look
>>> >> >>> > exactly
>>> >> >>> > the
>>> >> >>> > same as in my VTK code.
>>> >> >>> >
>>> >> >>> > Sanket
>>> >> >>> >
>>> >> >>> > On Fri, Oct 30, 2009 at 7:55 AM, Bill Lorensen
>>> >> >>> > <bill.lorensen at gmail.com>
>>> >> >>> > wrote:
>>> >> >>> >>
>>> >> >>> >> Perhaps your scalar values are not associated with the proper
>>> >> >>> >> points?
>>> >> >>> >> Have you looked at the original unstructured grid with
>>> >> >>> >> paraview?
>>> >> >>> >>
>>> >> >>> >> On Thu, Oct 29, 2009 at 10:21 PM, Sanket Jain
>>> >> >>> >> <jainsanket1 at gmail.com>
>>> >> >>> >> wrote:
>>> >> >>> >> > Yes, I tried for number of isovalues. But all of them have
>>> >> >>> >> > similar
>>> >> >>> >> > characteristics. Is it anything to do with the vtk file being
>>> >> >>> >> > in
>>> >> >>> >> > unstructured grid rather than polygonal data? For the mesh, I
>>> >> >>> >> > imported
>>> >> >>> >> > from
>>> >> >>> >> > COMSOL, I cannot use polygonal data.
>>> >> >>> >> >
>>> >> >>> >> > Sanket Jain
>>> >> >>> >> > On Thu, Oct 29, 2009 at 6:33 PM, Bill Lorensen
>>> >> >>> >> > <bill.lorensen at gmail.com>
>>> >> >>> >> > wrote:
>>> >> >>> >> >>
>>> >> >>> >> >> It does look strange. Have you tried changing the isosurface
>>> >> >>> >> >> value?
>>> >> >>> >> >>
>>> >> >>> >> >> On Thu, Oct 29, 2009 at 5:44 PM, Sanket Jain
>>> >> >>> >> >> <jainsanket1 at gmail.com>
>>> >> >>> >> >> wrote:
>>> >> >>> >> >> > I have attached a snapshot of my viewer. The isosurface is
>>> >> >>> >> >> > predicting
>>> >> >>> >> >> > the
>>> >> >>> >> >> > volume activated during monopolar stimulation. So,
>>> >> >>> >> >> > theoretically
>>> >> >>> >> >> > you
>>> >> >>> >> >> > will
>>> >> >>> >> >> > expect a sphere at a particular iso value.
>>> >> >>> >> >> >
>>> >> >>> >> >> > I tried using vtkPolyDataNormals. The figure attached is
>>> >> >>> >> >> > the
>>> >> >>> >> >> > output
>>> >> >>> >> >> > after
>>> >> >>> >> >> > including this filter. But I still think this is not
>>> >> >>> >> >> > smooth.
>>> >> >>> >> >> >
>>> >> >>> >> >> > I verified by opening my vtk file in Paraview (with,
>>> >> >>> >> >> > Compute
>>> >> >>> >> >> > Normal
>>> >> >>> >> >> > ON).
>>> >> >>> >> >> > Even then i get the same kind of response. So, do you
>>> >> >>> >> >> > think
>>> >> >>> >> >> > this
>>> >> >>> >> >> > is
>>> >> >>> >> >> > the
>>> >> >>> >> >> > best
>>> >> >>> >> >> > i can get? Or there might be some problem in the vtk file
>>> >> >>> >> >> > which is
>>> >> >>> >> >> > exported
>>> >> >>> >> >> > from COMSOL (I verified it multiple times).
>>> >> >>> >> >> >
>>> >> >>> >> >> > Thank you,
>>> >> >>> >> >> >
>>> >> >>> >> >> > Sanket
>>> >> >>> >> >> >
>>> >> >>> >> >> > On Thu, Oct 29, 2009 at 4:01 PM, Bill Lorensen
>>> >> >>> >> >> > <bill.lorensen at gmail.com>
>>> >> >>> >> >> > wrote:
>>> >> >>> >> >> >>
>>> >> >>> >> >> >> Sorry, reading your e-mail in more detail. Are you
>>> >> >>> >> >> >> generating
>>> >> >>> >> >> >> the
>>> >> >>> >> >> >> isosurfaces in vtk using vtkContourFIiter or some
>>> >> >>> >> >> >> equivalent.
>>> >> >>> >> >> >> If
>>> >> >>> >> >> >> so,
>>> >> >>> >> >> >> you should run the output through vtkPolyDataNormals.
>>> >> >>> >> >> >>
>>> >> >>> >> >> >> On Thu, Oct 29, 2009 at 4:59 PM, Bill Lorensen
>>> >> >>> >> >> >> <bill.lorensen at gmail.com>
>>> >> >>> >> >> >> wrote:
>>> >> >>> >> >> >> > What do you mean by rough? Perhaps the faces are flat
>>> >> >>> >> >> >> > shaded?
>>> >> >>> >> >> >> > How
>>> >> >>> >> >> >> > are
>>> >> >>> >> >> >> > you displaying the model in vtk?
>>> >> >>> >> >> >> >
>>> >> >>> >> >> >> > Are your isosurfaces composed of only triangles? If so,
>>> >> >>> >> >> >> > did
>>> >> >>> >> >> >> > you
>>> >> >>> >> >> >> > provide surface normals at each point?
>>> >> >>> >> >> >> >
>>> >> >>> >> >> >> > On Thu, Oct 29, 2009 at 4:30 PM, Sanket Jain
>>> >> >>> >> >> >> > <jainsanket1 at gmail.com>
>>> >> >>> >> >> >> > wrote:
>>> >> >>> >> >> >> >> Hello Experts,
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> I have just started to use VTK to fulfill my
>>> >> >>> >> >> >> >> visualization
>>> >> >>> >> >> >> >> needs.
>>> >> >>> >> >> >> >> I
>>> >> >>> >> >> >> >> am
>>> >> >>> >> >> >> >> trying out few fundamental steps which would be
>>> >> >>> >> >> >> >> crucial
>>> >> >>> >> >> >> >> for my
>>> >> >>> >> >> >> >> future
>>> >> >>> >> >> >> >> development.
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> I exported an  Finite Element Model (FEM) from COMSOL
>>> >> >>> >> >> >> >> and
>>> >> >>> >> >> >> >> wrote
>>> >> >>> >> >> >> >> it
>>> >> >>> >> >> >> >> as
>>> >> >>> >> >> >> >> vtk
>>> >> >>> >> >> >> >> unstructured grid in matlab (points, connections and
>>> >> >>> >> >> >> >> data). I
>>> >> >>> >> >> >> >> am
>>> >> >>> >> >> >> >> just
>>> >> >>> >> >> >> >> trying
>>> >> >>> >> >> >> >> to read my vtk file and trying to visualize the
>>> >> >>> >> >> >> >> isosurfaces at
>>> >> >>> >> >> >> >> some
>>> >> >>> >> >> >> >> value.
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> The problem is the isosurfaces are very rough even
>>> >> >>> >> >> >> >> when I
>>> >> >>> >> >> >> >> increased
>>> >> >>> >> >> >> >> the
>>> >> >>> >> >> >> >> mesh
>>> >> >>> >> >> >> >> density in my COMSOL model. I tried to perform the
>>> >> >>> >> >> >> >> same
>>> >> >>> >> >> >> >> task
>>> >> >>> >> >> >> >> in
>>> >> >>> >> >> >> >> paraview and
>>> >> >>> >> >> >> >> even there i saw the same problem.
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> Do you think that increasing the mesh density should
>>> >> >>> >> >> >> >> solve
>>> >> >>> >> >> >> >> it?
>>> >> >>> >> >> >> >> I
>>> >> >>> >> >> >> >> cannot
>>> >> >>> >> >> >> >> increase the mesh density because of computational
>>> >> >>> >> >> >> >> issues.
>>> >> >>> >> >> >> >> Any
>>> >> >>> >> >> >> >> ideas
>>> >> >>> >> >> >> >> on
>>> >> >>> >> >> >> >> this
>>> >> >>> >> >> >> >> problem will be appreciated.
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> Thank you,
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> Sanket Jain
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >> _______________________________________________
>>> >> >>> >> >> >> >> 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
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >>
>>> >> >>> >> >> >> >
>>> >> >>> >> >> >
>>> >> >>> >> >> >
>>> >> >>> >> >> >
>>> >> >>> >> >> > --
>>> >> >>> >> >> > Sanket Jain
>>> >> >>> >> >> >
>>> >> >>> >> >
>>> >> >>> >> >
>>> >> >>> >> >
>>> >> >>> >> > --
>>> >> >>> >> > Sanket Jain
>>> >> >>> >> >
>>> >> >>> >
>>> >> >>> >
>>> >> >>> >
>>> >> >>> > --
>>> >> >>> > Sanket Jain
>>> >> >>> >
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> Sanket Jain
>>> >> >>
>>> >> >
>>> >
>>> >
>>> >
>>> > --
>>> > Sanket Jain
>>> >
>>
>>
>>
>> --
>> Sanket Jain
>
>
>
> --
> Sanket Jain
>



More information about the vtkusers mailing list