DCDTCHG(1)

NAME
dcdtchg - ACR/NEMA DICOM PS3 ... DICOM PS3 - Change UIDs consistently

SYNOPSIS

dcdtchg " inputfile1 [ inputfile2 ... ]" -outdir dirname [ -v|verbose|vv|veryverbose ] [ -l ] [ -f|-filelist filename ] [ -basedate yyyymmdd ] [ -delta ms ] [ -forcefirstday ] [ -forcefirstmonth ] [ -keepzone ]

DESCRIPTION

dcdtchg reads all the named dicom input files (and/or the files listed in the specified file) and copies them to the specified directory, changing all the dates and times in a consistent manner throughout the set of files.

The dates and times obtained by two separate invocations of this utility on different files will be different, so the action needs to be performed on a set of files simultaneously in order to maintain consistency across studies, series and temporal frames of reference.

Normalization of dates and times involves shifting the first date and time pair encountered in the first file to a base date, and then maintaining a consistent offset from that base date and time for all subsequent dates and times encountered.

Normalization of the times is only performed for DT attributes and for those TM attributes that have a known DA corresponding attribute. For example Study Date and Study Time are treated as a pair. Any TM attribute that does not have a corresponding known standard DA attribute will be left alone, unless it happens to have exactly the same value as another TM attribute that does have a matching date and has been normalized.

After date and time normalization, the day of the month and the month of the year may be forced to a value of 1 with the appropiate options, though this will potentially invalidate time intervals that span 24 hour boundaries

All timezone information is removed and set to UTC, and the TimezoneOffsetFromUTC attribute added, unless suppressed with the keepzone option.

OPTIONS
The verbose output goes to standard error.

The basic switches are described in dcintro(1). Options specific to this program are:

-outdir dirname
    The directory, which must already exist, to which the copied files are written, using the basename of the original filename.

-v|verbose
    Display attributes as they are read and written.

-l
    List filenames as they are read and written.

-f|filelist filename

-basedate yyyymmdd[hhmmss]
    Use a different date (and time) to which to normalize all dates and times rather than the default 20010101000000.

-delta ms
    Use a specific delta (such as reported on a previous run of dcdtchg), so as to shift the datetimes of another set of instances by the same delta and hence maintain their relative temporal relationship.

-forcefirstday
    Replace the day of the month with 01 after shifting the date to the base date. This will potentially invalidate time intervals that span 24 hour boundaries.

-forcefirstmonth
    Replace the month of the year with 01 after shifting the date to the base date. This will potentially invalidate time intervals that span 24 hour boundaries.
-keepzone
    Do not change the timezone. Any TimezoneOffsetFromUTC is left unchanged. Any timezone component of a DT attribute is copied to the output.

ENVIRONMENT

EXAMPLES

% ls -1 IMAGES/[0-9]*
IMAGES/IM0001
IMAGES/IM0002
% mkdir /tmp/IMAGES
% dcuidchg IMAGES/[0-9]* -outdir /tmp/NEWIMAGES
delta = -200590875000
% ls -1 /tmp/NEWIMAGES
/tmp/NEWIMAGES/IM0001
/tmp/NEWIMAGES/IM0002
% dcdiff IMAGES/IM0001 /tmp/NEWIMAGES/IM0001
9,10c9,10
< (0x0008,0x0012) DA Instance Creation Date VR=<DA> VL=<0x0008> <20071109>
< (0x0008,0x0013) TM Instance Creation Time VR=<TM> VL=<0x0006> <161536>
---
> (0x0008,0x0012) DA Instance Creation Date VR=<DA> VL=<0x0008> <20010702>
> (0x0008,0x0013) TM Instance Creation Time VR=<TM> VL=<0x0006> <003421>
15c15
< (0x0008,0x002a) DT Acquisition Date Time VR=<DT> VL=<0x0014> <20070511155342-1400 >
---
> (0x0008,0x002a) DT Acquisition Date Time VR=<DT> VL=<0x0014> <20010101001227+0000 >
22c22
< (0x0008,0x0201) SH Timezone Offset From UTC VR=<SH> VL=<0x0006> <-0500>
---
> (0x0008,0x0201) SH Timezone Offset From UTC VR=<SH> VL=<0x0006> <+0000 >

FILES

SEE ALSO
dcintro(1), dcuidchg(1)

AUTHOR
Copyright (c) 1993-2022, David A. Clunie DBA PixelMed Publishing. All rights reserved.

BUGS

There is a fixed length of buffer used for reading each line from the list of filenames file.

Time normalization based on combined date and time values introduces the risk that times may wrap around the 24 hour period (in either direction) though any corresponding date attribute will be appropriately incremented or decremented. That is, the interval between times will be preserved, except when the date day or month values are forced to 1. This risk is mitigated by looking for the Study Date and Time (usually the earliest) first.

Timezone replacement does not take into account the possibility of two attributes with the different explicit timezones in DT attributes (or different from the value in the TimezoneOffsetFromUTC attribute) being present ... all timezone information is simply removed and replaced with "+0000" (UTC).

Times and datetimes with a fractional second component are always output to a precision of 3 digits (milliseconds) even if greater or lesser precision was present in the input. If a fractional component is present but has a value of 0, then the fractional component will not be present in the output; this is normally the case when the times in the input are specified to second precision.