Clear Filters
Clear Filters

How to properly display and work with int32 images?

6 views (last 30 days)
Hello everyone!
I am owrking with medical images and created a program to process and analyze the images. It seems that rescaling the image intensity to a range between 0 and 1 was a bad idea. The original images are int32 which contain large negative and positive values. I am rewriting my code and want to make sure that I am doing things right this time.
  1. I have not found a way for Imshow to display this type of images and it seems that image() works. Is this correct? If not, how can I display int32 images?
  2. Are there downsides of working with int32? The images are infrared images of vasodilatory responses of nerve fibers when stimulated with a laser beam. The program, I am developing has to measure the change in area over about 15 mins.
I will highly appreaciate your help and insights. Thank you for your attention.

Answers (1)

dpb
dpb on 2 Aug 2023
Edited: dpb on 2 Aug 2023
whos -file imageSample.mat
Name Size Bytes Class Attributes PerfImg 269x266 572432 double
load imageSample.mat
image(PerfImg)
We don't know if that is what would be expected or not; note that the given array as uploaded is not int32 as far as data type but an array of double(), the default MATLAB data type.
MATLAB supports the 8- and 16-bit depth as common image format types but doesn't have a specific format for int32; hence the other routines that expect such don't work.
[min(PerfImg(:)) max(PerfImg(:))]
ans = 1×2
-41.0289 197.9554
It appears you may have scaled the above to 8-bit magnitude based on the above range, but kept the full precision of the double?
Why not attach one of the original images and let one of the real image processing gurus see what they might think?
The disadvantage of using double() is simply one of storage; each pixel is 8-bytes; int32 is half although then overall storage also depends upon whether the original has more than the one plane or not. Of course, the size of the sample, anyway, is small enough that storage shouldn't be an issue regardless of data type chosen.
A secondary issue is what the end result is to be -- if need to save as an image file that other applications would be able to open, then see imwrite to see what MATLAB supports in that direction.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!