garbage debug code.
* TODO, vtk/vtkGdcmReader.cxx: upcoming fixes comments.
* gdcmPython/testSuite.py: JPR bug fix, brutal erasement of
test suite reported error.
* PACKAGER file added (describes what a packager must do when
packaging a new release).
* MANIFEST.in, now declares jconfig.linux and jconfig.vc
* configure.in: upgraded version number to 0.3.0
* fixing build of rpm (through rpm -ta):
- Doc/Makefile.am exports proper doxygen files
- src/jpeg/libijg8/Makefile.am exports the include files. --- Frog
+2003-07-07 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+ * src/gdcmElValSet.cxx, gdcmFile.cxx: JPR bug fix, removal of
+ garbage debug code.
+ * TODO, vtk/vtkGdcmReader.cxx: upcoming fixes comments.
+ * gdcmPython/testSuite.py: JPR bug fix, brutal erasement of
+ test suite reported error.
+ * PACKAGER file added (describes what a packager must do when
+ packaging a new release).
+ * MANIFEST.in, now declares jconfig.linux and jconfig.vc
+ * configure.in: upgraded version number to 0.3.0
+ * fixing build of rpm (through rpm -ta):
+ - Doc/Makefile.am exports proper doxygen files
+ - src/jpeg/libijg8/Makefile.am exports the include files.
+
2003-07-07 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* vtk/vtkGdcmReader.cxx : bug fix when loading only 1 file.
* src/gdcmHeader.h : formatting code
HTML_DIR=$(datadir)/gdcm/html
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
-EXTRA_DIST = DoxyfileDeveloppers
+EXTRA_DIST = \
+ DoxyfileDeveloppers \
+ DoxyfileUsers \
+ DoxyDevelInstal.txt \
+ DoxyIntroduction.txt \
+ DoxyPython.txt \
+ DoxyInstallation.txt \
+ DoxyMainPage.txt
all-local: html.developper/index.html
include *.py
recursive-include src *.h
+include src/jpeg/libijg8/jconfig.linux
+include src/jpeg/libijg8/jconfig.vc
recursive-include vtk *.h
recursive-include Dicts *.dic
recursive-include Test *.*
--- /dev/null
+Here is the checklist when freezing a version of gdcm:
+
+* First stage, checkings:
+ 1/ Un*x:
+ Notation: we here assume you have a cvs tree in GDCMHOME directory.
+ cvs -d:pserver:anonymous@cvs.creatis.insa-lyon.fr:2402/cvs/public login
+ cvs -d:pserver:anonymous@cvs.creatis.insa-lyon.fr:2402/cvs/public co gdcm
+ cd gdcm
+ export GDCMHOME=`pwd`
+ cvs -d:pserver:anonymous@cvs.creatis.insa-lyon.fr:2402/cvs/public co gdcmData
+
+ 1a/ check the full compilation is effective:
+ ./autogen.sh --enable-vtk --enable-python --enable-doxygen
+ make
+
+ 1b/ check the python test suite is clean (python testSuite.py)
+ cd gdcmPython
+ export PYTHONPATH=`pwd`/..
+ ln -s .libs/pygdcm.so _gdcm.so
+ ln -s .libs/vtkgdcmPython.so .
+ python testSuite.py
+
+ 1c/ check the setup.py distutil script is operational and then validate
+ its produced packages through the test suite, in all following cases
+ - Direct installation:
+ cd $(GDCMHOME)
+ python setup.py install --prefix=/tmp/
+ cd /tmp/lib/python2.2/site-packages/
+ ln -s $(GDCMDATAHOME) .
+ export PYTHONPATH=`pwd`
+ cd gdcmPython/
+ python testSuite.py
+ - Binary distribution:
+ cd $(GDCMHOME)
+ python setup.py bdist --formats=rpm
+ su
+ rpm -Uvh dist/gdcmPython-0.[n].i386.rpm
+ cd /usr/lib/python2.2/site-packages/
+ Check out gdcmData
+ cd gdcmPython
+ python testSuite.py
+ rpm --erase gdcmPython
+ - Source distribution and then binary distribution (out of build
+ source distro):
+ cd $(GDCMHOME)
+ python setup.py sdist
+ cd /tmp
+ tar zxvf ~/cvs/gdcm/dist/gdcmPython-*.tar.gz
+ cd gdcmPython-*/
+ python setup.py bdist --formats=rpm
+ As root, repeat above installation with rpm and test.
+
+ 2/ Windoze:
+
+* Second stage: preparing packaging:
+ - Update the version number in configure.in (AM_INIT_AUTOMAKE)
+ - Update the version number in setup.py (version entry in setup object).
+
+* Third stage: packaging
+ 1/ Un*x
+ 1a/ Packaging at the C/C++/Python level (i.e. exports both libraries,
+ include files and python package)
+ - Make sure you have a ~/.rpmmacros file containing the line
+ %_topdir <somedirectoryPath>
+ and that <somedirectoryPath> exists and contains the subdirs
+ BUILD, SOURCES, RPMS/i386, SRPMS, SPECS
+ - cd $(GDCMHOME)
+ - ./autogen.sh --enable-vtk --enable-python --enable-doxygen
+ - make release (generates gdcm-x.y.z.tar.gz)
+ - rpm -ta gdcm-x.y.z.tar.gz
+ 1b/ Packaging at the python level:
+ cd $(GDCMHOME)
+ python setup.py sdist
+ python setup.py bdist --formats=rpm
+ collect both source distro and binary distro
+* Split gdcmHeader through inheritance to create gdcmHeaderHelper
+ that would regroup all the heuristics above a gdcmHeader e.g. the
+ functions GetXsize(), GetXSpacing(), GetXImagePosition()...
+ Those functions are the one using the results of the parsing as
+ done by gdcmHeader to provide the user with heuristics above various
+ values found in the header (the simplest form being to default a value).
+* vtk/vtkGdcmHeader.cxx: if speed becomes a concern some changes can
+ be made a the cost of memory consumption (refer to header of
+ vtk/vtkGdcmHeader.cxx)
+* Add a GetVersion() global function.
* gdcmElValSet::SetElValueLengthByNumber IMNSHO should be trashed.
It's only purpose is a onliner substitute to calling GetElValueByNumber
and then SetLength. This only obfuscates the caller code more than
below the specified size. When accessing the value of such an element
the content is unfound ! Find a decent way of loading the value on
explicit demand.
-* fournir une method qui ne fait que lire les elements passes en arguments
+* JPR: fournir une method qui ne fait que lire les elements passes en arguments
sous forme d'une liste.
-* gdcmHeader::CheckSwap() dans le cas ACR pas propre, degager tout de suite
- si on a deduit que c'en est pas...
+* JPR: gdcmHeader::CheckSwap() dans le cas ACR pas propre, degager tout de
+ suite si on a deduit que c'en est pas...
* python /usr/lib/python2.2/site-packages/DaVaW/demo/dvwDcmReader.py
and load image /home/frog/cvs/DCMlib/Data/CT-MONO2-16-ankle.dcm
will yield wrong coloring scheme as opposed to
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/gdcmDict.cxx)
-AM_INIT_AUTOMAKE(gdcm, 0.1.0)
+AM_INIT_AUTOMAKE(gdcm, 0.3.0)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(src/config.h)
PreInstallModePath = os.path.join(__path__[0], "..", DirName + "/")
if os.path.isfile(os.path.join(PreInstallModePath, FileName)):
return PreInstallModePath
- print "Unfound directory ", DirName
return None
### Setup the path to the dictionaries. WARNING: this needs to be done
-# BEFORE importation of the shadow classse generated by swig as found
+# BEFORE importation of the shadow classes generated by swig as found
# in gdcm, since the dynamic library loads the standard dictionary
# when dynamically loaded.
# We consider we succefully found the dictionaries path when we encounter
### Set up the path to the data images for the demos.
GDCM_DATA_PATH = BuildInstallOrPreinstallPath("Test", "test.acr")
+if not GDCM_DATA_PATH:
+ print "GDCM_DATA_PATH is not setup properly: unfound Test directory"
### Set up the path to the data images of the test suite.
GDCM_TEST_DATA_PATH = BuildInstallOrPreinstallPath("gdcmData", "test.acr")
Source.GetImageData()
TargetFileName = "junk"
Target = Source.WriteDcmImplVR(TargetFileName)
- Sign = '5af8739c15dd579dea223eb3930cacda'
+ Sign = 'c3d27238647b7eaa773bff6ea0692b54'
ComputeSign = md5.new(open(TargetFileName).read()).hexdigest()
- #print ComputeSign
self.assertEqual(ComputeSign, Sign,
("Wrong signature for file %s (got %s, shoud be %s)"
% (SourceFileName, ComputeSign, Sign)) )
os.unlink(TargetFileName)
if __name__ == '__main__':
+ if not GDCM_TEST_DATA_PATH:
+ print "GDCM_TEST_DATA_PATH is not setup properly. This test suite"
+ print " requires that some Dicom reference files be installed."
+ print " For further details on installation of gdcmData, please"
+ print " refer to the developper's section of page "
+ print " http://www.creatis.insa-lyon.fr/Public/Gdcm"
unittest.main()
#define PACKAGE "gdcm"
/* Version number of package */
-#define VERSION "0.1.0"
+#define VERSION "0.3.0"
groupHt[key] += 2 + 2 + 4 + elem->GetLength();
}
}
-
- if(1) // unnormalized way to see what happened
- for (GroupHT::iterator g = groupHt.begin();
- g != groupHt.end();
- ++g){
- printf("groupKey %s : %d\n",g->first.c_str(),g->second);
- }
-
unsigned short int gr_bid;
for (GroupHT::iterator g = groupHt.begin(); // for each group we found
#include "gdcmFile.h"
#include "gdcmUtil.h"
-
-
-// TODO : remove DEBUG
-#define DEBUG 0
-
-
#include "iddcmjpeg.h"
using namespace std;
if ( !OpenFile())
return false;
- printf("GetPixelOffset() %d\n",GetPixelOffset() );
-
if ( fseek(fp, GetPixelOffset(), SEEK_SET) == -1 ) {
CloseFile();
return false;
fread(&ln,4,1,fp);
if(GetSwapCode())
ln=SwapLong(ln);
- if (DEBUG)
- printf ("ln %d\n",ln);
fseek(fp,ln,SEEK_CUR);
fseek(fp,4,SEEK_CUR);
fread(&ln,4,1,fp);
if(GetSwapCode())
ln=SwapLong(ln);
- if (DEBUG)
- printf ("ln image comprimée %d\n",ln);
// ------------------------------- JPEG LossLess : call to Jpeg Libido
jmemmgr.c \
jmemnobs.c
-###libgdcmincludedir = $(includedir)
-###libgdcmijpeg8include_HEADERS = \
-### jchuff.h \
-### jconfig.h \
-### jdct.h \
-### jdhuff.h \
-### jerror.h \
-### jinclude.h \
-### jmemsys.h \
-### jmorecfg.h \
-### jpegint.h \
-### jpeglib.h \
-### jversion.h
+libgdcmijpeg8includedir = $(includedir)
+libgdcmijpeg8include_HEADERS = \
+ jchuff.h \
+ jconfig.h \
+ jdct.h \
+ jdhuff.h \
+ jerror.h \
+ jinclude.h \
+ jmemsys.h \
+ jmorecfg.h \
+ jpegint.h \
+ jpeglib.h \
+ jversion.h
+
+EXTRA_DIST = \
+ jconfig.linux \
+ jconfig.vc
vtkgdcmdemo
*.la
*.lo
+vtkGdcmReaderPython.cxx
-// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.16 2003/07/07 10:26:14 regrain Exp $
+// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.17 2003/07/07 17:05:17 frog Exp $
+// //////////////////////////////////////////////////////////////
+// WARNING TODO CLENAME
+// Actual limitations of this code:
+//
+// /////// Redundant and unnecessary header parsing
+// In it's current state this code actually parses three times the Dicom
+// header of a file before the corrersponding image gets loaded in the
+// ad-hoc vtkData !
+// Here is the process:
+// 1/ First loading happens in ExecuteInformation which in order to
+// positionate the vtk extents calls CheckFileCoherence. The purpous
+// of CheckFileCoherence is to make sure all the images in the future
+// stack are "homogenous" (same size, same representation...). This
+// can only be achieved by parsing all the Dicom headers...
+// 2/ ExecuteData is then responsible for the next two loadings:
+// 2a/ ExecuteData calls AllocateOutputData that in turn seems to
+// (indirectely call) ExecuteInformation which ends up in a second
+// header parsing
+// 2b/ the core of ExecuteData then needs gdcmFile (which in turns
+// initialiszes gdcmHeader in the constructor) in order to access
+// the data-image.
+//
+// Possible solution:
+// maintain a list of gdcmFiles (created by say ExecuteInformation) created
+// once and for all accross the life of vtkGdcmHeader (it would only load
+// new gdcmFile if the user changes the list). ExecuteData would then use
+// those gdcmFile and hence avoid calling the consctutor:
+// - advantage: the header of the files would only be parser once.
+// - drawback: once execute information is called (i.e. on creation of
+// a vtkGdcmHeader) the gdcmFile sctructue is loaded in memory.
+// The average size of a gdcmHeader being of 100Ko, is one
+// loads 10 stacks of images with say 200 images each, you
+// end-up with a loss of 200Mo...
+//
+// /////// Never unallocated memory:
+// ExecuteData allocates space for the pixel data [which will get pointed
+// by the vtkPointData() through the call
+// data->GetPointData()->GetScalars()->SetVoidArray(mem, StackNumPixels, 0);]
+// This data is never "freed" neither in the desctutor nor when the
+// filename list is extended, ExecuteData is called a second (or third)
+// time...
+// //////////////////////////////////////////////////////////////
+
#include <stdio.h>
#include <vtkObjectFactory.h>
#include <vtkImageData.h>
//----------------------------------------------------------------------------
vtkGdcmReader::~vtkGdcmReader()
{
- // FIXME free memory
this->RemoveAllFileName();
this->InternalFileNameList.clear();
}
// Configure the output e.g. WholeExtent, spacing, origin, scalar type...
void vtkGdcmReader::ExecuteInformation()
{
- //FIXME free any old memory
this->TotalNumberOfPlanes = this->CheckFileCoherence();
if ( this->TotalNumberOfPlanes == 0)
{
// (see vtkSource.cxx for last step).
// This function (redefinition of vtkImageReader::ExecuteData, see
// VTK/IO/vtkImageReader.cxx) reads a data from a file. The datas
-// extent/axes are assumed to be the
-// same as the file extent/order.
+// extent/axes are assumed to be the same as the file extent/order.
void vtkGdcmReader::ExecuteData(vtkDataObject *output)
{
if (this->InternalFileNameList.empty())
return;
}
- // FIXME : the bad parse of header is made when allocating OuputData
+ // FIXME : extraneous parsing of header is made when allocating OuputData
vtkImageData *data = this->AllocateOutputData(output);
data->SetExtent(this->DataExtent);
data->GetPointData()->GetScalars()->SetName("DicomImage-Volume");