X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FexOverlaysACR.cxx;h=61590cf985d4b4ce071676cd841450f07b03c4da;hb=779c8f5232ad160d353b90d3fa47d0503e17965d;hp=01a0492aec9e5d4fbada2fa3074762380bcc3685;hpb=c4fa2e74a4ce56a0a8db54e4a70d404bec9fc8dd;p=gdcm.git diff --git a/Example/exOverlaysACR.cxx b/Example/exOverlaysACR.cxx index 01a0492a..61590cf9 100644 --- a/Example/exOverlaysACR.cxx +++ b/Example/exOverlaysACR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exOverlaysACR.cxx,v $ Language: C++ - Date: $Date: 2005/08/30 14:40:28 $ - Version: $Revision: 1.6 $ + Date: $Date: 2005/10/25 14:52:28 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -86,9 +86,9 @@ int main(int argc, char *argv[]) //std::cout << argv[1] << std::endl; - f = new gdcm::File( ); + f = gdcm::File::New( ); - f->SetLoadMode(GDCM_LD_NOSEQ | GDCM_LD_NOSHADOW); + f->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW); f->SetFileName( fileName ); bool res = f->Load(); @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) std::cout << "Sorry, " << fileName <<" not a gdcm-readable " << "DICOM / ACR File" <Delete(); return 0; } std::cout << " ... is readable " << std::endl; @@ -115,14 +115,14 @@ int main(int argc, char *argv[]) if ( bitsAllocated <= 8 ) { std::cout << " 8 bits pixel image cannot contain Overlays " << std::endl; - delete f; + f->Delete(); return 0; } - std::string s1 = f->GetEntryValue(0x6000, 0x0102); + std::string s1 = f->GetEntryString(0x6000, 0x0102); if (s1 == gdcm::GDCM_UNFOUND) { std::cout << " Image doesn't contain any Overlay " << std::endl; - delete f; + f->Delete(); return 0; } std::cout << " File is read! " << std::endl; @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) if (fp == 0) { std::cout << "Unable to open File" << std::endl; - delete f; + f->Delete(); return 0; } else @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) << "readable. expected length :" << nx*ny << " " << "read length : " << lgt << std::endl; - delete f; + f->Delete(); delete pixels; return 0; } @@ -199,11 +199,11 @@ int main(int argc, char *argv[]) gdcm::FileHelper *fh = 0; -while ( (strOvlBitPosition = f->GetEntryValue(currentOvlGroup, 0x0102)) - != gdcm::GDCM_UNFOUND ) -{ + while ( (strOvlBitPosition = f->GetEntryString(currentOvlGroup, 0x0102)) + != gdcm::GDCM_UNFOUND ) + { - strOverlayLocation = f->GetEntryValue(currentOvlGroup, 0x0200); + strOverlayLocation = f->GetEntryString(currentOvlGroup, 0x0200); if ( strOverlayLocation != gdcm::GDCM_UNFOUND ) { overlayLocation = atoi(strOverlayLocation.c_str()); @@ -234,32 +234,32 @@ while ( (strOvlBitPosition = f->GetEntryValue(currentOvlGroup, 0x0102)) if( gdcm::Debug::GetDebugFlag() ) std::cout << "About to built empty file" << std::endl; - fileToBuild = new gdcm::File(); + fileToBuild = gdcm::File::New(); if( gdcm::Debug::GetDebugFlag() ) std::cout << "Finish to built empty file" << std::endl; str.str(""); str << nx; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0011); // Columns + fileToBuild->InsertEntryString(str.str(),0x0028,0x0011); // Columns str.str(""); str << ny; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0010); // Rows + fileToBuild->InsertEntryString(str.str(),0x0028,0x0010); // Rows - fileToBuild->InsertValEntry("8",0x0028,0x0100); // Bits Allocated - fileToBuild->InsertValEntry("8",0x0028,0x0101); // Bits Stored - fileToBuild->InsertValEntry("7",0x0028,0x0102); // High Bit - fileToBuild->InsertValEntry("0",0x0028,0x0103); // Pixel Representation - fileToBuild->InsertValEntry("1",0x0028,0x0002); // Samples per Pixel + fileToBuild->InsertEntryString("8",0x0028,0x0100); // Bits Allocated + fileToBuild->InsertEntryString("8",0x0028,0x0101); // Bits Stored + fileToBuild->InsertEntryString("7",0x0028,0x0102); // High Bit + fileToBuild->InsertEntryString("0",0x0028,0x0103); // Pixel Representation + fileToBuild->InsertEntryString("1",0x0028,0x0002); // Samples per Pixel - fileToBuild->InsertValEntry("MONOCHROME2 ",0x0028,0x0004); + fileToBuild->InsertEntryString("MONOCHROME2 ",0x0028,0x0004); // Other mandatory fields will be set automatically, // just before Write(), by FileHelper::CheckMandatoryElements() if( gdcm::Debug::GetDebugFlag() ) std::cout << "-------------About to built FileHelper" << std::endl; - fh = new gdcm::FileHelper(fileToBuild); + fh = gdcm::FileHelper::New(fileToBuild); if( gdcm::Debug::GetDebugFlag() ) std::cout << "-------------Finish to built FileHelper" << std::endl; @@ -275,9 +275,9 @@ while ( (strOvlBitPosition = f->GetEntryValue(currentOvlGroup, 0x0102)) { std::cout << "Failed\n" << "File in unwrittable\n"; - delete fh; + fh->Delete(); if (fileToBuild) - delete fileToBuild; + fileToBuild->Delete(); delete pixels; delete tabPixels; return 0; @@ -290,13 +290,14 @@ while ( (strOvlBitPosition = f->GetEntryValue(currentOvlGroup, 0x0102)) i++; } - delete f; if (f) - delete fh; + fh->Delete(); if (fileToBuild) - delete fileToBuild; + fileToBuild->Delete(); + f->Delete(); delete pixels; delete tabPixels; + return 0; }