Mean gray value measurement issue, looking for advice to help me out

Hi All,

I am trying to compare several sets of MRI images of injured hamstrings ( pre injury and post injury) , and I am particulary interested in comparison of intra muscular oedema. As all MRI’s may have slightly different settings when they were made, I have to correct for that… So basically what I do: I measure the mean gray value of the injured muscle (just the intra muscular oedema-A1) , Subsequently I measure the same area of the post-injury MRI (at sport resumption A-2). Then I correct these values by a circular standardized measurement of uninjured muscle of both images R-1 and R-2. Finally I calculate the degree of oedema reduction: ((A-1/R1)-(A2/R2))…

However, when I was doing the normalization measurements I felt like the measurements didn’t really corresponded with the values I would expect. For example, two images who looked pretty similar, yielded two total different values of grayness. Oppisite was the case for some images who looked complete different - which yielded rather similar gray values. What is going on here? I already checked if the images are of same quality (256x256,16Bit). Once I copy a sample of the image that is considered ‘the darkest of the two by imageJ’, and paste this sample on the brightest of the two, it appears much darker then on the original image… Please see the images attached.

Best regards,
Robert

1 Like

Good day Robert,

just two hints:

  1. Have a look at the histograms of your images which may give you an idea what’s really happening.
    Furthermore use the “Brightness/Contrats”-tool and click “Reset”.
    (As long as you don’t click “Apply”, this tool changes the image isplay only but not the image data itself.)
  2. Post two original images in TIF-format in a Zip-Archive that show the discrepancy observed by you.
    (You may also make images accessible via a dropbox-like service.)

Regards

Herbie

Hi Robert,

To add an additonal hint to those pointed out by @anon96376101, MRI images coming from the original DICOM files usually have a calibration. You can check this on your images by pressing “i” to get the information on the image. If you scroll down, you will see something like this:

Also, when hovering over the image, the pixel values you get on the Fiji bar are presentes as calibrated (uncalibrated):
bar

When this calibration is present, all intensity measurements will be affected. Even though you have seemingly gray areas on two images (and even if their actual 16-bit values are equal), if their calibrations are different, the underlying calibrated values they represent will also be different.

Hope this helps.

Best,

Nico

2 Likes

Hi Herbie,

