CS-5630/6630 | Visualization | Fall 2014
conceptual problem with given NRRD files? - Printable Version

+- CS-5630/6630 | Visualization | Fall 2014 (http://www.eng.utah.edu/~abigelow/bulletinBoard)
+-- Forum: CS-5630/6630 | Visualization | Fall 2014 (/forumdisplay.php?fid=1)
+--- Forum: General Discussion (/forumdisplay.php?fid=2)
+--- Thread: conceptual problem with given NRRD files? (/showthread.php?tid=97)



conceptual problem with given NRRD files? - Roozbeh Gh. - 11-18-2014 06:24 PM

I was wondering what logic rule the files for max/min of values and how to map them to grayscale?
brain.nrrd type is float so it should be 32bit! but values are in range of 0 to 252 (just by quick skim). So should we assume range 0-252 is 0-255 (as somebody suggested in another topic)? Or maybe data was formed in a way that 252 actually means 252 in 0-255 range (probably what everyone assumed)! Or actually values are in range of 0-65535 (as 32 bit indicate) and we should scale 0-65535 down to 0-255?

For test.nrrd data is way bigger and there are 62xxx values. Which seems correct to me as they are 32bit values.

From my understanding, test.nrrd file is correct and brain.nrrd has a wrong header, as file is prepared with 8 bit type in mind and type should be "unsigned char" or similar. Although it doesn't make huge difference...but is confusing!

what do you think?


RE: conceptual problem with given NRRD files? - mcarter - 11-19-2014 02:09 AM

Rooz,
I kept a min and max variable as I was reading the data file. For each value read in, if it is greater than max, update max. Same for min.

I guess it depends on the data set whether or not you can safely remove the values from 0 to min... I think with the brain data set, it doesn't really matter if you map colors from 0 to Max, or Min to Max, since there isn't anything special about the range 0 to 96 (the true min of brain.nrrd).

An example of when you would NOT to simply map from min to max is if you have a special color mapping that represents something. For example, if you have a geographic temperature map of the US, you wouldn't want to scale the temperature on a summer day to the min/max range for the color mapping. This way you could end up with 70 degrees in blue (indicating cold), when really it should be yellow or orange.

In the end, remember that the values are measurements from some experiment (likely scientific). The measurements of such an experiment aren't bounded by their representation in binary (well, ACTUALLY they are, since they clearly can't record a value outside of the representation, but it certainly shouldn't be scaled to this representation range).

My guess with both the MRI and MtHood data sets is that the values are scaled to a range targeted for a specific representation. The MRI max is 253, which probably means the data set was using unsigned shorts for storage. The Mt Hood data set goes from -127 to 128, which fits within a signed short.

In other words, as a scientist, you need to decide what resolution of data values you need to be able to represent. If 256 discrete values offers enough resolution, there is no reason to use an int.

Also, while the encoding directive for NRRD should tell you the min/max values of the data, there is no reason you have to use this data type in your project. I used 32 bit int in my project, for all data sets. If we needed to keep many images in memory, it might start to make sense to use a more compact representation.

Also, I'd be pretty shocked if these data sets originally came in NRRD format. I'd guess these data sets have been converted to NRRD because it's easy to work with. Real data will almost certainly not be in ASCII format.


RE: conceptual problem with given NRRD files? - Roozbeh Gh. - 11-19-2014 04:34 PM

Thanks.
My thought was also that the data are scaled down! But when I was doing it I realized I need more information. As they are scalar value and if data derived from some real measurements there should be information on how much accuracy were there and also did they expected some bigger/smaller values but those data are not presented in this case! That why I thought min/max is not that justifiable. But NRRD does not provide a header for those information and as the end goal is to show an image, I was wondering maybe using min/max of data type should be the way to do it! But anyway it seems there is no one answer to that and any good judgement should be fine.


RE: conceptual problem with given NRRD files? - accidental_PhD - 11-19-2014 05:43 PM

Excellent answer, @mcarter!

@Roozbeh, you're correct that it's up to your good judgement. Remember that no one cares what a specific pixel intensity is; you're picking colors for perception. Focus on what people can or can't see – your color map choice includes the range. At the end of the day, it's up to you to choose a range, and justify why you picked it.