X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmFile.cxx;h=a586dc7dc935aa1bd34481b27ff84984c052cde7;hb=bb267016446eab423df841903f11dff35e4898f8;hp=73bc1756cdae9b7efbcbdb95af9755be7f68ea82;hpb=565a47ec4e037897aaf770aeccc5d67d7ad7b478;p=gdcm.git diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 73bc1756..a586dc7d 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -8,16 +8,16 @@ static void _Swap(void* im, int swap, int lgr, int nb); /** * \ingroup gdcmFile * \brief Constructor dedicated to writing a new DICOMV3 part10 compliant - * \file (see SetFileName, SetDcmTag and Write) - * \Opens (in read only and when possible) an existing file and checks - * \for DICOM compliance. Returns NULL on failure. - * \Note: the in-memory representation of all available tags found in - * \the DICOM header is post-poned to first header information access. - * \This avoid a double parsing of public part of the header when - * \one sets an a posteriori shadow dictionary (efficiency can be - * \seen as a side effect). + * file (see SetFileName, SetDcmTag and Write) + * Opens (in read only and when possible) an existing file and checks + * for DICOM compliance. Returns NULL on failure. + * \Note the in-memory representation of all available tags found in + * the DICOM header is post-poned to first header information access. + * This avoid a double parsing of public part of the header when + * one sets an a posteriori shadow dictionary (efficiency can be + * seen as a side effect). * - * @param + * @param filename file to be opened for parsing * * @return */ @@ -29,6 +29,7 @@ gdcmFile::gdcmFile(string & filename) ///////////////////////////////////////////////////////////////// +// FIXME JPR: comments in English please ! /** * \ingroup gdcmFile * \brief Renvoie la longueur A ALLOUER pour recevoir les pixels de l'image @@ -439,7 +440,7 @@ int gdcmFile::WriteDcm (string nomFichier) { fwrite("DICM",4,1,fp1); // un accesseur de + est obligatoire ??? - // pourtant le ElValSet contenu dans le gdcmHeader + // pourtant le gdcmElValSet contenu dans le gdcmHeader // ne devrait pas être visible par l'utilisateur final (?) GetPubElVals().Write(fp1); @@ -450,4 +451,42 @@ int gdcmFile::WriteDcm (string nomFichier) { return(1); } +///////////////////////////////////////////////////////////////// +/** + * \ingroup gdcmFile + * \brief Ecrit sur disque UNE image ACR-NEMA + * \ (a l'attention des logiciels cliniques + * \ qui ne prennent en entrée QUE des images ACR ... + * \ si un header DICOM est fourni en entree, + * \ les groupes < 0x0008 et les groupes impairs sont ignores) + * \ Aucun test n'est fait sur l'"Endiannerie" du processeur. + * \ Ca fonctionnera correctement (?) sur processeur Intel + * \ (Equivalent a IdDcmWrite) + * + * @param + * + * @return + */ +int gdcmFile::WriteAcr (string nomFichier) { + +// ATTENTION : fonction non terminée (commitée a titre de precaution) + + FILE * fp1; + fp1 = fopen(nomFichier.c_str(),"wb"); + if (fp1 == NULL) { + printf("Echec ouverture (ecriture) Fichier [%s] \n",nomFichier.c_str()); + return (0); + } + + // un accesseur de + est obligatoire ??? + // pourtant le gdcmElValSet contenu dans le gdcmHeader + // ne devrait pas être visible par l'utilisateur final (?) + + GetPubElVals().WriteAcr(fp1); + + fwrite(Pixels, lgrTotale, 1, fp1); + + fclose (fp1); + return(1); +}