The resulting file, tester, is the same as the original DICOM file except the patient name has been changed to John Doe and the DICM string has been removed from the header!!
I can tell that this has happened because when I run "strings tester | less" from the command line there is no DICM at the top. However, when I run "strings originalFile | less" from the command line DICM is listed as the first part of the file (as it should be).
Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I attempt to use editHeader to alter any fields, the saved file no longer contains the DICM string in the header. Here is the code:
use DICOM;
$name="PatientName";
my @loc=$dicom->fieldByName($name);
my $val=$dicom->value(@loc);
$dicom->editHeader("$loc[0],$loc[1]=JOHN DOE");
$dicom->write(tester);
The resulting file, tester, is the same as the original DICOM file except the patient name has been changed to John Doe and the DICM string has been removed from the header!!
I can tell that this has happened because when I run "strings tester | less" from the command line there is no DICM at the top. However, when I run "strings originalFile | less" from the command line DICM is listed as the first part of the file (as it should be).
Any ideas?