Re: [Paraview] Colormap cut planes and contour filter in an unstructured grid

2018-05-22 Thread Franco Di Rino
Jean


Thanks for your reply. Your answer is clear. Now, another questionIf i 
could make 3d cells would I can introduce vectors values in them? Because I  
undestood that I could only set escalars.

How could I do the  colormap slices and iso surfaces in case I would have a a 
3D cell?



De: Favre Jean 
Enviado: martes, 22 de mayo de 2018 04:55 a.m.
Para: Franco Di Rino; paraview@public.kitware.com
Asunto: RE: Colormap cut planes and contour filter in an unstructured grid

Franco

you cannot slice or isosurface a dataset made of poly-vertices, because there 
is no 3D cell.

your best bet would be to use the Point Interpolation filters (standard points 
, or SPH points). However, these filters require at least one scalar array 
attached to the points. Your data only contains a vector-valued array. If you 
decompose the vector into its 3 components, you would be able to use the Point 
Interpolators.

-
Jean/CSCS
___
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] Resample To Image with Catalyst

2018-05-22 Thread Andy Bauer
Hi Petr,

Could you try adding in the following to your Python script after the
coprocessor.RegisterWriter() line:
writer.DataMode = 'Ascii'

Please let me know if that fixes the issue for you. This isn't the desired
fix but something to at least verify that I can reproduce your issue.

Thanks,
Andy



On Mon, May 21, 2018 at 12:16 PM Petr Valenta  wrote:

> Hello,
>
> the code which I am using is instrumented with Catalyst.
> I am trying to process simulation data using ResampleToImage filter and
> then to store the result on a disk.
>
> In the Python pipeline I have something like:
>
> adaptor_input = coprocessor.CreateProducer(datadescription, 'input')
> resample = ResampleToImage(Input=adaptor_input)
> resample.UseInputBounds = True
> resample.SamplingDimensions = [256, 256, 256]
> writer = servermanager.writers.XMLPImageDataWriter(Input=resample)
> coprocessor.RegisterWriter(writer, filename='resample_%t.pvti', freq=10)
>
> When I check the results in ParaView, the grid is correct but the data
> array appended on it contains only zeros. When I skip the filter and dump
> directly the adaptor_input, the data array contains correct values. Could
> you, please, help me to resolve this issue?
>
> Thank you.
>
> Kind regards,
> Petr
>
>
> ___
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/paraview
>
___
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] OSPRay textures and materials mapping

2018-05-22 Thread David E DeMarle
And here is a python schell script to make step 4 (create the lookuptable)
automatic.

apartment = FindSource("sample_apartment.obj")

vtklevel = apartment.GetClientSideObject()

lut = GetColorTransferFunction('MaterialIds')

arr = vtklevel.GetOutput().GetFieldData().GetAbstractArray(0)

lut.InterpretValuesAsCategories = 1

ll = []

for x in range(0, arr.GetNumberOfTuples()):

ll.append(str(x))

ll.append(arr.GetValue(x))




David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Tue, May 22, 2018 at 1:51 PM, David E DeMarle 
wrote:

