Slice Representation Lookup table

Dear all,

In my c++ custom application I want to set the color map of my slice representation.

I have created the representation and settled the scalar to use with this code:

drepSliceCube = builder->createDataRepresentation(fitsSource->getOutputPort(0), viewCube);
auto reprProxySliceCube = drepSliceCube->getProxy();
vtkSMPropertyHelper(reprProxySliceCube, "Representation").Set("Slice");
vtkSMPVRepresentationProxy::SetScalarColoring(reprProxySliceCube, "FITSImage", vtkDataObject::POINT);

How can I set one of the predefined color map e.g. XRay?

Thanks

I was able to solve, here the code that might be useful for someone else

vtkNew<vtkSMTransferFunctionManager> mgr;
    
    if (vtkSMProperty* lutProperty = reprProxySliceCube->GetProperty("LookupTable"))
    {
        vtkSMTransferFunctionProxy* lutProxy = vtkSMTransferFunctionProxy::SafeDownCast(
                                                                                        mgr->GetColorTransferFunction(arrayName, reprProxySliceCube->GetSessionProxyManager()));
        int rescaleMode =
        vtkSMPropertyHelper(lutProxy, "AutomaticRescaleRangeMode", true).GetAsInt();
        
        auto presets = vtkSMTransferFunctionPresets::GetInstance();
        //qDebug()<<presets->HasPreset("X Ray");
        lutProxy->ApplyPreset(presets->GetFirstPresetWithName("X Ray"), (bool)rescaleMode);
        
        vtkSMPropertyHelper(lutProperty).Set(lutProxy);
        bool extend = rescaleMode == vtkSMTransferFunctionManager::GROW_ON_APPLY;
        bool force = false;
        vtkSMPVRepresentationProxy::RescaleTransferFunctionToDataRange(reprProxySliceCube, extend, force);
        reprProxySliceCube->UpdateVTKObjects();
    }

Now I would like to be able to use a custom vtkLookupTable, how can I do?

Dear All,

can you help me setting log scale when mapping data to colors in In my c++ custom application?

Thanks

Look at code in pqColorOpacityEditorWidget::useLogScaleClicked(...), it pretty much goes through the steps needed to enable/disable log scaling.

ref: https://gitlab.kitware.com/paraview/paraview/-/blob/master/Qt/ApplicationComponents/pqColorOpacityEditorWidget.cxx#L910

Thanks, I realized that is quite easy to enable the log scaling:

        vtkSMPropertyHelper(lutProxy, "UseLogScale").Set(1);