<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 GetGreyScaleStatisticsFromImageData(vtkImageData data, out long min_grey, out long max_grey)<br>{<br>            vtkImageExtractComponents extract = vtkImageExtractComponents.New();<br>            extract.SetInputData(data);<br>            extract.SetComponents(0);<br>            extract.Update();<br><br>            double[] scalarrange = extract.GetOutput().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(extract.GetOutputPort());<br>            histogram.SetComponentExtent((int)min_grey, (int)max_grey, 0, 0, 0, 0);<br>            histogram.SetComponentOrigin(0, 0, 0);<br>            histogram.SetComponentSpacing(1, 0, 0);<br>            histogram.SetIgnoreZero(1);<br>            histogram.Update();<br>            vtkLongArray count = vtkLongArray.New();<br>            count.SetNumberOfComponents(1);<br>            count.SetNumberOfTuples(size);<br>            IntPtr value = histogram.GetOutput().GetScalarPointer();<br>            string scalartype = histogram.GetOutput().GetScalarTypeAsString();<br>            int s = histogram.GetOutput().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><br><br><span title="neteasefooter"><p> </p></span>