1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to create a histogram of a nifti file

  1. Dec 10, 2011 #1
    Hi,
    I'm trying to create a histogram of a .nii file but it's now working.
    1. loading the nifti file:
    >> Try2=load_nifti('DM.nii');
    2. hist(Try2);
    that generarates a histogram, where most of the values are concentrated between -150 and 200.(3 bars,the middle one is between -50 and 100).
    3. I then use a function that sets all pixels in the range to 1 (white)
    and all pixels that are out of range to 0 (black).
    range=(inputFileName >= I_min & inputFileName <= i_max);
    inputFileName(range)=1;
    inputFileName(~range)=0;

    4. Then I save the file and open it with ITKSnap
    save_nifti(inputFileName,outputFileName,1);
    but when I open it, it's almost all white.

    Not sure what I'm doing wrong, please help.
    Thanks in advance!
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted