gdcmDicomDirVisit.cxx
gdcmDicomDirSerie.cxx
gdcmDicomDirStudy.cxx
- gdcmDicomEntry.cxx
gdcmDict.cxx
gdcmDictEntry.cxx
gdcmDictGroupName.cxx
Program: gdcm
Module: $RCSfile: gdcmCallbackCommand.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 15:20:35 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2005/11/29 17:21:33 $
+ 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
CallbackArg = NULL;
}
-
/**
* \brief Canonical destructor.
*/
Program: gdcm
Module: $RCSfile: gdcmDebug.h,v $
Language: C++
- Date: $Date: 2005/11/28 16:50:32 $
- Version: $Revision: 1.51 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.52 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
static std::ostream &GetOutput ();
- static void SendToOutput(unsigned int type,std::string const &msg,const Base *object = NULL);
+ static void SendToOutput(unsigned int type,std::string const &msg,
+ const Base *object = NULL);
private:
static bool DebugFlag;
* \brief Debug : To be used to help bug tracking developer
* @param msg message part
*/
-#define gdcmMessageBodyMacro(type,obj,msg,adds) \
+#define gdcmMessageBodyMacro(type, obj, msg, adds) \
{ \
std::ostringstream osmacro; \
osmacro << "In " __FILE__ ", line " << __LINE__ \
* @param msg message part
*/
#ifdef NDEBUG
-#define gdcmDebugBodyMacro(obj,msg) {}
+#define gdcmDebugBodyMacro(obj, msg) {}
#define gdcmDebugMacro(msg) {}
#define gdcmStaticDebugMacro(msg) {}
#else
-#define gdcmDebugBodyMacro(obj,msg) \
+#define gdcmDebugBodyMacro(obj, msg) \
{ \
if( Debug::GetDebugFlag() ) \
{ \
* @param msg message part
*/
// No NDEBUG test to always have a return of warnings !!!
-#define gdcmWarningBodyMacro(obj,msg) \
+// -> Rien compris! JPRx
+#define gdcmWarningBodyMacro(obj, msg) \
{ \
if( Debug::GetWarningFlag() ) \
gdcmMessageBodyMacro(gdcm::CMD_WARNING,obj,msg,""); \
* @param msg second message part
*/
// No NDEBUG test to always have a return of errors !!!
-#define gdcmErrorBodyMacro(obj,msg) \
+// -> Rien compris! JPRx
+#define gdcmErrorBodyMacro(obj, msg) \
{ \
gdcmMessageBodyMacro(gdcm::CMD_ERROR,obj,msg,""); \
}
* gdcmAssertMacro( "my message" && 2 < 3 )
*/
// No NDEBUG test to always have a return of asserts !!!
-#define gdcmAssertBodyMacro(obj,arg) \
+// -> Rien compris! JPRx
+#define gdcmAssertBodyMacro(obj, arg) \
{ \
if( !(arg) ) \
{ \
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/11/29 12:48:45 $
- Version: $Revision: 1.176 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.177 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
char buf[2048];
const char *cwd = getcwd(buf, 2048);
if( cwd )
- {
+ {
SetFileName( buf ); // will be converted into a string
- }
+ }
else
- {
+ {
gdcmErrorMacro( "Path was too long to fit on 2048 bytes" );
- }
+ }
}
NewMeta();
gdcmDebugMacro( "Parse directory and create the DicomDir : "
}
}
-/**
- * \brief CallStartMethod
- */
-void DicomDir::CallStartMethod()
-{
- Progress = 0.0f;
- Abort = false;
- CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS);
-}
-
-/**
- * \brief CallProgressMethod
- */
-void DicomDir::CallProgressMethod()
-{
- CommandManager::ExecuteCommand(this,CMD_PROGRESS);
-}
-
-/**
- * \brief CallEndMethod
- */
-void DicomDir::CallEndMethod()
-{
- Progress = 1.0f;
- CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS);
-}
//-----------------------------------------------------------------------------
// Private
* @param dst destination SQItem
* @param src source SQItem
*/
-void DicomDir::MoveSQItem(DocEntrySet *dst,DocEntrySet *src)
+void DicomDir::MoveSQItem(DocEntrySet *dst, DocEntrySet *src)
{
DocEntry *entry;
-
+// todo : rewrite the whole stuff, without using RemoveEntry an AddEntry,
+// to save time
entry = src->GetFirstEntry();
while(entry)
{
+ dst->AddEntry(entry); // use it, *before* removing it!
src->RemoveEntry(entry);
- dst->AddEntry(entry);
// we destroyed -> the current iterator is not longer valid
entry = src->GetFirstEntry();
}
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2005/11/29 12:48:46 $
- Version: $Revision: 1.72 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.73 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
~DicomDir();
void CreateDicomDirChainedList(std::string const &path);
- void CallStartMethod();
- void CallProgressMethod();
- void CallEndMethod();
private:
void Initialize();
ListDicomDirPatient Patients;
ListDicomDirPatient::iterator ItPatient;
- /// value of the ??? for any progress bar
- float Progress;
/// value of the ??? for any progress bar
bool ParseDir;
- mutable bool Abort;
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDictEntry.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 18:01:25 $
- Version: $Revision: 1.57 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.58 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
DictEntry::DictEntry(uint16_t group, uint16_t elem,
VRKey const &vr,
TagName const &vm,
- TagName const &name):
- DicomEntry(group,elem,vr)
+ TagName const &name)
+
{
+ Tag.SetGroup(group);
+ Tag.SetElement(elem);
+ VR = vr;
VM = vm;
Name = name;
}
+/**
+ * \brief Destructor
+ */
+DictEntry::~DictEntry()
+{
+}
//-----------------------------------------------------------------------------
// Public
/**
}
/**
- * \brief If-and only if-the V(alue) R(epresentation)
- * \ is unset then overwrite it.
- * @param vr New V(alue) R(epresentation) to be set.
- */
-void DictEntry::SetVR(VRKey const &vr)
-{
- //gdcmAssertMacro( IsVRUnknown() );
- DicomEntry::SetVR(vr);
-}
-
-/**
- * \brief If-and only if-the V(alue) M(ultiplicity)
- * \ is unset then overwrite it.
- * @param vm New V(alue) M(ultiplicity) to be set.
+ * \brief concatenates 2 uint16_t (supposed to be a Dicom group number
+ * and a Dicom element number)
+ * @param group the Dicom group number used to build the tag
+ * @param elem the Dicom element number used to build the tag
+ * @return the built tag
*/
-void DictEntry::SetVM(TagName const &vm)
+TagKey DictEntry::TranslateToKey(uint16_t group, uint16_t elem)
{
- gdcmAssertMacro( IsVMUnknown() );
- VM = vm;
+ // according to 'Purify', TranslateToKey is one of the most
+ // time consuming methods.
+ // Let's try to shorten it !
+ return TagKey(group,elem);
}
//-----------------------------------------------------------------------------
*/
void DictEntry::Print(std::ostream &os, std::string const &indent )
{
- DicomEntry::Print(os,indent);
+ os << GetKey();
+ os << " [" << VR << "] ";
std::ostringstream s;
Program: gdcm
Module: $RCSfile: gdcmDictEntry.h,v $
Language: C++
- Date: $Date: 2005/11/05 13:24:39 $
- Version: $Revision: 1.43 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.44 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMDICTENTRY_H
#define GDCMDICTENTRY_H
-#include "gdcmDicomEntry.h"
+#include "gdcmRefCounter.h"
+#include "gdcmTagKey.h"
+#include "gdcmVRKey.h"
namespace gdcm
{
//-----------------------------------------------------------------------------
+class VRKey;
+class TagKey;
/**
* \brief
* the DictEntry in an element contained by the Dict.
* - the VM (Value Multiplicity)
* - the corresponding name in english
*/
-class GDCM_EXPORT DictEntry : public DicomEntry
+class GDCM_EXPORT DictEntry : public RefCounter
{
gdcmTypeMacro(DictEntry);
// Print
void Print(std::ostream &os = std::cout, std::string const &indent = "");
-// Content of DictEntry
- virtual void SetVR(VRKey const &vr);
- virtual void SetVM(TagName const &vm);
+ /// \brief Returns the Dicom Group Number
+ /// @return the Dicom Group Number
+ const uint16_t &GetGroup() const { return Tag[0]; }
+
+ /// \brief Returns the Dicom Element Number
+ /// @return the Dicom Element Number
+ const uint16_t &GetElement() const { return Tag[1]; }
+
+ /// \brief Set the Dicom Value Representation
+ /// \param vr the Dicom Value Representation
+ virtual void SetVR(VRKey const &vr) { VR = vr; }
+ /// \brief Returns the Dicom Value Representation
+ /// @return the Dicom Value Representation
+ const VRKey &GetVR() const { return VR; }
+ /// \brief tells if the V(alue) R(epresentation) is known (?!)
+ /// @return
+ bool IsVRUnknown() const { return VR == GDCM_VRUNKNOWN; }
+
+ const TagKey &GetKey() const { return Tag; }
+
+// Key creation
+ static TagKey TranslateToKey(uint16_t group, uint16_t elem);
+
/// \brief returns the VM field of the current DictEntry
/// @return The 'Value Multiplicity' field
const TagName &GetVM() const { return VM; }
-
+ /// \brief Set the VM field of the current DictEntry
+ /// \param vm the'Value Multiplicity'
+ virtual void SetVM(TagName const &vm) { VM = vm; }
/// \brief tells if the V(alue) M(ultiplicity) is known (?!)
/// @return
bool IsVMUnknown() const { return VM == GDCM_UNKNOWN; }
TagName const &vm = GDCM_UNKNOWN,
TagName const &name = GDCM_UNKNOWN);
+ ~DictEntry();
+
private:
+ /// Dicom \ref TagKey. Contains Dicom Group number and Dicom Element number
+ TagKey Tag;
+
+ /// \brief Value Representation i.e. some clue about the nature
+ /// of the data represented e.g.
+ /// - "FD" short for "Floating Point Double"(see \ref VR)
+ /// - "PN" short for "Person Name"
+ VRKey VR;
+
/// \brief Value Multiplicity (e.g. "1", "1-n", "2-n", "6")
TagName VM;
Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 17:24:21 $
- Version: $Revision: 1.55 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.56 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Print method
* @param os ostream to write to
*/
-void DirList::Print(std::ostream &os, std::string const &indent)
+void DirList::Print(std::ostream &os, std::string const &)
{
std::copy(Filenames.begin(), Filenames.end(),
std::ostream_iterator<std::string>(os, "\n"));
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/11/21 16:28:06 $
- Version: $Revision: 1.331 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.332 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
return DoTheLoadingDocumentJob( );
}
-/*
-//#ifndef GDCM_LEGACY_REMOVE
-bool Document::Load( std::string const &fileName )
-{
- Filename = fileName;
- return DoTheLoadingDocumentJob( );
-}
-//#endif
-*/
-
/**
* \brief Performs the Loading Job (internal use only)
* @return false if file cannot be open or no swap info was found,
return groupLength;
}
+/**
+ * \brief CallStartMethod
+ */
+void Document::CallStartMethod()
+{
+ Progress = 0.0f;
+ Abort = false;
+ CommandManager::ExecuteCommand(this,CMD_STARTPROGRESS);
+}
+
+/**
+ * \brief CallProgressMethod
+ */
+void Document::CallProgressMethod()
+{
+ CommandManager::ExecuteCommand(this,CMD_PROGRESS);
+}
+
+/**
+ * \brief CallEndMethod
+ */
+void Document::CallEndMethod()
+{
+ Progress = 1.0f;
+ CommandManager::ExecuteCommand(this,CMD_ENDPROGRESS);
+}
+
//-----------------------------------------------------------------------------
// Private
/**
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/11/21 16:28:06 $
- Version: $Revision: 1.136 $
+ Date: $Date: 2005/11/29 17:21:34 $
+ Version: $Revision: 1.137 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmElementSet.h"
#include "gdcmException.h"
#include "gdcmDebug.h" // for LEGACY
+#include "gdcmCommandManager.h"
#include <map>
#include <list>
// gdcm::DicomDir are meaningfull).
Document();
virtual ~Document();
-
+
+ virtual void CallStartMethod();
+ virtual void CallProgressMethod();
+ virtual void CallEndMethod();
+
uint16_t ReadInt16() throw ( FormatError );
uint32_t ReadInt32() throw ( FormatError );
void SkipBytes(uint32_t);
DocEntry *Backtrack(DocEntry *docEntry);
// Variables
+protected:
+ /// value of the ??? for any progress bar
+ float Progress;
+ mutable bool Abort;
+
/// Public dictionary used to parse this header
Dict *RefPubDict;
/// \brief Optional "shadow dictionary" (private elements) used to parse
Module: $RCSfile: gdcmFileHelper.cxx,v $
Language: C++
- Date: $Date: 2005/11/21 09:46:26 $
- Version: $Revision: 1.83 $
+ Date: $Date: 2005/11/29 17:21:35 $
+ Version: $Revision: 1.84 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Initialize();
if ( FileInternal->IsReadable() )
{
- PixelReadConverter->GrabInformationsFromFile( FileInternal );
+ PixelReadConverter->GrabInformationsFromFile( FileInternal, this );
}
}
if ( !FileInternal->Load() )
return false;
- PixelReadConverter->GrabInformationsFromFile( FileInternal );
+ PixelReadConverter->GrabInformationsFromFile( FileInternal, this );
return true;
}
Program: gdcm
Module: $RCSfile: gdcmFileHelper.h,v $
Language: C++
- Date: $Date: 2005/11/28 16:31:23 $
- Version: $Revision: 1.35 $
+ Date: $Date: 2005/11/29 17:21:35 $
+ Version: $Revision: 1.36 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void SetKeepMediaStorageSOPClassUID (bool v)
{ KeepMediaStorageSOPClassUID = v; }
// no GetKeepMediaStorageSOPClassUID() method, on purpose!
+
+ void CallStartMethod();
+ void CallProgressMethod();
+ void CallEndMethod();
protected:
FileHelper( );
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.cxx,v $
Language: C++
- Date: $Date: 2005/11/28 16:50:32 $
- Version: $Revision: 1.105 $
+ Date: $Date: 2005/11/29 17:21:35 $
+ Version: $Revision: 1.106 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Gets various usefull informations from the file header
* @param file gdcm::File pointer
*/
-void PixelReadConvert::GrabInformationsFromFile( File *file )
+void PixelReadConvert::GrabInformationsFromFile( File *file,
+ FileHelper *fileHelper )
{
// Number of Bits Allocated for storing a Pixel is defaulted to 16
// when absent from the file.
}
}
FileInternal = file;
-
+ FH = fileHelper;
ComputeRawAndRGBSizes();
}
AllocateRaw();
//////////////////////////////////////////////////
+
+ CallStartMethod(); // for progress bar
+ unsigned int count = 0;
+ unsigned int frameSize;
+ unsigned int bitsAllocated = BitsAllocated;
+ if(bitsAllocated == 12)
+ bitsAllocated = 16;
+ frameSize = XSize*YSize*SamplesPerPixel*bitsAllocated/8;
+
//// Second stage: read from disk and decompress.
- if ( BitsAllocated == 12 )
+
+ if ( BitsAllocated == 12 ) // We suppose 'BitsAllocated' = 12 only exist for uncompressed files
{
ReadAndDecompress12BitsTo16Bits( fp);
}
gdcmWarningMacro( "Mismatch between PixelReadConvert : "
<< PixelDataLength << " and RawSize : " << RawSize );
}
+
+ //todo : is it the right patch?
+ char *raw = (char*)Raw;
+ uint32_t remainingLength;
+ unsigned int i;
+ unsigned int lengthToRead;
+
if ( PixelDataLength > RawSize )
- {
- fp->read( (char*)Raw, RawSize);
- }
+ lengthToRead = RawSize;
else
+ lengthToRead = PixelDataLength;
+
+ // perform a frame by frame reading
+ remainingLength = lengthToRead;
+ unsigned int nbFrames = lengthToRead / frameSize;
+ for (i=0;i<nbFrames; i++)
{
- fp->read( (char*)Raw, PixelDataLength);
+ fp->read( raw, frameSize);
+ raw += frameSize;
+ remainingLength -= frameSize;
}
+ if (remainingLength !=0 )
+ fp->read( raw, remainingLength);
+
+ //if ( PixelDataLength > RawSize )
+ //{
+ // fp->read( (char*)Raw, RawSize); // Read all the frames with a single fread
+ //}
+ //else
+ //{
+ // fp->read( (char*)Raw, PixelDataLength); // Read all the frames with a single fread
+ //}
if ( fp->fail() || fp->eof())
{
}
}
+/**
+ * \brief CallStartMethod
+ */
+void PixelReadConvert::CallStartMethod()
+{
+ Progress = 0.0f;
+ Abort = false;
+ CommandManager::ExecuteCommand(FH,CMD_STARTPROGRESS);
+}
+
+/**
+ * \brief CallProgressMethod
+ */
+void PixelReadConvert::CallProgressMethod()
+{
+ CommandManager::ExecuteCommand(FH,CMD_PROGRESS);
+}
+
+/**
+ * \brief CallEndMethod
+ */
+void PixelReadConvert::CallEndMethod()
+{
+ Progress = 1.0f;
+ CommandManager::ExecuteCommand(FH,CMD_ENDPROGRESS);
+}
+
+
//-----------------------------------------------------------------------------
} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmPixelReadConvert.h,v $
Language: C++
- Date: $Date: 2005/11/28 10:32:05 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/11/29 17:21:35 $
+ 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
#define GDCMPIXELREADCONVERT_H
#include "gdcmBase.h"
+#include "gdcmFileHelper.h"
#include "gdcmException.h"
+#include "gdcmCommandManager.h"
+
#include <fstream>
namespace gdcm
bool IsRawRGB();
// In progress
- void GrabInformationsFromFile( File *file );
+ void GrabInformationsFromFile( File *file, FileHelper *fileHelper );
bool ReadAndDecompressPixelData( std::ifstream *fp );
void Squeeze();
bool BuildRGBImage();
void AllocateRGB();
void AllocateRaw();
+ void CallStartMethod();
+ void CallProgressMethod();
+ void CallEndMethod();
+
// Variables
/**
* \brief Pixel data represented as RGB after LUT color interpretation.
File *FileInternal; // must be passed to User Function
VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
+ /// Needed for the progression bar stuff
+ FileHelper *FH;
+ mutable bool Abort;
+ float Progress;
};
} // end namespace gdcm