Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2004/11/23 17:12:25 $
- Version: $Revision: 1.205 $
+ Date: $Date: 2004/11/30 16:24:31 $
+ Version: $Revision: 1.209 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmTS.h"
#include "gdcmValEntry.h"
-#include <stdio.h>
+#include <stdio.h> //sscanf
#include <vector>
* @param filetype Type of the File to be written
* (ACR-NEMA, ExplicitVR, ImplicitVR)
*/
-void Header::Write(std::ofstream* fp,FileType filetype)
+bool Header::Write(std::string fileName,FileType filetype)
{
+ std::ofstream* fp = new std::ofstream(fileName.c_str(),
+ std::ios::out | std::ios::binary);
+ if (fp == NULL)
+ {
+ dbg.Verbose(2, "Failed to open (write) File: " , fileName.c_str());
+ return false;
+ }
+
// Bits Allocated
if ( GetEntryByNumber(0x0028,0x0100) == "12")
{
RemoveEntryNoDestroy(e);
}
}
- Document::Write(fp,filetype);
+ Document::WriteContent(fp,filetype);
+
+ fp->close();
+ delete fp;
+
+ return true;
}
//-----------------------------------------------------------------------------
return tsName;
}
-/**
- * \brief Sets the Pixel Area size in the Header
- * --> not-for-rats function
- * @param ImageDataSize new Pixel Area Size
- * warning : nothing else is checked
- */
-void Header::SetImageDataSize(size_t ImageDataSize)
-{
- ///FIXME I don't understand this code why do we set two times 'car' ?
- std::string car = Util::Format("%d", ImageDataSize);
-
- DocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel);
- a->SetLength(ImageDataSize);
-
- // Change the value of the BinEntry, not the BinArea !!!
- ImageDataSize += 8;
- car = Util::Format("%d", ImageDataSize);
- car = Util::DicomString( car.c_str() );
-
- SetEntryByNumber(car, GrPixel, NumPixel);
-}
-
//-----------------------------------------------------------------------------
// Protected