Hi OFFIS friends,
I want to open DICOM file, remove some tag (like Patient Name), and Save the file over the original file.
I have this simple code:
*********************************************************************
DcmFileFormat* S = NULL;
S = new DcmFileFormat();
S->loadFile( SrcName );;
// CLEAR some DICOM tags here.....
DcmDataset* dtS = S->getDataset();
E_TransferSyntax Stx = dtS->getOriginalXfer();
S->saveFile( DstName,Stx);
**********************************************************************
Everything works fine and as desired if SrcName and DstName are different.
However, when SrcName=DstName (i.e. overwrite), the function produces new file
incorrectly (and diagnostics says "Missing tags"). Also the overwritten file is drastically
smaller in size f.e. 272KB original down to 4.
Could you please let me know how to perform this operation with overwrite of the original file?
Thank you in advance,
-Artem
How to over-write a modified DICOM file?
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 2284
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: How to over-write a modified DICOM file?
By default, the call of loadFile() does not load all element values into main memory, only those that are smaller than 4 kbytes.
You could either increase this value (parameter "maxReadLength" of the method) or call loadAllDataIntoMemory() before saveFile().
You could either increase this value (parameter "maxReadLength" of the method) or call loadAllDataIntoMemory() before saveFile().
Who is online
Users browsing this forum: Baidu [Spider] and 1 guest