Thanks a lot for your advice. I tried both of your suggestions… Please see the link above. The Zip file contains several images:
MRI brightness contrast tool: I tried your suggestion about this tool… When I used the reset buton the images became more dark. However they remained realy similar ‘‘gray value wise’’. So I still don’t get why the values are so different… Then I tried the histogram function… I seems like the histograms realy correspond with the values I get when I do measurements. However, by just looking at the images i think the values are realy odd and do not correspond well… I attached two images of using this histogram tool: ‘’ MRI images_1’’ and ‘‘MRI images_2’’ the first one shows two images of which I think the measurement values do not correspond well. and the latter shows two images of which i think the measurements correspond well with what I would expect by just looking at the images… I also added a zoomed version of these images.
The images are not calibrated… not sure if that could affect the measurements? (see image: ‘’ MRI images 2 calibration’’. And lastly the image ‘’ MRI images 1_discrepancy’’ shows the same images as "MRI images_1’’ but in addition to that I took a measurement at the right image (encircled in yellow) copied this and pasted this to the left image and suddenly it appears darker than it looks at the original image…
So still not sure what is going on, seems to be a calibration issue to me…??

Hi Nico,

Thanks a lot for your advice. Please see my reply to Nico’s message… the images seems not to be calibrated as when I press ‘i’ it says uncalibrated (see images attached to my reply to Nico’’. What should I do?
The measurements doesnt seem to correspond very well with what I would expect but based on the histograms I get the measurements should be accurate…

@Robert_123 It looks like the dropbox link is not working. Can you check it?

sorry about that.
This link should work:


Regards, Robert

Good day Robert,

sorry but your data is worthless because you only show us screen shots but we need the original images in 16bit TIF-format.

After making them accessible please tell us exactly and step-by-step what you did and where you suspect problems or discrepancies.

Thank you!

Regards

herbie

Hi Herbie,

I try to post the new dropbox link but it says ‘‘you can’t post a link to that host’’ ?

Hi @Robert_123, and welcome to the forum! Because you posted a lot of links, the system thought you were a spammer. I have unflagged those posts, raised your user trust level from 0 to 1, and also whitelisted dropbox.com for the future so that other people are not bitten by this issue.

Please let me know if you continue to have any difficulties sharing files or images.

Hi Herbie,
Please see the dropbox link below, I tried to convert the files to TIF format but couldnt open the files anymore as the bitrate got changed (no 8 or 16 bit anymore)… So instead I shared the original files.

Thanks again, hopefully you’ll be able to help me out with these files.
Regards,
Robert

Robert,

thanks for making the images accessible and it was a good idea to post the original DICOM images. In fact ImageJ opens them (directly and with BioFormats without any resulting difference) but since I have no experience with DICOM images I can’t tell you whether they are opened according to the DICOM metadata or if the metadata is relevant for their display at all.

MRI 124_1_T0 versus MRI 124_1_RTP
Both images are different in several respects:
MRI 124_1_T0 has a significantly higher dynamic range and the shape of the histograms differs as well.
MRI 124_1_T0 shows a pronounced gradient especially in the left half and it suffers from sever artifacts that I guess are due to the image acqusition process. I wouldn’t use it.

MRI116_1_T0 versus MRI116_1_RTP
MRI116_1_T0 is missing

MRI 210_1_T0 versus MRI 210_1_RTP
Both images are different in several respects, similar to MRI 124
Just for the illustration, here are both images shown side by side with the same restricted dynamic range (gray values from 0 to 250):
MRI%20210_1_T0_and_RTO_both_0-250

MRI 210_1_T0 is clearly darker and if you copy parts of it to MRI 210_1_RTP which is clearly brighter, you get the described effect.

I must admit that presently I see no problems with what you’ve observed but perhaps I didn’t get to the point.

Regards

Herbie

1 Like

Hi Robert,

As @anon96376101 pointed out, there’s quite a variation from image to image in terms of dynamic range (and histograms, although I would argue that a lot of the later stems mainly from range scaling and tissue distribution in each image, except for the artifacts that he already mentioned on some of them). This dynamic range issue is expected in MRI, both across patients and acquisition dates (not my area of expertise, by the way, but a little reading helped clarify this issue [e.g.: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5540379/]). As I understand, that’s the main reason behind your normalization procedure.

Anyways, the point that I wanted to bring is the following: each of the images has a different maximum value for the display range that is already set when you open the image (and which is not the max value in the image, but correlates with it to some extent):

Image display max image max
MRI 210_1_RTP 422 659
MRI 210_1_T0 370 531
MRI 116_1_RTP 378 631
MRI 124_1_RTP 336 485
MRI 124_1_T0 378 599
MRI 135_1_RTP 479 821
MRI 135_1_T0 384 762

This value was probably set to get a reasonable “display window” of values, but is masking the actual differences in values that is present across images.

One way to make that evident is to have all images open, go to Brightness & Contrast > Set…, put the range 0-400, and set “propagate to all other open images” before hitting OK. You will then clearly see the differences across the image set, and all the mean values you measure will closely match your visual comparison.

Another way to look at the differences in (control) muscle values is to plot the histograms of the reference ROIs that you are using. As an example, here’s that plot for the images you provided, with some ROIs that I placed (guessing normal muscle, of course). The histograms have 30 bins, in the window from 50 to 200:

You can also estimate the peak value of those histograms by fitting a Gaussian to each (I chose this because it is quite insentive to the presence of vessels in the lazy rectangular ROIs I tossed arround :blush:, and it seems to fit well, but I’m not sure if it’s an appropriate distribution to fit in MRI data). Here are the values, and the code to reproduce it:

Image maxG
MRI 116_1_RTP 91.996
MRI 124_1_RTP 101.393
MRI 124_1_T0 94.970
MRI 135_1_RTP 139.700
MRI 135_1_T0 112.917
MRI 210_1_RTP 114.659
MRI 210_1_T0 96.626
// only the MRI images should be open, each with
// a ROI over an area of control muscle 

list=getList("image.titles");
series="";
colors=newArray("black", "blue", "green",  "magenta", "orange", "red", "#00c6ff", "yellow");

Plot.create("Histograms", "pixel value", "counts");

run("Clear Results");

for(i=0; i<list.length; i++){
	selectWindow(list[i]);
	if (getInfo("window.type")!="Plot"){ //to avoid problems if run several times
	
		getHistogram(values, counts, 30, 50, 200);
			
		Plot.setColor(colors[i%colors.length]);
		Plot.setLineWidth(2);
		Plot.add("line", values, counts);
		series+=list[i]+"\t";
	
		Fit.doFit("gaussian", values, counts);
		maxg=Fit.p(2); //max of the Gaussian
		
		setResult("Image", i, list[i]);
		setResult("maxG", i, maxg);
	
		// If the following line is uncommented, the images will also be recalibrated
		// to make the original ROIs match in intensity (100 by default)
		// Check this by recommenting the line and running again
		
		//run("Calibrate...", "function=[Straight Line] unit=[Gray Value] text1=[0\015 "+maxg+"] text2=[1\015 100]");
		
		}
	}
Plot.setLegend(series);
Plot.show();
Plot.setLimitsToFit();
setOption("ShowRowNumbers", false);

I added a commented line to recalibrate against the control ROI. Using this you would then just need to compare the injured ROIs (oedema reduction=(A1-A2)/100, to get the values in the scale you were using). You can check if this gives you similar results.

Cheers,
Nico

Good day Nico,

most of what you report here, has been mentioned in one of my previous posts.

[…] although I would argue that a lot of the later stems mainly from range scaling and tissue distribution in each image,

I never said anything about reasons but I fully agree with what you say here.

I still claim that if one compares the images when set to the same dynamic range, then there will be no need to explain any discrepancies. With the exception of the artifacts, there is nothing wrong with these images. They are however 16 bit images and this poses the known problem with common computer displays that are not able to cope with this dynamic range. This is neither a problem with the images nor with the software (Photoshop and other applications have to deal with this problem too). As I’ve shown, the solution of the OP’s problem is straightforward and logic.

Regards

Herbie

Thanks a lot for your help! So basically, what I understood; all the measurements I did are correct, but the fact that the images are 16 bit and that the dynamic range between images differ made that my visual measurement didn’t correspond very well to the actual measurements, however there’s nothing wrong with the measurements just with the visual appearance of these images due to the circumstances stated before.
So I don’t necessarily need to change the dynamic ranges or need your Gaussian histogram trick in order to get accurate values right?

1 Like

Did you take a look at the side by side images I’ve posted?

MRI%20210_1_T0_and_RTO_both_0-250

MRI 210_1_T0 is clearly darker and if you copy parts of it to MRI 210_1_RTP which is clearly brighter, you get the described effect.

Does this conform with your impression?

BTW, this

that my visual measurement

doesn’t exist because the visual system is unable to perform measurements.

Regards

Herbie

‘‘Does this conform with your impression?’’

Yes, that is one of the things I tried to describe in the google drive file that I shared. But when I compared these images with their default dynamic range they seems to be pretty similar, however, according to the measurements I did; ‘210_1_T0’ is supposed to be much darker compared to 210_1_RTP, and when I copy parts of 210_1_T0 to 210_1_RTP I get the described effect…

Sorry but your current reply shows that you may not have understood what I did with these images. What you see above are not the images as you have posted them.

Sorry but I think this way it is difficult to help.

Good luck

Herbie

Hi @anon96376101, sorry for the delayed response.

Sure! Some of the concepts outlined in my post had already been mentioned in some form in your previous post. Anyways, I believed that some clarification and further examples would be of help to the OP, even at the risk of incurring in some redundancy. I hope you agree.

Cheers!
Nico

Hi @Robert_123! It’s nice to know that this helped.

So I don’t necessarily need to change the dynamic ranges or need your Gaussian histogram trick in order to get accurate values right?

The change in range is just for display purposes, and the Gaussian trick is just a fancier way for quantifying the the differences. As long as you do some sort of normalization (similiar to the one outlined in your original post) you should be alright.

Good luck!
Nico