Problem when using SpectrophotometricColorCalibration from a script

jruuth

Well-known member
When I call SpectrophotometricColorCalibration (SPCC) from a script there is a problem that when the SPCC process ends it clears the script dialog window. What is left is an empty script dialog window with only tabs and some edit field values visible. Everything else in the dialog has been removed.

I use SPCC the same way as other processes. Below is a sample code:

Code:
var P = new SpectrophotometricColorCalibration;

P.applyCalibration = true;
… rest of the initialization is removed for this example

// imgWin.mainView.beginProcess(UndoFlag_NoSwapFile);

P.executeOn(imgWin.mainView);

// imgWin.mainView.endProcess(); Error: View.endProcess(): the view is not being processed

Any idea what is wrong or am I using it incorrectly?

Jarmo
 
I have created a small test program testSPCC.js that repeats the problem. Test shows that calling SpectrophotometricColorCalibration from a script will clear script dialog. At first it looks like it works fine but when you move the cursor on top of the dialog all but the label is removed from the dialog. I have also included a TestSPCC.xisf image file that is already plate solved and can be used for testing.

The file was too large to attach here so here is a link to the zip file:

Jarmo
 
Hi @jruuth,
I can reproduce the issue, we will investigate.

Regarding the comments in the code about invoking beginProcess and endProcess, these two functions need to be invoked when you programmatically modify the imageView; an ImageView is read-only by default and needs to be switched to the editable mode by invoking beginProcess() before invoking any function that modifies it, and you need to invoke endProcess() to restore its read-only mode once you are done.

The function executeOn() handles this internally: you don't need to wrap its invocation between beginProcess / endProcess calls.
The state of the image is read-only once executeOn is terminated (it calls endProcess internally before returning), so that's why you have the error "the view is not being processed".
 
Back
Top