mia-2dsegm...xel-kmeans(1)

πŸ“¦
version 2.4.7 Β· 3 versions
, in debian bookworm, ubuntu noble

✨ mia-2dsegment-per-pixel-kmeans ✨

okay bestie, listen up πŸ’– this one is a General Commands Manual page, section 1, filed under mia-2dsegm...xel-kmeans(1) β€” so it's a user command, you run it in your terminal, it's not some deep system call situation. Let's get into it, no cap.


🌸 NAME 🌸

mia-2dsegment-per-pixel-kmeans β€” Run a k-means segmentation of a 2D image.

like literally that's the whole job. she segments 2D images with k-means. iconic behavior πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

mia-2dsegment-per-pixel-kmeans -i <in-file> -o <out-file> [options]

so the two things you absolutely cannot skip are the input image and the output image. everything else is options, bestie. [options] means optional, in case the square brackets weren't already screaming that at you 🫢


πŸ’œ DESCRIPTION πŸ’œ

mia-2dsegment-per-pixel-kmeans runs the segmentation of a 2D image by applying a localized k-means approach that helps to overcome intensity inhomogeneities in the image. (the way that uneven brightness could never ruin her day πŸ’…)

The approach evaluates a global k-means clustering first, and then separates the image into overlapping regions where more k-means iterations are run β€” and here's the cute part β€” only including the locally present classes, i.e. the classes that relatively contain more pixels than a given threshold.

so: global pass first, then a bunch of little overlapping local glow-ups, but only the classes that actually showed up in that neighborhood get invited to the party. it's giving selective, and honestly? valid ✨


πŸŽ€ OPTIONS πŸŽ€

πŸ“ File-IO πŸ“

  • -i, --in-file=(required, input); io β€” the image to be segmented πŸ’– For supported file types see PLUGINS:2dimage/io
  • -o, --out-file=(required, output); io β€” the class label image based on merging local labels 🏷️ For supported file types see PLUGINS:2dimage/io

both of these are required, bestie. no input, no output, no segmentation. that's the vibe check and it passed βœ…


πŸ™‹ Help & Info πŸ™‹

  • -V, --verbose=warning β€” verbosity of output; she prints messages of the given level and higher priorities. Supported priorities, starting at the lowest level, are:
    • trace β€” Function call trace
    • debug β€” Debug output
    • info β€” Low level messages
    • message β€” Normal messages
    • warning β€” Warnings
    • fail β€” Report test failures
    • error β€” Report errors
    • fatal β€” Report only fatal errors
  • --copyright β€” print copyright information
  • -h, --help β€” print this help
  • -?, --usage β€” print a short help
  • --version β€” print the version number and exit

ngl the -? option is so real of her, some of us just need the short version 😭


βš™οΈ Parameters βš™οΈ

  • -w, --window=20; int in [3, inf) β€” Window size around the pixel to be analyzed πŸ” (default is 20, and it's an integer that has to be 3 or bigger β€” the sky is literally the limit)
  • -n, --nclasses=3; uint in [2, 127] β€” Number of intensity classes to segment 🎨 (default 3, unsigned int, from 2 all the way up to 127)
  • -t, --relative-cluster-threshold=0.0001; double in [0, 1) β€” Number of intensity classes to segment πŸ‘€ (default 0.0001, a double, and note the interval is half-open β€” 0 is allowed, 1 is NOT. so close yet so far)
not me noticing that -t and -n have the exact same description in the source. she said "copy paste is a love language" πŸ’€ keeping it fr fr.

πŸ”₯ Processing πŸ”₯

  • --threads=-1 β€” Maxiumum number of threads to use for processing. This number should be lower or equal to the number of logical processor cores in the machine. (-1: automatic estimation).

so -1 means "girl just figure it out yourself" and she will 🫢 but if you're gonna set a number, don't be out here requesting more threads than your machine actually has cores. that's not slay, that's chaos πŸ’€


🌈 PLUGINS: 2dimage/io 🌈

here's the full roster of file formats she can read and/or write, because a queen stays compatible ✨

  • bmp β€” BMP 2D-image input/output support. The plug-in supports reading and writing of binary images and 8-bit gray scale images. read-only support is provided for 4-bit gray scale images. The color table is ignored and the pixel values are taken as literal gray scale values.
    • Recognized file extensions: .BMP, .bmp
    • Supported element types:
      • binary data, unsigned 8 bit
  • datapool β€” Virtual IO to and from the internal data pool
    • Recognized file extensions: .@
  • dicom β€” 2D image io for DICOM
    • Recognized file extensions: .DCM, .dcm
    • Supported element types:
      • signed 16 bit, unsigned 16 bit
  • exr β€” a 2dimage io plugin for OpenEXR images
    • Recognized file extensions: .EXR, .exr
    • Supported element types:
      • unsigned 32 bit, floating point 32 bit
  • jpg β€” a 2dimage io plugin for jpeg gray scale images
    • Recognized file extensions: .JPEG, .JPG, .jpeg, .jpg
    • Supported element types:
      • unsigned 8 bit
  • png β€” a 2dimage io plugin for png images
    • Recognized file extensions: .PNG, .png
    • Supported element types:
      • binary data, unsigned 8 bit, unsigned 16 bit
  • raw β€” RAW 2D-image output support
    • Recognized file extensions: .RAW, .raw
    • Supported element types:
      • binary data, signed 8 bit, unsigned 8 bit, signed 16 bit, unsigned 16 bit, signed 32 bit, unsigned 32 bit, floating point 32 bit, floating point 64 bit
  • tif β€” TIFF 2D-image input/output support
    • Recognized file extensions: .TIF, .TIFF, .tif, .tiff
    • Supported element types:
      • binary data, unsigned 8 bit, unsigned 16 bit, unsigned 32 bit
  • vista β€” a 2dimage io plugin for vista images
    • Recognized file extensions: ., .V, .VISTA, .v, .vista
    • Supported element types:
      • binary data, signed 8 bit, unsigned 8 bit, signed 16 bit, unsigned 16 bit, signed 32 bit, unsigned 32 bit, floating point 32 bit, floating point 64 bit
careful with the vista one β€” that first extension is literally just .- in the original listing, so yeah. copy it exactly, bestie, don't get creative πŸ’€

πŸ“ EXAMPLE πŸ“

Run the segmentation on image test.png using three classes, local regions of 40 pixels (grid width 20 pixels), and a class ignore threshold of 0.01.

mia-2dsegment-per-pixel-kmeans -i test.png -o label.png -n 3 -g 20 -t
       0.01

look at her go, one line, doing the most πŸ’… (yes, that's -g in the example and -w in the option list β€” I'm reporting the tea exactly as it was poured, not my business πŸ«–)


πŸ‘‘ AUTHOR(s) πŸ‘‘

Gert Wollny

absolute legend behavior, we stan 🌟


This software is Copyright (c) 1999‐2015 Leipzig, Germany and Madrid, Spain. It comes with ABSOLUTELY NO WARRANTY and you may redistribute it under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 (or later). For more information run the program with the option --copyright.

fr fr: no warranty, none, zero, don't come for her if it breaks 😭 but the GPL v3 (or later) has your back on the redistribution side, so slay legally 🫢

and that's the whole page, bestie!! this was mia-2dsegm...xel-kmeans(1) from the USER COMMANDS crew, version v2.4.7 πŸ’œ go segment something cute and remember: global first, then local, always. mwah πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from