Window leveling tools

Dear wonderful MRTrix3 team,

I was wondering if there are window leveling tools besides right clicking and moving the mouse around to see visually. I mean tools like showing the histogram and a curve so we can control the min, max and middle points in the window leveling? ITK-SNAP currently has such tools but they don’t seem to have colorbar overlay and they probably can’t display fixels!

Thanks so much as always!
Sincerely,
Nagesh

Hi Nagesh,
I’m guessing you are talking about something similar to Gimp or Photoshop?

You you can set the min and max for the current view using the view tool (ctrl-F1). However, to display a full histogram would require a full load of the image (as opposed to just loading the required slice via memory mapping). We would not want to do this by default since we would loose the snappiness of mrview. However, I guess we could do a full load on the image if a histogram tool or button was pressed. I agree that it might be a nice feature to have, however given our limited spare time we have for developing new features, I can think of quite a few more features/tools/commands that would be more heavily used by the average user. Coding up a image histogram in a pop-up (either voxel or fixel-based) would not be too much work, however having a slider to then set the min/max of the image would be a little more involved.

As a side note, you can use mrstats image.mif -histogram hist.txt to generate a histogram (as a text file) from any voxel of fixel image. This can also work in conjunction with an input mask.
Cheers,
Dave

Hi Dave,

Thanks so much for the prompt response. I see that we can set the min and max more explicitly using the View options tool. I was hoping for a much more finer control. Basically how the colors are mapped between the min and max. For some NODDI based maps just setting the min and max seems insufficient for displaying the range of image intensities. I mentioned histogram because that can allow us to control the color mapping to the most interesting (around peaks in the histograms) pixel range.

I am attaching a screenshot from ITK-SNAP’s contrast control just for your info (look at the non-linear mapping that is possible). I know these things can be non-trivial to implement. I just wanted to know if there was already a built-in tool that I was missing.

Thanks again for your kind answer.
Sincerely,
Nagesh

Ah, I see what you mean. I can appreciate how a non-linear transform of the intensities may help to improve the contrast for a rough qualitative inspection. However ideally the colour bar would then need to have additional ticks along it (i.e. not just the min/max). I would not want to use such an image in a journal figure without the ticks, since most readers would assume the colourbar linearly maps between the min/max range.

In terms of qualitative inspection, can you not use something like a jet colour bar to explore your intensity range of interest?

Yes you are right Dave. We would need the additional tick marks (like the horizontal colorbar in the attached image above). Yeah I know what you mean in terms of other colormaps but for some reason grayscale seems to be an unofficial standard in MR images :slightly_smiling:
For now I think I know my options and will work with them. In the future I will try to contribute by perhaps coding such a feature.

Thanks again Dave!

You can also use mrcalc to apply a nonlinear intensity transformation to an image before loading it in the viewer. A little clumsy, and you need to pick the right transform, but it works.

Aha. But that also requires to explicitly mention the transform in presentation and yes that would be easier to do given the current repertoire of MRTrix3. Thank you all once again!

It seems that -histogram option is not in mrstats anymore.
What is the alternative way to have the histogram of a 3D volume in mrtrix?

Thanks,

I think you’re looking for mrhistogram – that functionality was split off a while back as part of this merge.

1 Like

Is there a tool to plot the histogram in MRTrix?
mrhistogram outputs a text file?