Skip to main content
. 2023 Jan 13;9(2):669. doi: 10.18063/ijb.v9i2.669

Table 1.

Simple ImageJ macro for removing non-vascular structures using the ROI Manager

  • n = roiManager(“count”);

    for (i=0; i<n; i++)

    {

        roiManager(“select”, i);

        setBackgroundColor(0, 0, 0);

        run(“Clear Outside”, “No”);

    }

Especially in the abdomen, the spine can be in direct contact with the aorta via lumbar arteries, which causes difficulties in segmentation, as vascular structures and bones might fuse to one object. Using the ROI Manager in ImageJ, this macro automatically removes everything outside the ROI on each slice of the stack. The macro can be saved as ClearOutsideMacro.ijm and installed via Plugins → Macro → Install.