X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FRawToDicom.cxx;h=9ad14ca1b64672e4afdc436c0f8b6c04cb133fc5;hb=c4e7cd167fff93d40374a4cd88dbeab78797127f;hp=678cdc799f5f645cb4ca147fda1818492cb9b230;hpb=fa079c1855bdb8564634d1eb61ee25192e7cc4d6;p=gdcm.git diff --git a/Example/RawToDicom.cxx b/Example/RawToDicom.cxx index 678cdc79..9ad14ca1 100755 --- a/Example/RawToDicom.cxx +++ b/Example/RawToDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: RawToDicom.cxx,v $ Language: C++ - Date: $Date: 2005/12/15 13:52:17 $ - Version: $Revision: 1.1 $ + Date: $Date: 2006/01/26 15:52:43 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -18,7 +18,7 @@ /** * Writes a Dicom file from a Raw File - * The image content is a horizontal grayscale from + * User has to supply parameters. * */ #include "gdcmFile.h" @@ -37,13 +37,16 @@ int main(int argc, char *argv[]) START_USAGE(usage) " \n RawToDicom : \n ", " Writes a Dicom file from a Raw File ", - " usage: RawToDicom {filein=inputFileName|dirin=inputDirectoryName} ", - " rows=nb of Rows, lines=nb of Lines, ", - " [frames = nb of Frames] //defaulted to 1 ", - " pixeltype={8U|8S|16U|16S} ", - " [samples = {1|3}} //defaulted to 1; 3 = RGB ", + " usage: RawToDicom filein=inputFileName ", " fileout=outputFileName ", - " [debug] [warning] ", + " rows=nb of Rows ", + " lines=nb of Lines, ", + " pixeltype={8U|8S|16U|16S} ", + " [frames = nb of Frames] //defaulted to 1 ", + " [samples = {1|3}} //defaulted to 1(1:Gray,3:RGB) ", + " [patientname = Patient's name] ", + " [debug] ", + " ", " debug : user wants to run the program in 'debug mode' ", FINISH_USAGE @@ -58,15 +61,18 @@ int main(int argc, char *argv[]) return 1; } - char *inputFileName = am->ArgMgrGetString("filein",(char *)0); - char *outputFileName = am->ArgMgrGetString("fileout",(char *)0); - char *dirName = am->ArgMgrGetString("dirin",(char *)0); + const char *inputFileName = am->ArgMgrGetString("filein"); + const char *outputFileName = am->ArgMgrGetString("fileout"); + //const char *dirName = am->ArgMgrGetString("dirin"); + + const char *patientName = am->ArgMgrGetString("patientname"); int nX = am->ArgMgrWantInt("rows", usage); int nY = am->ArgMgrWantInt("lines", usage); int nZ = am->ArgMgrGetInt("frames", 1); int samplesPerPixel = am->ArgMgrGetInt("samples", 1); + char *pixelType = am->ArgMgrWantString("pixeltype", usage); if (am->ArgMgrDefined("debug")) @@ -84,7 +90,6 @@ int main(int argc, char *argv[]) // ----------- End Arguments Manager --------- - // Read the Raw file std::ifstream *Fp = new std::ifstream(inputFileName, std::ios::in | std::ios::binary); @@ -97,7 +102,6 @@ int main(int argc, char *argv[]) } std::string strPixelType(pixelType); - int pixelLength; int pixelSign; int pixelSize; @@ -170,6 +174,8 @@ int main(int argc, char *argv[]) str << samplesPerPixel; fileToBuild->InsertEntryString(str.str(),0x0028,0x0002); // Samples per Pixel + if (strlen(patientName) != 0) + fileToBuild->InsertEntryString(patientName,0x0010,0x0010); // Patient's Name // Set the image Pixel Data fileH->SetImageData(pixels,dataSize);