From 6a800bd81da33ac35002fe93583d2bf319ee69f4 Mon Sep 17 00:00:00 2001 From: regrain Date: Tue, 7 Dec 2004 09:32:23 +0000 Subject: [PATCH] * src/gdcmPixelWriteConvert.[h|cxx] : ficnished this class * src/gdcmFile.cxx : finished the correctly use of PixelWriteConvert -- BeNours --- ChangeLog | 4 ++++ src/gdcmDicomDirObject.cxx | 6 ++--- src/gdcmFile.cxx | 41 +++++++++++++++-------------------- src/gdcmPixelWriteConvert.cxx | 38 ++++++++++++++++++++++---------- src/gdcmPixelWriteConvert.h | 8 +++++-- 5 files changed, 56 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e1419d5..75dfeb08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-12-07 Benoit Regrain + * src/gdcmPixelWriteConvert.[h|cxx] : ficnished this class + * src/gdcmFile.cxx : finished the correctly use of PixelWriteConvert + 2004-12-06 Benoit Regrain * src/gdcmDocument.cxx : bug fix when opening the file. All read is followed by an eof to prevent all bad read of the file... and in this case, the diff --git a/src/gdcmDicomDirObject.cxx b/src/gdcmDicomDirObject.cxx index 11dfd84c..db99f950 100644 --- a/src/gdcmDicomDirObject.cxx +++ b/src/gdcmDicomDirObject.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirObject.cxx,v $ Language: C++ - Date: $Date: 2004/12/06 11:37:38 $ - Version: $Revision: 1.10 $ + Date: $Date: 2004/12/07 09:32:24 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -120,7 +120,7 @@ void DicomDirObject::FillObject(ListDicomDirMetaElem const & elemList) else { entry->SetLength(entry->GetValue().length()); - } + } AddEntry(entry); } } diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index c7f72f23..3de485f7 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 20:16:58 $ - Version: $Revision: 1.171 $ + Date: $Date: 2004/12/07 09:32:24 $ + Version: $Revision: 1.172 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -540,18 +540,13 @@ void File::SetWriteToDecompressed() photInt->SetLength(12); } + PixelWriteConverter->SetReadData(PixelReadConverter->GetDecompressed(), + PixelReadConverter->GetDecompressedSize()); + BinEntry* pixel = CopyBinEntry(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel()); pixel->SetValue(GDCM_BINLOADED); - if(PixelWriteConverter->GetUserData()) - { - pixel->SetBinArea(PixelWriteConverter->GetUserData(),false); - pixel->SetLength(PixelWriteConverter->GetUserDataSize()); - } - else - { - pixel->SetBinArea(PixelReadConverter->GetDecompressed(),false); - pixel->SetLength(PixelReadConverter->GetDecompressedSize()); - } + pixel->SetBinArea(PixelWriteConverter->GetData(),false); + pixel->SetLength(PixelWriteConverter->GetDataSize()); Archive->Push(photInt); Archive->Push(pixel); @@ -576,24 +571,22 @@ void File::SetWriteToRGB() photInt->SetValue("RGB "); photInt->SetLength(4); - BinEntry* pixel = CopyBinEntry(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel()); - pixel->SetValue(GDCM_BINLOADED); - if(PixelWriteConverter->GetUserData()) - { - pixel->SetBinArea(PixelWriteConverter->GetUserData(),false); - pixel->SetLength(PixelWriteConverter->GetUserDataSize()); - } - else if(PixelReadConverter->GetRGB()) + if(PixelReadConverter->GetRGB()) { - pixel->SetBinArea(PixelReadConverter->GetRGB(),false); - pixel->SetLength(PixelReadConverter->GetRGBSize()); + PixelWriteConverter->SetReadData(PixelReadConverter->GetRGB(), + PixelReadConverter->GetRGBSize()); } else // Decompressed data { - pixel->SetBinArea(PixelReadConverter->GetDecompressed(),false); - pixel->SetLength(PixelReadConverter->GetDecompressedSize()); + PixelWriteConverter->SetReadData(PixelReadConverter->GetDecompressed(), + PixelReadConverter->GetDecompressedSize()); } + BinEntry* pixel = CopyBinEntry(GetHeader()->GetGrPixel(),GetHeader()->GetNumPixel()); + pixel->SetValue(GDCM_BINLOADED); + pixel->SetBinArea(PixelWriteConverter->GetData(),false); + pixel->SetLength(PixelWriteConverter->GetDataSize()); + Archive->Push(spp); Archive->Push(planConfig); Archive->Push(photInt); diff --git a/src/gdcmPixelWriteConvert.cxx b/src/gdcmPixelWriteConvert.cxx index a4f8cec9..d0f9e243 100644 --- a/src/gdcmPixelWriteConvert.cxx +++ b/src/gdcmPixelWriteConvert.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelWriteConvert.cxx,v $ Language: C++ - Date: $Date: 2004/12/03 11:55:38 $ - Version: $Revision: 1.1 $ + Date: $Date: 2004/12/07 09:32:24 $ + 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 @@ -57,15 +57,29 @@ void PixelWriteConvert::SetUserData(uint8_t* data,size_t size) UserDataSize = size; } +uint8_t* PixelWriteConvert::GetData() +{ + if(UserData) + { + return UserData; + } + else + { + return ReadData; + } +} + +size_t PixelWriteConvert::GetDataSize() +{ + if(UserData) + { + return UserDataSize; + } + else + { + return ReadDataSize; + } +} + //----------------------------------------------------------------------------- } // end namespace gdcm - -// NOTES on File internal calls -// User -// ---> GetImageData -// ---> GetImageDataIntoVector -// |---> GetImageDataIntoVectorRaw -// | lut intervention -// User -// ---> GetImageDataRaw -// ---> GetImageDataIntoVectorRaw diff --git a/src/gdcmPixelWriteConvert.h b/src/gdcmPixelWriteConvert.h index 3568b251..6f070e55 100644 --- a/src/gdcmPixelWriteConvert.h +++ b/src/gdcmPixelWriteConvert.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmPixelWriteConvert.h,v $ Language: C++ - Date: $Date: 2004/12/03 11:55:38 $ - Version: $Revision: 1.1 $ + Date: $Date: 2004/12/07 09:32:24 $ + 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 @@ -43,6 +43,10 @@ public: uint8_t* GetUserData() { return UserData; } size_t GetUserDataSize() { return UserDataSize; } + // Get the used image and its size + uint8_t* GetData(); + size_t GetDataSize(); + private: // Variables /// Pixel data represented as RGB after LUT color interpretation. -- 2.48.1