Andrei,

Here you go.

It is actually quite simple :
 - Open ParaView
 - Open Your file, Apply
 - Add a ressample with Image
 - Sampling Dimensions : 200 1 200
 - Apply



Mathieu Westphal

On Fri, Apr 13, 2018 at 12:04 PM, Andrei Cimpoeru <
andrei.cimpo...@cfms.org.uk> wrote:

> Mathieu,
>
> Thanks a lot. When I load your .pvsm Paraview 5.4.1 crashes .Could you
> export the state as .py instead of .pvsm?
>
> Thanks a lot
>
> On Fri, Apr 13, 2018 at 10:56 AM, Mathieu Westphal <
> mathieu.westp...@kitware.com> wrote:
>
>> Andrei,
>>
>> I'm able to generate valid results with the attached state file (use
>> File->Load State to test it)
>> Make sure to set the Sampling Dimensions correctly.
>>
>> Best,
>>
>> Mathieu Westphal
>>
>> On Fri, Apr 13, 2018 at 11:44 AM, Andrei Cimpoeru <
>> andrei.cimpo...@cfms.org.uk> wrote:
>>
>>> Mathiew,
>>>
>>>
>>> Thanks a lot. That was very helpful.
>>> However when I use Resample to Image Filter it looks like my information
>>> is lost. I have attached the dataset so you can have a look.
>>>
>>> Best,
>>>
>>> Andrei
>>>
>>>
>>> On Fri, Apr 13, 2018 at 9:38 AM, Mathieu Westphal <
>>> mathieu.westp...@kitware.com> wrote:
>>>
>>>> Dear Andrei,
>>>>
>>>> Yes, the "Resample To Image" Filter is dedicated to this task. It will
>>>> allow convert you Unstructured Grid to a regular Image Data and allow you
>>>> to save your data as a .vti file.
>>>>
>>>> Best,
>>>>
>>>> Mathieu Westphal
>>>>
>>>> On Fri, Apr 13, 2018 at 10:35 AM, Andrei Cimpoeru <
>>>> andrei.cimpo...@cfms.org.uk> wrote:
>>>>
>>>>> Dear Mathiew/David,
>>>>>
>>>>>
>>>>> Thanks a lot for you guidance. That was very helpful.
>>>>> I have seen that you also support VTI. I had a look at the structure
>>>>> of the format and it seems that this is a structured/rectilinear grid. The
>>>>> data that I am woking with right now is unstructured .pvd.
>>>>> Is there are way in Paraview to project/sample my unstructured dataset
>>>>> to a rectiliniar/structured grid so then I can export it to .VTI format?
>>>>>
>>>>> Many thanks and I am looking forward to hear from you.
>>>>>
>>>>> Best,
>>>>>
>>>>> Andrei
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Apr 12, 2018 at 4:22 PM, David E DeMarle <
>>>>> dave.dema...@kitware.com> wrote:
>>>>>
>>>>>> You can export to cinema to get rendered images for which the data at
>>>>>> each pixel in the image is a floating point value not a color.
>>>>>>
>>>>>> David E DeMarle
>>>>>> Kitware, Inc.
>>>>>> Principal Engineer
>>>>>> 21 Corporate Drive
>>>>>> <https://maps.google.com/?q=21+Corporate+Drive+Clifton+Park,+NY+12065&entry=gmail&source=g>
>>>>>> Clifton Park, NY 12065
>>>>>> <https://maps.google.com/?q=21+Corporate+Drive+Clifton+Park,+NY+12065&entry=gmail&source=g>
>>>>>> -8662
>>>>>> Phone: 518-881-4909
>>>>>>
>>>>>> On Thu, Apr 12, 2018 at 11:13 AM, Mathieu Westphal <
>>>>>> mathieu.westp...@kitware.com> wrote:
>>>>>>
>>>>>>> Hello
>>>>>>>
>>>>>>> Please keep the ML in the cc so everyone can provide.
>>>>>>>
>>>>>>> You should be able to do that in the python shell.
>>>>>>>
>>>>>>> Views->Python Shell
>>>>>>>
>>>>>>> s = GetActiveSource()
>>>>>>> r=Show(s)
>>>>>>> l=r.LookupTable
>>>>>>> l.RGBPoints
>>>>>>>
>>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> Mathieu Westphal
>>>>>>>
>>>>>>> On Thu, Apr 12, 2018 at 3:14 PM, Andrei Cimpoeru <
>>>>>>> andrei.cimpo...@cfms.org.uk> wrote:
>>>>>>>
>>>>>>>> Dear Mathieu,
>>>>>>>>
>>>>>>>> Please see the attached picture. I think that I can see a way to
>>>>>>>> get back to the original data. Is there a change to access the table 
>>>>>>>> with
>>>>>>>> the *Color Transfer Function Values?*
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Andrei
>>>>>>>>
>>>>>>>> On Thu, Apr 12, 2018 at 2:10 PM, Mathieu Westphal <
>>>>>>>> mathieu.westp...@kitware.com> wrote:
>>>>>>>>
>>>>>>>>> Dear Andrei
>>>>>>>>>
>>>>>>>>> There is no way to guess the pressure values with only the RGB
>>>>>>>>> data. One can only guess the range and the color map used for 
>>>>>>>>> generating
>>>>>>>>> the image.
>>>>>>>>> You will need to find the original data.
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>>
>>>>>>>>> Mathieu Westphal
>>>>>>>>>
>>>>>>>>> On Thu, Apr 12, 2018 at 2:59 PM, Andrei Cimpoeru <
>>>>>>>>> andrei.cimpo...@cfms.org.uk> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hi Mathieu,
>>>>>>>>>>
>>>>>>>>>> Thanks for getting back to me. Let's say that I have the image
>>>>>>>>>> below (attached). If you load it in Paraview  you have a vector 
>>>>>>>>>> field of
>>>>>>>>>> PNG consisting of RGB values. How do I turn these values back to 
>>>>>>>>>> pressure.
>>>>>>>>>> I am interested in this because I want to map the RGB colors back
>>>>>>>>>> to pressure field. Is there any way to this using vtk-python?
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Andrei
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, Apr 12, 2018 at 12:00 PM, Mathieu Westphal <
>>>>>>>>>> mathieu.westp...@kitware.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Dear Andrei,
>>>>>>>>>>>
>>>>>>>>>>> I'm not sure to follow what your are trying to achieve. Please
>>>>>>>>>>> explain again.
>>>>>>>>>>>
>>>>>>>>>>> In any case, the mapping between the pressure and the RGB values
>>>>>>>>>>> you see in paraview is controlled by
>>>>>>>>>>> the Color Map Editor and the range of the data. All these tools
>>>>>>>>>>> are accessible in the Toolbar visible in the attached image, I've
>>>>>>>>>>> highligthed the Color Editor button.
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Mathieu Westphal
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Apr 12, 2018 at 12:28 PM, Andrei Cimpoeru <
>>>>>>>>>>> andrei.cimpo...@cfms.org.uk> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi ,
>>>>>>>>>>>>
>>>>>>>>>>>> I am currently working with Paraview  and deep learning models.
>>>>>>>>>>>> I have created a set of images (.png) using Paraview. The images 
>>>>>>>>>>>> are
>>>>>>>>>>>> related to the pressure field around a wing. When I load images 
>>>>>>>>>>>> back to
>>>>>>>>>>>> Paraview all I can visualise are the RGB  values.
>>>>>>>>>>>> *When the image are exported from Paraview the pressure field
>>>>>>>>>>>> is transferred into RGB values. Is there a way to obtain the 
>>>>>>>>>>>> function that
>>>>>>>>>>>> does that?*
>>>>>>>>>>>> Instead of exporting to .png a data format that I like is the
>>>>>>>>>>>> .vti. This format keep the current information about pressure, 
>>>>>>>>>>>> velocity,
>>>>>>>>>>>> mach number etc. Is there something that I could export a slice  
>>>>>>>>>>>> to .vti?
>>>>>>>>>>>>
>>>>>>>>>>>>  Many thanks and I am looking forward to hear from you.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>
>>>>>>>>>>>> Andrei
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> *Andrei Cimpoeru* // CFD Engineer
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>>>>>>>>>>>>
>>>>>>>>>>>> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
>>>>>>>>>>>> www.cfms.org.uk
>>>>>>>>>>>> CFMS Services Ltd // Bristol & Bath Science Park // Dirac
>>>>>>>>>>>> Crescent // Emersons Green // Bristol // BS16 7FR
>>>>>>>>>>>>
>>>>>>>>>>>> CFMS Services Ltd is registered in England and Wales No
>>>>>>>>>>>> 05742022 - a subsidiary of CFMS Ltd
>>>>>>>>>>>> CFMS Services Ltd registered office // 43 Queens Square //
>>>>>>>>>>>> Bristol // BS1 4QP
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> 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
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Andrei Cimpoeru* // CFD Engineer
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>>>>>>>>>>
>>>>>>>>>> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
>>>>>>>>>> www.cfms.org.uk
>>>>>>>>>> CFMS Services Ltd // Bristol & Bath Science Park // Dirac
>>>>>>>>>> Crescent // Emersons Green // Bristol // BS16 7FR
>>>>>>>>>>
>>>>>>>>>> CFMS Services Ltd is registered in England and Wales No 05742022
>>>>>>>>>> - a subsidiary of CFMS Ltd
>>>>>>>>>> CFMS Services Ltd registered office // 43 Queens Square //
>>>>>>>>>> Bristol // BS1 4QP
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Andrei Cimpoeru* // CFD Engineer
>>>>>>>>
>>>>>>>>
>>>>>>>> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>>>>>>>>
>>>>>>>> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
>>>>>>>> www.cfms.org.uk
>>>>>>>> CFMS Services Ltd // Bristol & Bath Science Park // Dirac Crescent
>>>>>>>> // Emersons Green // Bristol // BS16 7FR
>>>>>>>>
>>>>>>>> CFMS Services Ltd is registered in England and Wales No 05742022 -
>>>>>>>> a subsidiary of CFMS Ltd
>>>>>>>> CFMS Services Ltd registered office // 43 Queens Square // Bristol
>>>>>>>> // BS1 4QP
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Andrei Cimpoeru* // CFD Engineer
>>>>>
>>>>>
>>>>> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>>>>>
>>>>> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
>>>>> www.cfms.org.uk
>>>>> CFMS Services Ltd // Bristol & Bath Science Park // Dirac Crescent // 
>>>>> Emersons
>>>>> Green // Bristol // BS16 7FR
>>>>>
>>>>> CFMS Services Ltd is registered in England and Wales No 05742022 - a
>>>>> subsidiary of CFMS Ltd
>>>>> CFMS Services Ltd registered office // 43 Queens Square // Bristol //
>>>>> BS1 4QP
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> *Andrei Cimpoeru* // CFD Engineer
>>>
>>>
>>> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>>>
>>> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
>>> www.cfms.org.uk
>>> CFMS Services Ltd // Bristol & Bath Science Park // Dirac Crescent // 
>>> Emersons
>>> Green // Bristol // BS16 7FR
>>>
>>> CFMS Services Ltd is registered in England and Wales No 05742022 - a
>>> subsidiary of CFMS Ltd
>>> CFMS Services Ltd registered office // 43 Queens Square // Bristol //
>>> BS1 4QP
>>>
>>
>>
>
>
> --
> *Andrei Cimpoeru* // CFD Engineer
>
>
> <https://cfms.org.uk/news-events/events/2018/july/farnborough-international-airshow-2018/>
>
> *e: *andrei.cimpo...@cfms.org.uk   *t*: 0117 906 1106   *w: *
> www.cfms.org.uk
> CFMS Services Ltd // Bristol & Bath Science Park // Dirac Crescent // Emersons
> Green // Bristol // BS16 7FR
>
> CFMS Services Ltd is registered in England and Wales No 05742022 - a
> subsidiary of CFMS Ltd
> CFMS Services Ltd registered office // 43 Queens Square // Bristol // BS1
> 4QP
>
# state file generated using paraview version 5.5.0-206-g73d5c95312

# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------

# trace generated using paraview version 5.5.0-206-g73d5c95312

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# Create a new 'Render View'
renderView1 = CreateView('RenderView')
renderView1.ViewSize = [1217, 856]
renderView1.AxesGrid = 'GridAxes3DActor'
renderView1.CenterOfRotation = [0.431870579719543, 0.5, 0.0]
renderView1.StereoType = 0
renderView1.CameraPosition = [0.5429196219708822, -5.791047154022987, 0.9226821787210124]
renderView1.CameraFocalPoint = [0.43187057971954296, 0.5000000000000012, 2.0273807362889293e-16]
renderView1.CameraViewUp = [0.9996944178696862, 0.019814320444382676, 0.01478051370949686]
renderView1.CameraParallelScale = 1.64591308359498
renderView1.Background = [0.32, 0.34, 0.43]

# init the 'GridAxes3DActor' selected for 'AxesGrid'
renderView1.AxesGrid.XTitleFontFile = ''
renderView1.AxesGrid.YTitleFontFile = ''
renderView1.AxesGrid.ZTitleFontFile = ''
renderView1.AxesGrid.XLabelFontFile = ''
renderView1.AxesGrid.YLabelFontFile = ''
renderView1.AxesGrid.ZLabelFontFile = ''

# ----------------------------------------------------------------
# restore active view
SetActiveView(renderView1)
# ----------------------------------------------------------------

# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------

# create a new 'XML Unstructured Grid Reader'
testvtu = XMLUnstructuredGridReader(FileName=['/home/glow/Downloads/test.vtu'])
testvtu.PointArrayStatus = ['yplus', 'cf', 'zone', 'V', 'p', 'T', 'rho', 'cp', 'mach']

# create a new 'Resample To Image'
resampleToImage1 = ResampleToImage(Input=testvtu)
resampleToImage1.SamplingDimensions = [200, 1, 200]
resampleToImage1.SamplingBounds = [-1.13625884056091, 2.0, 0.5, 0.5, -0.5, 0.5]

# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------

# show data from resampleToImage1
resampleToImage1Display = Show(resampleToImage1, renderView1)

# get color transfer function/color map for 'yplus'
yplusLUT = GetColorTransferFunction('yplus')
yplusLUT.RGBPoints = [0.0, 0.231373, 0.298039, 0.752941, 41066.08984375, 0.865003, 0.865003, 0.865003, 82132.1796875, 0.705882, 0.0156863, 0.14902]
yplusLUT.ScalarRangeInitialized = 1.0

# get opacity transfer function/opacity map for 'yplus'
yplusPWF = GetOpacityTransferFunction('yplus')
yplusPWF.Points = [0.0, 0.0, 0.5, 0.0, 82132.1796875, 1.0, 0.5, 0.0]
yplusPWF.ScalarRangeInitialized = 1

