-1

Let me explain.

My program takes an x-ray in a format of the x-ray detector ".his" which goes from 0 to 65535, and from those values it can tell you how much of a certain material is in each pixel "4 cm of aluminum" for example.

It does that for every pixel and you end up with a matrix that tells you how much of a given material is there, and you can visualize that matrix and see only fat tissue in an image without the bones blocking your view, it's very cool I know.

What I want to do now is to save that matrix as an image so that I can analyse and modify that image with programs like Image J, but I also want that if I see the pixel value I see the original value, I want to see "4" and know that pixel shows 4 cm of lungs or whatever material I'm working on.

Is that possible?, my professor seems to think that it is but he's not sure how to do it, and figure that out is my job anyway.

It should be possible since with Image J I can open the ".his" format and I can do just that, I can see the values from 0 to 65535, provided I say Image J that the image is 16 bit unsigned and other properties of that kind of files, but I wouldn't know how to do that for a Matlab variable.

Thanks a lot.

1 Answers1

0

So if I understand correctly, you want to save an image that also contains arbitrary metadata on every pixel (in this case an integer).

If you use an image format like PNG you could encode that extra data into the alpha channel (which would be nearly imperceptible with a value like 4/255 away from fully opaque), but you'd have to be careful when editing the image that you don't change the alpha channel by mistake.

However, this is rather finnicky and would be cumbersome to implement in Matlab.

Instead I would suggest simply saving a standard image and a text file (or binary file) alongside it with the data you want.

Extragorey
  • 1,276
  • 10
  • 26