<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_ym19_1_1463743659440_2639" abp="3550"><span id="yui_3_16_0_ym19_1_1463743659440_2638" abp="3551">Hi David.</span></div><div id="yui_3_16_0_ym19_1_1463743659440_2641" dir="ltr" abp="3552"><span id="yui_3_16_0_ym19_1_1463743659440_2640" abp="3553">Because of your excellent explanation, I have found my mistake ... after I had setup WL correctly on LUT on vtkImageMapToColors, I had taken these values, and setup vtkImageActor WL.</span></div><div id="yui_3_16_0_ym19_1_1463743659440_2776" dir="ltr" abp="3554"><span abp="3555"><br abp="3556"></span></div><div id="yui_3_16_0_ym19_1_1463743659440_2775" dir="ltr" abp="3557"><span id="yui_3_16_0_ym19_1_1463743659440_2774" abp="3558">Here is the code that I had used:</span></div><div id="yui_3_16_0_ym19_1_1463743659440_3477" dir="ltr" abp="3559"><span abp="3560"><br abp="3561"></span></div><div id="yui_3_16_0_ym19_1_1463743659440_2814" dir="ltr" abp="3562"><span id="yui_3_16_0_ym19_1_1463743659440_3313" abp="3563">// read the CT<br id="yui_3_16_0_ym19_1_1463743659440_2815" abp="3564">vtkDICOMReader* m_pDICOMReader = vtkDICOMReader::New();<br id="yui_3_16_0_ym19_1_1463743659440_2816" abp="3565">m_pDICOMReader->RemoveAllInputs();<br id="yui_3_16_0_ym19_1_1463743659440_2817" abp="3566">vtkDICOMApplyRescale* m_pRescale = vtkDICOMApplyRescale::New();<br id="yui_3_16_0_ym19_1_1463743659440_2818" abp="3567">m_pDICOMReader->SetFileNames(pFN); // all files from serie<br id="yui_3_16_0_ym19_1_1463743659440_2819" abp="3568">m_pDICOMReader->AutoRescaleOff();<br id="yui_3_16_0_ym19_1_1463743659440_2820" abp="3569">m_pDICOMReader->Update();<br id="yui_3_16_0_ym19_1_1463743659440_2821" abp="3570">m_pRescale->SetInputConnection(m_pDICOMReader->GetOutputPort());<br id="yui_3_16_0_ym19_1_1463743659440_2822" abp="3571">m_pRescale->Update();</span></div><div id="yui_3_16_0_ym19_1_1463743659440_2859" dir="ltr" abp="3572"><span id="yui_3_16_0_ym19_1_1463743659440_2824" abp="3573">vtkImageReslice* m_pResliceAxial = vtkImageReslice::New();<br id="yui_3_16_0_ym19_1_1463743659440_2825" abp="3574">m_pResliceAxial->SetInputConnection(m_pRescale->GetOutputPort());<br id="yui_3_16_0_ym19_1_1463743659440_2826" abp="3575">// setup LUT<br id="yui_3_16_0_ym19_1_1463743659440_2827" abp="3576">vtkLookupTable* m_pLUTAxial = vtkLookupTable::New();<br id="yui_3_16_0_ym19_1_1463743659440_2828" abp="3577">m_pLUTAxial->SetValueRange(0.0, 1.0); // from black to white<br id="yui_3_16_0_ym19_1_1463743659440_2829" abp="3578">m_pLUTAxial->SetSaturationRange(0.0, 0.0); // no color saturation<br id="yui_3_16_0_ym19_1_1463743659440_2830" abp="3579">vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData();<br id="yui_3_16_0_ym19_1_1463743659440_2831" abp="3580">const vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth);<br id="yui_3_16_0_ym19_1_1463743659440_2832" abp="3581">const vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter);<br id="yui_3_16_0_ym19_1_1463743659440_2833" abp="3582">double dWindow = window.AsDouble();<br id="yui_3_16_0_ym19_1_1463743659440_2834" abp="3583">double dLevel = level.AsDouble();<br id="yui_3_16_0_ym19_1_1463743659440_2835" abp="3584">m_pLUTAxial->SetRange(dLevel - 0.5 * dWindow, dLevel + 0.5 * dWindow); // image intensity range<br id="yui_3_16_0_ym19_1_1463743659440_2836" abp="3585">m_pLUTAxial->SetRampToLinear();<br id="yui_3_16_0_ym19_1_1463743659440_2837" abp="3586">m_pLUTAxial->Build();<br id="yui_3_16_0_ym19_1_1463743659440_2838" abp="3587">vtkImageMapToColors* m_pColorAxial = vtkImageMapToColors::New();<br id="yui_3_16_0_ym19_1_1463743659440_2839" abp="3588">m_pColorAxial->SetLookupTable(m_pLUTAxial);     // setup LUT<br id="yui_3_16_0_ym19_1_1463743659440_2840" abp="3589">m_pColorAxial->SetInputConnection(m_pResliceAxial->GetOutputPort());<br id="yui_3_16_0_ym19_1_1463743659440_2841" abp="3590">vtkImageActor* m_pImageActor = vtkImageActor::New();<br id="yui_3_16_0_ym19_1_1463743659440_2842" abp="3591">// and then, forward, setup m_pColorAxial to an image actor:<br id="yui_3_16_0_ym19_1_1463743659440_2843" abp="3592">pImageActor->GetMapper()->SetInputConnection(m_pColorAxial->GetOutputPort());<br id="yui_3_16_0_ym19_1_1463743659440_2844" abp="3593">// and add image actor to a renderer<br id="yui_3_16_0_ym19_1_1463743659440_2845" abp="3594">m_pRenderer->AddActor(m_pImageActor);<br id="yui_3_16_0_ym19_1_1463743659440_2846" abp="3595">// setup the actor WL with original values - my misake - that is why the image was whiter<br id="yui_3_16_0_ym19_1_1463743659440_2847" abp="3596">m_pImageActor->GetProperty()->SetColorWindow(dWindow);  // !! these are lines that I have removed <br id="yui_3_16_0_ym19_1_1463743659440_2848" abp="3597">m_pImageActor->GetProperty()->SetColorLevel(dLevel);    // !! these are lines that I have removed</span></div><div id="yui_3_16_0_ym19_1_1463743659440_2866" abp="3598"><br abp="3599"></div><div id="yui_3_16_0_ym19_1_1463743659440_3102" abp="3600">Now everything are working well.</div><div id="yui_3_16_0_ym19_1_1463743659440_3396" abp="3600"><br abp="3601"></div><div id="yui_3_16_0_ym19_1_1463743659440_3320" dir="ltr" abp="3602">"And the values (W: 80, L: 35) that are shown on the image... where do they come from?"</div><div id="yui_3_16_0_ym19_1_1463743659440_3338" dir="ltr" abp="3603"><br abp="3604"></div><div id="yui_3_16_0_ym19_1_1463743659440_3293" dir="ltr" abp="3605">These values are coming from the original DICOM images, and it has been taken like this:</div><div id="yui_3_16_0_ym19_1_1463743659440_3292" dir="ltr" abp="3606"><br abp="3607"></div><div id="yui_3_16_0_ym19_1_1463743659440_3109" dir="ltr" abp="3608">void CMyDoc::GetOriginalWindowLevel(double& dWindow, double& dLevel, BOOL bUpdateReader/* = FALSE*/)<br id="yui_3_16_0_ym19_1_1463743659440_3080" abp="3609">{<br id="yui_3_16_0_ym19_1_1463743659440_3081" abp="3610"> if(NULL == m_pDICOMReader)<br id="yui_3_16_0_ym19_1_1463743659440_3082" abp="3611">  return;<br id="yui_3_16_0_ym19_1_1463743659440_3083" abp="3612"> if(bUpdateReader)<br id="yui_3_16_0_ym19_1_1463743659440_3084" abp="3613">  m_pDICOMReader->Update();<br id="yui_3_16_0_ym19_1_1463743659440_3085" abp="3614"> vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData();<br id="yui_3_16_0_ym19_1_1463743659440_3086" abp="3615"> const vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth);<br id="yui_3_16_0_ym19_1_1463743659440_3087" abp="3616"> const vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter);<br id="yui_3_16_0_ym19_1_1463743659440_3088" abp="3617"> dWindow = window.AsDouble();<br id="yui_3_16_0_ym19_1_1463743659440_3089" abp="3618"> dLevel = level.AsDouble();<br id="yui_3_16_0_ym19_1_1463743659440_3090" abp="3619">}<br id="yui_3_16_0_ym19_1_1463743659440_3091" abp="3620"></div><div id="yui_3_16_0_ym19_1_1463743659440_3111" dir="ltr" abp="3621"><br abp="3622"></div><div id="yui_3_16_0_ym19_1_1463743659440_3110" dir="ltr" abp="3623"><br abp="3624"></div><div id="yui_3_16_0_ym19_1_1463743659440_3164" dir="ltr" abp="3625">"but you posted code, and an output image that the code produced.  So I am confused.  Did the code crash?  Or did it just display an error message?"</div><div id="yui_3_16_0_ym19_1_1463743659440_3165" dir="ltr" abp="3626"><br abp="3627"></div><div id="yui_3_16_0_ym19_1_1463743659440_3290" dir="ltr" abp="3628">In the code case without using LUT, the program has started, and shown images like the original ones ... but after few image handling (zooming, moving, etc.) the program was crashed. All time when I handling the image (before crash, of course), the debugger shows me the error like in the post title: "No LookupTable was set but input data is not VTK_UNSIGNED_CHAR".</div><div id="yui_3_16_0_ym19_1_1463743659440_3335" dir="ltr" abp="3628"><br></div><div id="yui_3_16_0_ym19_1_1463743659440_3407" dir="ltr" abp="3628">One thing is sure: without your help, I would didn't make it ! I really appreciate your help ! Kindly thank you David !</div><div id="yui_3_16_0_ym19_1_1463743659440_3408" dir="ltr" abp="3628"><br></div><div id="yui_3_16_0_ym19_1_1463743659440_3414" dir="ltr" abp="3628">Flaviu.</div><div id="yui_3_16_0_ym19_1_1463743659440_3336" dir="ltr" abp="3628"><br></div><div id="yui_3_16_0_ym19_1_1463743659440_3288" dir="ltr" abp="3628"><br></div><div id="yui_3_16_0_ym19_1_1463743659440_3289" dir="ltr" abp="3628"><br abp="3629"></div></div></body></html>