X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FWriteDicomSimple.cxx;h=19f8a9c818560a8dda99c4febeeb8f3edc6d2891;hb=d00078b5e19310b379c8339fa8fe38362e8ca392;hp=8503e531d7ffd51319179e029805c260be482701;hpb=446ab2af0e3045cd559b086ced08a8cc5a61d2e2;p=gdcm.git diff --git a/Example/WriteDicomSimple.cxx b/Example/WriteDicomSimple.cxx index 8503e531..19f8a9c8 100644 --- a/Example/WriteDicomSimple.cxx +++ b/Example/WriteDicomSimple.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomSimple.cxx,v $ Language: C++ - Date: $Date: 2004/12/09 11:31:52 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/01/20 16:16:58 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,9 +23,10 @@ * */ #include "gdcmHeader.h" -#include "gdcmFile.h" +#include "gdcmFileHelper.h" #include +#include // Image size #define SIZE_X 256 @@ -62,39 +63,39 @@ int main(int argc, char* argv[]) // Set the image size str.str(""); str << SIZE_X; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0011); + header->ReplaceOrCreate(str.str(),0x0028,0x0011); // Columns str.str(""); str << SIZE_Y; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0010); + header->ReplaceOrCreate(str.str(),0x0028,0x0010); // Rows // Set the pixel type str.str(""); str << COMPONENT_SIZE * 8; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0100); - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0101); + header->ReplaceOrCreate(str.str(),0x0028,0x0100); // Bits Allocated + header->ReplaceOrCreate(str.str(),0x0028,0x0101); // Bits Stored str.str(""); str << COMPONENT_SIZE * 8 - 1; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0102); + header->ReplaceOrCreate(str.str(),0x0028,0x0102); // High Bit // Set the pixel representation str.str(""); str << "0"; // Unsigned - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0103); + header->ReplaceOrCreate(str.str(),0x0028,0x0103); // Pixel Representation // Set the samples per pixel str.str(""); str << COMPONENT; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x0002); + header->ReplaceOrCreate(str.str(),0x0028,0x0002); // Samples per Pixel // Set the Window / Level str.str(""); str << COLOR_WINDOW; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x1051); + header->ReplaceOrCreate(str.str(),0x0028,0x1051); // Window Width str.str(""); str << COLOR_LEVEL; - header->ReplaceOrCreateByNumber(str.str(),0x0028,0x1050); + header->ReplaceOrCreate(str.str(),0x0028,0x1050); // Window Center if( !header->IsReadable() ) { @@ -123,14 +124,14 @@ int main(int argc, char* argv[]) } // Step 3 : Create the file of the image - gdcm::File *file = new gdcm::File(header); + gdcm::FileHelper *file = new gdcm::FileHelper(header); file->SetImageData(imageData,size); // Step 4 : Set the writting mode and write the image std::string fileName = argv[1]; std::string mode = argv[2]; - file->SetWriteModeToDecompressed(); + file->SetWriteModeToRaw(); switch (mode[0]) { case 'a' : // Write an ACR file @@ -189,3 +190,4 @@ int main(int argc, char* argv[]) return 0; } +