> On Tue, May 22, 2018 at 12:34 PM, David E DeMarle <
> dave.dema...@kitware.com> wrote:
>
>>
>> On Tue, May 22, 2018 at 10:34 AM, Jonathan Borduas <
>> jonathan.bord...@caboma.com> wrote:
>>
>>> Hi David,
>>>
>>> I was able to complete all the steps. As you probably know, the step
>>> four was tedious.
>>>
>>> However I couldn’t get the result I wanted since I couldn’t assign the
>>> right textures to the right areas. Is there a mechanism to assign the
>>> texture just like we assign materials ?
>>> I guess this is what you mean by “multi-texture isn’t implemented yet”.
>>> I could probably extract all objects using a connectivity filter and then
>>> manually assign the textures, but again it is a tedious process for complex
>>> objects.
>>>
>>>
>> Better to do it in the code. We read in all of the texture coordinates
>> when we read the .obj and all of the texture files when we read the .mtl ->
>> we just aren't using the right set of texture coordinates in all cases yet.
>> That is most of what I mean by multitexture.
>>
>> Is there a roadmap as to when the multi-texture could be implemented ?
>>>
>>
>> I'm hoping for 5.6 in a couple of months time. Although this is important
>> it may very well slip because of other priorities.
>>
>>
>
> In the meantime, this python programmable filter is a workaround.
>
> pdi = self.GetInput()
>
> pdo = self.GetOutput()
>
> pdo.ShallowCopy(pdi)
>
>
> arraynames = []
>
> arrays = {}
>
> for a in range(0,pdi.GetPointData().GetNumberOfArrays()):
>
>   array = pdi.GetPointData().GetArray(a)
>
>   if array.GetNumberOfComponents() != 2:
>
> continue
>
>   arrname = array.GetName()
>
>   pdo.GetPointData().RemoveArray(arrname)
>
>   arraynames.append(arrname)
>
>   arrays[arrname] = array
>
>
> tcoords = vtk.vtkFloatArray()
>
> tcoords.SetName("TCoords")
>
> tcoords.SetNumberOfComponents(2)
>
> pdo.GetPointData().SetTCoords(tcoords)
>
> # todo numpy this to make it 100x faster
>
> for p in range(0, pdi.GetNumberOfPoints()):
>
>   tcoord = [0,0]
>
>   for arrname in arrays:
>
> candidate = arrays[arrname].GetTuple2(p)
>
> if candidate[0] == -1 and candidate[1] == -1:
>
>   continue
>
> tcoord = candidate
>
>   tcoords.InsertNextTuple2(tcoord[0],tcoord[1])
>
>
>
>
>
>> It would be great to have readers that can load
>>> texture/Geometry/Materials files such as .obj (.mtl and .png), .fbx and
>>> .dwg.
>>>
>>
>> Agreed.
>>
>>
>>> Best regards,
>>>
>>>
>>>
>>> Jonathan Borduas
>>>
>>>
>>>
>>> *From:* David E DeMarle 
>>> *Sent:* Friday, May 18, 2018 10:58 AM
>>> *To:* Jonathan Borduas 
>>> *Cc:* paraview@public.kitware.com
>>> *Subject:* Re: [Paraview] OSPRay textures and materials mapping
>>>
>>>
>>>
>>> Hi Jonathan.
>>>
>>>
>>>
>>> Yes you can do that.
>>>
>>>
>>>
>>> 1) File->Load OSPRay Materials, switch the file type from "OSPRay
>>> Material Files (*.json)"  to "Wavefront Material FIles (*.mtl)". That will
>>> let you load all of the materials and textures. They should all show up in
>>> the Material list.
>>>
>>>
>>>
>>> 2) The OSPRay Material selection (on Display section of Properties Tab
>>> advanced) will have all of the individual materials listed in it + a few
>>> others including "Value Indexed" which is all the way at the bottom. Choose
>>> that it means "use the categorical color lookup table to decide what
>>> material to use for each block and or polygon"
>>>
>>>
>>>
>>> 3) Now change the scalar array to color by to "Material Id", a cell
>>> aligned array which has the material index to use for each cell.
>>>
>>>
>>>
>>> 4) Make up a categorical lookup table.
>>>
>>>open spreadsheet view, switch to Field Data, look at the Material
>>> Names.
>>>
>>>open the color map editor for the "Material Id", click on Interpret
>>> Values As Categories and the color will change from bluewhitered to
>>> extremely YELLOW.
>>>
>>>add annotations, value 0 should be the name of the first entry in the
>>> Material Names array.
>>>
>>>
>>>
>>> Notes:
>>>
>>> * I have the trivial script somewhere that I used for the SC17 demo that
>>> makes up the lookup table for you. I'll try and dig that up.
>>>
>>> * in general it isn't a 1:1 match between mtl and ospray, in particular
>>> multitextures are not yet implemented
>>>
>>> * along those lines, the mtl parser I whipped up
>>> 

Re: [Paraview] OSPRay textures and materials mapping

2018-05-22 Thread David E DeMarle
On Tue, May 22, 2018 at 12:34 PM, David E DeMarle 
wrote:

