X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmFileHelper.cxx;h=583a619297edf04e7c93673f42596f9ae82416d3;hb=b99fc00d0f4df0ddcee535b792e7ea6826fd0397;hp=6852fe48219254ddba59d6d48b64d0085ee98690;hpb=f42c171403bfb96eee2237f528a05d5f8591a7bd;p=gdcm.git diff --git a/src/gdcmFileHelper.cxx b/src/gdcmFileHelper.cxx index 6852fe48..583a6192 100644 --- a/src/gdcmFileHelper.cxx +++ b/src/gdcmFileHelper.cxx @@ -4,8 +4,8 @@ Module: $RCSfile: gdcmFileHelper.cxx,v $ Language: C++ - Date: $Date: 2005/03/09 09:45:33 $ - Version: $Revision: 1.29 $ + Date: $Date: 2005/04/19 12:31:56 $ + Version: $Revision: 1.34 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -611,17 +611,25 @@ bool FileHelper::Write(std::string const &fileName) SetWriteFileTypeToImplicitVR(); CheckMandatoryElements(); break; + case Unknown: // should never happen; ExplicitVR is the default value case ExplicitVR: SetWriteFileTypeToExplicitVR(); CheckMandatoryElements(); 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: - SetWriteFileTypeToExplicitVR(); + SetWriteFileTypeToImplicitVR(); CheckMandatoryElements(); + break; + } // -------------------------------------------------------------- @@ -632,6 +640,7 @@ bool FileHelper::Write(std::string const &fileName) // just before writting ... /// \todo the best trick would be *change* the recognition code /// but pb expected if user deals with, e.g. COMPLEX images + if( WriteType == ACR_LIBIDO ) { SetWriteToLibido(); @@ -1004,6 +1013,12 @@ void FileHelper::RestoreWriteOfLibido() Archive->Restore(0x0028,0x0010); Archive->Restore(0x0028,0x0011); Archive->Restore(0x0008,0x0010); + + // Restore 'LibIDO-special' entries, if any + Archive->Restore(0x0028,0x0015); + Archive->Restore(0x0028,0x0016); + Archive->Restore(0x0028,0x0017); + Archive->Restore(0x0028,0x00199); } /** @@ -1115,6 +1130,7 @@ void FileHelper::CheckMandatoryElements() e_0002_0001->SetLength(2); Archive->Push(e_0002_0001); + // 'Media Stored SOP Class UID' ValEntry *e_0002_0002 = CopyValEntry(0x0002,0x0002); // [Secondary Capture Image Storage] e_0002_0002->SetValue("1.2.840.10008.5.1.4.1.1.7"); @@ -1293,17 +1309,7 @@ void FileHelper::CheckMandatoryElements() Archive->Push(e_0010_0010); } - // Patient's ID : if missing, we set it to 'GDCM_Patient_ID' - ValEntry *e_0010_0020 = FileInternal->GetValEntry(0x0010, 0x0020); - if ( !e_0010_0020 ) - { - e_0010_0020 = new ValEntry( - Global::GetDicts()->GetDefaultPubDict()->GetEntry(0x0010, 0x0020) ); - e_0010_0020->SetValue("GDCM_Patient_ID"); - Archive->Push(e_0010_0020); - } - - // Patient's Birth Date :'type 2' entry -> must exist, value not mandatory + // Patient's Birth Date : 'type 2' entry -> must exist, value not mandatory ValEntry *e_0010_0030 = FileInternal->GetValEntry(0x0010, 0x0030); if ( !e_0010_0030 ) { @@ -1383,7 +1389,10 @@ void FileHelper::Initialize() } /** - * \brief + * \brief Reads/[decompresses] the pixels, + * *without* making RGB from Palette Colors + * @return the pixels area, whatever its type + * (uint8_t is just for prototyping : feel free to Cast it) */ uint8_t *FileHelper::GetRaw() { @@ -1408,7 +1417,11 @@ uint8_t *FileHelper::GetRaw() } //----------------------------------------------------------------------------- -// Print +/** + * \brief Prints the common part of ValEntry, BinEntry, SeqEntry + * @param os ostream we want to print in + * @param indent (unused) + */ void FileHelper::Print(std::ostream &os, std::string const &) { FileInternal->SetPrintLevel(PrintLevel);