Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/03/03 11:05:00 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2005/03/11 11:12:13 $
+ Version: $Revision: 1.30 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
break;
case ACR:
case ACR_LIBIDO:
+ // Just to avoid further trouble if user create a file ex-nihilo,
+ // wants to write it as an ACR-NEMA file,
+ // and forget to create any Entry belonging to group 0008
+ // (shame on him !)
+ // We add Recognition Code (RET)
+ if ( ! FileInternal->GetValEntry(0x0008, 0x0010) )
+ FileInternal->InsertValEntry("", 0x0008, 0x0010);
SetWriteFileTypeToACR();
break;
default:
RestoreWrite();
RestoreWriteFileType();
+ RestoreWriteMandatory();
// --------------------------------------------------------------
// Special Patch to allow gdcm to re-write ACR-LibIDO formated images
*/
void FileHelper::RestoreWriteFileType()
{
- // group 0002 may be pushed out for ACR-NEMA writting purposes
- Archive->Restore(0x0002,0x0000);
- Archive->Restore(0x0002,0x0001);
- Archive->Restore(0x0002,0x0002);
- Archive->Restore(0x0002,0x0003);
- Archive->Restore(0x0002,0x0010);
- Archive->Restore(0x0002,0x0012);
- Archive->Restore(0x0002,0x0013);
- Archive->Restore(0x0002,0x0016);
- Archive->Restore(0x0002,0x0100);
- Archive->Restore(0x0002,0x0102);
}
/**
DocEntry *oldE = FileInternal->GetDocEntry(group, elem);
BinEntry *newE;
- if( oldE )
+ if( oldE )
if( oldE->GetVR()!=vr )
oldE = NULL;
* - we push the sensitive entries to the Archive
* The writing process will restore the entries as they where before
* entering FileHelper::CheckMandatoryElements, so the user will always
- * see the entries just as he
+ * see the entries just as he left them.
*
* \todo : - warn the user if we had to add some entries :
* even if a mandatory entry is missing, we add it, with a default value
// Create them if not found
// Always modify the value
// Push the entries to the archive.
-
ValEntry *e_0002_0000 = CopyValEntry(0x0002,0x0000);
e_0002_0000->SetValue("0"); // for the moment
Archive->Push(e_0002_0000);
e_0002_0001->SetBinArea((uint8_t*)Util::GetFileMetaInformationVersion(),
false);
e_0002_0001->SetLength(2);
+ Archive->Push(e_0002_0001);
ValEntry *e_0002_0002 = CopyValEntry(0x0002,0x0002);
// [Secondary Capture Image Storage]
e_0002_0003->SetValue(Util::CreateUniqueUID());
Archive->Push(e_0002_0003);
- ValEntry *e_0002_0010 = CopyValEntry(0x0002,0x0010);
- //[Explicit VR - Little Endian]
- e_0002_0010->SetValue("1.2.840.10008.1.2.1");
- Archive->Push(e_0002_0010);
-
// 'Implementation Class UID'
ValEntry *e_0002_0012 = CopyValEntry(0x0002,0x0012);
e_0002_0012->SetValue(Util::CreateUniqueUID());
// the source image was NOT a true Dicom one.
// We consider the image is a 'Secondary Capture' one
// SOP Class UID
- ValEntry *e_0008_0016 = new ValEntry(
+ e_0008_0016 = new ValEntry(
Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0008, 0x0016) );
// [Secondary Capture Image Storage]
e_0008_0016 ->SetValue("1.2.840.10008.5.1.4.1.1.7");
// Remove some inconstencies (probably some more will be added)
- // Push out (0020 0052),Frame of Reference UID
// if (0028 0008)Number of Frames exists
- // (0020 0052),Frame of Reference UID only meaningfull within a Serie
+ // Push out (0020 0052),Frame of Reference UID
+ // (only meaningfull within a Serie)
ValEntry *e_0028_0008 = FileInternal->GetValEntry(0x0028, 0x0008);
if ( !e_0028_0008 )
{
}
}
+/**
+ * \brief Restore in the File the initial group 0002
+ */
+void FileHelper::RestoreWriteMandatory()
+{
+ // group 0002 may be pushed out for ACR-NEMA writting purposes
+ Archive->Restore(0x0002,0x0000);
+ Archive->Restore(0x0002,0x0001);
+ Archive->Restore(0x0002,0x0002);
+ Archive->Restore(0x0002,0x0003);
+ Archive->Restore(0x0002,0x0012);
+ Archive->Restore(0x0002,0x0013);
+ Archive->Restore(0x0002,0x0016);
+ Archive->Restore(0x0002,0x0100);
+ Archive->Restore(0x0002,0x0102);
+}
+
//-----------------------------------------------------------------------------
// Private
/**