In case anyone finds this useful, I also found a solution to a related problem.

Once I extended the previous code to import multiple VTIs, editing the 
colour/opacity mapping broke again. I could only get it to affect either one of 
the imageDatas, or all of them simultaneously.

I eventually discovered that this was due to the default name of the scalar 
points in imageDatas being hardcoded to “ImagesScalars” in VTK. ParaView 
apparently assumes that they should all have the same colour/opacity maps as a 
result. I just added 

imageData->GetPointData()->GetScalars()->SetName(“ImageScalars” + 
std::to_string(index)).c_str());

to my export code, which seems to have fixed it.

- Ross

On 24/07/2017, 12:01, "Ross Gardiner" <[email protected]> wrote:

    Hi yoshimi,
    
    Thanks – your suggestion helped me find a solution:
    
    
    opacity_map = CreatePiecewiseFunction(Points=[44.0, 0.0, 0.5, 0.0, 132.0, 
0.0, 0.5, 0.0, 154.0, 1.0, 0.5, 0.0]) 
    representation.LookupTable.ScalarOpacityFunction = opacity_map
    representation.ScalarOpacityFunction = opacity_map
    
    I believe what’s going on here is that the LookupTable editor in ParaView 
gets its data from LookupTable.ScalarOpacityFunction, while the renderer gets 
it from representation.ScalarOpacityFunction. If they’re both initialised 
separately, updating the opacity mapping in the colour map editor does not 
cause the rendering to update. If they both reference the same object, it works 
as expected.
    
    - Ross
    
    On 22/07/2017, 11:12, "kenichiro yoshimi" <[email protected]> wrote:
    
        c
    
    

_______________________________________________
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

Reply via email to