579579 set(h ,' Value' ,1 );
580580end
581581
582- % if procId was assigned and PointSourceDetectionProcess3DDynROI or TrackingDynROIProcess was selected on Overlay panel,
583- % then selected radiobutton on Image panel should be changed from Raw image to BuildDynROIProcess.
582+ %% If procId was assigned to a process on the Overlay panel, by default selected radiobutton on Image panel is Raw image.
583+ % Below is to set the selected radiobutton on Image panel from Raw image to another process, for some special processes.
584+ % Also see local function setRadioButtonForSpecialProcess and getDrawableOutput for outputNum.
585+ % Added by Qiongjing (Jenny) Zou, Oct 2019 and Oct 2024
584586if ~isempty(i )&& ~isempty(h )&& isequal(h .Style ,' checkbox' )&& isequal(imagePanel .SelectedObject .String ,' Raw image' )
585587switch class(validProc{i })
586588case {' PointSourceDetectionProcess3DDynROI' ,' TrackingDynROIProcess' }
587- BuildDynROIProcId= validProcId(cellfun(@(x ) isa(x ,' BuildDynROIProcess' ),validProc ));
588- if ~isempty(BuildDynROIProcId )
589- h2= findobj(mainFig ,' -regexp' ,' Tag' ,[' radiobutton_process' num2str(BuildDynROIProcId )' _output2.*' ]);
590- set(h2 ,' Value' ,1 );
591- else
592- set(h ,' Value' ,0 );
589+ % For u-track3D (MD.packages_ can be empty), if procId was assigned to PointSourceDetectionProcess3DDynROI or TrackingDynROIProcess on Overlay panel,
590+ % then change selected radiobutton on Image panel to BuildDynROIProcess (output 2)
591+ setRadioButtonForSpecialProcess(validProcId ,' BuildDynROIProcess' ,validProc ,mainFig ,h ,2 );
592+
593+ case {' ThresholdProcess' ,' MultiScaleAutoSegmentationProcess' ,' ExternalSegmentationProcess' , ...
594+ ' BackgroundMasksProcess' ,' MaskRefinementProcess' ,' MaskIntersectionProcess' }
595+ % For BiosensorsPackage (u-probe) (MD.packages_ can be empty), if step 3 CropShadeCorrectROIProcess is done,
596+ % and procId was assigned to step 4-6 and MaskIntersectionProcess on Overlay panel,
597+ % then change selected radiobutton on Image panel to CropShadeCorrectROIProcess (output 1)
598+ if any(cellfun(@(x ) isa(x ,' CropShadeCorrectROIProcess' ), validProc{i }.processTree_))
599+ setRadioButtonForSpecialProcess(validProcId ,' CropShadeCorrectROIProcess' ,validProc ,mainFig ,h ,1 );
593600end
594601end
595602end
603+ %%
596604
597605% Clear cache when initializing movieViewer
598606cached .load(' -clear' );
@@ -1589,4 +1597,15 @@ function movieviewerRefresher(MO)
15891597clear MD ;
15901598end
15911599end
1592- out= userData ;
1600+ out= userData ;
1601+
1602+ function setRadioButtonForSpecialProcess(validProcId ,SpecProcessClass ,validProc ,mainFig ,h ,outputNum )
1603+ % Find process ID for the given special process class
1604+ SpecProcId= validProcId(cellfun(@(x ) isa(x ,SpecProcessClass ),validProc ));
1605+ if ~isempty(SpecProcId )
1606+ % Find and select the appropriate radiobutton
1607+ h2= findobj(mainFig ,' -regexp' ,' Tag' , [' radiobutton_process' num2str(SpecProcId )' _output' num2str(outputNum )' .*' ]);
1608+ set(h2 ,' Value' ,1 );
1609+ else
1610+ set(h ,' Value' ,0 );
1611+ end