I am trying to create a panel that use a slider to change the frame of an image volume (3D wave). This is very similar to the "Add Slider" in the Image Processing package of Igor. However I notice a very bad lag for the image display to update using my own SliderProc as shown below. On the same project, I use Igor's "Add Slider" on the same image volume displayed in a separate plot (not on a panel) and it gives a very smooth change when I move the slider. Is there anything that I might do wrong with my code?
Thanks a lot!
Function SliderProc_ImgFrame(sa) : SliderControl
STRUCT WMSliderAction &sa
switch( sa.eventCode )case -1: // control being killedbreak
default:
if( sa.eventCode &1)// value setVariable curval = sa.curval
modifyimage/W=SLP_ImgXPS_Panel_01#IX_ImgW WF01 plane=(curval)endifbreakendswitchreturn0End
For the slider's limit, I use "Slider Slider_Img limits={0,dimsize(ImgVolW,2),1}"
Your slider is slow because on each change in the displayed layer, Igor has to recompute the min and max values of the frame in order to scale the color table. You can get around that point by executing a global WaveStats for the 3D wave and then execute:
ModifyImage imageName ctab= {V_min,V_max,,0}// missing ctb to leave it unchanced.
Now Igor would use the global min and max values to compute the same scaling for all frames.
I think, the dimension slide has to go correctly from 0 but to:
dimsize(ImgVolW,2)-1
Secondly, you can write the switch and actually use the cases, something like:
As to slow, what is the dimension of the images?
best,
_sk
March 6, 2017 at 01:16 am - Permalink
Now Igor would use the global min and max values to compute the same scaling for all frames.
I hope this helps,
A.G.
WaveMetrics, Inc.
March 7, 2017 at 07:49 am - Permalink
March 7, 2017 at 08:19 am - Permalink
_SK - Thanks a lot for pointing out the mistake.
March 9, 2017 at 01:05 am - Permalink