Hi,David,<br><br>I try the log plot. It is more similar to MIMICS. However, it is not smooth yet.<br><br>Refer to the attachment for the graph.<br><div><br>Any suggestions?<br><br>Thanks.<br>Liu Peng<br><br></div>
<span>
</span>
<br> 在2016-08-15,"David Gobbi" <david.gobbi@gmail.com> 写道:
<blockquote id="isReplyContent" style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
-----原始邮件-----<br>
<b>发件人:</b>"David Gobbi" <david.gobbi@gmail.com> <br>
<b>发送时间:</b>2016年08月15日 星期一<br>
<b>收件人:</b>"Liu_tj" <tjlp@netease.com><br>
<b>抄送:</b>"vtkusers" <vtkusers@vtk.org><br>
<b>主题:</b>Re: Re: [vtkusers] why my computing gray scale histogram of DICOM files is different from mimics<br>
<br><div dir="ltr">Hi Liu Peng,<div><br></div><div>Take the log of count. Or log of count+1, to avoid log(0).</div><div>It will probably be like this:</div><div><br></div><div><div> for(int i=0; i<managedValArray.Length; i++)</div><div> {</div><div> count.SetTuple1(i, log(1 + managedValArray[i]));</div><div> }</div></div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 14, 2016 at 7:46 PM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, David,<br><br>Thanks for your point.<br><br>I understand the plot shift. It just change the gray scale value range from [-1023, 2016] to [0, 3140]. This does not impact the generated graph shape. <br><br>Would you like to explain how to show log plot according to my code?<br><br>Thanks<br><div><br>Liu Peng<br></div>
<span>
</span>
<br> 在2016-08-15,"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> 写道:
<blockquote style="padding-left:1ex;margin:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
-----原始邮件-----<br>
<b>发件人:</b>"David Gobbi" <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> <br>
<b>发送时间:</b>2016年08月15日 星期一<br>
<b>收件人:</b>"Liu_tj" <<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>><br>
<b>抄送:</b>"vtkusers" <<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>><br>
<b>主题:</b>Re: [vtkusers] why my computing gray scale histogram of DICOM files is different from mimics<div><div class="h5"><br>
<br><div dir="ltr"><div>Two differences:</div><div><br></div><div>1) MIMICS is showing a log plot</div><div>2) The plot is shifted by the RescaleIntercept</div><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 14, 2016 at 9:52 AM, Liu_tj <span dir="ltr"><<a href="mailto:tjlp@netease.com" target="_blank">tjlp@netease.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi,<br><br>I try to get the grayscale of points in DICOM files and draw the histogram using .NET component, and what I get is different from the histogram of MIMICS. My C# code is as follow, the returned vtkLongArray stores the grayscale statistic result, value of element is the total number of the point whose gray scale value is equal to the array index:<br><br>public vtkLongArray GetGreyScaleStatisticsFromImag<wbr>eData(vtkImageData data, out long min_grey, out long max_grey)<br>{<br> vtkImageExtractComponents extract = vtkImageExtractComponents.New(<wbr>);<br> extract.SetInputData(data);<br> extract.SetComponents(0);<br> extract.Update();<br><br> double[] scalarrange = extract.GetOutput().GetScalarR<wbr>ange();<br> min_grey = (long)scalarrange[0];<br> max_grey = (long)scalarrange[1];<br> long size = (long)(scalarrange[1] - scalarrange[0]);<br> vtkImageAccumulate histogram = vtkImageAccumulate.New();<br> histogram.SetInputConnection(e<wbr>xtract.GetOutputPort());<br> histogram.SetComponentExtent((<wbr>int)min_grey, (int)max_grey, 0, 0, 0, 0);<br> histogram.SetComponentOrigin(0<wbr>, 0, 0);<br> histogram.SetComponentSpacing(<wbr>1, 0, 0);<br> histogram.SetIgnoreZero(1);<br> histogram.Update();<br> vtkLongArray count = vtkLongArray.New();<br> count.SetNumberOfComponents(1)<wbr>;<br> count.SetNumberOfTuples(size);<br> IntPtr value = histogram.GetOutput().GetScala<wbr>rPointer();<br> string scalartype = histogram.GetOutput().GetScala<wbr>rTypeAsString();<br> int s = histogram.GetOutput().GetScala<wbr>rSize();<br> long[] managedValArray = new long[size];<br> Marshal.Copy(value, managedValArray, 0, managedValArray.Length);<br> for(int i=0; i<managedValArray.Length; i++)<br> {<br> count.SetTuple1(i, managedValArray[i]);<br> }<br> return count;<br>}<br><br>The images of my and MIMICS are attached.<br><br>Does any guys know that?<br><br>Thanks<br>Liu Peng<br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></div></blockquote></div><br></div></div>
</div></div></blockquote><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br></div>
</blockquote><br><br><span title="neteasefooter"><p> </p></span>