[prev in list] [next in list] [prev in thread] [next in thread]
List: paraview
Subject: Re: [Paraview] python changes 4.0/4.1 to 4.3?
From: Dan Lipsa <dan.lipsa () kitware ! com>
Date: 2015-08-31 18:23:56
Message-ID: CADwGrVpQx29aBR1Ehc2c=DGTu3H06v=Lg6VMAfRBrZFvza1PoQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Anton,
I think the relevant change in ParaView 4.3 is that it now colors data
resulted from a threshold operation using the default color map. This makes
sense as you may see data with different values within a given threshold.
(this is not the case in your particular case).
This is why your DiffuseColor settings have no effect.
If you want to color you threshold data with a plain color as you have done
in the past you have to add
ColorBy(DataRepresentationX, None) after you set
DataRepresentationx.DifuseColor = ...
Where X is 2, 3 and 4.
Dan
On Tue, Jun 9, 2015 at 2:40 PM, Anton Shterenlikht <mexas@bris.ac.uk> wrote:
> There is no error, just instead of the requested colours:
>
> DataRepresentation2.DiffuseColor = [ 1, 0, 1 ] <- purple
> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0] <- yellow
> DataRepresentation4.DiffuseColor = [0.0, 1.0, 0.5] <- greenish
>
> I get red and blue.
>
> The colours I had with pv 4.0/4.1 can be seen here:
> http://eis.bris.ac.uk/~mexas/cgpack/201502res/cr.png
> http://eis.bris.ac.uk/~mexas/cgpack/201503res/gb.png
>
> The colours I'm getting now with 4.3 (with the same script)
> can be seen here:
> http://eis.bris.ac.uk/~mexas/cgpack/201506res/cr.png
> http://eis.bris.ac.uk/~mexas/cgpack/201506res/gb.png
>
> The 2 data files I used are:
> http://eis.bris.ac.uk/~mexas/zg0.raw
> http://eis.bris.ac.uk/~mexas/zf5.raw
>
> The files are raw binary, 40MB each.
>
> I might have done something really stupid,
> in which case I apologise for wasting your time.
>
> Thanks for your help
>
> Anton
>
>
> On 09/06/2015, Utkarsh Ayachit <utkarsh.ayachit@kitware.com> wrote:
> > Anton,
> >
> > DiffuseColor still exists. Can you post the full error message that
> you're
> > getting? If you can share the dataset you're using to test this script,
> > that'll be even better!
> >
> > Utkarsh
> >
> >
> > On Mon, Jun 8, 2015 at 7:39 PM Anton Shterenlikht <mexas@bris.ac.uk>
> wrote:
> >
> >> I've a script that used to work ok on 4.0 and 4.1,
> >> but now something is wrong with the colours.
> >> Has anything changed between 4.0/4.1 to 4.3 to make
> >>
> >> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]
> >>
> >> not understood?
> >>
> >>
> >> The full script:
> >>
> >> ######################################################################72
> >> # Adjust these parameters
> >> ext1 = 220 # data extent along 1
> >> ext2 = 220 # data extent along 2
> >> ext3 = 220 # data extent along 3
> >> ffile = "zf5.raw" # fracture file
> >> gfile = "zg0.raw" # grain file
> >> imsize1 = 1000 # size, in pixels, of the resulting image along 1
> >> imsize2 = 1000 # size, in pixels, of the resulting image along 2
> >>
> >> # End of adjustable parameters
> >> ######################################################################72
> >>
> >> # define the centre of rotation (cor)
> >> cor1 = 0.5 * ext1
> >> cor2 = 0.5 * ext2
> >> cor3 = 0.5 * ext3
> >>
> >> from paraview.simple import *
> >>
> >> # the extents start from zero, so need to lower
> >> # the upper extents by 1
> >> cracks = ImageReader( FilePrefix= ffile )
> >> cracks.DataExtent=[ 0, ext1-1, 0, ext2-1, 0, ext3-1 ]
> >> cracks.DataByteOrder = 'LittleEndian'
> >> cracks.DataScalarType = 'int'
> >>
> >> RenderView1 = GetRenderView()
> >> DataRepresentation1 = Show()
> >>
> >> DataRepresentation1.Representation = 'Outline'
> >> DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5]
> >>
> >> # grain boundaries, cell state 2
> >>
> >> Threshold1 = Threshold()
> >> Threshold1.Scalars = ['POINTS', 'ImageFile']
> >> Threshold1.ThresholdRange = [ 2, 2 ]
> >> Threshold1.AllScalars = 0
> >>
> >> DataRepresentation2 = Show()
> >> DataRepresentation2.ScalarOpacityUnitDistance = 1.0
> >> DataRepresentation2.SelectionPointFieldDataArrayName = 'ImageFile'
> >> DataRepresentation2.DiffuseColor = [ 1, 0, 1 ]
> >>
> >> camera = GetActiveCamera()
> >> camera.SetViewUp(-1,0,0)
> >> camera.Azimuth(30)
> >> camera.Elevation(30)
> >>
> >> RenderView1.ResetCamera()
> >>
> >> # gradient background colour
> >> RenderView1.UseGradientBackground = 1
> >> RenderView1.Background2 = [0.0, 0.0, 0.16470588235294117]
> >> RenderView1.Background = [0.3215686274509804, 0.3411764705882353,
> >> 0.43137254901960786]
> >>
> >> RenderView1.CenterAxesVisibility = 0
> >> RenderView1.OrientationAxesVisibility = 1
> >> RenderView1.CenterOfRotation = [ cor1, cor2, cor3 ]
> >> RenderView1.CameraFocalPoint = [ cor1, cor2, cor3 ]
> >> RenderView1.ViewSize = [ imsize1, imsize2 ]
> >> RenderView1.CameraViewAngle = 30
> >>
> >> # do all crack states from the main dataset
> >> SetActiveSource( cracks )
> >>
> >> # (100) cracks
> >> cracks100 = Threshold()
> >> cracks100.Scalars = ['POINTS', 'ImageFile']
> >> cracks100.ThresholdRange = [ 0, 0 ]
> >> cracks100.AllScalars = 0
> >>
> >> DataRepresentation3 = Show()
> >> DataRepresentation3.ScalarOpacityUnitDistance = 1.0
> >> DataRepresentation3.SelectionPointFieldDataArrayName = 'ImageFile'
> >> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]
> >>
> >> # (110) cracks
> >> SetActiveSource( cracks )
> >> cracks110 = Threshold()
> >> cracks110.Scalars = ['POINTS', 'ImageFile']
> >> cracks110.ThresholdRange = [ -1, -1 ]
> >> cracks110.AllScalars = 0
> >>
> >> DataRepresentation4 = Show()
> >> DataRepresentation4.ScalarOpacityUnitDistance = 1.0
> >> DataRepresentation4.SelectionPointFieldDataArrayName = 'ImageFile'
> >> DataRepresentation4.DiffuseColor = [0.0, 1.0, 0.5]
> >>
> >> # 1 is to show, 0 not to show
> >> # data2 is GB
> >> # data3 is cracks
> >> # data4 is grains microstructure
> >>
> >> DataRepresentation2.Opacity = 0.1
> >> WriteImage( "crgb.png" )
> >>
> >> DataRepresentation2.Opacity = 1
> >> DataRepresentation3.Visibility = 0
> >> WriteImage( "gb.png" )
> >>
> >> DataRepresentation2.Visibility = 0
> >> DataRepresentation3.Visibility = 1
> >> WriteImage( "cr.png" )
> >>
> >> RenderView1.ResetCamera()
> >>
> >> Render()
> >>
> >>
> >> ****
> >>
> >> Is there anything wrong in this script for 4.3?
> >>
> >> Many thanks
> >>
> >> Anton
> >>
> >> _______________________________________________
> >> 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:
> >> http://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:
> http://public.kitware.com/mailman/listinfo/paraview
>
[Attachment #5 (text/html)]
<div dir="ltr">Anton,<div>I think the relevant change in ParaView 4.3 is that it now \
colors data resulted from a threshold operation using the default color map. This \
makes sense as you may see data with different values within a given threshold. (this \
is not the case in your particular case).</div><div><br></div><div>This is why your \
DiffuseColor settings have no effect.</div><div>If you want to color you threshold \
data with a plain color as you have done in the past you have to \
add</div><div><br></div><div>ColorBy(DataRepresentationX, None) after you set \
DataRepresentationx.DifuseColor = ...<br></div><div><br></div><div>Where X is 2, 3 \
and 4.</div><div><br></div><div>Dan</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 9, 2015 at 2:40 PM, \
Anton Shterenlikht <span dir="ltr"><<a href="mailto:mexas@bris.ac.uk" \
target="_blank">mexas@bris.ac.uk</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">There is no error, just instead of the requested colours:<br> \
<br> DataRepresentation2.DiffuseColor = [ 1, 0, 1 ] <- purple<br>
DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0] <- yellow<br>
DataRepresentation4.DiffuseColor = [0.0, 1.0, 0.5] <- greenish<br>
<br>
I get red and blue.<br>
<br>
The colours I had with pv 4.0/4.1 can be seen here:<br>
<a href="http://eis.bris.ac.uk/~mexas/cgpack/201502res/cr.png" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/cgpack/201502res/cr.png</a><br> <a \
href="http://eis.bris.ac.uk/~mexas/cgpack/201503res/gb.png" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/cgpack/201503res/gb.png</a><br> <br>
The colours I'm getting now with 4.3 (with the same script)<br>
can be seen here:<br>
<a href="http://eis.bris.ac.uk/~mexas/cgpack/201506res/cr.png" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/cgpack/201506res/cr.png</a><br> <a \
href="http://eis.bris.ac.uk/~mexas/cgpack/201506res/gb.png" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/cgpack/201506res/gb.png</a><br> <br>
The 2 data files I used are:<br>
<a href="http://eis.bris.ac.uk/~mexas/zg0.raw" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/zg0.raw</a><br> <a \
href="http://eis.bris.ac.uk/~mexas/zf5.raw" rel="noreferrer" \
target="_blank">http://eis.bris.ac.uk/~mexas/zf5.raw</a><br> <br>
The files are raw binary, 40MB each.<br>
<br>
I might have done something really stupid,<br>
in which case I apologise for wasting your time.<br>
<br>
Thanks for your help<br>
<span class="HOEnZb"><font color="#888888"><br>
Anton<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 09/06/2015, Utkarsh Ayachit <<a \
href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>> \
wrote:<br> > Anton,<br>
><br>
> DiffuseColor still exists. Can you post the full error message that \
you're<br> > getting? If you can share the dataset you're using to test \
this script,<br> > that'll be even better!<br>
><br>
> Utkarsh<br>
><br>
><br>
> On Mon, Jun 8, 2015 at 7:39 PM Anton Shterenlikht <<a \
href="mailto:mexas@bris.ac.uk">mexas@bris.ac.uk</a>> wrote:<br> ><br>
>> I've a script that used to work ok on 4.0 and 4.1,<br>
>> but now something is wrong with the colours.<br>
>> Has anything changed between 4.0/4.1 to 4.3 to make<br>
>><br>
>> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]<br>
>><br>
>> not understood?<br>
>><br>
>><br>
>> The full script:<br>
>><br>
>> ######################################################################72<br>
>> # Adjust these parameters<br>
>> ext1 = 220 # data extent along 1<br>
>> ext2 = 220 # data extent along 2<br>
>> ext3 = 220 # data extent along 3<br>
>> ffile = "zf5.raw" # fracture file<br>
>> gfile = "zg0.raw" # grain file<br>
>> imsize1 = 1000 # size, in pixels, of the resulting image along \
1<br> >> imsize2 = 1000 # size, in pixels, of the resulting image \
along 2<br> >><br>
>> # End of adjustable parameters<br>
>> ######################################################################72<br>
>><br>
>> # define the centre of rotation (cor)<br>
>> cor1 = 0.5 * ext1<br>
>> cor2 = 0.5 * ext2<br>
>> cor3 = 0.5 * ext3<br>
>><br>
>> from paraview.simple import *<br>
>><br>
>> # the extents start from zero, so need to lower<br>
>> # the upper extents by 1<br>
>> cracks = ImageReader( FilePrefix= ffile )<br>
>> cracks.DataExtent=[ 0, ext1-1, 0, ext2-1, 0, ext3-1 ]<br>
>> cracks.DataByteOrder = 'LittleEndian'<br>
>> cracks.DataScalarType = 'int'<br>
>><br>
>> RenderView1 = GetRenderView()<br>
>> DataRepresentation1 = Show()<br>
>><br>
>> DataRepresentation1.Representation = 'Outline'<br>
>> DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5]<br>
>><br>
>> # grain boundaries, cell state 2<br>
>><br>
>> Threshold1 = Threshold()<br>
>> Threshold1.Scalars = ['POINTS', 'ImageFile']<br>
>> Threshold1.ThresholdRange = [ 2, 2 ]<br>
>> Threshold1.AllScalars = 0<br>
>><br>
>> DataRepresentation2 = Show()<br>
>> DataRepresentation2.ScalarOpacityUnitDistance = 1.0<br>
>> DataRepresentation2.SelectionPointFieldDataArrayName = \
'ImageFile'<br> >> DataRepresentation2.DiffuseColor = [ 1, 0, 1 ]<br>
>><br>
>> camera = GetActiveCamera()<br>
>> camera.SetViewUp(-1,0,0)<br>
>> camera.Azimuth(30)<br>
>> camera.Elevation(30)<br>
>><br>
>> RenderView1.ResetCamera()<br>
>><br>
>> # gradient background colour<br>
>> RenderView1.UseGradientBackground = 1<br>
>> RenderView1.Background2 = [0.0, 0.0, 0.16470588235294117]<br>
>> RenderView1.Background = [0.3215686274509804, 0.3411764705882353,<br>
>> 0.43137254901960786]<br>
>><br>
>> RenderView1.CenterAxesVisibility = 0<br>
>> RenderView1.OrientationAxesVisibility = 1<br>
>> RenderView1.CenterOfRotation = [ cor1, cor2, cor3 ]<br>
>> RenderView1.CameraFocalPoint = [ cor1, cor2, cor3 ]<br>
>> RenderView1.ViewSize = [ imsize1, imsize2 ]<br>
>> RenderView1.CameraViewAngle = 30<br>
>><br>
>> # do all crack states from the main dataset<br>
>> SetActiveSource( cracks )<br>
>><br>
>> # (100) cracks<br>
>> cracks100 = Threshold()<br>
>> cracks100.Scalars = ['POINTS', 'ImageFile']<br>
>> cracks100.ThresholdRange = [ 0, 0 ]<br>
>> cracks100.AllScalars = 0<br>
>><br>
>> DataRepresentation3 = Show()<br>
>> DataRepresentation3.ScalarOpacityUnitDistance = 1.0<br>
>> DataRepresentation3.SelectionPointFieldDataArrayName = \
'ImageFile'<br> >> DataRepresentation3.DiffuseColor = [1.0, 1.0, \
0.0]<br> >><br>
>> # (110) cracks<br>
>> SetActiveSource( cracks )<br>
>> cracks110 = Threshold()<br>
>> cracks110.Scalars = ['POINTS', 'ImageFile']<br>
>> cracks110.ThresholdRange = [ -1, -1 ]<br>
>> cracks110.AllScalars = 0<br>
>><br>
>> DataRepresentation4 = Show()<br>
>> DataRepresentation4.ScalarOpacityUnitDistance = 1.0<br>
>> DataRepresentation4.SelectionPointFieldDataArrayName = \
'ImageFile'<br> >> DataRepresentation4.DiffuseColor = [0.0, 1.0, \
0.5]<br> >><br>
>> # 1 is to show, 0 not to show<br>
>> # data2 is GB<br>
>> # data3 is cracks<br>
>> # data4 is grains microstructure<br>
>><br>
>> DataRepresentation2.Opacity = 0.1<br>
>> WriteImage( "crgb.png" )<br>
>><br>
>> DataRepresentation2.Opacity = 1<br>
>> DataRepresentation3.Visibility = 0<br>
>> WriteImage( "gb.png" )<br>
>><br>
>> DataRepresentation2.Visibility = 0<br>
>> DataRepresentation3.Visibility = 1<br>
>> WriteImage( "cr.png" )<br>
>><br>
>> RenderView1.ResetCamera()<br>
>><br>
>> Render()<br>
>><br>
>><br>
>> ****<br>
>><br>
>> Is there anything wrong in this script for 4.3?<br>
>><br>
>> Many thanks<br>
>><br>
>> Anton<br>
>><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> >><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> \
>><br> >> Please keep messages on-topic and check the ParaView Wiki \
at:<br> >> <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" \
target="_blank">http://paraview.org/Wiki/ParaView</a><br> >><br>
>> Search the list archives at: <a \
href="http://markmail.org/search/?q=ParaView" rel="noreferrer" \
target="_blank">http://markmail.org/search/?q=ParaView</a><br> >><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/paraview" \
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
>><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> <br>
Visit other Kitware open-source projects at <a \
href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> <br>
Please keep messages on-topic and check the ParaView Wiki at: <a \
href="http://paraview.org/Wiki/ParaView" rel="noreferrer" \
target="_blank">http://paraview.org/Wiki/ParaView</a><br> <br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" \
rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br> <br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" \
target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br> \
</div></div></blockquote></div><br></div>
_______________________________________________
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:
http://public.kitware.com/mailman/listinfo/paraview
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic