jpr [Thu, 24 Jun 2004 18:03:14 +0000 (18:03 +0000)]
Jean-Pierre Roux
FIX : Write - All the Sequences and Sequence Item are now written
as 'no length' stuff, and a Sequence Delimitor aor an Item Delimitor
is added a the end, when necessary.
- A lot of brain-damaged images, that were read correctly are
now written correctly
- length compatible BinEntry are now loaded correctly
(even for odd groups)
- Note : only Explicit Value Representation was checked.
(question : is implicit VR really necessary for gdcm ?)
jpr [Wed, 23 Jun 2004 09:30:22 +0000 (09:30 +0000)]
gdcmDocument.cxx
- Now we do recognize the JpegLossLess format (there was a misstyping in
code 'beautyfication' :-(
- Now we automaticaticaly load the Luts, if any
jpr [Tue, 22 Jun 2004 13:47:33 +0000 (13:47 +0000)]
2004-06-22 Jean-Pierre Roux
In order : to write Sequences, whatever their imbrication level,
: to allow user to create his own Sequences
a lot of modif where necessary (adding, moving, or virtualising methods)
frog [Mon, 21 Jun 2004 12:38:28 +0000 (12:38 +0000)]
* src/gdcmBinEntry.cxx, gdcmValEntry.cxx: gdcmBinEntry::Print() now
properly calls gdcmValEntry::Print() (that was weed out from
code related to gdcmBinEntry).
frog [Mon, 21 Jun 2004 08:47:13 +0000 (08:47 +0000)]
* Test/TestWriteSimple.cxx: fix to gdcmHeader-gdcmHeaderHelper revamping.
The default constructor invoked by the line
gdcmHeader *f1 = new gdcmHeader( header );
was gdcmHeader::gdcmHeader(bool) instead of the expected
gdcmHeader::gdcmHeader(std::string const &, bool = false, bool, bool).
Hence the parsing wasn't executed... See also below.
* src/gdcmHeader.h: the declaration of gdcmHeader::gdcmHeader(bool)
as explicit constructor didn't do the trick to fix the above problem.
Could anyone explain why ? --- Frog
malaterre [Mon, 21 Jun 2004 04:43:01 +0000 (04:43 +0000)]
ENH: Ok second chunk of patch, tests seems to go smoothly
1. Compile with CMAKE_CXX_FLAGS (need to turn advanced ON) = -W -Wall -Werror
2. Add two virtual to destructor, with a bit of luck these were the leaks reported by frog
malaterre [Mon, 21 Jun 2004 04:18:23 +0000 (04:18 +0000)]
ENH:First chunk of patch:
1. Get rid of gdcmHeaderHelper, the class was only gdcmHeader with nice default values, no big deal
2. Left a legacy mode where you can still use the class gdcmHeaderHelper
3. Some minor clean up, but all the tests are passing
frog [Sun, 20 Jun 2004 18:08:46 +0000 (18:08 +0000)]
* Erroneous leading white fix:
- src/gdcmDict.cxx: getline(from,xxx) doesn't remove the leading
white[s] (as opposed to from >> xxx, that removes it [them].
- src/gdcmTS.cxx: ditto.
- gdcmPython/testSuite.py: dirty related kludge removed.
* src/*: remaining references to gdcmParser removed.
* src/*[cxx|h]: added copy[way]left header. --- Frog
frog [Sat, 19 Jun 2004 23:51:03 +0000 (23:51 +0000)]
* In order to fix memory leaks:
- Test/TestWriteSimple.cxx: added cleaning of free store through
some delete calls.
- src/gdcmBinEntry.cxx: fix to avoid SegFault.
- src/gdcmDicomDir.[cxx|h]: fixed initialisation in constructor
gdcmDicomDir::gdcmDicomDir(bool) [either the constructor itself
(through the call to ::AddDicomDirMeta()) or the destructor
would crash when deleting uninitialized ::metaElems].
- src/gdcmDictEntry.cxx: annotation of ununderstood memory leak.
- src/gdcmDocument.cxx:
-- ::~gdcmDocument() destructor now cleans up all dictionary entries
from dynamic stores.
-- ::ParseDES() misplaced deletion of temporary NewDocEntry
was causing memory leaks.
- src/gdcmSQItem.cxx:
-- ::~gdcmSQItem() dummy code cleaned (learned that deletion is
cleanly handled with polymophism: sorry but my milage is low).
-- ::SetEntryByNumber(string, guint16, guint16) now cleanly allocates
a gdcmValENtry, and makes no assumption on type (gdcmDocEntry,
gdcmSeqEntry vs gdcmValEntry) of existing entry (when present).
This avoids SegFaulting.
- src/gdcmSQItem.h: coding style.
* Conclusion:
- Test/TestWriteSimple still severely sucks. The output image content
(when $(GDCMDATA_HOME)/012345.002.050.dcm in input) is brain
damaged when displayed with vtkgdcmViewer.
- on memory leaks: TestWriteSimple leaks really less (see entry
of 2004-06-18 in Changelog file for the call to valgrind).
- on segfaults: ctest now passes all the tests but one (no more
segfaults).
frog [Fri, 18 Jun 2004 12:26:53 +0000 (12:26 +0000)]
* In order to fix writing of dicom files:
- Test/TestWriteSimple.cxx: a simpler example of writing.
- Test/CMakeLists.txt changed accordingly.
- src/gdcmDocument.cxx:
-- The destructor now recursilvely removes potential sequences.
-- Bug fix in ::IsJPEG2000()
-- ::ReplaceOrCreateByNumber(std::string, guint16, guint16)
now handles promotion of gdcmDocEntry to gdcmValEntry in a cleaner
manner.
-- ::GetValEntryByNumber(guint16, guint16) now defined (as opposed
to only declared) and build on top of
::GetDocEntryByNumber(guint16, guint16).
-- ::SetEntryByNumber() now uses GetValEntryByNumber(group, element)
- src/gdcmElementSet.[h|cxx]: added ::RemoveEntry(gdcmDocEntry *)
for usage in destructor and treatement of promotion in
::ReplaceOrCreateByNumber().
- src/gdcmSQItem.cxx: destructor should better handle his job.
Test/TestWriteSimple now runs (or at least it DOES something).
* We can now start hutting memory links. A good starting point is:
valgrind -q --skin=memcheck --leak-check=yes --leak-resolution=high
--num-callers=100 --show-reachable=yes gdcmTests TestWriteSimple
$(GDCMDATA_HOME)/012345.002.050.dcm foo.dcm
frog [Fri, 18 Jun 2004 00:11:44 +0000 (00:11 +0000)]
* Valgrind note: after Mathieu Malaterre teached me how to read
the valgrind FAQ ;-] (see http://valgrind.kde.org/faq.html), I
learned that:
Using gcc, you can force the STL to use malloc and to free memory as
soon as possible by globally disabling memory caching.
With 3.2.2 and later, you should export the environment variable
GLIBCPP_FORCE_NEW before running your program.
By setting GLIBCPP_FORCE_NEW, STL related memory leak messages of gdcm
simply vanish (it is still not clear to me, whether this means that STL
std::string leaks or if valgrind believes it leaks...).
* Fixing of SegFault of Test/makeDicomDir (as shown by ctest or by
running bin/gdcmTests makeDicomDir):
- src/gdcmDicomDir.cxx: dynamic casting used + clean up.
- Test/makeDicomDir.cxx now properly traps empty lists and returns
with 1.
NOW, makeDicomDir cleanly fails (in ctest terminology) instead of
SegFaulting (I drowned in DicomDir related code when trying to
understand why the list is empty...).
* src/gdcmDocument.h: first BSD license header try.
* Doc/License.txt added. --- Frog
frog [Tue, 15 Jun 2004 13:10:18 +0000 (13:10 +0000)]
* src/gdcmDocument.[h|cxx]:
- Clean up of the Transfer related predicates. They are now all based
on new method isGivenTransferSyntax, that (should) handle properly
the padding problem.
- general clean up, simplification, and coding style.
- Specific clean up of Parse7FE0() (umproperly named actually).
* gdcmPython/testSuite.py: an odd temporary kludge introduced.
jpr [Tue, 15 Jun 2004 10:06:10 +0000 (10:06 +0000)]
Jean-Pierre Roux
* gdcmSeqEntry.cxx
- fix the display of Sequence Delimitor (SQDepthLevel pb)
- fix the display of SQItem ordinal number
- add the GetSQItemByOrdinalNumber method
- remove some useless never written private methods
jpr [Tue, 15 Jun 2004 08:41:09 +0000 (08:41 +0000)]
Jean-Pierre Roux
gdcmBinEntry.cxx
- adding a constructor taking a gdcmDocEntry as an input param
- ReplaceOrCreateByNumber now returns :
a gdcmBinEntry * if a Binary (void *) value is passed as a param
a gdcmValEntry * if a string value is passed as a param
gdcmDocument.cxx
- SetEntryByNumber now allows setting gdcmValEntry or gdcmBinEntry,
according to the param type (no longer sets a gdcmDocEntry)
- GetValEntryByNumber, GetBinEntryByNumber added
- NewValEntryByNumber and NewBinEntryByNumber added
gdcmFile.cxx
- Pixel Data are now linked to the (7fe0,0010) elements, after reading
gdcmSQItem.h
- GetSQItemNumber and SetSQItemNumber added, to provide
a (relative) Item identier inside a given Sequence
\warning : some pb remaining around this number
will be solved asap
- AddEntry now takes the Item Number as a param
gdcmValEntry.cxx
- adding a constructor taking a gdcmDocEntry as an input param
frog [Mon, 14 Jun 2004 08:35:35 +0000 (08:35 +0000)]
* Memory leak hunt with the following command:
valgrind --leak-check=yes --leak-resolution=high --num-callers=40
--show-reachable=yes gdcmTests PrintDocument
It looks like many (all?) leaks are due to the STL (or a bad usage
of the STL. The lines producing the leaks now have a comment with
a "MEMORY LEAK" tag: you can retrieve them with
grep "MEMORY LEAK" src/*
Here are two typical examples which I can't help fixing:
-----
#include <string>
int main() {
std::string name;
char * test = "babo";
name = test; //// <--- valgrind detects 960 bytes lost in
//// call to std::string::operator=(char const*)
name.clear(); //// Doesn't help !
return 0;
}
-----
#include <string>
#include <iostream>
int main() {
std::string line;
std::cout << "Type a bunch of characters followed by RETURN: ";
getline(std::cin, line); //// <--- valgrind dectects a loss
//// of 1320 bytes in call to
/// std::basic_istream<>& std::getline<>
return 0;
}
-----
frog [Thu, 10 Jun 2004 13:28:53 +0000 (13:28 +0000)]
* src/gdcmHeader.[cxx|h]:
- Predicates on the Transfer syntax (of the form Is[JPEF|RLE]*)
and related, moved away to gdcmDocument.
- Accessors (on the form [Get|Set]Entry*) set up to expose publicly
the corresponding protected accessors of inherited class
gdcmDocument, removed ! As a consequence gdcmFile had to be
declared friend of class gdcmDocument (see below).
- operator< moved to gdcmDocument (in fact it belongs to gdcmDicomDir).
- Clean up of undefined or unused methods.
* src/gdcmFile.[cxx|h]: added SetEntryByNumber (in order to take into
account the changes to gdcmHeader.h).
* src/gdcmDocument.h:
- gdcmFile is now a friend class (in order to take into account the
changes to gdcmHeader.h).
- Predicates on the Transfer syntax (of the form Is[JPEF|RLE]*) added
(see changes to gdcmHeader.h).
- Accessors (reading on the form GetEntry*) are now public.
- Clean up of undefined or unused methods.
* src/gdcmDocument.cxx:
- adaptation to changes to gdcmDocument.h
- ::OpenFile now writes a verbose message when file cannot be opened.
- some std::string properly set to VRKey
* src/gdcmDicomDir.h: historical references to gdcmHeader changed to
references to gdcmDocument.
* Test/TestFindTags.cxx: changed accordingly to above changes.
* gdcmPython/testSuite.py: adapted to renaming of acr files in
cvs repository gdcmData.
frog [Wed, 9 Jun 2004 15:00:42 +0000 (15:00 +0000)]
* src/gdcmValEntry.h: member voidArea type changed from char* to void*.
* src/gdcmBinEntry.h: member voidArea commented out, since it potentially
conflicts with gdcmValEntry::voidArea.
* src/gdcmValEntry.cxx: unmatching comment wiped out.
* src/gdcmVR.[h|cxx]: added two predicates that partition the possible
Value representation between StringRepresentable and BinaryRepresentable.
* src/gdcmDocument.cxx:
- method ParseDES: proper indentation restored and usage of
gdcmVR::IsVROfGdcmStringRepresentable wired in.
- method LoadDocEntry: the fingerprint left in the SetValue() of
unloaded entries (length > MaxSizeLoadEntry) had curiously been
removed. Reverting to previous code segment with the proper
dynamic_cast< gdcmValEntry* >.
Note: this was (partially) breaking the python test suite
(gdcmPython/testSuite.py) that made usage of the above
fingerprint to check presence of "Pixel Data".
* src/gdcmDocEntry.h: coding style.
* gdcmPython/__init__.py: environement variable GDCM_DATA_PATH is
now taken into account.
* gdcmPython/gdcm.i: adaptation to the new internal representation
of gdcm (exit gdcmParser, hello gdcmDocument).
* gdcmPython/testSuite.py: quick and dirty fix for loading vtkgdcmPython
on posix.
* gdcmPython/demo/PrintHeader.py: doesn't use the gdcmDocument::Print()
anymore, but instead prints the loaded Python dictionary.
* .... alas, the python testSuite is still broken.
frog [Tue, 8 Jun 2004 10:51:34 +0000 (10:51 +0000)]
src/CMakeLists.txt :
* kernel (i.e. src/gdcm*) doesn't compile gdcmParser.cxx nor
gdcmHeaderEntry.cxx anymore.
* converted the file format from DOS return to un*x ones (it caused
my lincvs graphical diff mode to display kinky results). --- Frog
malaterre [Mon, 17 May 2004 04:26:23 +0000 (04:26 +0000)]
* Some more cleanup/enhancement in gdcmPython/CMakeLists.txt getting close
to right behavior
* Initial addition of automatic python testing
* Initial addition of automatic image comparison
jpr [Tue, 4 May 2004 15:03:01 +0000 (15:03 +0000)]
Taking into account the 'Dicom Sequences' leads up to introduce new concepts
(and new classes) :
a 'gdcmDocument' is composed of a set of Doc Entries, that are
- elementary gdcmDocEntries (former gdcmHeaderEntries)
- Sequence Doc Entries (gdcmSeqEntries)
a Sequence is composed of Items.
Each item is a set of Doc Entries (this is recursive)
The non uniqueness of the 'Dicom tag' is due to this recursivity
(never taken into account)
Our unability to add a new 'entry' in the header
at the proper location (neither in the H-Table (map or multimap), nor in
the Chained List is also due to this recursivity.
Don't try, right now, to use/modify/compile these new sources : nothing is
finished.
We just commit all the stuff, 'as is', in order not to loose it.