From 6df14b12a643a8cc3061192b22e549eed18cca73 Mon Sep 17 00:00:00 2001 From: regrain Date: Sat, 22 Jan 2005 12:39:10 +0000 Subject: [PATCH] * bug fix for compilation on MSVC6 * gdcmPython/gdcm.i : rename of classes missed -- BeNours --- ChangeLog | 4 +++ Example/TestWriteSimple.cxx | 69 ++++++++++++++++++------------------- gdcmPython/gdcm.i | 8 ++--- src/gdcmCommon.h | 6 ++-- 4 files changed, 45 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bf409f0..7dafde23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-01-22 Benoit Regrain + * bug fix for compilation on MSVC6 + * gdcmPython/gdcm.i : rename of classes missed + 2005-01-20 Benoit Regrain * gdcmDicomDirElement.[h|cxx] : change the AddEntry method. Now, it gets a type and not a string. So, there remove problems on the format of the diff --git a/Example/TestWriteSimple.cxx b/Example/TestWriteSimple.cxx index 2e60574c..7c76e13e 100644 --- a/Example/TestWriteSimple.cxx +++ b/Example/TestWriteSimple.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestWriteSimple.cxx,v $ Language: C++ - Date: $Date: 2005/01/21 11:40:53 $ - Version: $Revision: 1.9 $ + Date: $Date: 2005/01/22 12:39:11 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,39 +20,38 @@ int main(int argc, char* argv[]) { + if (argc < 3) + { + std::cerr << "Usage :" << std::endl << argv[0] + << " InputFile OutputDicom" << std::endl; + return 0; + } - if (argc < 3) - { - std::cerr << "Usage :" << std::endl << argv[0] << - " InputFile OutputDicom" << std::endl; - return 0; - } - - std::string header = argv[1]; - const char *output = argv[2]; - - gdcm::File *f1 = new gdcm::File( header ); - gdcm::FileHelper *f2 = new gdcm::FileHelper( f1 ); - - // If the following call is important, then the API sucks. Why is it - // required to allocate PixelData when we are not using it !? - uint8_t* PixelData = f2->GetImageData(); //EXTREMELY IMPORTANT - //Otherwise ReadPixel == -1 -> the dicom writing fails completely - - int dataSize = f2->GetImageDataSize(); - // unsigned char cast is necessary to be able to delete the buffer - // since deleting a void* is not allowed in c++ - uint8_t *imageData = (uint8_t *)f2->GetImageData(); - - f2->SetImageData( imageData, dataSize ); - - f2->WriteDcmExplVR( output ); - - delete f1; - delete f2; - //delete PixelData; //Does GetImageData return the same pointer ? - (void)PixelData; - - return 0; + std::string header = argv[1]; + const char *output = argv[2]; + + gdcm::File *f1 = new gdcm::File( header ); + gdcm::FileHelper *f2 = new gdcm::FileHelper( f1 ); + + // If the following call is important, then the API sucks. Why is it + // required to allocate PixelData when we are not using it !? + uint8_t* PixelData = f2->GetImageData(); //EXTREMELY IMPORTANT + //Otherwise ReadPixel == -1 -> the dicom writing fails completely + + int dataSize = f2->GetImageDataSize(); + // unsigned char cast is necessary to be able to delete the buffer + // since deleting a void* is not allowed in c++ + uint8_t *imageData = (uint8_t *)f2->GetImageData(); + + f2->SetImageData( imageData, dataSize ); + + f2->WriteDcmExplVR( output ); + + delete f1; + delete f2; + //delete PixelData; //Does GetImageData return the same pointer ? + (void)PixelData; + + return 0; } diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index 2d3c5ad6..cb5aaeac 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -18,7 +18,7 @@ #include "gdcmElementSet.h" #include "gdcmFileHelper.h" #include "gdcmGlobal.h" -#include "gdcmHeader.h" +#include "gdcmFile.h" #include "gdcmSerieHeader.h" #include "gdcmRLEFramesInfo.h" #include "gdcmJPEGFragmentsInfo.h" @@ -288,13 +288,13 @@ using namespace gdcm; //////////////////////////////////////////////////////////////////////////// // Because overloading and %rename don't work together (see below Note 1) // we need to ignore some methods (e.g. the overloaded default constructor). -// The gdcm::Header class doesn't have any SetFilename method anyhow, and +// The gdcm::File class doesn't have any SetFilename method anyhow, and // this constructor is only used internaly (not from the API) so this is // not a big loss. %ignore gdcm::binary_write(std::ostream &,uint32_t const &); %ignore gdcm::binary_write(std::ostream &,uint16_t const &); -%ignore gdcm::Header::Header(); +%ignore gdcm::File::File(); %ignore gdcm::DicomDir::DicomDir(); // Ignore all placed in gdcmCommon.h @@ -322,7 +322,7 @@ using namespace gdcm; %include "gdcmDicomDirPatient.h" %include "gdcmDicomDirMeta.h" %include "gdcmDocument.h" -%include "gdcmHeader.h" +%include "gdcmFile.h" %include "gdcmSerieHeader.h" %include "gdcmFile.h" %include "gdcmUtil.h" diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index ddd95eb7..82b8dae2 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommon.h,v $ Language: C++ - Date: $Date: 2005/01/21 20:49:37 $ - Version: $Revision: 1.54 $ + Date: $Date: 2005/01/22 12:39:12 $ + Version: $Revision: 1.55 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -54,7 +54,7 @@ typedef signed char int8_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; -typedef unsigned __int64 uint64_t; +#define uint64_t unsigned __int64 // problems with swig when using a typedef #define UINT32_MAX (4294967295U) #endif -- 2.45.1