From cd605bf3181b4cd75120619921569dcdfae845b6 Mon Sep 17 00:00:00 2001 From: malaterre Date: Tue, 18 Oct 2005 19:06:28 +0000 Subject: [PATCH] ENH: Several change, fix compilation warnings, and update to newer API...no comment --- Example/WriteDicomAsJPEG.cxx | 28 +++++++++++++++------------- Testing/TestDataEntry.cxx | 7 +++---- src/gdcmJpeg.cxx | 5 +++-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Example/WriteDicomAsJPEG.cxx b/Example/WriteDicomAsJPEG.cxx index dbdd5aa1..934542a6 100644 --- a/Example/WriteDicomAsJPEG.cxx +++ b/Example/WriteDicomAsJPEG.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomAsJPEG.cxx,v $ Language: C++ - Date: $Date: 2005/10/18 18:36:53 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/10/18 19:06:28 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -172,11 +172,12 @@ bool CreateOneFrame (std::ostream *fp, void *input_buffer, int fragment_size, // Open a dicom file and compress it as JPEG stream int main(int argc, char *argv[]) { + if( argc < 2) + return 1; + std::string filename = argv[1]; // Step 1 : Create the header of the image - gdcm::File *header = new gdcm::File(); - gdcm::File *f = new gdcm::File(); f->SetLoadMode ( gdcm::LD_ALL ); // Load everything f->SetFileName( filename ); @@ -208,6 +209,7 @@ int main(int argc, char *argv[]) return 1; } std::streambuf* sb = of->rdbuf(); + (void)sb; //of->close(); std::ofstream out("/tmp/jpeg2.jpg"); //out.write( of->str(), of @@ -228,44 +230,44 @@ int main(int argc, char *argv[]) // Set the image size str.str(""); str << xsize; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0011); // Columns + fileToBuild->InsertEntryString(str.str(),0x0028,0x0011); // Columns str.str(""); str << ysize; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0010); // Rows + fileToBuild->InsertEntryString(str.str(),0x0028,0x0010); // Rows //if(img.sizeZ>1) //{ // str.str(""); // str << img.sizeZ; - // fileToBuild->InsertValEntry(str.str(),0x0028,0x0008); // Number of Frames + // fileToBuild->InsertEntryString(str.str(),0x0028,0x0008); // Number of Frames //} // Set the pixel type str.str(""); str << 8; //img.componentSize; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated + fileToBuild->InsertEntryString(str.str(),0x0028,0x0100); // Bits Allocated str.str(""); str << 8; //img.componentUse; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored + fileToBuild->InsertEntryString(str.str(),0x0028,0x0101); // Bits Stored str.str(""); str << 7; //( img.componentSize - 1 ); - fileToBuild->InsertValEntry(str.str(),0x0028,0x0102); // High Bit + fileToBuild->InsertEntryString(str.str(),0x0028,0x0102); // High Bit // Set the pixel representation str.str(""); str << 0; //img.sign; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation + fileToBuild->InsertEntryString(str.str(),0x0028,0x0103); // Pixel Representation // Set the samples per pixel str.str(""); str << samplesPerPixel; //img.components; - fileToBuild->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel + fileToBuild->InsertEntryString(str.str(),0x0028,0x0002); // Samples per Pixel str.str(""); str << "1.2.840.10008.1.2.4.50"; - fileToBuild->InsertValEntry(str.str(),0x0002,0x0010); // Transfer Syntax UID + fileToBuild->InsertEntryString(str.str(),0x0002,0x0010); // Transfer Syntax UID // Step 2 : Create the output image // std::cout << "2..."; diff --git a/Testing/TestDataEntry.cxx b/Testing/TestDataEntry.cxx index b9b2e542..c6fc0d31 100644 --- a/Testing/TestDataEntry.cxx +++ b/Testing/TestDataEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestDataEntry.cxx,v $ Language: C++ - Date: $Date: 2005/10/18 08:35:46 $ - Version: $Revision: 1.1 $ + Date: $Date: 2005/10/18 19:06:29 $ + Version: $Revision: 1.2 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,9 +33,8 @@ unsigned long nbvalue = 5; /** * \brief Test the DataEntry object */ -int TestDataEntry(int argc, char *argv[]) +int TestDataEntry(int , char *[]) { - unsigned int error = 0; gdcm::DictEntry *dict; gdcm::DataEntry *entry; diff --git a/src/gdcmJpeg.cxx b/src/gdcmJpeg.cxx index 3edb58af..7cfee75f 100644 --- a/src/gdcmJpeg.cxx +++ b/src/gdcmJpeg.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmJpeg.cxx,v $ Language: C++ - Date: $Date: 2005/10/18 18:39:49 $ - Version: $Revision: 1.50 $ + Date: $Date: 2005/10/18 19:06:30 $ + Version: $Revision: 1.51 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -108,6 +108,7 @@ bool gdcm_write_JPEG_file (std::ostream *fp, void *im_buf, // // } assert( 0 ); + (void)fp; //jpeg_stdio_dest(&cinfo, fp, 0, 0, image_width, image_height, quality); /* Step 3: set parameters for compression */ -- 2.45.1