<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 id="yui_3_16_0_1_1463660880199_2761" dir="ltr" abp="2440">Hi David. Something strange is happen ... I had tried to set LUT as you said, but the image are still whiter than without LUT ... see attached images ...</div><div id="yui_3_16_0_1_1463660880199_2760" dir="ltr" abp="2440"><br></div><div id="yui_3_16_0_1_1463660880199_3086" dir="ltr" abp="2440">And of course, I can not use vtkImageMapToColors without LUT, because the application is crashing ... is there a solution here ?</div><div id="yui_3_16_0_1_1463660880199_3034" dir="ltr" abp="2440"><br></div><div id="yui_3_16_0_1_1463660880199_3035" dir="ltr" abp="2440">Flaviu.<br abp="2444"></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" id="yui_3_16_0_1_1463660880199_2651" style="display: block;" abp="2445"> <div id="yui_3_16_0_1_1463660880199_2650" style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2446"> <div id="yui_3_16_0_1_1463660880199_2649" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2447"> <div id="yui_3_16_0_1_1463660880199_2648" dir="ltr" abp="2448"><font id="yui_3_16_0_1_1463660880199_2647" face="Arial" size="2" abp="2449"> </font><font id="yui_3_16_0_1_1463660880199_2668" face="Arial" size="2" abp="2467"><br clear="none" abp="2468"></font></div><div class="y_msg_container" id="yui_3_16_0_1_1463660880199_2672" abp="2453"><div id="yiv8612973935" abp="2454"><div id="yui_3_16_0_1_1463660880199_2671" abp="2455"><div id="yui_3_16_0_1_1463660880199_2670" 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="2456"><div class="yiv8612973935yqt9222146475" id="yiv8612973935yqt75572" abp="2462"><div class="yiv8612973935yahoo_quoted" id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3031" style="display: block;" abp="2463"><div id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3030" style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2464"><div id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3029" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2465"> <br clear="none" abp="2469"><br clear="none" abp="2470"> <div class="yiv8612973935y_msg_container" id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3028" abp="2471"><div id="yiv8612973935" abp="2472"><div id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3027" abp="2473"><div id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3026" dir="ltr" abp="2474">Hi Flaviu,<div id="yui_3_16_0_1_1463660880199_2762" abp="2475"><br clear="none" abp="2476"></div><div id="yui_3_16_0_1_1463660880199_2733" abp="2477">This is incorrect:</div><div id="yiv8612973935yui_3_16_0_ym19_1_1463203246557_3025" abp="2478"><br clear="none" abp="2479"></div><div id="yui_3_16_0_1_1463660880199_2777" abp="2480">m_pLUTAxial->SetRange(dLevel, dWindow);<br clear="none" abp="2481"></div><div id="yui_3_16_0_1_1463660880199_2776" abp="2482"><br clear="none" abp="2483"></div><div abp="2484">It should be something like this:</div><div abp="2485"><br clear="none" abp="2486"></div><div abp="2487"><div abp="2488">m_pLUTAxial->SetRange(dLevel - 0.5*dWindow, dLevel + 0.5*dWindow);</div></div><div id="yui_3_16_0_1_1463660880199_2710" abp="2489"><br clear="none" abp="2490"></div><div abp="2491"> - David</div><div id="yui_3_16_0_1_1463660880199_2907" abp="2492"><br clear="none" abp="2493"></div></div><div class="yiv8612973935yqt0539917848" id="yiv8612973935yqt13525" abp="2494"><div class="yiv8612973935gmail_extra" id="yui_3_16_0_1_1463660880199_2716" abp="2495"><br clear="none" abp="2496"><div class="yiv8612973935gmail_quote" id="yui_3_16_0_1_1463660880199_2715" abp="2497">On Fri, May 13, 2016 at 1:22 AM, Flaviu2 <span dir="ltr" abp="2498"><<a href="mailto:flaviu2@yahoo.com" target="_blank" rel="nofollow" shape="rect" abp="2499" ymailto="mailto:flaviu2@yahoo.com">flaviu2@yahoo.com</a>></span> wrote:<br clear="none" abp="2500"><blockquote class="yiv8612973935gmail_quote" id="yui_3_16_0_1_1463660880199_2714" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" abp="2501"><div id="yui_3_16_0_1_1463660880199_2713" abp="2502"><div id="yui_3_16_0_1_1463660880199_2712" 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="2503"><div abp="2504"><span abp="2505"></span></div><div id="yui_3_16_0_1_1463660880199_2711" abp="2506">This is a little pseudocode of the entire pipeline:</div><div id="yui_3_16_0_1_1463660880199_2717" abp="2507"><br clear="none" abp="2508"></div><div id="yui_3_16_0_1_1463660880199_2902" abp="2509"> vtkDICOMReader* m_pDICOMReader = vtkDICOMReader::New();</div><div abp="2510">
</div><div id="yui_3_16_0_1_1463660880199_2732" abp="2511"> m_pDICOMReader->RemoveAllInputs();</div><div abp="2512">
</div><div id="yui_3_16_0_1_1463660880199_2718" abp="2513"> vtkDICOMApplyRescale* m_pRescale = vtkDICOMApplyRescale::New();</div><div abp="2514">
</div><div dir="ltr" abp="2515"> m_pDICOMReader->SetFileNames(pFN); // all files from serie</div><div abp="2516">
</div><div abp="2517"> m_pDICOMReader->AutoRescaleOff();</div><div abp="2518">
</div><div abp="2519"> m_pDICOMReader->Update();</div><div abp="2520">
</div><div id="yui_3_16_0_1_1463660880199_2719" abp="2521"> m_pRescale->SetInputConnection(m_pDICOMReader->GetOutputPort());</div><div abp="2522">
</div><div abp="2523"> m_pRescale->Update();</div><div abp="2524">
</div><div id="yui_3_16_0_1_1463660880199_2903" abp="2525"> vtkImageReslice* m_pResliceAxial = vtkImageReslice::New();</div><div abp="2526">
</div><div abp="2527"> m_pResliceAxial->SetInputConnection(m_pRescale->GetOutputPort());</div><div abp="2528">
</div><div id="yui_3_16_0_1_1463660880199_2720" abp="2529"> vtkLookupTable* m_pLUTAxial = vtkLookupTable::New();</div><span class="yiv8612973935" abp="2530"></span><div abp="2531">
</div><div id="yui_3_16_0_1_1463660880199_2904" abp="2532"> m_pLUTAxial->SetValueRange(0.0, 1.0); <font color="#008000" abp="2533">// from black to white</font></div><div abp="2534"><font color="#008000" abp="2535">
</font></div><div abp="2536"> m_pLUTAxial->SetSaturationRange(0.0, 0.0); <font color="#008000" abp="2537">// no color saturation</font></div><div abp="2538"><font color="#008000" abp="2539">
</font></div><div abp="2540"> vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData();</div><div abp="2541">
</div><div id="yui_3_16_0_1_1463660880199_2721" abp="2542"> <font color="#0000ff" abp="2543">const</font> vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth);</div><div abp="2544">
</div><div id="yui_3_16_0_1_1463660880199_2905" abp="2545"> <font color="#0000ff" abp="2546">const</font> vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter);</div><div abp="2547">
</div><div abp="2548"> <font color="#0000ff" abp="2549">double</font> dWindow = window.AsDouble();</div><div abp="2550">
</div><div id="yui_3_16_0_1_1463660880199_2874" abp="2551"> <font color="#0000ff" abp="2552">double</font> dLevel = level.AsDouble();</div><div abp="2553">
</div><div id="yui_3_16_0_1_1463660880199_2728" abp="2554"> m_pLUTAxial->SetRange(dLevel, dWindow); <font id="yui_3_16_0_1_1463660880199_2727" color="#008000" abp="2555">// image intensity range</font></div><div abp="2556"><font color="#008000" abp="2557">
</font></div><div abp="2558"> m_pLUTAxial->SetRampToLinear();</div><div abp="2559">
</div><div id="yui_3_16_0_1_1463660880199_2731" abp="2560"> m_pLUTAxial->Build();</div><div abp="2561">
</div><div id="yui_3_16_0_1_1463660880199_2729" abp="2562"> vtkImageMapToColors* m_pColorAxial = vtkImageMapToColors::New();</div><div abp="2563">
</div><div id="yui_3_16_0_1_1463660880199_2730" abp="2564"> m_pColorAxial->SetLookupTable(m_pLUTAxial);</div><div abp="2565">
</div><div id="yui_3_16_0_1_1463660880199_2906" abp="2566"> m_pColorAxial->SetInputConnection(m_pResliceAxial->GetOutputPort());</div><div abp="2567">
</div><div id="yui_3_16_0_1_1463660880199_2726" abp="2568"> vtkImageActor* m_pImageActor = vtkImageActor::New();</div><div abp="2569">
</div><div id="yui_3_16_0_1_1463660880199_2723" abp="2570"> <font id="yui_3_16_0_1_1463660880199_2722" color="#008000" abp="2571">// and then, forward, setup m_pColorAxial to an image actor:</font></div><div abp="2572"><font color="#008000" abp="2573">
</font></div><div id="yui_3_16_0_1_1463660880199_2724" abp="2574"> pImageActor->GetMapper()->SetInputConnection(m_pColorAxial->GetOutputPort());</div><div abp="2575">
</div><div abp="2576"> <font color="#008000" abp="2577">// and add image actor to a renderer</font></div><div abp="2578"><font color="#008000" abp="2579">
</font></div><div abp="2580"> m_pRenderer->AddActor(m_pImageActor);</div><div dir="ltr" abp="2581"><br clear="none" abp="2582"></div><div id="yui_3_16_0_1_1463660880199_2865" style="display: block;" abp="2583"><div id="yui_3_16_0_1_1463660880199_2864" style="font-family: Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2584"><div id="yui_3_16_0_1_1463660880199_2863" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" abp="2585"><div id="yui_3_16_0_1_1463660880199_2862" abp="2586"><div id="yui_3_16_0_1_1463660880199_2861" abp="2587"><div id="yui_3_16_0_1_1463660880199_2860" abp="2588"><div id="yui_3_16_0_1_1463660880199_2859" 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="2589"><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="2590"><font face="Arial" size="2" abp="2591"></font><br clear="none" abp="2592"></div><div id="yui_3_16_0_1_1463660880199_2873" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="2593">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" abp="2594"><br clear="none" abp="2595"></div><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="2596">Flaviu.</div><span class="yiv8612973935" abp="2597"><font face="Arial" size="2" abp="2598"></font></span><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="2599"><br clear="none" abp="2600"></div><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="2601"><br clear="none" abp="2602"></div><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" dir="ltr" abp="2603"><br clear="none" abp="2604"></div><div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="2605"><font face="Arial" size="2" abp="2606"></font> <br clear="none" abp="2607"><br clear="none" abp="2608"> </div><div id="yui_3_16_0_1_1463660880199_2858" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px; display: block;" abp="2609"><div id="yui_3_16_0_1_1463660880199_2857" abp="2610"><div id="yui_3_16_0_1_1463660880199_2856" abp="2611"><div id="yui_3_16_0_1_1463660880199_2855" dir="ltr" abp="2612">Since you're already using vtk-dicom, you can use vtkDICOMApplyRescale<div abp="2613">to convert your CT image to Hounsfield units (if you use this filter, you should</div><div abp="2614">also call AutoRescaleOff() on the reader).</div><div id="yui_3_16_0_1_1463660880199_2872" abp="2615"><br clear="none" abp="2616"></div><div abp="2617">After the image has been converted to Hounsfield units, you can use the</div><div abp="2618">"Window Center" and "Window Width" presets that are stored in the meta</div><div id="yui_3_16_0_1_1463660880199_2871" abp="2619">data to set the range for the lookup table.</div><div abp="2620"><br clear="none" abp="2621"></div><div abp="2622">However, I usually ignore these presets, and instead use the VTK class</div><div id="yui_3_16_0_1_1463660880199_2870" abp="2623">vtkImageHistogramStatistics to compute the range. Its GetAutoRange()</div><div abp="2624">computes a range by doing some simple histogram analysis.</div><div abp="2625"><br clear="none" abp="2626"></div><div abp="2627">If you enjoy doing a lot of reading, the relevant parts the DICOM standard</div><div id="yui_3_16_0_1_1463660880199_2869" abp="2628">are here:</div><div abp="2629"><a href="http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html" target="_blank" rel="nofollow" shape="rect" abp="2630">http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html</a></div><div abp="2631"><br clear="none" abp="2632"></div><div id="yui_3_16_0_1_1463660880199_2868" abp="2633">After the image goes through vtkImageMapToColors, how are you</div><div id="yui_3_16_0_1_1463660880199_2867" abp="2634">rendering it?</div><div id="yui_3_16_0_1_1463660880199_2866" abp="2635"><br clear="none" abp="2636"></div><div id="yui_3_16_0_1_1463660880199_2854" abp="2637"> - David<br clear="none" abp="2638"><br clear="none" abp="2639"></div></div></div></div></div></div></div></div></div> </div> </div> </div></div></div></blockquote></div><br clear="none" abp="2640"></div></div></div></div><br clear="none" abp="2641"><br clear="none" abp="2642"></div> </div> </div> </div></div></div></div></div><br abp="2643"><br abp="2644"></div> </div> </div> </div></div></body></html>