[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">&lt;<a href="mailto:mexas@bris.ac.uk" \
target="_blank">mexas@bris.ac.uk</a>&gt;</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 ]            &lt;- purple<br>
DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0] &lt;- yellow<br>
DataRepresentation4.DiffuseColor = [0.0, 1.0, 0.5] &lt;- 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&#39;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 &lt;<a \
href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>&gt; \
wrote:<br> &gt; Anton,<br>
&gt;<br>
&gt; DiffuseColor still exists. Can you post the full error message that \
you&#39;re<br> &gt; getting? If you can share the dataset you&#39;re using to test \
this script,<br> &gt; that&#39;ll be even better!<br>
&gt;<br>
&gt; Utkarsh<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Jun 8, 2015 at 7:39 PM Anton Shterenlikht &lt;<a \
href="mailto:mexas@bris.ac.uk">mexas@bris.ac.uk</a>&gt; wrote:<br> &gt;<br>
&gt;&gt; I&#39;ve a script that used to work ok on 4.0 and 4.1,<br>
&gt;&gt; but now something is wrong with the colours.<br>
&gt;&gt; Has anything changed between 4.0/4.1 to 4.3 to make<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]<br>
&gt;&gt;<br>
&gt;&gt; not understood?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; The full script:<br>
&gt;&gt;<br>
&gt;&gt; ######################################################################72<br>
&gt;&gt; # Adjust these parameters<br>
&gt;&gt; ext1      = 220              # data extent along 1<br>
&gt;&gt; ext2      = 220              # data extent along 2<br>
&gt;&gt; ext3      = 220            # data extent along 3<br>
&gt;&gt; ffile     = &quot;zf5.raw&quot; # fracture file<br>
&gt;&gt; gfile     = &quot;zg0.raw&quot;     # grain file<br>
&gt;&gt; imsize1 = 1000            # size, in pixels, of the resulting image along \
1<br> &gt;&gt; imsize2 = 1000            # size, in pixels, of the resulting image \
along 2<br> &gt;&gt;<br>
&gt;&gt; # End of adjustable parameters<br>
&gt;&gt; ######################################################################72<br>
&gt;&gt;<br>
&gt;&gt; # define the centre of rotation (cor)<br>
&gt;&gt; cor1 = 0.5 * ext1<br>
&gt;&gt; cor2 = 0.5 * ext2<br>
&gt;&gt; cor3 = 0.5 * ext3<br>
&gt;&gt;<br>
&gt;&gt; from paraview.simple import *<br>
&gt;&gt;<br>
&gt;&gt; # the extents start from zero, so need to lower<br>
&gt;&gt; # the upper extents by 1<br>
&gt;&gt; cracks = ImageReader( FilePrefix= ffile )<br>
&gt;&gt; cracks.DataExtent=[ 0, ext1-1, 0, ext2-1, 0, ext3-1 ]<br>
&gt;&gt; cracks.DataByteOrder = &#39;LittleEndian&#39;<br>
&gt;&gt; cracks.DataScalarType = &#39;int&#39;<br>
&gt;&gt;<br>
&gt;&gt; RenderView1 = GetRenderView()<br>
&gt;&gt; DataRepresentation1 = Show()<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation1.Representation = &#39;Outline&#39;<br>
&gt;&gt; DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5]<br>
&gt;&gt;<br>
&gt;&gt; # grain boundaries, cell state 2<br>
&gt;&gt;<br>
&gt;&gt; Threshold1 = Threshold()<br>
&gt;&gt; Threshold1.Scalars = [&#39;POINTS&#39;, &#39;ImageFile&#39;]<br>
&gt;&gt; Threshold1.ThresholdRange = [ 2, 2 ]<br>
&gt;&gt; Threshold1.AllScalars = 0<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation2 = Show()<br>
&gt;&gt; DataRepresentation2.ScalarOpacityUnitDistance = 1.0<br>
&gt;&gt; DataRepresentation2.SelectionPointFieldDataArrayName = \
&#39;ImageFile&#39;<br> &gt;&gt; DataRepresentation2.DiffuseColor = [ 1, 0, 1 ]<br>
&gt;&gt;<br>
&gt;&gt; camera = GetActiveCamera()<br>
&gt;&gt; camera.SetViewUp(-1,0,0)<br>
&gt;&gt; camera.Azimuth(30)<br>
&gt;&gt; camera.Elevation(30)<br>
&gt;&gt;<br>
&gt;&gt; RenderView1.ResetCamera()<br>
&gt;&gt;<br>
&gt;&gt; # gradient background colour<br>
&gt;&gt; RenderView1.UseGradientBackground = 1<br>
&gt;&gt; RenderView1.Background2 = [0.0, 0.0, 0.16470588235294117]<br>
&gt;&gt; RenderView1.Background = [0.3215686274509804, 0.3411764705882353,<br>
&gt;&gt; 0.43137254901960786]<br>
&gt;&gt;<br>
&gt;&gt; RenderView1.CenterAxesVisibility = 0<br>
&gt;&gt; RenderView1.OrientationAxesVisibility = 1<br>
&gt;&gt; RenderView1.CenterOfRotation = [ cor1, cor2, cor3 ]<br>
&gt;&gt; RenderView1.CameraFocalPoint = [ cor1, cor2, cor3 ]<br>
&gt;&gt; RenderView1.ViewSize = [ imsize1, imsize2 ]<br>
&gt;&gt; RenderView1.CameraViewAngle = 30<br>
&gt;&gt;<br>
&gt;&gt; # do all crack states from the main dataset<br>
&gt;&gt; SetActiveSource( cracks )<br>
&gt;&gt;<br>
&gt;&gt; # (100) cracks<br>
&gt;&gt; cracks100 = Threshold()<br>
&gt;&gt; cracks100.Scalars = [&#39;POINTS&#39;, &#39;ImageFile&#39;]<br>
&gt;&gt; cracks100.ThresholdRange = [ 0, 0 ]<br>
&gt;&gt; cracks100.AllScalars = 0<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation3 = Show()<br>
&gt;&gt; DataRepresentation3.ScalarOpacityUnitDistance = 1.0<br>
&gt;&gt; DataRepresentation3.SelectionPointFieldDataArrayName = \
&#39;ImageFile&#39;<br> &gt;&gt; DataRepresentation3.DiffuseColor = [1.0, 1.0, \
0.0]<br> &gt;&gt;<br>
&gt;&gt; # (110) cracks<br>
&gt;&gt; SetActiveSource( cracks )<br>
&gt;&gt; cracks110 = Threshold()<br>
&gt;&gt; cracks110.Scalars = [&#39;POINTS&#39;, &#39;ImageFile&#39;]<br>
&gt;&gt; cracks110.ThresholdRange = [ -1, -1 ]<br>
&gt;&gt; cracks110.AllScalars = 0<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation4 = Show()<br>
&gt;&gt; DataRepresentation4.ScalarOpacityUnitDistance = 1.0<br>
&gt;&gt; DataRepresentation4.SelectionPointFieldDataArrayName = \
&#39;ImageFile&#39;<br> &gt;&gt; DataRepresentation4.DiffuseColor = [0.0, 1.0, \
0.5]<br> &gt;&gt;<br>
&gt;&gt; # 1 is to show, 0 not to show<br>
&gt;&gt; # data2 is GB<br>
&gt;&gt; # data3 is cracks<br>
&gt;&gt; # data4 is grains microstructure<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation2.Opacity = 0.1<br>
&gt;&gt; WriteImage( &quot;crgb.png&quot; )<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation2.Opacity = 1<br>
&gt;&gt; DataRepresentation3.Visibility = 0<br>
&gt;&gt; WriteImage( &quot;gb.png&quot; )<br>
&gt;&gt;<br>
&gt;&gt; DataRepresentation2.Visibility = 0<br>
&gt;&gt; DataRepresentation3.Visibility = 1<br>
&gt;&gt; WriteImage( &quot;cr.png&quot; )<br>
&gt;&gt;<br>
&gt;&gt; RenderView1.ResetCamera()<br>
&gt;&gt;<br>
&gt;&gt; Render()<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ****<br>
&gt;&gt;<br>
&gt;&gt; Is there anything wrong in this script for 4.3?<br>
&gt;&gt;<br>
&gt;&gt; Many thanks<br>
&gt;&gt;<br>
&gt;&gt; Anton<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" rel="noreferrer" \
target="_blank">www.kitware.com</a><br> &gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" \
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br> \
&gt;&gt;<br> &gt;&gt; Please keep messages on-topic and check the ParaView Wiki \
at:<br> &gt;&gt; <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" \
target="_blank">http://paraview.org/Wiki/ParaView</a><br> &gt;&gt;<br>
&gt;&gt; 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> &gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://public.kitware.com/mailman/listinfo/paraview" \
rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
 &gt;&gt;<br>
&gt;<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