Conversation
- New qc.smk with 5 QC rules: qc_intensity_histogram, qc_segmentation_overview, qc_zprofile, qc_objectstats, qc_roi_summary - New Python scripts for each QC rule - Add all_qc target rule to Snakefile and include it in all_participant - All PNGs written to 'qc' datatype directory for each subject Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/79447efe-f339-4deb-a3b4-6d9823ac5ccd Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
|
@copilot: the segslice overlay needs to have the aspect ratio scaled accordingly by voxel dimensions, or use the downsample_near_isotropic arg with from_ome_zarr.. also, need to have another output png similar to this, but zoomed in and cropped, so full detail can be seen, ideally montage across multiple ROIs. this visualization can be done identically for the vessels mask as well, i.e. not just the stains_for_seg |
- qc_segmentation_overview.py: replace aspect='auto' with physically correct aspect ratio computed from NIfTI header voxel dimensions (_slice_aspect helper for axial/coronal/sagittal orientations) - qc_segmentation_roi_zoom.py: new script; crops SPIM+fieldfrac to each atlas ROI bounding box, shows best axial slice with overlay and correct aspect ratio - qc.smk: add qc_vessels_overview (vessel fieldfrac, vesselslices.png), qc_segmentation_roi_zoom (roimontage.png), qc_vessels_roi_zoom (vesselroimontage.png) - Snakefile: add vessel overview + seg/vessel ROI zooms to all_qc Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/5069de35-e796-4137-9dfe-cbaa8a4d880e Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Addressed in commit
|
|
@copilot I have modified the qc_segmentaton_roi_zoom to make use of ZarrNii and ZarrNiiAtlas so that full-res images can be generated. update the rest of the high-res plotting functions to also use ZarrNii and ZarrNii atlas, including the vessel segmentaiton plotting. |
- qc_segmentation_overview.py: replace nibabel NIfTI loading with ZarrNii.from_ome_zarr() (downsample_near_isotropic=True); use get_zooms() for aspect ratio; import scipy.ndimage.zoom at top - qc.smk qc_segmentation_overview: inputs now spim (OME-Zarr) + mask.ozx at segmentation_level; add level/mask_level/zarrnii_kwargs params; increase threads/mem_mb to match histogram rule - qc.smk qc_vessels_overview: same changes, datatype='vessels' mask - qc.smk qc_vessels_roi_zoom: update to same ZarrNii pattern as qc_segmentation_roi_zoom (OME-Zarr + mask.ozx + dseg_nii); add level param; increase threads/mem_mb Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/ebb6ebb2-5a93-4243-ac48-35628311ecb3 Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Done in commit
|
|
@copilot: one final edit, the intensity histograms that are linearly scaled in y have the max x and max y set too high perhaps use a percentile to set the bounds instead. |
- lin_xlim: cap at p99_val * 1.05 instead of last non-zero bin - lin_ylim: cap at max count within the visible x range * 1.05 so the distribution body is visible, not dominated by a spike - log and CDF panels keep the existing disp_max bounds Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/7db49e48-7c6c-4c09-b466-650c2ca2aef3 Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Done in commit For the linear histogram panel:
The log-scale and CDF panels keep the existing |
|
@copilot: final fix, for any instance-level analyses (e.g. roisummary etc) always start by dropping all the instances with atlas label 0 (background), as these are outside the brain and shouldn't be used |
Background regions (index == 0) are outside the brain and should be excluded from the per-ROI summary bar charts. Agent-Logs-Url: https://github.com/khanlab/SPIMquant/sessions/e1add057-49be-45a2-8dbf-1e8d402fd215 Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Done in commit |
right now only seg=coarse uses custom setting..
Adds a new
qc.smkrules module that generates per-subject, per-channel PNG quality-control figures covering the major QC categories described in the issue. All outputs land in theqcBIDS datatype directory.New rules (
spimquant/workflow/rules/qc.smk)qc_intensity_histogramqc_segmentation_overviewmask.ozxat segmentation levelZarrNii.get_zooms()qc_vessels_overviewmask.ozxat segmentation levelvesselslices.png)qc_segmentation_roi_zoommask.ozx+ atlas dseg NIfTI (subject space) + label TSVZarrNii/ZarrNiiAtlas: best axial slice with overlay (roimontage.png)qc_vessels_roi_zoommask.ozx+ atlas dseg NIfTI (subject space) + label TSVvesselroimontage.png)qc_zprofileqc_objectstatsqc_roi_summaryWorkflow integration (
Snakefile)all_qctarget rule — intensity histograms always; segmentation-dependent outputs gated ondo_seg; vessel outputs gated ondo_vesselsrules.all_qc.inputadded toall_participantso QC runs by defaultinclude: "rules/qc.smk"appended alongside existing rule includesScripts (
spimquant/workflow/scripts/)Six new scripts following the established snakemake-script pattern — access inputs/outputs/wildcards/params via the
snakemakeobject, usematplotlibwith theaggbackend, and leveragezarrnii/pandasas appropriate:qc_intensity_histogram.py— linear-scale histogram panel uses percentile-based axis bounds: x-axis capped at the 99th-percentile intensity (+ 5 % headroom) and y-axis capped at the tallest bar within that visible range, preventing long empty tails and background spikes from obscuring the distribution body; log-scale and CDF panels retain full-range boundsqc_segmentation_overview.py— loads SPIM and mask viaZarrNii.from_ome_zarr()withdownsample_near_isotropic=True; usesget_zooms()for physically correctimshowaspect ratios; also used byqc_vessels_overviewqc_segmentation_roi_zoom.py— usesZarrNiiandZarrNiiAtlasto load full-resolution data; crops to each atlas ROI's bounding box viaatlas.get_region_bounding_box()andcrop_centered(); renders a 5-column grid montage; also used byqc_vessels_roi_zoomqc_zprofile.pyqc_objectstats.pyqc_roi_summary.py— drops atlas label 0 (background) immediately after loading the segstats TSV so out-of-brain regions never appear in the summary bar charts