Let's say you have a 16-bit image volume that you'd like to threshold to create an 8-bit mask. You can do this in MEDx, selecting Toolbox --> Segmentation --> Threshold, followed by a change of data encoding. Here's another way to do it, outside of MEDx.
(1) Get into a tcsh shell. For the sake of illustration, let's assume that the 16-bit image volume that you want to threshold is named All.mean.img. Type the following command:
This returns the maximum value of All.mean.img. For the sake of illustration, let's assume that this number if 873.
(2) Let's compute a threshold from the maximum; 15% can be a reasonable value. Find 15% of 873 using this command:
Rounding to the nearest integer, we get a threshold of 131. You can try other thresholds, e.g. 10% and 20%, and see which one you like the best.
(3) Run the following command to threshold All.mean.img.
makemaskWGT All.mean.img Mask.15pct.img 131
This creates a file named Mask.15pct.img. We still need to make an ANALYZE header for it.
(4) Run the following command to create an ANALYZE header for the new mask, using the header for All.mean.img as a model (the mask will still have the same image dimensions and voxel size):
Make8BitHeaders.csh All.mean.hdr Mask.15pct.img
This will create a new file named Mask.15pct.hdr. Now you can load this ANALYZE format image into MEDx and look at it. Make sure that it is more or less brain-shaped. If it has too much junk outside of the brain (e.g., meninges, eyeballs), you may need to hand-edit this mask to remove that stuff.
Comments (0)
You don't have permission to comment on this page.