Is there no binary type '01' in the pixel type of SimpleItk?

Is there no binary type ‘01’ in the pixel type of SimpleItk?

SimpleITK and ITK commonly use unsigned bytes, uint8 or sitkUInt8 type to represent binary images. These are commonly referred to as mask images. We have a FAQ entry in SimpleITK which discussed this common convention:

https://simpleitk.readthedocs.io/en/master/conventions.html#mask-image-types-and-default-values

Why is there no ‘2-bit int’ type? I think this type is very commonly used…

It is not directly addressable in memory. Reading memory which is not aligned with processor cache lines is inconvenient/slower, and most processor architectures, and therefore most programming languages, do not expose bit as a primitive type, like they do for int.

Can’t make a pseudo bit int type?

In C and C++, that is available in structs. Read more about it:

Also, C++ has a specialized std::vector<bool>.

Howto write a bit-int type with python?

I don’t think Python has that:

1 Like

Thanks!..it’s a hassle.