# trace defaults for the display properties.
resampleToImage1Display.Representation = 'Surface'
resampleToImage1Display.ColorArrayName = ['POINTS', 'yplus']
resampleToImage1Display.LookupTable = yplusLUT
resampleToImage1Display.OSPRayScaleArray = 'yplus'
resampleToImage1Display.OSPRayScaleFunction = 'PiecewiseFunction'
resampleToImage1Display.SelectOrientationVectors = 'cf'
resampleToImage1Display.ScaleFactor = 0.313625884056091
resampleToImage1Display.SelectScaleArray = 'yplus'
resampleToImage1Display.GlyphType = 'Arrow'
resampleToImage1Display.GlyphTableIndexArray = 'yplus'
resampleToImage1Display.GaussianRadius = 0.0156812942028046
resampleToImage1Display.SetScaleArray = ['POINTS', 'yplus']
resampleToImage1Display.ScaleTransferFunction = 'PiecewiseFunction'
resampleToImage1Display.OpacityArray = ['POINTS', 'yplus']
resampleToImage1Display.OpacityTransferFunction = 'PiecewiseFunction'
resampleToImage1Display.DataAxesGrid = 'GridAxesRepresentation'
resampleToImage1Display.SelectionCellLabelFontFile = ''
resampleToImage1Display.SelectionPointLabelFontFile = ''
resampleToImage1Display.PolarAxes = 'PolarAxesRepresentation'
resampleToImage1Display.ScalarOpacityUnitDistance = 0.0313835142370417
resampleToImage1Display.ScalarOpacityFunction = yplusPWF
resampleToImage1Display.IsosurfaceValues = [40832.48046875]

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
resampleToImage1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 82132.1796875, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
resampleToImage1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 82132.1796875, 1.0, 0.5, 0.0]

# init the 'GridAxesRepresentation' selected for 'DataAxesGrid'
resampleToImage1Display.DataAxesGrid.XTitleFontFile = ''
resampleToImage1Display.DataAxesGrid.YTitleFontFile = ''
resampleToImage1Display.DataAxesGrid.ZTitleFontFile = ''
resampleToImage1Display.DataAxesGrid.XLabelFontFile = ''
resampleToImage1Display.DataAxesGrid.YLabelFontFile = ''
resampleToImage1Display.DataAxesGrid.ZLabelFontFile = ''

# init the 'PolarAxesRepresentation' selected for 'PolarAxes'
resampleToImage1Display.PolarAxes.PolarAxisTitleFontFile = ''
resampleToImage1Display.PolarAxes.PolarAxisLabelFontFile = ''
resampleToImage1Display.PolarAxes.LastRadialAxisTextFontFile = ''
resampleToImage1Display.PolarAxes.SecondaryRadialAxesTextFontFile = ''

# setup the color legend parameters for each legend in this view

# get color legend/bar for yplusLUT in view renderView1
yplusLUTColorBar = GetScalarBar(yplusLUT, renderView1)
yplusLUTColorBar.Title = 'yplus'
yplusLUTColorBar.ComponentTitle = ''
yplusLUTColorBar.TitleFontFile = ''
yplusLUTColorBar.LabelFontFile = ''

# set color bar visibility
yplusLUTColorBar.Visibility = 1

# show color legend
resampleToImage1Display.SetScalarBarVisibility(renderView1, True)

# ----------------------------------------------------------------
# setup color maps and opacity mapes used in the visualization
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------

# ----------------------------------------------------------------
# finally, restore active source
SetActiveSource(None)
# ----------------------------------------------------------------
_______________________________________________
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

Reply via email to