# DICOM data \<--\> buffer using ITK/GDCM

**URL:** <https://discourse.itk.org/t/dicom-data-buffer-using-itk-gdcm/962>\
**Category:** Beginner Questions\
**Created:** [May 30, 2018, 4:06pm UTC](https://discourse.itk.org/t/dicom-data-buffer-using-itk-gdcm/962 "2018-05-30T16:06:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fijoy\_Vadakkumpadan](https://discourse.itk.org/user_avatar/discourse.itk.org/fijoy_vadakkumpadan/32/1287_2.png) [@Fijoy\_Vadakkumpadan](https://discourse.itk.org/u/Fijoy_Vadakkumpadan)\
**Post date:** [May 30, 2018, 4:06pm UTC](https://discourse.itk.org/t/dicom-data-buffer-using-itk-gdcm/962/1 "2018-05-30T16:06:20Z")

</div>

Hello,

I need to write/read arbitrary DICOM Data Sets and Data Elements to/from memory buffers to facilitate data exchange between nodes in a distributed application. The Data Elements I’m interested in include Sequences (Value Representation=SQ) that contain other (nested) Data Elements. Can anyone advise on the best way to do this?

Specifically, are the Write() and Read() functions provided by the gdcm::DataSet and gdcm::DataElement classes enough for the above purpose? If yes, what template arguments should I provide to these functions’ template parameters TDE and TSwap to get best performance? I did some simple tests with these functions using gdcm::ImplicitDataElement and gdcm::SwapperNoOp as template arguments, and these tests have been successful. I’m looking for confirmation that this approach is the best available within ITK/GDCM, for any caveats or limitations regarding Read()/Write() that I should keep in mind, and the best options for TDE and TSwap.

Thanks much,  
–Fijoy
