<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV><BR> </DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Dear bill</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman" size=3> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Hi,</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>I checked that link and I made the change you were suggested. Something strange happened:</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Min =4294966272 & Max = 1244 and the output histogram didnąt change.</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3> </FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Yours truly,</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Hossein</FONT></DIV>
<DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>--- On <B>Thu, 9/11/08, Bill Lorensen <I><bill.lorensen@gmail.com></I></B> wrote:<BR></DIV></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">From: Bill Lorensen <bill.lorensen@gmail.com><BR>Subject: Re: [Insight-users] need help image histogram<BR>To: hn_6112@yahoo.com<BR>Cc: "Luis Ibanez" <luis.ibanez@kitware.com>, insight-users@itk.org<BR>Date: Thursday, September 11, 2008, 4:44 PM<BR><BR><PRE>Hossein,
Try setting the image type to:
typedef itk::Image<short, 2 > ImageType;
If this is CT data, the units of the measurements are usually
Hounsfield units. See http://en.wikipedia.org/wiki/Hounsfield_scale
They will range from -1000 to > 400 for bone. The dicom reader
correctly applies the slope/intercept that is stored in the dicom
header.
I suspect that the MATLAB reader ignores the slope/intercept in the
header. This is not correct.
Bill
2008/9/11 hossein nazem <hn_6112@yahoo.com>:
>
>
>
> Dear Luis
>
> Hi
>
>
>
> I chose 4096 because the image bit depth is 12 and I want to have precise
> histogram. I did what you said and the result is:
>
>
>
> Min=0;
>
> Max=65535;
>
>
>
> Via this code:
>
>
>
> typedef itk::Image<unsigned short, 2 > ImageType;
>
>
>
>
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
>
>
> ReaderType::Pointer reader = ReaderType::New();
>
>
>
> reader->SetFileName( "IM000075.dcm" );
>
>
>
> try
>
> {
>
> reader->Update();
>
> }
>
> catch( itk::ExceptionObject & excp )
>
> {
>
> std::cerr << "Problem reading image file : " <<
"IM000075.dcm" <<
> std::endl;
>
> std::cerr << excp << std::endl;
>
> return -1;
>
> }
>
> typedef itk::MinimumMaximumImageCalculator< ImageType >
> MinimumMaximumCalculatorType;
>
> MinimumMaximumCalculatorType::Pointer calculator =
> MinimumMaximumCalculatorType::New();
>
> calculator->SetImage( reader->GetOutput() );
>
> calculator->ComputeMaximum();
>
> const unsigned int maximumValue = calculator->GetMaximum();
>
> calculator->ComputeMinimum();
>
> const unsigned int minimumValue = calculator->GetMinimum();
>
> std::cout << "min = " << minimumValue <<
std::endl;
>
> std::cout << "max = " << maximumValue <<
std::endl;
>
>
>
> Sleep(5000);
>
>
>
> As you said there may be a rescaling (I don't want that) but why total
sum
> of pixels is different from total sum of frequencies?
>
>
>
> In MATLAB image min=0; and max=2340;
>
> Yours truly,
>
> Hossein
>
>
>
> --- On Wed, 9/10/08, Luis Ibanez <luis.ibanez@kitware.com> wrote:
>
> From: Luis Ibanez <luis.ibanez@kitware.com>
> Subject: Re: [Insight-users] need help image histogram
> To: hn_6112@yahoo.com
> Cc: insight-users@itk.org
> Date: Wednesday, September 10, 2008, 11:04 PM
>
> Hi Hossein,
>
>
> Why are you choosing "4096" as the maximum value ?
>
>
> Can you please run the MaximumMinimumImageCalculator in your
> image and post back to the list the maximum and minimum values
> that you get ?
>
>
> It is unlikely that 4096 is actually the maximum value.
>
>
> You may not be considering the fact that the pixel intensities
> may be linearly rescaled by the slope and intercept values
> indicated in the DICOM header.
>
>
> Please let us know what your find,
>
>
> Thanks
>
>
> Luis
>
>
> -------------------
> hossein nazem wrote:
>>
>>
>>
>> Dear Luis
>>
>> Hi,
>>
>>
>>
>> Thank you for your consideration. It seems that a mapping take place
>> somewhere and convert data from uint16 to unit8.
>>
>> These are my parameters:
>>
>>
>>
>> histogramGenerator->SetNumberOfBins( 4096 );
>>
>> histogramGenerator->SetMarginalScale( 1 );
>>
>>
>>
>> histogramGenerator->SetHistogramMin( -0.5 );
>>
>> histogramGenerator->SetHistogramMax( 4096 );
>>
>>
>>
>> I expect that I have frequency of nearly 1000 around bin no 1000 but
its
>> 0 and I expect that some of frequency match the total sum of pixels
but
>> its nearly half of the total sum.
>>
>> I need the real histogram (0-4096).
>>
>> And here is how I check the result for each bin (actually I use the
>> examples I mentioned before):
>>
>>
>>
>> std::cout << histogram->GetFrequency( bin, 0 ) <<
> std::endl;
>>
>>
>>
>> And the total number of pixels must be equal to:
>>
>>
>>
>> s=s+histogram->GetFrequency( bin, 0 );
>>
>>
>>
>> Yours truly,
>>
>> Hossein
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --- On *Tue, 9/9/08, Luis Ibanez /<luis.ibanez@kitware.com>/*
wrote:
>>
>> From: Luis Ibanez <luis.ibanez@kitware.com>
>> Subject: Re: [Insight-users] need help image histogram
>> To: hn_6112@yahoo.com
>> Cc: insight-users@itk.org
>> Date: Tuesday, September 9, 2008, 9:22 PM
>>
>> Hi Hossein,
>>
>>
>> What values did you set up for the Max and Min of the Histogram ?
>>
>>
>> min.Fill( -0.5 ); ??
>> max.Fill( 255.5 ); ??
>>
>> generator->SetHistogramMin( min );
>> generator->SetHistogramMax( max );
>>
>>
>> If the total number of entries in the Histogram doesn't match the
>> number of pixels in the image, then it is likely that your Min and
>> Max setting in the histogram calculator are defining an intensity
>> range smaller than the actual dynamic range of your DICOM image.
>>
>>
>> Please let us know,
>>
>>
>> Thanks
>>
>>
>> Luis
>>
>>
>> -------------------
>> hossein nazem wrote:
>>> Hi,
>>>
>>> I'm trying to extract the histogram of a dicom image. The
result is
>>> different to what I achieve from MATLAB. There is something wrong
in
> itk
>>> because total pixels are fix and 512*512=262144 but in my code
it's
>>> variable when I change the bins, and the shape of histogram is
>>> different comparing with MATLAB output. I work on a 512*512 dicom
> uint12
>>> image. I tried the Examples/Statistics/ImageHistogram1.cxx &
>>> Examples/Statistics/ImageHistogram2.cxx.
>>>
>>>
>>>
>>> Yours truly,
>>>
>>> Hossein
>>>
>>>
>>>
>>>
> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users@itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
</PRE></BLOCKQUOTE></td></tr></table><br>