Credentials. The first run downloads weights from Hugging Face, so a token may be needed if access to the repository is restricted in your environment.
Who it is forA medical imaging researcher or data engineer who has a set of X-ray images and needs anatomy masks without writing model code.
The problemManually outlining anatomy on many X-rays is slow, and many segmentation tools need model setup before any output appears.
The outcomeA predictions folder containing image_masks.npy, image_probabilities.npy, image_logits.npy, and label_names.json for each input.
What you need first
- Python 3.10 or newer and pip
- One or more X-ray images in PNG, JPEG, TIFF, BMP, or DICOM (DICOM needs the dicom extra)
- Internet access to download pretrained weights from Hugging Face on first run
- For training only: a labeled dataset, and a GPU or CPU for the dry run; the README says training is single-process with at most one GPU
- For the MCP use case: an MCP-capable client such as Claude Code or Claude Desktop
Steps
- Install the package with
python -m pip install flexray. - Run a single prediction with
flexify --input ./image.png --output-dir ./predictions. - To predict a whole folder, pass the folder to the same command with
flexify --input ./xrays --output-dir ./predictions. (inferred, check the README) - Open label_names.json to map channel numbers to anatomical labels, then load the .npy files with NumPy.
Prompt for your agent
In the FleXray repo (pip package flexray), run `flexify --input <input-path> --output-dir <output-dir>` on the target X-ray image or folder. Expect image_masks.npy, image_probabilities.npy, image_logits.npy, and label_names.json per image. Verify that the masks arrays are CxHxW with C equal to the number of labels in label_names.json.
Caveat. The README describes segmentation output but does not state clinical validation, so treat masks as research output unless you verify them yourself.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for VictorButoi/FleXray and "Segment X-ray images into anatomy masks from the terminal"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer