X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FReWrite.cxx;h=65b5c8504e02d79378530477399c7ac4459726c5;hb=8b37460973bc9cafbc230ef9806cc73ae2e202ac;hp=677ebdad637754c45218c8002e674b88d3123f81;hpb=8fd45dc6d321d1419854dc0e4fa6a37d6826b655;p=gdcm.git diff --git a/Example/ReWrite.cxx b/Example/ReWrite.cxx index 677ebdad..65b5c850 100644 --- a/Example/ReWrite.cxx +++ b/Example/ReWrite.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: ReWrite.cxx,v $ Language: C++ - Date: $Date: 2007/05/23 14:18:04 $ - Version: $Revision: 1.26 $ + Date: $Date: 2007/07/25 13:15:14 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) " (usefull when the file header is not very straight). ", " ", " usage: ReWrite filein=inputFileName fileout=outputFileName ", - " [mode=write mode] [noshadow] [noseq][debug] ", + " [mode=write mode] [monochrome1] [noshadow] [noseq][debug] ", " --> The following line to 'rubout' a burnt-in Patient name ", " [rubout=xBegin,xEnd,yBegin,yEnd [ruboutvalue=n (<255)] ] ", " --> The 2 following lines, to extract a sub image within some frames ", @@ -40,11 +40,12 @@ int main(int argc, char *argv[]) " [firstframe=beg] [lastframe=end] ", " ", " mode = a (ACR), x (Explicit VR Dicom), r (RAW : only pixels) ", + " monochrome1 = user wants MONOCHROME1 photom. interp. (0=white) ", " noshadowseq: user doesn't want to load Private Sequences ", " noshadow : user doesn't want to load Private groups (odd number)", " noseq : user doesn't want to load Sequences ", - " rgb : user wants to tranform LUT (if any) to RGB pixels ", - " warning : developper wants to run the program in 'warning mode'", + " rgb : user wants to transform LUT (if any) to RGB pixels ", + " warning : developper wants to run the program in 'warning mode'", " debug : developper wants to run the program in 'debug mode' ", FINISH_USAGE @@ -55,14 +56,14 @@ int main(int argc, char *argv[]) { am->ArgMgrUsage(usage); // Display 'usage' delete am; - return 0; + return 1; } char *fileName = am->ArgMgrWantString("filein",usage); if ( fileName == NULL ) { std::cout << "'filein= ...' is mandatory" << std::endl; delete am; - return 0; + return 1; } char *outputFileName = am->ArgMgrWantString("fileout",usage); @@ -70,7 +71,7 @@ int main(int argc, char *argv[]) { std::cout << "'fileout= ...' is mandatory" << std::endl; delete am; - return 0; + return 1; } const char *mode = am->ArgMgrGetString("mode","X"); @@ -88,6 +89,8 @@ int main(int argc, char *argv[]) bool rgb = ( 0 != am->ArgMgrDefined("RGB") ); + bool monochrome1 = ( 0 != am->ArgMgrDefined("monochrome1") ); + if (am->ArgMgrDefined("debug")) GDCM_NAME_SPACE::Debug::DebugOn(); @@ -148,21 +151,21 @@ int main(int argc, char *argv[]) GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New(); f->SetLoadMode( loadMode ); + f->SetFileName( fileName ); bool res = f->Load(); - if ( !res ) + if ( !res ) { f->Delete(); - return 0; + return 1; } if (!f->IsReadable()) { std::cerr << "Sorry, not a Readable DICOM / ACR File" <Delete(); - return 0; + return 1; } - GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f); void *imageData; @@ -193,7 +196,9 @@ int main(int argc, char *argv[]) transferSyntaxName = f->GetTransferSyntaxName(); std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl; - + + if(monochrome1) + fh->SetPhotometricInterpretationToMonochrome1(); if (rgb) {