[vtkusers] (dcmtk -> vtkImageData) for Volume rendering

Cory Quammen cory.quammen at kitware.com
Wed Feb 10 10:38:50 EST 2016


Yep, what Simon said.

Cory

On Wed, Feb 10, 2016 at 9:34 AM, Simon ESNEAULT <simon.esneault at gmail.com>
wrote:

> Hello Mallikarjun,
>
> If it is a CT scan, maybe you're missing the Rescale Intercept Slope
> parameters to get the same results as the vtkDicomImageReader ?
> https://blog.kitware.com/dicom-rescale-intercept-rescale-slope-and-itk/
>
> Simon
>
>
> 2016-02-10 15:12 GMT+01:00 Mallikarjun K <mallikarjun49 at gmail.com>:
>
>> Hello Cory,
>>
>> Yes,the first image looks like a human head but it is surrounded by some
>> other gray/balck colored stuff.I think you are right,it is the issue with
>> color/opacity maps.The data is in the range of 0-65536(unsigned short).
>> Below are the color and opacity maps I applied.
>>
>>                 //setup opacity
>> d->m_opacityTransferFunction->AddPoint(132.108911, 0.000000);
>> d->m_opacityTransferFunction->AddPoint(197.063492, 0.041333);
>> d->m_opacityTransferFunction->AddPoint(1087.917989, 0.700000);
>> //setup gradient opacity
>> d->m_gradientTransferFunction->AddPoint(560.695000, 1.000000);
>>
>> // Setup color
>> d->m_colorTransferFunction->AddRGBPoint(176.881890, 0.650980, 0.000000,
>> 0.000000);
>> d->m_colorTransferFunction->AddRGBPoint(239.427822, 0.933333, 0.000000,
>> 0.000000);
>> d->m_colorTransferFunction->AddRGBPoint(301.973753, 1.000000, 0.800000,
>> 0.062745);
>> d->m_colorTransferFunction->AddRGBPoint(495.866142, 1.000000, 0.905882,
>> 0.666667);
>> d->m_colorTransferFunction->AddRGBPoint(677.249344, 1.000000, 0.882353,
>> 0.215686);
>> d->m_colorTransferFunction->AddRGBPoint(808.595801, 1.000000, 1.000000,
>> 1.000000);
>>
>> What should I do to eliminate gray/balck colored stuff ? please guide me.
>>
>> Thank you.
>> Regards,
>> Mallikarjun
>>
>>
>>
>> On Wed, Feb 10, 2016 at 7:18 PM, Cory Quammen <cory.quammen at kitware.com>
>> wrote:
>>
>>> Mallikarjun,
>>>
>>> Could you clarify for me whether the first image at all looks like a
>>> human head? Is the issue that the color/opacity maps do not appear to be
>>> applied correctly, or that the data is just completely strange when reading
>>> from dcmtk?
>>>
>>> If it is the latter, I have a couple guesses:
>>>
>>> - maybe your dimensions are off from what dcmtk tells you
>>> - maybe dcmtk's conventions for voxel order are different from VTK
>>>
>>> Cory
>>>
>>> On Wed, Feb 10, 2016 at 2:40 AM, Mallikarjun K <mallikarjun49 at gmail.com>
>>> wrote:
>>>
>>>> Hello Cory Quammen,
>>>>
>>>> Thanks for the response and suggestions.We are kind of established in
>>>> using dcmtk in our project,So couldn't use vtk-dicom for time being.
>>>>
>>>> Below is the code snippet which I used to get dcmtk data to vtk:
>>>>
>>>>
>>>> vtkDataArray* scalars = 0;
>>>>
>>>>
>>>>
>>>> switch (dicomDataType)
>>>> {
>>>> case TYPE_U32Data:
>>>> scalars = vtkUnsignedIntArray::New();
>>>> ((vtkUnsignedIntArray*)(scalars))->SetArray((unsigned int*)dicomData,
>>>> dicomDataSize, 1);//dicomData is the data from dcmtk
>>>> break;
>>>> case TYPE_U8Data:
>>>> scalars = vtkUnsignedCharArray::New();
>>>> ((vtkUnsignedCharArray*)(scalars))->SetArray((unsigned char*)dicomData,
>>>> dicomDataSize, 1);
>>>> break;
>>>> case TYPE_U16Data:
>>>> scalars = vtkUnsignedShortArray::New();
>>>> ((vtkUnsignedShortArray*)(scalars))->SetArray((unsigned
>>>> short*)dicomData, dicomDataSize, 1);
>>>> break;
>>>> case TYPE_S16Data:
>>>> scalars = vtkShortArray::New();
>>>> ((vtkShortArray*)(scalars))->SetArray((short*)dicomData, dicomDataSize,
>>>> 1);
>>>> break;
>>>> }
>>>> scalars->SetNumberOfComponents(1);
>>>> double range[2];
>>>> scalars->GetRange(range);
>>>> m_imageData = vtkImageData::New();
>>>> m_imageData->SetDimensions(dimensions);
>>>> m_imageData->SetSpacing(spacing);
>>>> m_imageData->GetPointData()->SetScalars(scalars);
>>>> scalars->Delete();
>>>> m_imageData->GetPointData()->GetScalars()->SetName("VR Cuboid");
>>>>
>>>>
>>>> Thanks&Regards,
>>>> Mallikarjun
>>>>
>>>>
>>>>
>>>> On Tue, Feb 9, 2016 at 8:47 PM, Cory Quammen <cory.quammen at kitware.com>
>>>> wrote:
>>>>
>>>>> How are you getting the data from dcmtk to VTK? Code would be helpful.
>>>>>
>>>>> As an aside, you may be interested in David Gobbi's excellent DICOM
>>>>> reader for VTK.
>>>>>
>>>>> https://github.com/dgobbi/vtk-dicom
>>>>>
>>>>> I believe you can build this within VTK by enabling the
>>>>> Module_vtkDICOM option.
>>>>>
>>>>> Best,
>>>>> Cory
>>>>>
>>>>> On Tue, Feb 9, 2016 at 8:25 AM, Mallikarjun K <mallikarjun49 at gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Hello All,
>>>>>> I used dcmtk to read dicom raw data and applied Modality LUT and
>>>>>> created a vtkImageData. When I used this data for Volume
>>>>>> Rendering(vtkGPUVolumeRayCastMapper), I am getting the following output.
>>>>>>
>>>>>>
>>>>>> [image: Inline image 2]
>>>>>>
>>>>>>
>>>>>> When I used vtkDicomImageReader's output for Volume rendering ,I am
>>>>>> getting the following output.
>>>>>>
>>>>>> [image: Inline image 1]
>>>>>>
>>>>>> Can anyone give some pointers why this is happening?
>>>>>>
>>>>>> Thanks in advance..
>>>>>> --
>>>>>> *With Kind Regards:*
>>>>>> Mallikarjun
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the VTK FAQ at:
>>>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>>>>
>>>>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cory Quammen
>>>>> R&D Engineer
>>>>> Kitware, Inc.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *With Kind Regards:*
>>>> Mallikarjuna K,
>>>> 07795531103/09908238861.
>>>>
>>>>
>>>
>>>
>>> --
>>> Cory Quammen
>>> R&D Engineer
>>> Kitware, Inc.
>>>
>>
>>
>>
>> --
>> *With Kind Regards:*
>> Mallikarjuna K,
>> 07795531103/09908238861.
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
> --
> ------------------------------------------------------------------
> Simon Esneault
> Rennes, France
> ------------------------------------------------------------------
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160210/b1877fbe/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 111519 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160210/b1877fbe/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 35053 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160210/b1877fbe/attachment-0003.png>


More information about the vtkusers mailing list