<div dir="ltr">Hi Flaviu,<div><br></div><div>This is incorrect:</div><div><br></div><div>m_pLUTAxial->SetRange(dLevel, dWindow);<br></div><div><br></div><div>It should be something like this:</div><div><br></div><div><div>m_pLUTAxial->SetRange(dLevel - 0.5*dWindow, dLevel + 0.5*dWindow);</div></div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 13, 2016 at 1:22 AM, Flaviu2 <span dir="ltr"><<a href="mailto:flaviu2@yahoo.com" target="_blank">flaviu2@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><div><span></span></div><div>This is a little pseudocode of the entire pipeline:</div><div><br></div><div> vtkDICOMReader* m_pDICOMReader = vtkDICOMReader::New();</div><div>
</div><div> m_pDICOMReader->RemoveAllInputs();</div><div>
</div><div> vtkDICOMApplyRescale* m_pRescale = vtkDICOMApplyRescale::New();</div><div>
</div><div dir="ltr"> m_pDICOMReader->SetFileNames(pFN); // all files from serie</div><div>
</div><div> m_pDICOMReader->AutoRescaleOff();</div><div>
</div><div> m_pDICOMReader->Update();</div><div>
</div><div> m_pRescale->SetInputConnection(m_pDICOMReader->GetOutputPort());</div><div>
</div><div> m_pRescale->Update();</div><div>
</div><div> vtkImageReslice* m_pResliceAxial = vtkImageReslice::New();</div><div>
</div><div> m_pResliceAxial->SetInputConnection(m_pRescale->GetOutputPort());</div><div>
</div><div> vtkLookupTable* m_pLUTAxial = vtkLookupTable::New();</div><span class=""><div>
</div><div> m_pLUTAxial->SetValueRange(0.0, 1.0); <font color="#008000">// from black to white</font></div><div><font color="#008000">
</font></div><div> m_pLUTAxial->SetSaturationRange(0.0, 0.0); <font color="#008000">// no color saturation</font></div><div><font color="#008000">
</font></div></span><div> vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData();</div><div>
</div><div> <font color="#0000ff">const</font> vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth);</div><div>
</div><div> <font color="#0000ff">const</font> vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter);</div><div>
</div><div> <font color="#0000ff">double</font> dWindow = window.AsDouble();</div><div>
</div><div> <font color="#0000ff">double</font> dLevel = level.AsDouble();</div><div>
</div><div> m_pLUTAxial->SetRange(dLevel, dWindow); <font color="#008000">// image intensity range</font></div><div><font color="#008000">
</font></div><div> m_pLUTAxial->SetRampToLinear();</div><div>
</div><div> m_pLUTAxial->Build();</div><div>
</div><div> vtkImageMapToColors* m_pColorAxial = vtkImageMapToColors::New();</div><div>
</div><div> m_pColorAxial->SetLookupTable(m_pLUTAxial);</div><div>
</div><div> m_pColorAxial->SetInputConnection(m_pResliceAxial->GetOutputPort());</div><div>
</div><div> vtkImageActor* m_pImageActor = vtkImageActor::New();</div><div>
</div><div> <font color="#008000">// and then, forward, setup m_pColorAxial to an image actor:</font></div><div><font color="#008000">
</font></div><div> pImageActor->GetMapper()->SetInputConnection(m_pColorAxial->GetOutputPort());</div><div>
</div><div> <font color="#008000">// and add image actor to a renderer</font></div><div><font color="#008000">
</font></div><div> m_pRenderer->AddActor(m_pImageActor);</div><div dir="ltr"><br></div><div style="display:block"><div style="font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><div><div><div><div style="color:rgb(0,0,0);font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;background-color:rgb(255,255,255)"><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block"><font face="Arial" size="2"></font><br></div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block" dir="ltr">I had taken "Window center" and "Window width" and put them as range on lookuptable ... the image are little dark, and is not like the original (without setup lookup table looks good, but I get those warning like in post subject) ... might not understand well what you said about this range, but I am feel I am not far from solve this problem ... can you guide me a little bit ?</div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block" dir="ltr"><br></div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block" dir="ltr">Flaviu.</div><span class=""><font face="Arial" size="2"><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block"><br></div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block"><br></div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block" dir="ltr"><br clear="none"></div></font><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block"><font face="Arial" size="2"></font> <br clear="none"><br clear="none"> </div><div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px;display:block"><div><div><div dir="ltr">Since you're already using vtk-dicom, you can use vtkDICOMApplyRescale<div>to convert your CT image to Hounsfield units (if you use this filter, you should</div><div>also call AutoRescaleOff() on the reader).</div><div><br clear="none"></div><div>After the image has been converted to Hounsfield units, you can use the</div><div>"Window Center" and "Window Width" presets that are stored in the meta</div><div>data to set the range for the lookup table.</div><div><br clear="none"></div><div>However, I usually ignore these presets, and instead use the VTK class</div><div>vtkImageHistogramStatistics to compute the range. Its GetAutoRange()</div><div>computes a range by doing some simple histogram analysis.</div><div><br clear="none"></div><div>If you enjoy doing a lot of reading, the relevant parts the DICOM standard</div><div>are here:</div><div><a href="http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html" rel="nofollow" shape="rect" target="_blank">http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html</a></div><div><br clear="none"></div><div>After the image goes through vtkImageMapToColors, how are you</div><div>rendering it?</div><div><br clear="none"></div><div> - David<br><br></div></div></div></div></div></span></div></div></div></div> </div> </div> </div></div></div></blockquote></div><br></div>