[Insight-users] binary mask

Luis Ibanez luis . ibanez at kitware . com
Fri, 12 Dec 2003 09:05:18 -0500


Hi Constantine,

A) You can store a binary mask as an Octree by
    using the Brains2MaskImageIO object:

http://www . itk . org/Insight/Doxygen/html/classitk_1_1Brains2MaskImageIO . html

    It writes a binary mask image in a compressed
    format. This format was defined by the Image Processing Lab
    http://www . psychiatry . uiowa . edu/ipl/
    at the Psychiatry Department of the University of Iowa

    Details about Brains2 can be found at
 
http://www . psychiatry . uiowa . edu/ipl/local/brains2/BRAINS2_Users_Guide/index . html

    This mask format was specifically designed for storing
    segmentations, therefore it supports arbitrary shapes.


B) About using booleans for binary images:

    This is the theoretical right thing to do,... but in practice
    booleans take 1 byte in memory, so you can as well use unsigned
    char for representing masks.

    You could compress binary masks by storing 1 pixel per bit,...
    but this will not flow through the ITK pipeline.  If image
    compression is the goal, you could win much more by using
    run lenght encoding (RLE).



Please let us know if you have further questions.


Thanks


   Luis



------------------------------
Constantine Butakoff wrote:

> Hello all,
> 
>       Does anybody know if the possibility to store mask together with
>       the image is implemented in ITK ?
> 
>       Why I'm asking is that I want to have some sort of region of
>       interest (of any shape) inside each image.
> 
>       And another question: if I want to define a binary image(1 bit per
>       pixel) with itk::Image, should I use "bool" type or define a
>       class for the pixel of 1 bit length?
>