[vtkusers] Fw: No LookupTable was set but input data is not VTK_UNSIGNED_CHAR

Flaviu2 flaviu2 at yahoo.com
Fri May 13 03:22:28 EDT 2016


This is a little pseudocode of the entire pipeline:
 vtkDICOMReader* m_pDICOMReader = vtkDICOMReader::New(); m_pDICOMReader->RemoveAllInputs(); vtkDICOMApplyRescale* m_pRescale = vtkDICOMApplyRescale::New(); m_pDICOMReader->SetFileNames(pFN); // all files from serie m_pDICOMReader->AutoRescaleOff(); m_pDICOMReader->Update(); m_pRescale->SetInputConnection(m_pDICOMReader->GetOutputPort()); m_pRescale->Update(); vtkImageReslice* m_pResliceAxial = vtkImageReslice::New(); m_pResliceAxial->SetInputConnection(m_pRescale->GetOutputPort()); vtkLookupTable* m_pLUTAxial = vtkLookupTable::New(); m_pLUTAxial->SetValueRange(0.0, 1.0); // from black to white m_pLUTAxial->SetSaturationRange(0.0, 0.0); // no color saturation vtkDICOMMetaData* pMeta = m_pDICOMReader->GetMetaData(); const vtkDICOMValue& window = pMeta->GetAttributeValue(DC::WindowWidth); const vtkDICOMValue& level = pMeta->GetAttributeValue(DC::WindowCenter); double dWindow = window.AsDouble(); double dLevel = level.AsDouble(); m_pLUTAxial->SetRange(dLevel, dWindow); // image intensity range m_pLUTAxial->SetRampToLinear(); m_pLUTAxial->Build(); vtkImageMapToColors* m_pColorAxial = vtkImageMapToColors::New(); m_pColorAxial->SetLookupTable(m_pLUTAxial); m_pColorAxial->SetInputConnection(m_pResliceAxial->GetOutputPort()); vtkImageActor* m_pImageActor = vtkImageActor::New(); // and then, forward, setup m_pColorAxial to an image actor: pImageActor->GetMapper()->SetInputConnection(m_pColorAxial->GetOutputPort()); // and add image actor to a renderer m_pRenderer->AddActor(m_pImageActor);

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 ?
Flaviu.


 

 Since you're already using vtk-dicom, you can use vtkDICOMApplyRescaleto convert your CT image to Hounsfield units (if you use this filter, you shouldalso call AutoRescaleOff() on the reader).
After the image has been converted to Hounsfield units, you can use the"Window Center" and "Window Width" presets that are stored in the metadata to set the range for the lookup table.
However, I usually ignore these presets, and instead use the VTK classvtkImageHistogramStatistics to compute the range.  Its GetAutoRange()computes a range by doing some simple histogram analysis.
If you enjoy doing a lot of reading, the relevant parts the DICOM standardare here:http://dicom.nema.org/MEDICAL/Dicom/current/output/chtml/part03/sect_C.11.html
After the image goes through vtkImageMapToColors, how are yourendering it?
 - David

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160513/08d79566/attachment.html>


More information about the vtkusers mailing list