>
> On Tue, May 22, 2018 at 10:34 AM, Jonathan Borduas <
> jonathan.bord...@caboma.com> wrote:
>
>> Hi David,
>>
>> I was able to complete all the steps. As you probably know, the step four
>> was tedious.
>>
>> However I couldn’t get the result I wanted since I couldn’t assign the
>> right textures to the right areas. Is there a mechanism to assign the
>> texture just like we assign materials ?
>> I guess this is what you mean by “multi-texture isn’t implemented yet”. I
>> could probably extract all objects using a connectivity filter and then
>> manually assign the textures, but again it is a tedious process for complex
>> objects.
>>
>>
> Better to do it in the code. We read in all of the texture coordinates
> when we read the .obj and all of the texture files when we read the .mtl ->
> we just aren't using the right set of texture coordinates in all cases yet.
> That is most of what I mean by multitexture.
>
> Is there a roadmap as to when the multi-texture could be implemented ?
>>
>
> I'm hoping for 5.6 in a couple of months time. Although this is important
> it may very well slip because of other priorities.
>
>

In the meantime, this python programmable filter is a workaround.

pdi = self.GetInput()

pdo = self.GetOutput()

pdo.ShallowCopy(pdi)


arraynames = []

arrays = {}

for a in range(0,pdi.GetPointData().GetNumberOfArrays()):

  array = pdi.GetPointData().GetArray(a)

  if array.GetNumberOfComponents() != 2:

continue

  arrname = array.GetName()

  pdo.GetPointData().RemoveArray(arrname)

  arraynames.append(arrname)

  arrays[arrname] = array


tcoords = vtk.vtkFloatArray()

tcoords.SetName("TCoords")

tcoords.SetNumberOfComponents(2)

pdo.GetPointData().SetTCoords(tcoords)

# todo numpy this to make it 100x faster

for p in range(0, pdi.GetNumberOfPoints()):

  tcoord = [0,0]

  for arrname in arrays:

candidate = arrays[arrname].GetTuple2(p)

if candidate[0] == -1 and candidate[1] == -1:

  continue

tcoord = candidate

  tcoords.InsertNextTuple2(tcoord[0],tcoord[1])





> It would be great to have readers that can load texture/Geometry/Materials
>> files such as .obj (.mtl and .png), .fbx and .dwg.
>>
>
> Agreed.
>
>
>> Best regards,
>>
>>
>>
>> Jonathan Borduas
>>
>>
>>
>> *From:* David E DeMarle 
>> *Sent:* Friday, May 18, 2018 10:58 AM
>> *To:* Jonathan Borduas 
>> *Cc:* paraview@public.kitware.com
>> *Subject:* Re: [Paraview] OSPRay textures and materials mapping
>>
>>
>>
>> Hi Jonathan.
>>
>>
>>
>> Yes you can do that.
>>
>>
>>
>> 1) File->Load OSPRay Materials, switch the file type from "OSPRay
>> Material Files (*.json)"  to "Wavefront Material FIles (*.mtl)". That will
>> let you load all of the materials and textures. They should all show up in
>> the Material list.
>>
>>
>>
>> 2) The OSPRay Material selection (on Display section of Properties Tab
>> advanced) will have all of the individual materials listed in it + a few
>> others including "Value Indexed" which is all the way at the bottom. Choose
>> that it means "use the categorical color lookup table to decide what
>> material to use for each block and or polygon"
>>
>>
>>
>> 3) Now change the scalar array to color by to "Material Id", a cell
>> aligned array which has the material index to use for each cell.
>>
>>
>>
>> 4) Make up a categorical lookup table.
>>
>>open spreadsheet view, switch to Field Data, look at the Material
>> Names.
>>
>>open the color map editor for the "Material Id", click on Interpret
>> Values As Categories and the color will change from bluewhitered to
>> extremely YELLOW.
>>
>>add annotations, value 0 should be the name of the first entry in the
>> Material Names array.
>>
>>
>>
>> Notes:
>>
>> * I have the trivial script somewhere that I used for the SC17 demo that
>> makes up the lookup table for you. I'll try and dig that up.
>>
>> * in general it isn't a 1:1 match between mtl and ospray, in particular
>> multitextures are not yet implemented
>>
>> * along those lines, the mtl parser I whipped up
>> $PVSRC/VTK/Rendering/OSPRay/vtkMaterialLibrary::InternalParseMTL
>> recognizes a "type" extension outside of mtl that lets you bring in
>> ospray's nice materials instead of the default OBJMaterial. Glass and Metal
>> are particularly nice.
>>
>>
>>
>> At some point I'll get around to making this all automatic. Patches are
>> welcome in the meantime.
>>
>>
>>
>> good luck
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> David E DeMarle
>> Kitware, Inc.
>> Principal Engineer
>> 21 Corporate Drive
>> 
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>>
>>
>> On Fri, May 18, 2018 at 10:25 AM, Jonathan Borduas <
>> jonathan.bord...@caboma.com> wrote:
>>
>> Hi,
>>
>> I tried rendering an .obj file running OSPRay that was 

