• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!


Make a Mean Image Volume and Mask

Page history last edited by PBworks 17 years ago

Make a Mean Image Volume and Mask

(1) Open up a new MEDx session, and then open up a New Folder.


(2) In the New Folder, select Image --> Open Image. In the Open Image dialog box, in the Filter entry box, type in the tutorial directory, followed by Mc*.hdr, e.g.




and then click on the Filter button. This will cause a list of the 84 motion-corrected image volumes to be made in the Files: pane. Click on the first one, then (leaving the first one selected) scroll down to the last one and press the Shift key. While pressing on the Shift key, click on the last Mc image volume, which should be #84. This should cause all 84 Mc image volumes to be selected.


(3) In the Open Image dialog box, click on the Open button. This will load the 84 motion-corrected scans into MEDx. Note the name of the Group page; it should be New Group.


(4) Select Toolbox --> Functional --> Group Statistics, and within the Group Statistics dialog box, make sure that the Within Group tab is selected (it should be on top by default).


(5) Set Group to the Group page you created in step 1 (use the Select... button if you like, or just type in New Group).


(6) Set Operation to Mean.


(7) Click on the OK button. This creates an average of the 84 scans. Note the name of this mean image volume.


(8) Select Page --> Duplicate Page. This creates a duplicate of the average image volume. Change the name of this duplicate page to Mask by select Page --> Page Properties, typing in Mask for the Name, and then clicking on the OK button. The name of the page should be changed to Mask -- check the name displayed in the title bar of the window to be sure.


(9) Select Display --> Display range. In the Display Range dialog box, click on the Compute button. Note that the maximum value in this image volume is shown to be 919. If we want to threshold this image at 15% of its maximum, that would correspond to a threshold value of about 138.


(9) While looking at this duplicate page, now named Mask, select Toolbox --> Segmentation --> Thresholding.


(10) In the Thresholding dialog box, set Type to One Value, Value to 138, and Output to Binary(One). Then click on the OK button.


(11) The result is a mask that roughly defines brain versus non-brain. It appears blank, but this is only a display issue, which is a very common occurence. Select Display --> Display range. In the Dipslay Range dialog box, note that the Max value is still set to 919. This is because before thresholding, the Mean image volume had a maximum value of 919, which was being displayed as pure white, while its minimum of 0 was being displayed as pure black; intermediate values were being displayed in intermediate shades of gray. After thresholding, the maximum value is only 1, very close to zero, but MEDx is still mapping 919 to pure white.


To readjust MEDx's windowing level, click on the Compute button. The Max will now be set to the new maximum of 1, and the brain-like shape of the mask becomes apparent in pure white.


(12) Let's change the data type of the mask to 8-bit, since a lot of our in-house software assumes that masks are 8-bit. Select Toolbox --> Conversion --> Data Encoding..., and in the Convert Data Encoding dialog box set Output Pixel Encoding to Unsigned Integer and Output Depth to 8. Still in the Encoding Conversion dialog box, click on the OK button. This will create a new image named Converted Volume from Mask.


(13) Select Image --> Save Image As.... In the Save Image As dialog box, set File Format to AVW (this is easy to overlook!), and set Filter: to the tutorial directory, followed by *.hdr, e.g.




Click on the Filter button (to make sure that MEDx is now "looking at" the tutorial directory), and under Selection type Mask.hdr. Click on the Apply button; this saves the 8-bit mask image out to disk. If you had clicked on the OK button, it would still have saved the 8-bit mask image to disk, but it would also have dismissed the Save Image As dialog box. Sometimes it's convenient to keep dialog boxes up.


(14) Use the Page Manager (under Page --> Page Manager...) to go to the mean image volume created in step 7. Save it into the tutorial directory using the Save Image As dialog box as an AVW format file, but this time named Mean.hdr rather than Mask.hdr.


You're now ready for the next step, Linear Temporal Filtering!


For more information on the Group Statistics module in MEDx, see section 31.9 in Chapter 31 of the MEDx User's Guide. See also this stand-alone MEDx tutorial.


Here's a very short stand-alone tutorial on conversion of data encoding.


Return to tutorial main page

Comments (0)

You don't have permission to comment on this page.