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

Mallikarjun K mallikarjun49 at gmail.com
Wed Feb 10 02:40:58 EST 2016


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160210/77827990/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/77827990/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/77827990/attachment-0003.png>


More information about the vtkusers mailing list