users > Documentation or Examples for use
Showing 1-4 of 4 posts
Results per page:
Nov 17, 2009  04:11 PM | Gary Pack
Documentation or Examples for use
Is there any user documentation or list of examples for imagemath?
I desperately need to use the staple implementation before a paper deadline.


Nov 17, 2009  06:11 PM | Torsten Rohlfing - Google LLC
RE: Documentation or Examples for use
Hi Gary --

Since you're in a rush, do you want to use the binary or the multi-label STAPLE? They work slightly differently.

In general, the imagemath tool is used like this:

imagemath --in img1 img2 ... imgN [operations] --out resultImg

One of the "operations" could be "--staple" for the binary staple and another could be "--mstaple". If you give more than one operation, they are executed in order. If more than one image is left on the internal image stack when processing gets to "--out", then the top image is written.

Ah, yes, the tool uses an image stack for all operations. All images read are pushed onto the stack. Two-image operators operate on the last two images and put their result back onto the stack. And so forth...

Hope this gets you a little closer.

By the way -- if you download the CMTK source from SVN (or if you look into the SVN viewer on NITRC) you will find a file


which is the script that runs the automated software tests for all command line apps. You could also look in there for examples of how imagemath can be used.

Nov 17, 2009  06:11 PM | Torsten Rohlfing - Google LLC
RE: Documentation or Examples for use
One more thing right now: both "--staple" and "--mstaple" expect a parameter, which is the number of iterations you want the EM algorithm to run. I haven't decided on a reasonable criterion for convergence detection, so this is a necessary evil for the time being.

Nov 18, 2009  11:11 AM | Torsten Rohlfing - Google LLC
RE: Documentation or Examples for use

Hope my comments last night helped you with your urgent problems. In the meantime, I have improved the imagemath "--help" command line help, and I also put a copy of that documentation on the Wiki. Let me know if you have further questions or run into problems.

One word of caution: the implementation of STAPLE in imagemath is *NOT* the code that we used for our papers on the algorithm and its application to multi-atlas segmentation. That code was a complete mess with unbearable design flaws, and I replaced it with a rewrite from scratch when I put together the imagemath tool. So please make sure you give your results sanity checks before you publish them...