<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().<wbr>GetScalarRange();<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(<wbr>extract.GetOutputPort());<br>            histogram.SetComponentExtent((<wbr>int)min_grey, (int)max_grey, 0, 0, 0, 0);<br>            histogram.SetComponentOrigin(<wbr>0, 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().<wbr>GetScalarPointer();<br>            string scalartype = histogram.GetOutput().<wbr>GetScalarTypeAsString();<br>            int s = histogram.GetOutput().<wbr>GetScalarSize();<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></div></blockquote></div><br></div></div>