dwi_ma..._slices(1)

πŸ’… dwi_mask_bad_slices β€” the dwi_ma..._slices(1) page, bestie edition

okay so real quick: this is a page from The Computational Morphology Toolkit (CMTK, our beloved), and it's about a lil tool called dwi_mask_bad_slices. she's a problem-solver. she finds the weird slices. yes bestie, we're doing this.


✨ NAME ✨

dwi_mask_bad_slices β€” find bad slices in a set of diffusion-weighted images. that's it. that's the job. πŸ’…


🌸 SYNOPSIS 🌸

dwi_mask_bad_slices DiffusionImagePaths

so simple, so iconic. you hand her a list of paths, she does her thing. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

Bestie, listen. This tool reads a whole set of 3D diffusion-weighted MR images and goes hunting for bad slices. Not vibe bad. Actually bad.

Here's the tea though on how she decides: a slice in a diffusion image counts as a bad slice when its mean intensity falls outside a specified interval around the mean of the means of all corresponding slices from the remaining diffusion images. Basically she looks at what all the other corresponding slices averaged to, she builds a comfy little interval around that, and if your slice is way outside? She clocks it. Immediately. πŸ™ˆ


πŸ’– OPTIONS πŸ’–

πŸ‘‘ Global Toolkit Options (these are shared by all CMTK tools)

these are the universal ones, the group-chat regulars, every CMTK tool has them:

  • --help β€” writes the list of basic command line options to standard output. the essentials, no lore.
  • --help-all β€” writes the complete list of basic and advanced command line options to standard output. the extended lore. the director's cut.
  • --wiki β€” writes the list of command line options to standard output in MediaWiki markup. for when you're wiki-pilled.
  • --man β€” writes the man page source in nroff markup to standard output. yes she can write her own manpage. main character energy fr.
  • --version β€” writes the toolkit version to standard output.
  • --echo β€” writes the current command line to standard output. she's just letting you know what you asked for.
  • --verbose-level <integer> β€” set the verbosity level. pick your yapping tier.
  • --verbose, -v β€” increment verbosity level by 1. ⚠️ deprecated β€” supported for backward compatibility only. she still loves you if you use it, but she's moved on.
  • --threads <integer> β€” set the maximum number of parallel threads (for POSIX threads and OpenMP). go faster, slay.

πŸ“ Input Options

  • --b0count <integer> β€” number of b=0 images at the beginning of the image list. These are not included in bad slice detection or masking, but they are written to the output directory anyway for convenience. and it's a hard assumption that all b=0 images sit at the beginning of the list of input images β€” not at the end, not in the middle. do not test her. [Default: 0]
  • --slice-orientation β€” defines the slice orientation of the diffusion images. Supported values: "axial", "sagittal", "coronal", "slice-x", "slice-y", "slice-z", where the default is "axial". or you can use one of these lil shortcut flags instead:
    • --axial β€” Axial slices. [This is the default]
    • --sagittal β€” Sagittal slices.
    • --coronal β€” Coronal slices.
    • --slice-x β€” X coordinate axis is the slice direction.
    • --slice-y β€” Y coordinate axis is the slice direction.
    • --slice-z β€” Z coordinate axis is the slice direction. [This is the default]
πŸ‘€ yes, both the "axial" value and "slice-z" value are noted as the default. that's exactly what the original says. we do not editorialize. we report. 😌

πŸ”₯ Bad Slice Detection

  • --stdev <double> β€” threshold for bad slice identification, in units of intensity standard deviations over all corresponding slices from the remaining diffusion images. [Default: 3]

πŸŽ€ Output Options

  • --convert-to β€” scalar data type for the output images. Here's a real tip from the original: if your padding value is negative but your input data is unsigned, for example, make sure to select a signed data type for the output. By default, the output data type is the same as the input type. Supported values: "char", "byte", "short", "ushort", "int", "uint", "float", "double". or use one of these:
    • --char β€” 8 bits, signed
    • --byte β€” 8 bits, unsigned
    • --short β€” 16 bits, signed
    • --ushort β€” 16 bits, unsigned
    • --int β€” 32 bits signed
    • --uint β€” 32 bits unsigned
    • --float β€” 32 bits floating point
    • --double β€” 64 bits floating point
  • --padding-value <double>, -p <double> β€” padding value used to replace the data of detected bad slices in the output images. [Default: -1]
  • --bad-slice-statistics <string>, -s <string> β€” a CSV file capturing the slice number and distance of bad slices. [Default: NONE]
  • --output-directory <string>, -o <string> β€” file system path for writing images with bad slices masked out (i.e., filled with a padding value). [Default: NONE]

πŸ’œ AUTHORS πŸ’œ

Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko. the whole squad showed up and honestly? ate. πŸ‘‘


⭐ LICENSE ⭐

http://www.fsf.org/licensing/licenses/gpl.html

go read it, bestie. it's giving legal but make it free software.


πŸ’€ BUGS πŸ’€

Report bugs at http://nitrc.org/projects/cmtk/

she's not perfect, she's just a tool. tell the devs, not the group chat. πŸ™ˆ


🌈 ACKNOWLEDGMENTS 🌈

CMTK is developed with support from the NIAAA under Grant AA021697, National Consortium on Alcohol and Neurodevelopment in Adolescence (N-CANDA): Data Integration Component. From April 2009 through September 2011, CMTK development and maintenance was supported by the NIBIB under Grant EB008381.

funding! we love to see it. 🫢


and that's the whole page, bestie. no cap, nothing skipped. this was CMTK 3.3.1p2, dated Jun 24 2026, page dwi_ma..._slices(1) β€” go find those bad slices and mask them out. you got this. βœ¨πŸ’–πŸ§š

πŸ“¦ where this page comes from