<html><head></head><body><div style="color:#000; background-color:#fff; font-family:Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div abp="21092"><span abp="21093"></span></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1463054070768_12343" abp="21094">This is a little pseudocode of the entire pipeline:</div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1463054070768_12342" abp="21094"><br></div><div id="yui_3_16_0_ym19_1_1463054070768_12165" abp="21094"> vtkDICOMReader* m_pDICOMReader = vtkDICOMReader::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12166" abp="21094"> m_pDICOMReader->RemoveAllInputs();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12167" abp="21094"> vtkDICOMApplyRescale* m_pRescale = vtkDICOMApplyRescale::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12168" dir="ltr" abp="21094"> m_pDICOMReader->SetFileNames(pFN); // all files from serie</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12169" abp="21094"> m_pDICOMReader->AutoRescaleOff();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12170" abp="21094"> m_pDICOMReader->Update();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12171" abp="21094"> m_pRescale->SetInputConnection(m_pDICOMReader->GetOutputPort());</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12172" abp="21094"> m_pRescale->Update();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12173" abp="21094"> vtkImageReslice* m_pResliceAxial = vtkImageReslice::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12174" abp="21094"> m_pResliceAxial->SetInputConnection(m_pRescale->GetOutputPort());</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12175" abp="21094"> vtkLookupTable* m_pLUTAxial = vtkLookupTable::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12176" abp="21094"> m_pLUTAxial->SetValueRange(0.0, 1.0); <font id="yui_3_16_0_ym19_1_1463054070768_12177" color="#008000" abp="21394">// from black to white</font></div><div class="qtdSeparateBR" abp="21094"><font id="yui_3_16_0_ym19_1_1463054070768_12178" color="#008000">
</font></div><div id="yui_3_16_0_ym19_1_1463054070768_12179" abp="21094"> m_pLUTAxial->SetSaturationRange(0.0, 0.0); <font id="yui_3_16_0_ym19_1_1463054070768_12180" color="#008000">// no color saturation</font></div><div class="qtdSeparateBR" abp="21094"><font id="yui_3_16_0_ym19_1_1463054070768_12181" color="#008000">
</font></div><div id="yui_3_16_0_ym19_1_1463054070768_12182" abp="21094"> vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12183" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12184" color="#0000ff" abp="21395">const</font> vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth);</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12185" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12186" color="#0000ff" abp="21396">const</font> vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter);</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12187" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12188" color="#0000ff" abp="21397">double</font> dWindow = window.AsDouble();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12189" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12190" color="#0000ff" abp="21398">double</font> dLevel = level.AsDouble();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12191" abp="21094"> m_pLUTAxial->SetRange(dLevel, dWindow); <font id="yui_3_16_0_ym19_1_1463054070768_12192" color="#008000" abp="21399">// image intensity range</font></div><div class="qtdSeparateBR" abp="21094"><font id="yui_3_16_0_ym19_1_1463054070768_12193" color="#008000">
</font></div><div id="yui_3_16_0_ym19_1_1463054070768_12194" abp="21094"> m_pLUTAxial->SetRampToLinear();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12195" abp="21094"> m_pLUTAxial->Build();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12196" abp="21094"> vtkImageMapToColors* m_pColorAxial = vtkImageMapToColors::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12197" abp="21094"> m_pColorAxial->SetLookupTable(m_pLUTAxial);</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12198" abp="21094"> m_pColorAxial->SetInputConnection(m_pResliceAxial->GetOutputPort());</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12199" abp="21094"> vtkImageActor* m_pImageActor = vtkImageActor::New();</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12200" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12201" color="#008000" abp="21400">// and then, forward, setup m_pColorAxial to an image actor:</font></div><div class="qtdSeparateBR" abp="21094"><font id="yui_3_16_0_ym19_1_1463054070768_12202" color="#008000">
</font></div><div id="yui_3_16_0_ym19_1_1463054070768_12203" abp="21094"> pImageActor->GetMapper()->SetInputConnection(m_pColorAxial->GetOutputPort());</div><div class="qtdSeparateBR" abp="21094">
</div><div id="yui_3_16_0_ym19_1_1463054070768_12204" abp="21094"> <font id="yui_3_16_0_ym19_1_1463054070768_12205" color="#008000" abp="21401">// and add image actor to a renderer</font></div><div class="qtdSeparateBR" abp="21094"><font id="yui_3_16_0_ym19_1_1463054070768_12206" color="#008000">
</font></div><div id="yui_3_16_0_ym19_1_1463054070768_12207" abp="21094"> m_pRenderer->AddActor(m_pImageActor);</div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1463054070768_12279" dir="ltr" abp="21094"><br abp="21095"></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12055" style="display: block;" abp="21097"><div id="yui_3_16_0_ym19_1_1463054070768_12054" style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="21098"><div id="yui_3_16_0_ym19_1_1463054070768_12053" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="21099"><div class="y_msg_container" id="yui_3_16_0_ym19_1_1463054070768_12052" abp="21105"><div id="yiv3793393620" abp="21106"><div id="yui_3_16_0_ym19_1_1463054070768_12051" abp="21107"><div id="yui_3_16_0_ym19_1_1463054070768_12050" 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);" abp="21108"><div class="yiv3793393620yahoo_quoted" id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5720" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="21117"><font id="yui_3_16_0_ym19_1_1463054070768_12064" face="Arial" size="2" abp="21119"></font><br></div><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12404" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="21117">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 class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12405" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="21117"><br></div><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12406" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="21117">Flaviu.</div><font id="yui_3_16_0_ym19_1_1463054070768_12214" face="Arial" size="2" abp="21119"><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12259" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="21117"><br></div><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12216" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="21117"><br></div><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12213" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="21118"><br clear="none" abp="21120"></div></font><div class="yiv3793393620yahoo_quoted" id="yui_3_16_0_ym19_1_1463054070768_12212" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="21117"><font face="Arial" size="2" abp="21119"></font> <br clear="none" abp="21121"><br clear="none" abp="21122"> </div><div class="yiv3793393620y_msg_container" id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5725" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="21123"><div id="yiv3793393620" abp="21124"><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5724" abp="21125"><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5723" dir="ltr" abp="21126">Since you're already using vtk-dicom, you can use vtkDICOMApplyRescale<div id="yui_3_16_0_ym19_1_1463054070768_12060" abp="21127">to convert your CT image to Hounsfield units (if you use this filter, you should</div><div id="yui_3_16_0_ym19_1_1463054070768_12291" abp="21128">also call AutoRescaleOff() on the reader).</div><div id="yui_3_16_0_ym19_1_1463054070768_12289" abp="21129"><br clear="none" abp="21130"></div><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5726" abp="21131">After the image has been converted to Hounsfield units, you can use the</div><div abp="21132">"Window Center" and "Window Width" presets that are stored in the meta</div><div abp="21133">data to set the range for the lookup table.</div><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5727" abp="21134"><br clear="none" abp="21135"></div><div id="yui_3_16_0_ym19_1_1463054070768_12089" abp="21136">However, I usually ignore these presets, and instead use the VTK class</div><div id="yui_3_16_0_ym19_1_1463054070768_12273" abp="21137">vtkImageHistogramStatistics to compute the range. Its GetAutoRange()</div><div id="yui_3_16_0_ym19_1_1463054070768_12266" abp="21138">computes a range by doing some simple histogram analysis.</div><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5728" abp="21139"><br clear="none" abp="21140"></div><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5729" abp="21141">If you enjoy doing a lot of reading, the relevant parts the DICOM standard</div><div abp="21142">are here:</div><div id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5731" abp="21143"><a id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5730" href="http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html" target="_blank" rel="nofollow" shape="rect" abp="21144">http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html</a></div><div class="yiv3793393620gmail_extra" id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5732" abp="21145"><br clear="none" abp="21146"></div><div class="yiv3793393620gmail_extra" id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5733" abp="21147">After the image goes through vtkImageMapToColors, how are you</div><div class="yiv3793393620gmail_extra" id="yiv3793393620yui_3_16_0_ym19_1_1463054070768_5734" abp="21148">rendering it?</div><div class="yiv3793393620gmail_extra" id="yui_3_16_0_ym19_1_1463054070768_12274" abp="21149"><br clear="none" abp="21150"></div><div class="yiv3793393620gmail_extra" id="yui_3_16_0_ym19_1_1463054070768_12090" abp="21151"> - David<br id="yui_3_16_0_ym19_1_1463054070768_12092" abp="21243"><br abp="21244"></div></div></div></div></div></div></div></div></div> </div> </div> </div></div></body></html>