Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2004/06/20 18:08:47 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief constructor : populates the chained lists
* from the file 'Dicts/DicomDir.dic'
*/
- gdcmDicomDirElement::gdcmDicomDirElement(void) {
+gdcmDicomDirElement::gdcmDicomDirElement() {
std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_ELEM);
std::ifstream from(filename.c_str());
dbg.Error(!from, "gdcmDicomDirElement::gdcmDicomDirElement: can't open dictionary",filename.c_str());
* \ingroup gdcmDicomDirElement
* \brief canonical destructor
*/
- gdcmDicomDirElement::~gdcmDicomDirElement() {
+gdcmDicomDirElement::~gdcmDicomDirElement() {
DicomDirMetaList.clear();
DicomDirPatientList.clear();
DicomDirStudyList.clear();
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 14:14:01 $
- Version: $Revision: 1.106 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.107 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \note If the gdcmHeader is created by the gdcmFile, it is destroyed
* by the gdcmFile
*/
-gdcmFile::~gdcmFile(void) {
+gdcmFile::~gdcmFile() {
if(SelfHeader)
delete Header;
Header=NULL;
* (no interest for compressed images).
* @return length to allocate
*/
-void gdcmFile::SetPixelDataSizeFromHeader(void) {
+void gdcmFile::SetPixelDataSizeFromHeader() {
// see PS 3.3-2003 : C.7.6.3.2.1
//
// MONOCHROME1
* the pixel data represented in this file.
* @return The size of pixel data in bytes.
*/
-size_t gdcmFile::GetImageDataSize(void) {
- return (lgrTotale);
+size_t gdcmFile::GetImageDataSize() {
+ return lgrTotale;
}
/**
* \warning to be used with GetImagePixelsRaw()
* @return The size of pixel data in bytes.
*/
-size_t gdcmFile::GetImageDataSizeRaw(void) {
- return (lgrTotaleRaw);
+size_t gdcmFile::GetImageDataSizeRaw() {
+ return lgrTotaleRaw;
}
/**
* @return Pointer to newly allocated pixel data.
* NULL if alloc fails
*/
-void * gdcmFile::GetImageData (void) {
- PixelData = new char[lgrTotale];
+void * gdcmFile::GetImageData () {
+ PixelData = new unsigned char[lgrTotale]; //consistant with GetImageDataIntoVector
if (PixelData) {
GetImageDataIntoVector(PixelData, lgrTotale);
GetHeader()->SetEntryVoidAreaByNumber(PixelData,
}
PixelRead=0; // no PixelRaw
- return(PixelData);
+ return PixelData;
}
/**
* @return Pointer to newly allocated pixel data.
* \ NULL if alloc fails
*/
-void * gdcmFile::GetImageDataRaw (void) {
+void * gdcmFile::GetImageDataRaw () {
if (Header->HasLUT())
/// \todo Let gdcmHeadar user a chance to get the right value
/// Create a member lgrTotaleRaw ???
lgrTotale /= 3;
- PixelData = new char[lgrTotale];
+ PixelData = new unsigned char[lgrTotale];
if (PixelData) {
GetImageDataIntoVectorRaw(PixelData, lgrTotale);
GetHeader()->GetNumPixel());
}
PixelRead=1; // PixelRaw
- return(PixelData);
+
+ return PixelData;
}
/**
return (size_t)0;
}
- (void)ReadPixelData(destination);
+ ReadPixelData(destination);
// Number of Bits Allocated for storing a Pixel
str_nb = Header->GetEntryByNumber(0x0028,0x0100);
deb ++;
}
} else {
- dbg.Verbose(0, "gdcmFile::GetImageDataIntoVector: wierd image");
- return (size_t)0;
+ dbg.Verbose(0, "gdcmFile::GetImageDataIntoVector: weird image");
+ return 0;
}
}
// DO NOT remove this commented out code .
PixelData = inData;
lgrTotale = ExpectedSize;
PixelRead = 1;
- return(true);
+
+ return true;
}
/**
* @return false if write fails
*/
-bool gdcmFile::WriteRawData (std::string fileName) {
+bool gdcmFile::WriteRawData (std::string const & fileName) {
FILE *fp1;
fp1 = fopen(fileName.c_str(),"wb");
if (fp1 == NULL) {
printf("Fail to open (write) file [%s] \n",fileName.c_str());
- return (false);
+ return false;
}
fwrite (PixelData,lgrTotale, 1, fp1);
fclose (fp1);
- return(true);
+
+ return true;
}
/**
* @return false if write fails
*/
-bool gdcmFile::WriteDcmImplVR (std::string fileName) {
+bool gdcmFile::WriteDcmImplVR (std::string const & fileName) {
return WriteBase(fileName, gdcmImplicitVR);
}
-/**
- * \ingroup gdcmFile
- * \brief Writes on disk A SINGLE Dicom file,
- * using the Implicit Value Representation convention
- * NO test is performed on processor "Endiannity". * @param fileName name of the file to be created
- * (any already existing file is overwritten)
- * @return false if write fails
- */
-
-bool gdcmFile::WriteDcmImplVR (const char *fileName) {
- return WriteDcmImplVR (std::string (fileName));
-}
-
/**
* \ingroup gdcmFile
* \brief Writes on disk A SINGLE Dicom file,
* @return false if write fails
*/
-bool gdcmFile::WriteDcmExplVR (std::string fileName) {
+bool gdcmFile::WriteDcmExplVR (std::string const & fileName) {
return WriteBase(fileName, gdcmExplicitVR);
}
* @return false if write fails
*/
-bool gdcmFile::WriteAcr (std::string fileName) {
+bool gdcmFile::WriteAcr (std::string const & fileName) {
return WriteBase(fileName, gdcmACR);
}
* @param type file type (ExplicitVR, ImplicitVR, ...)
* @return false if write fails
*/
-bool gdcmFile::WriteBase (std::string fileName, FileType type) {
+bool gdcmFile::WriteBase (std::string const & fileName, FileType type) {
FILE *fp1;
// fwrite(PixelData, lgrTotale, 1, fp1); // should be useless, now
fclose (fp1);
- return(true);
+
+ return true;
}
//-----------------------------------------------------------------------------
* @param nb Pixels Bit number
*/
void gdcmFile::SwapZone(void *im, int swap, int lgr, int nb) {
-guint32 s32;
-guint16 fort,faible;
-int i;
+ guint32 s32;
+ guint16 fort,faible;
+ int i;
-if(nb == 16)
- switch(swap) {
+ if(nb == 16)
+ switch(swap) {
case 0:
case 12:
case 1234:
printf("SWAP value (16 bits) not allowed : %d\n", swap);
}
-if( nb == 32 )
- switch (swap) {
+ if( nb == 32 )
+ switch (swap) {
case 0:
case 1234:
break;
break;
default:
- printf("SWAP value (32 bits) not allowed : %d\n", swap);
+ std::cout << "SWAP value (32 bits) not allowed : " << swap << std::endl;
}
-return;
}
/**
}
Header->CloseFile();
- return(true);
+ return true;
}
// ---------------------- Uncompressed File
Program: gdcm
Module: $RCSfile: gdcmFile.h,v $
Language: C++
- Date: $Date: 2004/06/23 02:13:14 $
- Version: $Revision: 1.33 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.34 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
public:
gdcmFile(gdcmHeader *header);
gdcmFile(std::string const & filename,
- bool exception_on_error = false,
- bool enable_sequences = false,
- bool skip_shadow = false);
+ bool exception_on_error = false,
+ bool enable_sequences = false,
+ bool skip_shadow = false);
- virtual ~gdcmFile(void);
+ virtual ~gdcmFile();
/// \brief returns the gdcmHeader *Header
- inline gdcmHeader *GetHeader(void) {return(Header);};
+ inline gdcmHeader *GetHeader() { return Header;};
// For promotion (performs a deepcopy of pointed header object)
// TODO Swig gdcmFile(gdcmHeader* header);
// different from the constructor's one (no overwriting allowed).
// TODO Swig int SetFileName(std::string filename);
- void SetPixelDataSizeFromHeader(void);
+ void SetPixelDataSizeFromHeader();
size_t GetImageDataSize();
size_t GetImageDataSizeRaw();
// Write pixels of ONE image on hard drive
// No test is made on processor "endianity"
// The user must call his reader correctly
- bool WriteRawData (std::string fileName);
- bool WriteDcmImplVR(std::string fileName);
- bool WriteDcmImplVR(const char * fileName);
- bool WriteDcmExplVR(std::string fileName);
- bool WriteAcr (std::string fileName);
+ bool WriteRawData (std::string const & fileName);
+ bool WriteDcmImplVR(std::string const & fileName);
+ bool WriteDcmExplVR(std::string const & fileName);
+ bool WriteAcr (std::string const & fileName);
// Body in file gdcmParse.cxx
- bool ParsePixelData(void);
+ bool ParsePixelData();
- inline virtual bool SetEntryByNumber(std::string content,
+ inline virtual bool SetEntryByNumber(std::string const & content,
guint16 group, guint16 element)
{ GetHeader()->SetEntryByNumber(content,group,element);
return true; //default behavior ?
protected:
- bool WriteBase(std::string FileName, FileType type);
+ bool WriteBase(std::string const & FileName, FileType type);
private:
void SwapZone(void* im, int swap, int lgr, int nb);
/// ==-1 if ImageData never read
int PixelRead;
- /// weather already parsed
+ /// wether already parsed
int Parsed;
/// To avoid file overwrite
Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 14:18:49 $
- Version: $Revision: 1.167 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.168 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \ingroup gdcmHeader
* \brief Canonical destructor.
*/
-gdcmHeader::~gdcmHeader (void) {
+gdcmHeader::~gdcmHeader () {
}
//-----------------------------------------------------------------------------
* @return true when gdcmHeader is the one of a reasonable Dicom/Acr file,
* false otherwise.
*/
-bool gdcmHeader::IsReadable(void) {
+bool gdcmHeader::IsReadable() {
if(!gdcmDocument::IsReadable()) {
return false;
}
* @return The encountered size when found, 0 by default.
* 0 means the file is NOT USABLE. The caller will have to check
*/
-int gdcmHeader::GetXSize(void) {
+int gdcmHeader::GetXSize() {
std::string StrSize;
StrSize = GetEntryByNumber(0x0028,0x0011);
if (StrSize == GDCM_UNFOUND)
* @return The encountered size when found, 1 by default
* (The ACR-MEMA file contains a Signal, not an Image).
*/
-int gdcmHeader::GetYSize(void) {
+int gdcmHeader::GetYSize() {
std::string StrSize = GetEntryByNumber(0x0028,0x0010);
if (StrSize != GDCM_UNFOUND)
return atoi(StrSize.c_str());
* being the ACR-NEMA "Planes" tag content.
* @return The encountered size when found, 1 by default (single image).
*/
-int gdcmHeader::GetZSize(void) {
+int gdcmHeader::GetZSize() {
// Both DicomV3 and ACR/Nema consider the "Number of Frames"
// as the third dimension.
std::string StrSize = GetEntryByNumber(0x0028,0x0008);
* \brief gets the info from 0008,0060 : Modality
* @return Modality Type
*/
-ModalityType gdcmHeader::GetModality(void) {
+ModalityType gdcmHeader::GetModality() {
// 0008 0060 CS ID Modality
std::string StrModality = GetEntryByNumber(0x0008,0x0060);
if (StrModality != GDCM_UNFOUND) {
* @return The encountered number of Bits Allocated, 0 by default.
* 0 means the file is NOT USABLE. The caller has to check it !
*/
-int gdcmHeader::GetBitsAllocated(void) {
+int gdcmHeader::GetBitsAllocated() {
std::string StrSize = GetEntryByNumber(0x0028,0x0100);
if (StrSize == GDCM_UNFOUND)
return 0; // It's supposed to be mandatory
* @return The encountered number of Samples Per Pixel, 1 by default.
* (Gray level Pixels)
*/
-int gdcmHeader::GetSamplesPerPixel(void) {
+int gdcmHeader::GetSamplesPerPixel() {
std::string StrSize = GetEntryByNumber(0x0028,0x0002);
if (StrSize == GDCM_UNFOUND)
return 1; // Well, it's supposed to be mandatory ...
* (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane)
* @return The encountered Planar Configuration, 0 by default.
*/
-int gdcmHeader::GetPlanarConfiguration(void) {
+int gdcmHeader::GetPlanarConfiguration() {
std::string StrSize = GetEntryByNumber(0x0028,0x0006);
if (StrSize == GDCM_UNFOUND)
return 0;
* of *image* pixels (not *icone image* pixels, if any !)
* @return Pixel Offset
*/
-size_t gdcmHeader::GetPixelOffset(void) {
+size_t gdcmHeader::GetPixelOffset() {
gdcmDocEntry* PixelElement = GetDocEntryByNumber(GrPixel,NumPixel);
* -in case of embeded compressed image-)
* 0 : NOT USABLE file. The caller has to check.
*/
-size_t gdcmHeader::GetPixelAreaLength(void) {
+size_t gdcmHeader::GetPixelAreaLength() {
gdcmDocEntry* PixelElement = GetDocEntryByNumber(GrPixel,NumPixel);
* when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
* @ return bit number of each LUT item
*/
-int gdcmHeader::GetLUTNbits(void) {
+int gdcmHeader::GetLUTNbits() {
std::vector<std::string> tokens;
//int LutLength;
//int LutDepth;
* no known Dicom reader deals with them :-(
* @return a RGBA Lookup Table
*/
-unsigned char * gdcmHeader::GetLUTRGBA(void) {
+unsigned char * gdcmHeader::GetLUTRGBA() {
// Not so easy : see
// http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
* else 1.
* @return The full Transfert Syntax Name (as opposed to Transfert Syntax UID)
*/
-std::string gdcmHeader::GetTransfertSyntaxName(void) {
+std::string gdcmHeader::GetTransfertSyntaxName() {
// use the gdcmTS (TS : Transfert Syntax)
std::string TransfertSyntax = GetEntryByNumber(0x0002,0x0010);
if (TransfertSyntax == GDCM_UNFOUND) {
Program: gdcm
Module: $RCSfile: gdcmHeader.h,v $
Language: C++
- Date: $Date: 2004/06/21 08:47:14 $
- Version: $Revision: 1.76 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.77 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
guint16 GrPixel;
public:
- explicit gdcmHeader(bool exception_on_error = false);
+ gdcmHeader(bool exception_on_error = false);
gdcmHeader(std::string const & filename,
bool exception_on_error = false,
bool enable_sequences = false,
Program: gdcm
Module: $RCSfile: gdcmRLE.cxx,v $
Language: C++
- Date: $Date: 2004/06/20 18:08:48 $
- Version: $Revision: 1.18 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.19 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
delete[] newDest;
}
- return(true);
+ return true;
}
Program: gdcm
Module: $RCSfile: gdcmSeqEntry.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 14:57:11 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
cc != items.end();
count ++, ++cc){
if (count==nb)
- return (*cc);
+ return *cc;
}
return (*(items.end())); // Euhhhhh ?!? Is this the last one . FIXME
}
Program: gdcm
Module: $RCSfile: gdcmTS.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 13:47:33 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.21 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
std::string gdcmTS::GetValue(TSKey key)
{
if (ts.count(key) == 0)
- return (GDCM_UNFOUND);
+ return GDCM_UNFOUND;
return ts[key];
}
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2004/06/20 18:08:48 $
- Version: $Revision: 1.44 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.45 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
if(s[str.size()-1]==0)
str[str.size()-1]=' ';
- return(str);
+ return str;
}
/**
fullName.resize(pos1);
else
fullName.resize(pos2);
- return(fullName);
+ return fullName;
}
/**
for (int j=deb;j<fin+1;j++)
lastName=lastName+fullName.c_str()[j];
- return(lastName);
+ return lastName;
}
Program: gdcm
Module: $RCSfile: gdcmValEntry.h,v $
Language: C++
- Date: $Date: 2004/06/22 14:37:04 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2004/06/23 03:36:24 $
+ Version: $Revision: 1.15 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a
/// 'string', if it's stored as an integer in the header of the
/// current Dicom Document Entry
- inline std::string GetValue(void) { return value; };
+ inline std::string GetValue() { return value; };
/// Sets the value (string) of the current Dicom Document Entry
inline void SetValue(std::string val) { value = val; };