-
+2004-03-24 Jean-Pierre Roux
+ * FIX a lot of little surface modifications to be doxygen 1.3.6 compliant
+
2004-03-23 Jean-Pierre Roux
* FIX Now gdcmFile::SwapZone doesn't seg faults any longer for
big endian made volumes
* \page DoxyInstallation Installing gdcm and gdcmPython
* \section DoxyRequirements Requirements
* - For the core C++ library you shall need a C++ compiler with the
- * <list> and <map> STL containers. Gdcm is developped and tested under:
+ * "list" and "map" STL containers. Gdcm is developped and tested under:
* -# GNU/linux (gcc 2.96.x)
* -# Win32/VC++ 6.x
- * .
+ * .
* - For \ref DoxyPythonComplete you shall need:
* -# <A HREF="http://www.python.org/2.2.2/">Python version 2.2.x</A>
* -# <A HREF="http://www.swig.org">Swig</A> version >= 1.3.17x (in order
* <A HREF="http://www.swig.org/download.html">the sources</A>
* </UL>
* \endhtmlonly
- * .
+ * .
* .
- *
+ *
* \section DoxyInstallLinux Un*x
* \subsection DoxyInstallLinuxCvs Starting from cvs sources.
- * - Retrieve the
- <A HREF="http://www.creatis.insa-lyon.fr/Public/Gdcm/cvs.html">
- sources through cvs</A>,
- * - <TT>cd gdcm</TT>
- * - <TT>./autogen.sh --help</TT> in order to select your preferences
- * - <TT>./autogen.sh</TT> to launch the usual automake/autoconf
+ * - Retrieve the
+ * <A HREF="http://www.creatis.insa-lyon.fr/Public/Gdcm/cvs.html">
+ * sources through cvs</A>,
+ * - <TT>cd gdcm</TT>
+ * - <TT>./autogen.sh --help</TT> in order to select your preferences
+ * - <TT>./autogen.sh</TT> to launch the usual automake/autoconf
* process e.g.
- * -# <TT>./autogen.sh --prefix=/where/ever/you/want</TT>
+ * -# <TT>./autogen.sh --prefix=/where/ever/you/want</TT>
* to configure the script to force installation in a specified
* place.
- * -# <TT>./autogen.sh --enable-python</TT> to generate the
+ * -# <TT>./autogen.sh --enable-python</TT> to generate the
* python wrappers (a.k.a. gdcmPython)
- * -# <TT>./autogen.sh --enable-vtk</TT> to generate the
+ * -# <TT>./autogen.sh --enable-vtk</TT> to generate the
* vtk clases that shallow wrap gdcm,
- * -# <TT>./autogen.sh --enable-doxygen</TT> to generate the
+ * -# <TT>./autogen.sh --enable-doxygen</TT> to generate the
* <A HREF="http://www.doxygen.org/">doxygen</A>
* based documentation
- * .
- * - <TT>make</TT>
- * - <TT>make instal</TT>
- * - As usual, you can optionnally:
- * -# <TT>make clean</TT>
- * -# <TT>make CFLAGS='-g' CXXFLAGS='-DPUB_DICT_PATH=\"/usr/local/share/gdcm/\" -D__STDC_LIMIT_MACROS'</TT>
+ * .
+ * .
+ * - <TT>make</TT>
+ * - <TT>make instal</TT>
+ * - As usual, you can optionnally:
+ * -# <TT>make clean</TT>
+ * -# <TT>make CFLAGS='-g' CXXFLAGS='-DPUB_DICT_PATH=\"/usr/local/share/gdcm/\" -D__STDC_LIMIT_MACROS'</TT>
* if you are in hurry and want to omit "-g -O2" default flags
- * -# <TT>make snapshot</TT>
- * .
- * .
+ * -# <TT>make snapshot</TT>
+ * .
+ *
* \subsection DoxyInstallLinuxSources Starting from the sources (snapshot).
* The process is exactly the same as the one using the cvs sources
* (see above) except that you shall use <TT>./configure</TT> instead
// Constructor / Destructor
-/*
+/**
* \ingroup gdcmDicomDir
- * \brief Constructor : Parses recursively the directory and creates the DicomDir
- * \ or uses an already built DICOMDIR, depending on 'parseDir' value
- * @param Name name of the root directory (parseDir = true)
- * name of the DICOMDIR (parseDir = false)
- * @param parseDir - true if user passed an entry point
+ * \brief Constructor Parses recursively the directory and creates the DicomDir
+ * or uses an already built DICOMDIR, depending on 'parseDir' value
+ * @param FileName name
+ - of the root directory (parseDir = true)
+ * - of the DICOMDIR (parseDir = false)
+ * @param parseDir boolean
+ * - true if user passed an entry point
* and wants to explore recursively the directories
- * - false if user passed an already built DICOMDIR file
+ * - false if user passed an already built DICOMDIR file
* and wants to use it
- * @param exception_on_error whether we want to throw an exception or not
+ * @param exception_on_error whether we want to throw an exception or not
*/
-gdcmDicomDir::gdcmDicomDir(const char *Name, bool parseDir,
+gdcmDicomDir::gdcmDicomDir(const char *FileName, bool parseDir,
bool exception_on_error):
- gdcmParser(Name,exception_on_error,true) // true : enable SeQuences
+ gdcmParser(FileName,exception_on_error,true) // true : enable SeQuences
{
// que l'on ai passe un root directory ou un DICOMDIR
// et quelle que soit la valeur de parseDir,
// if parseDir == false, it should be tagged as an error
dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry list empty");
- if(strlen(Name)==1 && Name[0]=='.') { // user passed '.' as Name
+ if(strlen(FileName)==1 && FileName[0]=='.') { // user passed '.' as Name
// we get current directory name
char*dummy=(char*) malloc(1000);
#ifdef _MSC_VER
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Constructor : creates an empty gdcmDicomDir
* @param exception_on_error whether we want to throw an exception or not
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Canonical destructor
*/
//-----------------------------------------------------------------------------
// Print
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Canonical Printer
*/
//-----------------------------------------------------------------------------
// Public
-/*
+/**
* \ingroup gdcmDicomDir
* \brief This predicate, based on hopefully reasonable heuristics,
* decides whether or not the current header was properly parsed
return(true);
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief fills the whole structure, starting from a root Directory
*/
CreateDicomDir();
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the start method to call when the parsing of the directory starts
* @param method Method to call
* @param arg Argument to pass to the method
+ * @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
void gdcmDicomDir::SetStartMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
startMethodArgDelete=argDelete;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the
startMethodArgDelete=method;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the progress method to call when the parsing of the directory progress
* @param method Method to call
* @param arg Argument to pass to the method
+ * @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
void gdcmDicomDir::SetProgressMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
progressMethodArgDelete=argDelete;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the
progressMethodArgDelete=method;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the end method to call when the parsing of the directory ends
* @param method Method to call
* @param arg Argument to pass to the method
+ * @param argDelete Argument
* \warning In python : the arg parameter isn't considered
*/
-void gdcmDicomDir::SetEndMethod(gdcmMethod *method,void *arg,gdcmMethod *argDelete)
+void gdcmDicomDir::SetEndMethod(gdcmMethod *method, void *arg, gdcmMethod *argDelete)
{
if((endArg)&&(endMethodArgDelete))
endMethodArgDelete(endArg);
endMethodArgDelete=argDelete;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Set the method to delete the argument
* The argument is destroyed when the method is changed or when the class
//-----------------------------------------------------------------------------
// Protected
-/*
+/**
* \ingroup gdcmDicomDir
* \brief create a gdcmHeader-like chained list from a root Directory
* @param path entry point of the tree-like structure
CallEndMethod();
}
-
+/**
+ * \ingroup gdcmDicomDir
+ * \brief modifies the limits of a gdcmObject, created from a DICOMDIR file
+ */
void gdcmDicomDir::CheckBoundaries()
{
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief adds a new Patient to a partially created DICOMDIR
*/
return p;
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief CallStartMethod
*/
if(startMethod)
startMethod(startArg);
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief CallProgressMethod
*/
if(progressMethod)
progressMethod(progressArg);
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief CallEndMethod
*/
//-----------------------------------------------------------------------------
// Private
-/*
+/**
* \ingroup gdcmDicomDir
* \brief create a 'gdcmDicomDir' from a DICOMDIR gdcmHeader
*/
if(begin!=end)
AddObjectToEnd(type,begin,--end2);
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief AddObjectToEnd
* @param type
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end)
{
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief Well ... Not realy to end, there is only one occurence
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddDicomDirMetaToEnd(ListTag::iterator begin,ListTag::iterator end)
{
metaElems = new gdcmDicomDirMeta(begin,end,&tagHT,&listEntries);
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirPatientToEnd
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end)
{
patients.push_back(new gdcmDicomDirPatient(begin,end,&tagHT, &listEntries));
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirStudyToEnd
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddDicomDirStudyToEnd(ListTag::iterator begin,ListTag::iterator end)
{
(*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(begin,end,&tagHT, &listEntries));
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirSerieToEnd
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddDicomDirSerieToEnd(ListTag::iterator begin,ListTag::iterator end)
{
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirImageToEnd
- * @param begin
- * @param end
+ * @param begin iterator on the first HeaderEntry within the chained List
+ * @param end iterator on the last HeaderEntry within the chained List
*/
void gdcmDicomDir::AddDicomDirImageToEnd(ListTag::iterator begin,ListTag::iterator end)
{
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief for each Header of the chained list, add/update the Patient/Study/Serie/Image info
* @param path path of the root directory
}
}
-/*
+/**
* \ingroup gdcmDicomDir
* \brief adds to the HTable and at the end of the Chained List
* the gdcmEntries (Dicom Elements) corresponding to the given type
//wasUpdated = 1; // is private
}
}
-
+/**
+ * \ingroup gdcmDicomDir
+ * \brief compares two dgcmHeaders
+ */
bool gdcmDicomDir::HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2)
{
return(*header1<*header2);
}
-
+/**
+ * \ingroup gdcmDicomDir
+ * \brief Sets the accurate value for the (0x0004,0x1220) element of a DICOMDIR
+ */
void gdcmDicomDir::UpdateDirectoryRecordSequenceLength() {
int offset = 0;
void SetProgressMethodArgDelete(gdcmMethod *);
void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
void SetEndMethodArgDelete(gdcmMethod *);
-
- inline float GetProgress(void) {return(progress);};
- inline void AbortProgress(void){abort=true; };
- inline bool IsAborted(void) {return(abort); };
+/**
+ * \ingroup gdcmDicomDir
+ * \brief GetProgress.
+ */
+ inline float GetProgress(void)
+ {return(progress);};
+/**
+ * \ingroup gdcmDicomDir
+ * \brief AbortProgress.
+ */ inline void AbortProgress(void)
+ {abort=true; };
+/**
+ * \ingroup gdcmDicomDir
+ * \brief IsAborted.
+ */ inline bool IsAborted(void)
+ {return(abort); };
// Adding
gdcmDicomDirPatient * NewPatient(void);
*/
ListDicomDirPatient patients;
+/// pointer to the initialisation method for any progress bar
gdcmMethod *startMethod;
- gdcmMethod *progressMethod;
+/// pointer to the incrementation method for any progress bar
+ gdcmMethod *progressMethod;
+/// pointer to the tremination method for any progress bar
gdcmMethod *endMethod;
+/// pointer to the ??? method for any progress bar
gdcmMethod *startMethodArgDelete;
+/// pointer to the ??? method for any progress bar
gdcmMethod *progressMethodArgDelete;
+/// pointer to the ??? method for any progress bar
gdcmMethod *endMethodArgDelete;
+/// pointer to the ??? for any progress bar
void *startArg;
+/// pointer to the ??? for any progress bar
void *progressArg;
+/// pointer to the ??? for any progress bar
void *endArg;
-
+/// value of the ??? for any progress bar
float progress;
+/// value of the ??? for any progress bar
bool abort;
};
//-----------------------------------------------------------------------------
// Public
-/*
+/**
* \ingroup gdcmDicomDir
* \brief adds a new Patient at the begining of the PatientList
* of a partially created DICOMDIR
//-----------------------------------------------------------------------------
// Public
-/*
+/**
* \ingroup gdcmDicomSerie
* \brief adds a new Image to a partially created DICOMDIR
*/
//-----------------------------------------------------------------------------
// Public
-/*
+/**
* \ingroup gdcmDicomStudy
* \brief adds a new Serie at the begining of the SerieList
* of a partially created DICOMDIR
guint16 group; // e.g. 0x0010
/// DicomElement number
guint16 element; // e.g. 0x0103
- /// Value Representation i.e. some clue about the nature
- /// of the data represented e.g. "FD" short for
- /// "Floating Point Double"
+ /**
+ * \ingroup gdcmDictEntry
+ * \brief Value Representation i.e. some clue about the nature
+ * of the data represented
+ * e.g. "FD" short for "Floating Point Double"
+ */
std::string vr;
// CLEANME: find the official dicom name for this field !
-
- ///Fourth field containing some semantics.
- ///(Group Name abbr.)
- /// DON'T USER ANY LONGER !
+ /**
+ * \ingroup gdcmDictEntry
+ * \brief Fourth field containing some semantics
+ * (Group Name abbr.)
+ * DON'T USER ANY LONGER !
+ */
std::string fourth;
- /// e.g. "Patient_Name"
+ /// e.g. "Patient's Name"
std::string name;
/// Redundant with (group, element) but we add it
/// on efficiency purposes.
- TagKey key;
+ /**
+ * \ingroup gdcmDictEntry
+ * \brief Redundant with (group, element) but we add it
+ * on efficiency purposes.
+ */ TagKey key;
// DCMTK has many fields for handling a DictEntry (see below). What are the
// relevant ones for gdcmlib ?
/**
* \ingroup gdcmDictSet
- * \brief - Consider all the entries of the public dicom dictionnary.
- * Build an hashtable whose keys are the names of the groups
+ * \brief
+ * - Consider all the entries of the public dicom dictionnary.
+ * - Build an hashtable whose keys are the names of the groups
* (fourth field in each line of dictionary) and whose corresponding
* values are lists of all the dictionnary entries among that
* group. Note that apparently the Dicom standard doesn't explicitely
#include <unistd.h>
#endif
-// ================= WARNING
-// ================= DOXYGEN DOESN'T WORK FOR THIS FILE ?!?
-// =================
-
// Constructor / Destructor
-/*
+/**
* \ingroup gdcmDirList
* \brief Constructor
* @param dirName root directory name
Explore(name,recursive);
}
-/*
+/**
* \ingroup gdcmDirList
* \brief Destructor
*/
//-----------------------------------------------------------------------------
// Public
-/*
+/**
* \ingroup gdcmDirList
* \brief Get the directory name
* @return the directory name
//-----------------------------------------------------------------------------
// Private
-/*
+/**
* \ingroup gdcmDirList
* \brief Explore a directory with possibility of recursion
* @param dirName directory to explore
std::string GetDirName(void);
+/// \
static const char SEPARATOR_X;
- static const char SEPARATOR_WIN;
+/// /
+static const char SEPARATOR_WIN;
+/// depending on the O.S.
static const std::string SEPARATOR;
private :
void Explore(std::string dirName,bool recursive=false);
-
+/// name of the root directory to explore
std::string name;
};
//-----------------------------------------------------------------------------
// gdcmException
-/*
+/**
* \ingroup gdcmException
* \brief constructor
* @param f
#endif
-/*
+/**
* \ingroup gdcmException
* \brief fatal
* @param from
}
}
-/*
+/**
* \ingroup gdcmException
* \brief getName
* @return string
}
}
-/*
+/**
* \ingroup gdcmException
* \brief gdcmException::operator
- * @param
*/
gdcmException::operator const char *() const throw() {
return getName().c_str();
}
//-----------------------------------------------------------------------------
-/*
+/**
* \ingroup gdcmException
* \brief gdcmException::operator <<
- * @param
*/
std::ostream& operator<<(std::ostream &os, const gdcmException &e) {
try {
explicit gdcmException(const std::string &from, const std::string &error = "")
throw();
- /*
- * virtual destructor makes this class dynamic
+ /**
+ * \brief virtual destructor makes this class dynamic
*/
virtual ~gdcmException() throw() {
}
- // exception caught within exception class: print error message and die
+ /// exception caught within exception class: print error message and die
static void fatal(const char *from) throw();
- // returns error message
+ /// returns error message
const std::string &getError(void) const throw() {
return error;
}
- // try to discover this (dynamic) class name
+ /// try to discover this (dynamic) class name
virtual std::string getName() const throw();
- // returns exception name string (overloads std::exception::what)
+ /// returns exception name string (overloads std::exception::what)
virtual const char *what() const throw() {
return (const char *) *this;
}
- // returns exception name string
+ /// returns exception name string
operator const char *() const throw();
friend std::ostream& operator<<(std::ostream &os, const gdcmException &e);
protected:
- // error message
+ /// error message part 1
std::string from;
- // error message
+ /// error message part 2
std::string error;
};
*/
class GDCM_EXPORT gdcmFileError : public gdcmException {
public:
- /*
- * Builds an file-related exception with minimal information: name of
- * the thrower method and error message
- *
+ /**
+ * \brief Builds an file-related exception with minimal information: name of
+ * the thrower method and error message
* @param from name of the thrower
* @param error error description string
*/
/**
* \ingroup gdcmFile
* \brief canonical destructor
- * \Note If the gdcmHeader is created by the gdcmFile, it is destroyed
+ * \note If the gdcmHeader is created by the gdcmFile, it is destroyed
* by the gdcmFile
*/
gdcmFile::~gdcmFile(void) {
/**
* \ingroup gdcmHeader
* \brief Constructor
- * @param InFilename
- * @param exception_on_error
+ * @param InFilename name of the file whose header we want to analyze
+ * @param exception_on_error whether we want to throw an exception or not
* @param enable_sequences = true to allow the header
* to be parsed *inside* the SeQuences,
* when they have an actual length
/**
* \ingroup gdcmHeader
* \brief Constructor
- * @param exception_on_error
+ * @param exception_on_error whether we want to throw an exception or not
*/
gdcmHeader::gdcmHeader(bool exception_on_error) :
gdcmParser(exception_on_error)
* \ingroup gdcmHeader
* \brief anonymize a Header (removes Patient's personal info)
* (read the code to see which ones ...)
- * @param
*/
bool gdcmHeader::anonymizeHeader() {
/**
* \ingroup gdcmHeaderHelper
* \brief This function is intended to user that DOESN'T want
- * \to get RGB pixels image when it's stored as a PALETTE COLOR image
- * \ - the (vtk) user is supposed to know how deal with LUTs -
+ * to get RGB pixels image when it's stored as a PALETTE COLOR image
+ * - the (vtk) user is supposed to know how deal with LUTs -
* \warning to be used with GetImagePixelsRaw()
* @return 1 if Gray level, 3 if Color (RGB or YBR - NOT 'PALETTE COLOR' -)
*/
bool gdcmSerieHeaderHelper::ImageNumberOrdering() {
int min, max, pos;
- int n = 0;//CoherentGdcmFileList.size(); //O(N) operation !!
+ int n = 0;//CoherentGdcmFileList.size() is a O(N) operation !!
unsigned char *partition;
std::list<gdcmHeaderHelper*>::iterator it = CoherentGdcmFileList.begin();
* @return 1 on success, 0 on error
*/
-//GLOBAL(bool)
bool gdcmFile::gdcm_read_JPEG_file (FILE *fp,void * image_buffer) {
char *pimage;
/* This struct contains the JPEG decompression parameters and pointers to
- * working space (which is allocated as needed by the JPEG library).
- */
+ * working space (which is allocated as needed by the JPEG library).
+ */
struct jpeg_decompress_struct cinfo;
/* -------------- inside, we found :
- JDIMENSION image_width; // input image width
- JDIMENSION image_height; // input image height
- int input_components; // nb of color components in input image
- J_COLOR_SPACE in_color_space; // colorspace of input image
- double input_gamma; // image gamma of input image
- -------------- */
+ * JDIMENSION image_width; // input image width
+ * JDIMENSION image_height; // input image height
+ * int input_components; // nb of color components in input image
+ * J_COLOR_SPACE in_color_space; // colorspace of input image
+ * double input_gamma; // image gamma of input image
+ * -------------- */
/* We use our private extension JPEG error handler.
- * Note that this struct must live as long as the main JPEG parameter
- * struct, to avoid dangling-pointer problems.
- */
+ * Note that this struct must live as long as the main JPEG parameter
+ * struct, to avoid dangling-pointer problems.
+ */
struct my_error_mgr jerr;
/* More stuff */
// typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */
// typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
// typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
+
int row_stride; /* physical row width in output buffer */
- if (DEBUG) printf("entree dans gdcmFile::gdcm_read_JPEG_file, depuis gdcmJpeg\n");
-
+ if (DEBUG) printf("entree dans gdcmFile::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
- /* In this example we want to open the input file before doing anything else,
- * so that the setjmp() error recovery below can assume the file is open.
- * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
- * requires it in order to read binary files.
- */
-
- /* Step 1: allocate and initialize JPEG decompression object */
-
+ /* In this example we want to open the input file before doing anything else,
+ * so that the setjmp() error recovery below can assume the file is open.
+ * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
+ * requires it in order to read binary files.
+ */
+
+ /* Step 1: allocate and initialize JPEG decompression object */
if (DEBUG)printf("Entree Step 1\n");
-
+
/* We set up the normal JPEG error routines, then override error_exit. */
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
- /* Establish the setjmp return context for my_error_exit to use. */
-
+ /* Establish the setjmp return context for my_error_exit to use. */
if (setjmp(jerr.setjmp_buffer)) {
/* If we get here, the JPEG code has signaled an error.
* We need to clean up the JPEG object, close the input file, and return.
}
-/*
- JDIMENSION image_width; // input image width
- JDIMENSION image_height; // input image height
- int output_components; // # of color components returned
- J_COLOR_SPACE in_color_space; // colorspace of input image
- double input_gamma; // image gamma of input image
- int data_precision; // bits of precision in image data
-
-*/
+ /*
+ * JDIMENSION image_width; // input image width
+ * JDIMENSION image_height; // input image height
+ * int output_components; // # of color components returned
+ * J_COLOR_SPACE in_color_space; // colorspace of input image
+ * double input_gamma; // image gamma of input image
+ * int data_precision; // bits of precision in image data
+ */
/* Step 4: set parameters for decompression */
if (DEBUG) printf("Entree Step 4\n");
/* Step 5: Start decompressor */
if (DEBUG) printf("Entree Step 5\n");
- (void) jpeg_start_decompress(&cinfo);
- /* We can ignore the return value since suspension is not possible
- * with the stdio data source.
- */
-
- /* We may need to do some setup of our own at this point before reading
- * the data. After jpeg_start_decompress() we have the correct scaled
- * output image dimensions available, as well as the output colormap
- * if we asked for color quantization.
- * In this example, we need to make an output work buffer of the right size.
- */
-
- /* JSAMPLEs per row in output buffer */
- row_stride = cinfo.output_width * cinfo.output_components;
+ (void) jpeg_start_decompress(&cinfo);
+ /* We can ignore the return value since suspension is not possible
+ * with the stdio data source.
+ */
+
+ /* We may need to do some setup of our own at this point before reading
+ * the data. After jpeg_start_decompress() we have the correct scaled
+ * output image dimensions available, as well as the output colormap
+ * if we asked for color quantization.
+ * In this example, we need to make an output work buffer of the right size.
+ */
+
+ /* JSAMPLEs per row in output buffer */
+ row_stride = cinfo.output_width * cinfo.output_components;
if (DEBUG) printf ("cinfo.output_width %d cinfo.output_components %d row_stride %d\n",
- cinfo.output_width, cinfo.output_components,row_stride);
+ cinfo.output_width, cinfo.output_components,row_stride);
/* Make a one-row-high sample array that will go away when done with image */
buffer = (*cinfo.mem->alloc_sarray)
pimage=(char *)image_buffer;
while (cinfo.output_scanline < cinfo.output_height) {
- /* jpeg_read_scanlines expects an array of pointers to scanlines.
- * Here the array is only one element long, but you could ask for
- * more than one scanline at a time if that's more convenient.
- */
+ /* jpeg_read_scanlines expects an array of pointers to scanlines.
+ * Here the array is only one element long, but you could ask for
+ * more than one scanline at a time if that's more convenient.
+ */
// l'image est deja allouée (et passée en param)
// on ecrit directement les pixels
/* Step 7: Finish decompression */
if (DEBUG) printf("Entree Step 7\n");
-
(void) jpeg_finish_decompress(&cinfo);
+
/* We can ignore the return value since suspension is not possible
* with the stdio data source.
*/
/* And we're done! */
- return 1;
+ return(true);
}
/*
#define BITS_IN_JSAMPLE 12
+#define DEBUG 0
+
// BITS_IN_JSAMPLE is a compile time defined options.
// We need both 8 an 12;
// To avoid renaming *all* the Jpeg functions,
#define jpeg_destroy jDestroy
#define jpeg_resync_to_restart jResyncRestart
-#define DEBUG 0
-
/*
* <setjmp.h> is used for the optional error recovery mechanism shown in
* the second part of the example.
//-----------------------------------------------------------------------------
struct my_error_mgr {
- struct jpeg_error_mgr pub; /* "public" fields */
- jmp_buf setjmp_buffer; /* for return to caller */
+ struct jpeg_error_mgr pub; /* "public" fields */
+ jmp_buf setjmp_buffer; /* for return to caller */
};
+//-----------------------------------------------------------------------------
typedef struct my_error_mgr * my_error_ptr;
-//-----------------------------------------------------------------------------
/*
* Here's the routine that will replace the standard error_exit method:
*/
-METHODDEF(void)
-my_error_exit (j_common_ptr cinfo) {
- /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
- my_error_ptr myerr = (my_error_ptr) cinfo->err;
+METHODDEF(void) my_error_exit (j_common_ptr cinfo) {
+ /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
+ my_error_ptr myerr = (my_error_ptr) cinfo->err;
- /* Always display the message. */
- /* We could postpone this until after returning, if we chose. */
- (*cinfo->err->output_message) (cinfo);
+ /* Always display the message. */
+ /* We could postpone this until after returning, if we chose. */
+ (*cinfo->err->output_message) (cinfo);
- /* Return control to the setjmp point */
- longjmp(myerr->setjmp_buffer, 1);
+ /* Return control to the setjmp point */
+ longjmp(myerr->setjmp_buffer, 1);
}
/* This struct contains the JPEG decompression parameters and pointers to
* working space (which is allocated as needed by the JPEG library).
*/
-
struct jpeg_decompress_struct cinfo;
/* -------------- inside, we found :
// typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */
// typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
-
int row_stride; /* physical row width in output buffer */
if (DEBUG) printf("entree dans gdcmFile::gdcm_read_JPEG_file12, depuis gdcmJpeg\n");
-
/* In this example we want to open the input file before doing anything else,
* so that the setjmp() error recovery below can assume the file is open.
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
if (DEBUG) {
printf("--------------Header contents :----------------\n");
printf("image_width %d image_height %d\n",
- cinfo.image_width , cinfo.image_height);
+ cinfo.image_width , cinfo.image_height);
printf("bits of precision in image data %d \n",
- cinfo.output_components);
+ cinfo.output_components);
printf("nb of color components returned %d \n",
- cinfo.data_precision);
+ cinfo.data_precision);
}
/* Make a one-row-high sample array that will go away when done with image */
buffer = (*cinfo.mem->alloc_sarray)
- ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+ ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
/* Step 6: while (scan lines remain to be read) */
if (DEBUG) printf("Entree Step 6\n");
*/
if (DEBUG) printf ("cinfo.output_height %d cinfo.output_width %d\n",
- cinfo.output_height,cinfo.output_width);
+ cinfo.output_height,cinfo.output_width);
pimage=(char *)image_buffer;
/* Step 7: Finish decompression */
if (DEBUG) printf("Entree Step 7\n");
- (void) jpeg_finish_decompress(&cinfo);
+ (void) jpeg_finish_decompress(&cinfo);
/* We can ignore the return value since suspension is not possible
* with the stdio data source.
*/
//-----------------------------------------------------------------------------
// Protected
-/*
+/**
* \ingroup gdcmObject
* \brief add the 'Object' related Dicom Elements to the listEntries
* of a partially created DICOMDIR
~gdcmObject(void);
-void FillObject(std::list<gdcmElement> elemList);
+ void FillObject(std::list<gdcmElement> elemList);
/**
* \brief iterator on the first Header Entry (i.e Dicom Element),
*/
ListTag *plistEntries;
/**
-* \brief
+* \brief detail level to be printed
*/
int printLevel;
/// used to pass variables to FillObject function
-/// Work as 'global' variables
- std::list<gdcmHeaderEntry *>::iterator debInsertion, finInsertion, i,j;
+/// Works as 'global' variable
+/**
+* \brief used to pass variables to FillObject function
+* Works as 'global' variable
+*/ std::list<gdcmHeaderEntry *>::iterator debInsertion, finInsertion, i,j;
private:
SetEntryLengthByNumber(20, 0x0002, 0x0010);
}
-/* TODO : rewrite later
+/* TODO : rewrite later, if really usefull
if ( (type == ImplicitVR) || (type == ExplicitVR) )
UpdateGroupLength(false,type);
return 0;
TotalLength += 4; // We even have to decount the group and element
- if ( g != 0xfffe && g!=0xb00c ) /*for bogus header */
+ if ( g != 0xfffe && g!=0xb00c ) //for bogus header
{
char msg[100]; // for sprintf. Sorry
sprintf(msg,"wrong group (%04x) for an item sequence (%04x,%04x)\n",g, g,n);
errno = 1;
return 0;
}
- if ( n == 0xe0dd || ( g==0xb00c && n==0x0eb6 ) ) /* for bogus header */
+ if ( n == 0xe0dd || ( g==0xb00c && n==0x0eb6 ) ) // for bogus header
FoundSequenceDelimiter = true;
else if ( n != 0xe000 )
{
// header parsing has to be considered as finished.
return (gdcmHeaderEntry *)0;
-/* Pb : how to propagate the element length (used in SkipHeaderEntry)
+// Pb : how to propagate the element length (used in SkipHeaderEntry)
// direct call to SkipBytes ?
- if (ignoreShadow == 1 && g%2 ==1)
+// if (ignoreShadow == 1 && g%2 ==1)
// if user wants to skip shadow groups
// and current element *is* a shadow element
// we don't create anything
- return (gdcmHeaderEntry *)1; // to tell caller it's NOT finished
-*/
+// return (gdcmHeaderEntry *)1; // to tell caller it's NOT finished
+
NewEntry = NewHeaderEntryByNumber(g, n);
FindHeaderEntryVR(NewEntry);
FindHeaderEntryLength(NewEntry);
//-----------------------------------------------------------------------------
#include <stdio.h>
#include "gdcmFile.h"
-#include <ctype.h> /* to declare isprint() */
+#include <ctype.h> // to declare isprint()
#define str2num(str, typeNum) *((typeNum *)(str))
///////////////////////////////////////////////////////////////////////////
-/*
+/**
* \brief to prevent a flashing screen when non-printable character
- * @param
+ * @param v characters array to remove non printable characters from
*/
char *_cleanString(char *v) {
char *d;
}
///////////////////////////////////////////////////////////////////////////
-/*
+/**
* \brief to prevent a flashing screen when non-printable character
- * @param
+ * @param s string to remove non printable characters from
*/
std::string _CreateCleanString(std::string s) {
std::string str=s;
}
///////////////////////////////////////////////////////////////////////////
-/*
+/**
* \brief Add a SEPARATOR to the end of the name is necessary
- * @param
+ * @param name file/directory name to normalize
*/
void NormalizePath(std::string &name)
{
}
///////////////////////////////////////////////////////////////////////////
-/*
+/**
* \brief Get the (directory) path from a full path file name
- * @param
+ * @param fullName file/directory name to extract Path from
*/
std::string GetPath(std::string &fullName)
{
}
///////////////////////////////////////////////////////////////////////////
-/*
+/**
* \brief Get the (last) name of a full path file name
- * @param
+ * @param fullName file/directory name to extract end name from
*/
std::string GetName(std::string &fullName)
{
size_t size;
// If the data structure of vtk for image/volume representation
- // were straigthforwards the following would suffice:
+ // were straigthforwards the following would be enough:
// GdcmFile.GetImageDataIntoVector((void*)Dest, size);
// But vtk chooses to invert the lines of an image, that is the last
// line comes first (for some axis related reasons?). Hence we need