 # Measuring a volume of thresholded pixels in a DICOM image stack / manually differentiate certain pixels

Hi everybody,

I have image stacks of dual energy CT of gouty deposits in articular joints (DICOM images in Tif format).
My goal is to measure the volume of these pixels registered as gouty deposits, and to evaluate the amount of false positives (artifacts)

I am looking for help to measure a volume of thresholded pixels in an image stack (problem 1). And ideally to also manually differentiate these pixels and classify them as “true gouty deposits” or artifacts of different natures (problem 2).

I used split channels and subtract images on my native images to obtain a stack of 8bit images containing gouty deposits as voxels encoded in white (value 255) on black backbround (value 0).

Problem 1/

I cannot find a volume calculator macro that gives volume values consistent with the “official” CT constructor values.

• I tried the following macro, which did not work (maybe my voxels aren’t as well calibrated as I thought ?)
``````// ImageJ Macro Code
// Measure Volume of Thresholded Pixels in an Image Stack
//
//

macro "Measure Stack" {
run("Clear Results");   // First, clear the results table

// loop through each slice in the stack. Start at n=1 (the first slice),
// keep going while n <= nSlices (nSlices is the total number of slices in the stack)
// and increment n by one after each loop (n++)
for (n=1; n<=nSlices; n++) {
setSlice(n);  // set the stack's current slice to n
run("Measure");   // Run the "Measure" function in ImageJ
}

// Create a variable that we will use to store the area measured in each slice
totalArea = 0;
// Loop through each result from 0 (the first result on the table) to nResult (the total number of results on the table)
for (n=0; n < nResults; n++)
{
totalArea += getResult("Area",n);   // Add the area of the current result to the total
}
// Get the calibration information from ImageJ and store into width, height, depth, and unit variables.
// We will only be using depth and unit
getVoxelSize(width, height, depth, unit);
// Calculate the volume by multiplying the sum of area of each slice by the depth
volume = totalArea*depth;
// Print the result of the volume calculation to the log
print(volume + " " + unit + "^3");
}
``````

Do you have any idea of what’s wrong with the macro I used, or another process/plugin I could use ?

Problem 2/

Differentiating my pixels (labeling “real” gouty deposits vs different types of artifacts)

• I tried the Find Connected Regions plugin, which separates clumps of voxels, but I haven’t found a way to then label them or sort them manually (in the image stack or through the results table).
• I tried using the wand tool or flood filler to color some clumps of pixels (thinking I could manually color them to differentiate them, then analyze the volume per color), but it works only on a single slice at a time, and I havent found a way to have it spread to contiguous slices in the Z axis.

As a last resort I could go through my stack slice by slice and manually clear a single type of pixel “gouty deposit” or a type of artifact at a type then do substractions. But I’m trying to find a way to avoid doing this as it’s quite tedious Apologies if some of these answers are readily available, I have spent many days searching but am new to this (clinical radiologist troubleshooting with no coding background)