DicomWriter - A module to create a dicom file from dicom fields
use DicomPack::IO::DicomWriter; my $dicomFields = ...; # dicomFields is the output of DicomReader->getDicomField(). my $writer = DicomPack::IO::DicomWeader->new($dicomFields); # dicomFields can be undefined. # set PatientName to a new value $writer->setValue("PatientName", "DicomTest"); # assign a value to "300a,0230/x/300b,100". 'x' used to add a new sequence item $writer->setValue("300a,0230/x/300b,100", "aValue"); # use the current Dicom field structure to create a Dicom file. $writer->flush($dicomFile);
This module creates a Dicom file.
new
Returns a new DicomWriter object.
A template Dicom field structure (optional). If there is a template Dicom file, use DicomReader to read a template Dicom file and getDicomField() to get the template Dicom field structure as the input of new().
setValue
Set or change the value of a specified Dicom field, or create a dicom field. If sequence number is 'x', add a new sequence item.
Dicom tag path. See the doc of getValue of DicomReader for details about format.
An array reference pointing to the values, or a scalar value.
The name of VR (optional). For explicit VR, if missing, default VR will be used.
flush
Use the current Dicom field structure to create a new Dicom file.
A path to an output dicom file.
showDicomField
Display the structure of a dicom field structure.
Verbose level. Available values: 0, 1, 2. By default, 0.
A dicom field structure (optional). If no dicom field structure is specified, use the root dicom field structure.
Baoshe Zhang, MCV Medical School, Virginia Commonwealth University
To install DicomPack::IO::CommonUtil, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DicomPack::IO::CommonUtil
CPAN shell
perl -MCPAN -e shell install DicomPack::IO::CommonUtil
For more information on module installation, please visit the detailed CPAN module installation guide.