:orphan:

.. _general_examples:

General examples
----------------

Somewhere to start



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This examples illustrates how to find the differences between two DICOM files.">

.. only:: html

  .. image:: /auto_examples/images/thumb/sphx_glr_plot_dicom_difference_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_plot_dicom_difference.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Analyse differences between DICOM files</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Very simple app to display unicode person names.">

.. only:: html

  .. image:: /auto_examples/images/thumb/sphx_glr_show_charset_name_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_show_charset_name.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Display unicode person names</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show how to write a DICOM dataset into a byte array and to read it back from a byte array. This can be helpful for example if working with datasets saved as blobs in a database.">

.. only:: html

  .. image:: /auto_examples/images/thumb/sphx_glr_memory_dataset_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_memory_dataset.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show working with memory-based dataset</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="sudo apt install tix-dev sudo pip install -U pydicom python3 dicomtree.py file.dcm Or in file browser, right click on file.dcm, open with custom command: python3 dicomtree.py">

.. only:: html

  .. image:: /auto_examples/images/thumb/sphx_glr_dicomtree_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_dicomtree.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a dicom file using hierarchical tree</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /auto_examples/plot_dicom_difference
   /auto_examples/show_charset_name
   /auto_examples/memory_dataset
   /auto_examples/dicomtree


Image processing
----------------

These examples illustrate the image processing available in pydicom which can
be applied to DICOM images.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to downsize an MR image from 512  imes 512 to 64       imes 64. The downsizing is performed by taking the central section instead of averagin the pixels. Finally, the image is store as a dicom image.">

.. only:: html

  .. image:: /auto_examples/image_processing/images/thumb/sphx_glr_plot_downsize_image_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_image_processing_plot_downsize_image.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Downsize MRI image using pydicom</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example illustrates how to plot waveforms from a Waveform Sequence using matplotlib.">

.. only:: html

  .. image:: /auto_examples/image_processing/images/thumb/sphx_glr_plot_waveforms_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_image_processing_plot_waveforms.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Decode and plot Waveform Data</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example illustrates loading multiple files, sorting them by slice location, building a 3D image and reslicing it in different planes.">

.. only:: html

  .. image:: /auto_examples/image_processing/images/thumb/sphx_glr_reslice_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_image_processing_reslice.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Load CT slices and plot axial, sagittal and coronal images</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


Input-output
------------

These examples illustrate the use of pydicom to read DICOM data.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Given an RTPLAN DICOM file, list basic info for the beams in it.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_read_rtplan_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_read_rtplan.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Read RTPLAN DICOM and list information</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example illustrates how to open a DICOM file, print some dataset information, and show it using matplotlib.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_read_dicom_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_read_dicom.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Read a Dataset and plot Pixel Data</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example illustrates how to print the data set in your own format.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_printing_dataset_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_printing_dataset.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Format the output of the data set printing</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to write a DICOM file from scratch using pydicom. This example does not produce a DICOM standards compliant file as written, you will have to change UIDs to valid values and add all required DICOM data elements.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_write_dicom_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_write_dicom.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Write DICOM data</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to read a DICOM :File-set&#x27;s DICOMDIR dataset.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_read_dicom_directory_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_read_dicom_directory.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Read a DICOMDIR dataset</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to read and interact with a DICOM File-set.">

.. only:: html

  .. image:: /auto_examples/input_output/images/thumb/sphx_glr_plot_read_fileset_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_input_output_plot_read_fileset.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Read a DICOM File-set</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


Metadata processing
-------------------

These examples illustrates the processing available in pydicom to modify the
metadata of DICOM data.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This examples illustrates how to add dictionary items to the &#x27;standard&#x27; DICOM dictionary dynamically.">

.. only:: html

  .. image:: /auto_examples/metadata_processing/images/thumb/sphx_glr_plot_add_dict_entries_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_metadata_processing_plot_add_dict_entries.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Add dictionary items in the standard DICOM dictionary</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This examples illustrates how to work with sequences.">

.. only:: html

  .. image:: /auto_examples/metadata_processing/images/thumb/sphx_glr_plot_sequences_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_metadata_processing_plot_sequences.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Working with sequences</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example is a starting point to anonymize DICOM data.">

.. only:: html

  .. image:: /auto_examples/metadata_processing/images/thumb/sphx_glr_plot_anonymize_thumb.png
    :alt:

  :ref:`sphx_glr_auto_examples_metadata_processing_plot_anonymize.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Anonymize DICOM data</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:
   :includehidden:


   /auto_examples/image_processing/index.rst
   /auto_examples/input_output/index.rst
   /auto_examples/metadata_processing/index.rst


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download all examples in Python source code: auto_examples_python.zip </auto_examples/auto_examples_python.zip>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip </auto_examples/auto_examples_jupyter.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
