skills/cv/multi-window-channel-stacking/SKILL.md
Stack multiple CT window settings (brain, subdural, bone) as separate RGB channels for CNN input
npx skillsauth add wenmin-wu/ds-skills cv-multi-window-channel-stackingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CT scans contain a wide range of Hounsfield Unit (HU) values. A single window clips most diagnostic detail. Stacking three clinically-relevant windows — brain (W:80, L:40), subdural (W:200, L:80), and soft tissue (W:380, L:40) — as RGB channels preserves all three ranges in one image that standard ImageNet-pretrained CNNs can consume directly.
import pydicom
import numpy as np
def window_image(img, center, width, intercept, slope):
img = img * slope + intercept
img_min = center - width // 2
img_max = center + width // 2
return np.clip(img, img_min, img_max)
def multi_window_rgb(dcm):
px = dcm.pixel_array.astype(np.float32)
intercept, slope = float(dcm.RescaleIntercept), float(dcm.RescaleSlope)
brain = window_image(px, 40, 80, intercept, slope)
subdural = window_image(px, 80, 200, intercept, slope)
soft = window_image(px, 40, 380, intercept, slope)
# Normalize each channel to [0, 1]
brain = (brain - (40 - 40)) / 80
subdural = (subdural - (80 - 100)) / 200
soft = (soft - (40 - 190)) / 380
return np.stack([brain, subdural, soft], axis=-1)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF