Snapshot¶
- class controllers.Snapshot¶
Bases:
handleSNAPSHOT - Controller for the Snapshot dialog.
Makes snapshots of the currently shown image in MIB. Supports saving to file or clipboard, various formats (TIF, JPG, PNG, BMP), scale bars, split channels, and ROI/shown area cropping.
- Constructor Summary
- Snapshot(mibModel, varargin)¶
SNAPSHOT - Constructor for the Snapshot controller.
- Syntax:
controller = controllers.Snapshot(mibModel) controller = controllers.Snapshot(mibModel, extraController) controller = controllers.Snapshot(mibModel, [], BatchOpt)
- Parameters:¶
instance (
**mibModel** - handle to the MibModel)* (
**BatchOpt**)*
- Property Summary
- BatchOpt¶
pixSize the Width/Height fields were last computed from; a voxel-size change alters the aspect ratio of the output, so axesLimitsChanged_Callback recomputes them
- dimsPixSize¶
width adjusted for aspect ratio
- extraController¶
cell array of listener handles
- listener¶
handle to the view (core.ChildView)
- mibController¶
handle to MibModel
- mibModel¶
- origHeight¶
optional handle to extra controller (volume viewer)
- origWidth¶
original height of the image area
- resizedWidth¶
original width of the image area
- view¶
handle to MibController (for modifier keys)
- Method Summary
- FileFormatTabGroup_Callback()¶
FILEFORMATTABGROUP_CALLBACK - Sync format dropdown and filename when a tab is clicked directly.
- FileFormat_Callback()¶
FILEFORMAT_CALLBACK - Switch format tab and update filename extension.
- Height_Callback()¶
HEIGHT_CALLBACK - Update width to maintain aspect ratio when height changes.
- SplitChannels_Callback()¶
SPLITCHANNELS_CALLBACK - Enable/disable split channel controls.
- static ViewListner_Callback2(src, evnt)¶
VIEWLISTNER_CALLBACK2 - Standard listener callback with validity guard.
- Width_Callback()¶
WIDTH_CALLBACK - Update height to maintain aspect ratio when width changes.
- addCallbacks()¶
ADDCALLBACKS - Wire essential callbacks (CloseRequestFcn only). Other callbacks are wired in the .mlapp by the user.
- axesLimitsChanged_Callback()¶
AXESLIMITSCHANGED_CALLBACK - Update dimensions when the shown area or the voxel size changes.
Fired by MibController.listener_updateDatasetAxes after zoom, resize and fit, and also after a voxel-size change (MibRibbon.updateVoxelSizes, scalebar_Callback). With the shown area the output size follows the view; otherwise it is recomputed only when the voxel size differs from the one the fields were computed from, so a size typed by the user is not reset by every zoom.
- binCheck_Callback()¶
update buttons bin/mag buttons
- binMagButtons_Callback(hObject, event)¶
calculate new width/height of the dataset depending on the pressed button and its text
- closeWindow()¶
CLOSEWINDOW - Close the Snapshot dialog and clean up.
- crop_Callback()¶
CROP_CALLBACK - Update dimensions based on crop mode selection.
- help()¶
show help
- measurementsOptions_Callback()¶
MEASUREMENTSOPTIONS_CALLBACK - Update measurement visualization settings.
- measurements_Callback()¶
enable or disable rendering of measurements on the snapshot
- outputDir_Callback()¶
OUTPUTDIR_CALLBACK - Validate and update the output filename.
- returnBatchOpt(BatchOptOut)¶
RETURNBATCHOPT - Return BatchOpt structure via SyncBatch event.
- scalebar_Callback()¶
SCALEBAR_CALLBACK - Enable scale bar and verify pixel size.
- selectFileBtn_Callback()¶
SELECTFILEBTN_CALLBACK - Open a file save dialog for the snapshot.
- snapshotBtn_Callback(useBatchMode)¶
SNAPSHOTBTN_CALLBACK - Generate and save (or copy to clipboard) the snapshot image.
- Syntax:
obj.snapshotBtn_Callback() obj.snapshotBtn_Callback(useBatchMode)
Builds an RGB image from the current dataset slice using the settings in
obj.BatchOpt(crop mode, output dimensions, scale bar, LUT, …) and either saves it to disk or copies it to the system clipboard.BigData pyramid-level selection - for BigData datasets (OME-Zarr / WSI), the function selects the finest pyramid level whose native resolution still covers the requested output size, avoiding loading the full-resolution image into memory before resize:
'ShownArea'- fetches atdataset.magFactor(current viewport resolution).'FullImage'- selects the coarsest levelLwherelevelScaleFactors(L) ≤ min(fullW/newW, fullH/newH).'ROI'- same formula usingobj.origWidth/obj.origHeight(ROI extent in full-res pixels set bycrop_Callback); the ROI bounding box is divided bylevelScaleFactors(L)beforeimcrop.
Scale bar correction -
utils.addScaleBarexpectsscale = newWidth / fullResWidth. For a downsampled pyramid level the rawnewWidth / size(img,2)ratio is too large, so the correct value is computed frompyramid.levelImageSizes(1,2)(FullImage),scale / magFactor(ShownArea), ornewWidth / obj.origWidth(ROI). ZX / ZY orientations are unaffected because the Z dimension is never pyramided.- Input Arguments:
useBatchMode (optional) - [logical]
1= run silently (no GUI button flash), used when called from batch processing. Default:0.
Example 1 - interactive snapshot triggered by the Snapshot button:
obj.snapshotBtn_Callback();Example 2 - batch-mode: save a 2048 × 2048 PNG of the full image:
obj.BatchOpt.Crop{1} = 'FullImage'; obj.BatchOpt.Width{1} = 2048; obj.BatchOpt.Height{1} = 2048; obj.BatchOpt.FileFormat{1} = 'PNG'; obj.BatchOpt.Destination{1} = 'File'; obj.snapshotBtn_Callback(1);
- updateBatchOptFromGUI(hObject, ~)¶
UPDATEBATCHOPTFROMGUI - Update BatchOpt from GUI widget value.
- updateCropMode()¶
update the crop mode for the snapshot
- updateDestination()¶
update destination for the snapshot
- updateRoiIndex()¶
updateRoiIndex - Update shown ROI selection.
- updateWidgets()¶
UPDATEWIDGETS - Refresh all widgets to match the current dataset state.
- updateWidthHeight()¶
UPDATEWIDTHHEIGHT - Update width/height fields for the snapshot.