<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl" ?>
<!DOCTYPE Data [ <!ENTITY version SYSTEM 'version.txt'> ]>
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<info>
<author><personname><firstname>Mathieu</firstname><surname>Malaterre</surname></personname><contrib>Main developer</contrib></author>
<copyright><year>2006</year><year>2011</year><holder>Mathieu Malaterre</holder></copyright>
</info>
  <refmeta>
    <refentrytitle>gdcmclean</refentrytitle>
    <manvolnum>1</manvolnum>
    <refmiscinfo class="source">GDCM</refmiscinfo>
    <refmiscinfo class="version">&version;</refmiscinfo>
    <refmiscinfo class="manual">DICOM Manipulation.</refmiscinfo>
  </refmeta>
  <refnamediv><refname>gdcmclean</refname>
    <refpurpose>Tool to clean a DICOM file.</refpurpose>
</refnamediv>
<refsection xml:id="gdcmclean_1synopsis">
<title>SYNOPSIS</title>

<para><literallayout>gdcmclean [options] file-in file-out
gdcmclean [options] dir-in  dir-out
</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1description">
<title>DESCRIPTION</title>

<para>The <emphasis role="bold">gdcmclean</emphasis> tool is an cleaning tool.</para>

</refsection>
<refsection xml:id="gdcmclean_1parameters">
<title>PARAMETERS</title>

<para><literallayout>file-in   DICOM input filename

file-out  DICOM output filename
</literallayout></para>

<para>or</para>

<para><literallayout>file-in   DICOM input directory

file-out  DICOM output directory
</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1options">
<title>OPTIONS</title>

<para>You need to :</para>
<refsection xml:id="gdcmclean_1specific_options">
<title>specific options</title>

<para><literallayout>  -i --input                  DICOM filename / directory
  -o --output                 DICOM filename / directory
  -r --recursive              recursively process (sub-)directories.
     --continue               Do not stop when file found is not DICOM.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1editing_mode_options">
<title>Editing mode options</title>

<para><literallayout>     --empty    %d,%d         DICOM tag(s) to empty
                %d,%d,%s      DICOM private tag(s) to empty
                %s            DICOM keyword/path(s) to empty
     --remove   %d,%d         DICOM tag(s) to remove
                %d,%d,%s      DICOM private tag(s) to remove
                %s            DICOM keyword/path(s) to remove
     --scrub    %d,%d         DICOM tag(s) to scrub
                %d,%d,%s      DICOM private tag(s) to scrub
                %s            DICOM keyword/path(s) to scrub
     --preserve %s            DICOM path(s) to preserve
     --preserve-missing-private-creator             Whether or not preserve private attributes with missing private creator.
     --preserve-group-length                        Whether or not preserve deprecated group length attributes (will not be re-computed).
     --preserve-illegal                             Whether or not preserve illegal attributes (eg. group 0003...).
</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1general_options">
<title>general options</title>

<para><literallayout>  -h   --help
         print this help text and exit

  -v   --version
         print version information and exit

  -V   --verbose
         verbose mode (warning+error).

  -W   --warning
         warning mode, print warning information

  -E   --error
         error mode, print error information

  -D   --debug
         debug mode, print debug information
</literallayout></para>
</refsection>
</refsection>
<refsection xml:id="gdcmviewer_1usage">
<title>Typical usage</title>
<refsection xml:id="gdcmclean_1editing">
<title>Editing mode</title>

<para>This functionality is not described in the DICOM standard.</para>

<para>The following example shows how to use editing mode and achieve multiple operations at the same time: <itemizedlist>
<listitem>
<para>Preserve illegal attributes (removed by default), </para>
</listitem>
<listitem>
<para>Empty any 'PN' attributes anywhere in the hierarchy tree, but preserve the DICOM attribute value only at location "0010,0010",</para>
</listitem>
<listitem>
<para>Empty the tag (0010,0020) Patient ID, (only if keyword is know internally),</para>
</listitem>
<listitem>
<para>Empty the tag (0070,0084),</para>
</listitem>
<listitem>
<para>Remove the private attributes: (0029,20, SIEMENS MEDCOM HEADER) / (0033,02,MITRA OBJECT UTF8 ATTRIBUTES 1.0) / (0043,2a,GEMS_PARM_01). Since (0033,02,MITRA OBJECT UTF8 ATTRIBUTES 1.0) is defined internally in the private dictionary with Value Representation = PN, this attribute will be skipped (since redundant).</para>
</listitem>
<listitem>
	<para>Scrub the private attributes: (0029,10,SIEMENS CSA HEADER) / (0029,20,SIEMENS CSA HEADER) / (700d,08,TOSHIBA_MEC_MR3) / (0029,90,PMTF INFORMATION DATA)</para>
</listitem>
</itemizedlist>
</para>
<para><literallayout>$ gdcmclean \
    --recursive --continue \
    --preserve-illegal \
    --empty PN --preserve /0010,0010 \
    --empty PatientID --empty "0070,0084" \
    --remove "0029,20,SIEMENS MEDCOM HEADER" --remove "0033,02,MITRA OBJECT UTF8 ATTRIBUTES 1.0" --remove "0043,2a,GEMS_PARM_01" \
	--scrub "0029,10,SIEMENS CSA HEADER" --scrub "0029,20,SIEMENS CSA HEADER" \
	--scrub "700d,08,TOSHIBA_MEC_MR3" \
	--scrub "0029,90,PMTF INFORMATION DATA" --scrub "0029,90,TOSHIBA_MEC_MR3" \
    input_folder output_folder
</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1caveat">
<title>DICOM Path</title>

<para>For ease of use on shell cmmand the syntax allow for the '/' separator in the DICOM Path notation. So the following is valid</para>
<para><literallayout>"/0040,0100/1/0040,0006"</literallayout></para>
<para>However Private Creator can use all of Value Representation LO definition. So in some case you will be required to use backslash as separator (since illegal in VR:LO):</para>
<para><literallayout>"\\4109,2,Applicare/Centricity Radiology Web/Version 1.0"</literallayout></para>
</refsection>
<refsection xml:id="gdcmclean_1part15">
<title>Safe Private Attributes</title>
<para>It is currently not possible to empty/remove any private attribute listed in the Safe Private Attributes table at:</para>
<para><link xlink:href="https://dicom.nema.org/medical/dicom/current/output/chtml/part15/sect_E.3.10.html#table_E.3.10-1">https://dicom.nema.org/medical/dicom/current/output/chtml/part15/sect_E.3.10.html#table_E.3.10-1</link></para>
</refsection>
</refsection>
<refsection xml:id="gdcmclean_1see_also">
<title>SEE ALSO</title>

<para><emphasis role="bold">gdcmanon</emphasis>(1), <emphasis role="bold">gdcmdump</emphasis>(1), <emphasis role="bold">gdcmdiff</emphasis>(1)</para>
</refsection>
</refentry>