Re: [Paraview] OSPRay textures and materials mapping

2018-05-22 Thread Jonathan Borduas
Hi David,

I was able to complete all the steps. As you probably know, the step four was 
tedious.

However I couldn’t get the result I wanted since I couldn’t assign the right 
textures to the right areas. Is there a mechanism to assign the texture just 
like we assign materials ?
I guess this is what you mean by “multi-texture isn’t implemented yet”. I could 
probably extract all objects using a connectivity filter and then manually 
assign the textures, but again it is a tedious process for complex objects.

Is there a roadmap as to when the multi-texture could be implemented ? It would 
be great to have readers that can load texture/Geometry/Materials files such as 
.obj (.mtl and .png), .fbx and .dwg.

Best regards,

Jonathan Borduas

From: David E DeMarle 
Sent: Friday, May 18, 2018 10:58 AM
To: Jonathan Borduas 
Cc: paraview@public.kitware.com
Subject: Re: [Paraview] OSPRay textures and materials mapping

Hi Jonathan.

Yes you can do that.

1) File->Load OSPRay Materials, switch the file type from "OSPRay Material 
Files (*.json)"  to "Wavefront Material FIles (*.mtl)". That will let you load 
all of the materials and textures. They should all show up in the Material list.

2) The OSPRay Material selection (on Display section of Properties Tab 
advanced) will have all of the individual materials listed in it + a few others 
including "Value Indexed" which is all the way at the bottom. Choose that it 
means "use the categorical color lookup table to decide what material to use 
for each block and or polygon"

3) Now change the scalar array to color by to "Material Id", a cell aligned 
array which has the material index to use for each cell.

4) Make up a categorical lookup table.
   open spreadsheet view, switch to Field Data, look at the Material Names.
   open the color map editor for the "Material Id", click on Interpret Values 
As Categories and the color will change from bluewhitered to extremely YELLOW.
   add annotations, value 0 should be the name of the first entry in the 
Material Names array.

Notes:
* I have the trivial script somewhere that I used for the SC17 demo that makes 
up the lookup table for you. I'll try and dig that up.
* in general it isn't a 1:1 match between mtl and ospray, in particular 
multitextures are not yet implemented
* along those lines, the mtl parser I whipped up 
$PVSRC/VTK/Rendering/OSPRay/vtkMaterialLibrary::InternalParseMTL recognizes a 
"type" extension outside of mtl that lets you bring in ospray's nice materials 
instead of the default OBJMaterial. Glass and Metal are particularly nice.

At some point I'll get around to making this all automatic. Patches are welcome 
in the meantime.

good luck










David E DeMarle
Kitware, Inc.
Principal Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Fri, May 18, 2018 at 10:25 AM, Jonathan Borduas 
> wrote:
Hi,

I tried rendering an .obj file running OSPRay that was exported from PCon 
Planner Version 7.7 Patch 1. The original file is a .dwg

I used the PathThracer mode. However, attached to the .obj there is an .mtl 
file containing 50+ materials and 50+ texture (.png) files.

I didn’t find an automated way to map all polydata of the .obj with their 
respective material and texture file and rendering them using OSPRay.

It seems that I have to assign the material and texture to each polydata 
one-by-one.

Is there a feature that will automatically map the respective textures and 
materials ?
Here is the link to download the original .dwg file. 
https://www.easterngraphics.com/pcon/en/wp-content/uploads/2015/03/sample_apartment.dwg
You will need to export it to .obj using PCon Planner Version 7.7 Patch 1 with 
the File/Export/Geometry menu.
I couldn’t share the .obj  file since the size is 60mb+

Thank you

Jonathan Borduas


___
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview

___
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview


Re: [Paraview] Colormap cut planes and contour filter in an unstructured grid

2018-05-22 Thread Favre Jean
Franco

you cannot slice or isosurface a dataset made of poly-vertices, because there 
is no 3D cell.

your best bet would be to use the Point Interpolation filters (standard points 
, or SPH points). However, these filters require at least one scalar array 
attached to the points. Your data only contains a vector-valued array. If you 
decompose the vector into its 3 components, you would be able to use the Point 
Interpolators.

-
Jean/CSCS
___
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 ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview