技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-preparation【数据与研究】Prepare, validate, and troubleshoot DeepMedic 0.8.4 NIFTI subjects, modality manifests, labels, ROI masks, CSV inputs, and intensity normalization before training, validation, or inference.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a Researcher must turn a new multi-modal NIFTI dataset into DeepMedic input, or diagnose a path, list, grid, label, ROI, or normalization failure. Establish the subject ordering and spatial contract first; only then hand the prepared inputs to the session-specific skill.
channel_<name> columns and remember that the implementation sorts those
column names alphabetically. See the data-formats reference for required
ground_truth, optional roi_mask, and optional prediction_filename
signals.0
and task classes are contiguous increasing integers (0, 1, 2, ...); with
N output classes, values must be in [0, N). ROI is optional: absent ROI
means whole-volume sampling/inference and whole-volume normalization
statistics. A provided ROI uses positive voxels as inside.--read-data for a full payload read. Also inspect voxel-size consistency
across subjects and verify co-registration visually or with a trusted
imaging QA process; those are not fully proven by a header check.-) in the task notes. A later session skill should consume this
record rather than reconstructing it from filenames.The source-backed data I/O and preprocessing signatures are:
load_volume(filepath)
saveImgToNiiWithOriginalHdr(imgToSave, filepathTarget,
filepathOriginToCopyHeader,
npDtype=np.dtype(np.float32), log=None)
savePredImgToNiiWithOriginalHdr(labelImageCreatedByPredictions,
namesForSavingPreds,
listOfFilepathsToEachChannelOfEachPatient,
case_i, suffixToAdd="",
npDtype=np.dtype(np.float32), log=None)
saveFmImgToNiiWithOriginalHdr(fmImageCreatedByVisualisation,
namesForSavingPreds,
listOfFilepathsToEachChannelOfEachPatient,
image_i, index_of_typeOfPathway_to_visualize,
index_of_layer_in_pathway_to_visualize,
index_of_FM_in_pathway_to_visualize, log=None)
save4DImgWithAllFmsToNiiWithOriginalHdr(multidimImageWithAllVisualisedFms,
namesForSavingFms,
listOfFilepathsToEachChannelOfEachPatient,
image_i, log=None)
normalize_zscore_subj(log, channels, roi_mask, prms,
verbose_lvl=0, job_id='', in_place=True)
parse_filelist(filelist_path, make_abs=False)
parse_fpaths_of_channs_from_filelists(list_of_filelists, abs_path_root)
get_paths_from_df(log, df, abs_path, req_gt=True)
load_volume returns a 3-D NumPy array: 2-D becomes x,y,1; 4-D is allowed
only with singleton fourth dimension. The NIFTI save helpers copy the source
header affine and relevant zooms; the generic helper creates parent folders
and appends .nii.gz when the target does not already end in that suffix.
Prediction/feature helpers derive output names from per-case name tokens and
use the first channel as the header source. They are output helpers, not a
replacement for input registration.
normalize_zscore_subj expects channels shaped [channels, x, y, z] and an
ROI shaped [x, y, z] or None. prms contains
apply_to_all_channels, apply_per_channel, cutoff_percents,
cutoff_times_std, and cutoff_below_mean; incompatible all/per-channel
selection is rejected. It returns (channels, applied), mutating the input
by default. The long-form behavior and failure cases are in the references.
This sub-skill does not choose CNN pathways, class-head architecture, patch sizes, optimizer settings, training schedules, checkpoint loading, or feature map inference. Do not “repair” a data error by changing those settings. Use the three linked sibling skills only after this input contract is satisfied.
This operating contract follows DeepMedic 0.8.4 source behavior for I/O,
manifest parsing, dataframe extraction, subject loading, label checks, and
normalization. The prose documentation calls dataframe input new/not yet
used, while the 0.8.4 parser contains active dataframe branches; follow the
code when the two conflict. The prose also says .nii, while the bundled
examples use .nii.gz; the loader delegates to NiBabel and the examples show
that both common NIFTI suffixes are an intended safe contract. The bundled
example names illustrate two modalities, labels, and brain masks only; they
are not a requirement that a new task have exactly two channels or a brain
ROI.