["Manufacturer", "Acme Products"],
# FIXME: 92160 / (120*256) = 3 bytes per pixel NOT 1. Maybe
# it has something to do with [Samples Per Pixel] = [3] ???
+ # You said it, puffy (tu l'as dit, bouffi, in french language)
+ # RGB is 3 bytes per pixel
+ # + Planar configuration (0028,0006) = 0 --> Pixels RGB
["Pixel Data", "gdcm::NotLoaded. Address:904 Length:92160"] ] ],
["US-RGB-8-epicard.dcm",
# Interest: Big endian transfert syntax
[ ["Transfer Syntax UID", "1.2.840.10008.1.2.2"], # Big endian
+ # But ... group 0000 is LE .
["Modality", "US"],
["Photometric Interpretation", "RGB"],
["Rows", "480"],
["Pixel Representation", "0"],
["Manufacturer", "G.E. Medical Systems"],
["Manufacturer Model Name", "LOGIQ 700"],
- # FIXME: 921600/(480*640) = 3 bytes per pixel NOT 1. Maybe
- # it has something to do with [Samples Per Pixel] = [3] ???
+ # + Planar configuration (0028,0006) = 1 --> Plane R, Plane G, Plane B
["Implementation Version Name", "OFFIS-DCMTK-311"],
["Pixel Data", "gdcm::NotLoaded. Address:1012 Length:921600"] ] ],
]
* \ingroup gdcmFile
* \brief Read pixel data from disk (optionaly decompressing) into the
* caller specified memory location.
- * @param destination Where the pixel data should be stored.
+ * @param destination where the pixel data should be stored.
*
*/
bool gdcmFile::ReadPixelData(void* destination) {
return (size_t)0;
}
}
+
+ // ---
+ string str_PlanarConfiguration = GetPubElValByNumber(0x0028,0x0006);
+ int PlanarConfiguration;
+ if (str_PlanarConfiguration == "gdcm::Unfound" ) {
+ PlanarConfiguration = 0;
+ } else {
+ PlanarConfiguration = atoi(str_PlanarConfiguration.c_str() );
+ }
+ // ---
+
+ // TODO : replace by
+ // if (GetPlanarConfiguration() == 1) {
+ // after unfreeze
+
+ if (PlanarConfiguration == 1) { // need to make RGB Pixels
+ int l = lgrTotale/3 ;
+
+ char * a = (char *)destination;
+ char * b = a + l;
+ char * c = b + l;
+ char * newDest = (char*) malloc(lgrTotale);
+ // TODO :
+ // any trick not to have to allocate temporary buffer is welcome ...
+ char *x = newDest;
+ for (int i=0;i<l; i++) {
+ *(x++) = *(a++);
+ *(x++) = *(b++);
+ *(x++) = *(c++);
+ }
+ a = (char *)destination;
+ x = newDest;
+ for (int i=0;i<lgrTotale; i++) {
+ *(a++) = *(x++);
+ }
+ free(newDest);
+ }
return lgrTotale;
}
case 1234:
break;
- case 21:
- case 3412:
- case 2143:
- case 4321:
-
- for(i=0;i<lgr;i++)
- ((unsigned short int*)im)[i]= ((((unsigned short int*)im)[i])>>8)
- | ((((unsigned short int*)im)[i])<<8);
- break;
+ case 21:
+ case 3412:
+ case 2143:
+ case 4321:
+
+ for(i=0;i<lgr;i++)
+ ((unsigned short int*)im)[i]= ((((unsigned short int*)im)[i])>>8)
+ | ((((unsigned short int*)im)[i])<<8);
+ break;
- default:
- printf("valeur de SWAP (16 bits) non autorisee : %d\n", swap);
+ default:
+ printf("valeur de SWAP (16 bits) non autorisee : %d\n", swap);
}
if( nb == 32 )
}
break;
- case 2143:
- for(i=0;i<lgr;i++) {
- faible= ((unsigned long int*)im)[i]&0x0000ffff; /* 2143 */
- fort=((unsigned long int*)im)[i]>>16;
- fort= (fort>>8) | (fort<<8);
- faible=(faible>>8) | (faible<<8);
- s32=fort;
- ((unsigned long int*)im)[i]=(s32<<16)|faible;
- }
- break;
+ case 2143:
+ for(i=0;i<lgr;i++) {
+ faible= ((unsigned long int*)im)[i]&0x0000ffff; /* 2143 */
+ fort=((unsigned long int*)im)[i]>>16;
+ fort= (fort>>8) | (fort<<8);
+ faible=(faible>>8) | (faible<<8);
+ s32=fort;
+ ((unsigned long int*)im)[i]=(s32<<16)|faible;
+ }
+ break;
- case 3412:
- for(i=0;i<lgr;i++) {
- faible= ((unsigned long int*)im)[i]&0x0000ffff; /* 3412 */
- fort=((unsigned long int*)im)[i]>>16;
- s32=faible;
- ((unsigned long int*)im)[i]=(s32<<16)|fort;
- }
- break;
+ case 3412:
+ for(i=0;i<lgr;i++) {
+ faible= ((unsigned long int*)im)[i]&0x0000ffff; /* 3412 */
+ fort=((unsigned long int*)im)[i]>>16;
+ s32=faible;
+ ((unsigned long int*)im)[i]=(s32<<16)|fort;
+ }
+ break;
- default:
- printf("valeur de SWAP (32 bits) non autorisee : %d\n", swap);
+ default:
+ printf("valeur de SWAP (32 bits) non autorisee : %d\n", swap);
}
return;
}
SetImageDataSize(ExpectedSize);
PixelData = inData;
lgrTotale = ExpectedSize;
-
-
return(1);
}
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.75 2003/07/01 17:22:44 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.76 2003/07/02 16:47:22 jpr Exp $
#include <stdio.h>
#include <cerrno>
* @param InFilename
* @param exception_on_error
*/
- gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error) {
- SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_);
- filename = InFilename;
- Initialise();
- if ( !OpenFile(exception_on_error))
- return;
- ParseHeader();
- LoadElements();
- CloseFile();
+gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error) {
+ SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_);
+ filename = InFilename;
+ Initialise();
+ if ( !OpenFile(exception_on_error))
+ return;
+ ParseHeader();
+ LoadElements();
+ CloseFile();
}
/**
// instead of just checking for UL, OB and UI !?
if( (memcmp(entCur, "UL", (size_t)2) == 0) ||
(memcmp(entCur, "OB", (size_t)2) == 0) ||
- (memcmp(entCur, "UI", (size_t)2) == 0) )
- {
+ (memcmp(entCur, "UI", (size_t)2) == 0) )
+ {
filetype = ExplicitVR;
dbg.Verbose(1, "gdcmHeader::CheckSwap:",
"explicit Value Representation");
dbg.Verbose(1, "gdcmHeader::CheckSwap:",
"not an explicit Value Representation");
}
-
if (net2host) {
sw = 4321;
dbg.Verbose(1, "gdcmHeader::CheckSwap:",
size_t item_read;
item_read = fread (&g, (size_t)2,(size_t)1, fp);
if ( item_read != 1 ) {
- dbg.Verbose(1, "gdcmHeader::ReadInt16", " Failed to read :");
+ dbg.Verbose(0, "gdcmHeader::ReadInt16", " Failed to read :");
if(feof(fp))
- dbg.Verbose(1, "gdcmHeader::ReadInt16", " End of File encountered");
+ dbg.Verbose(0, "gdcmHeader::ReadInt16", " End of File encountered");
if(ferror(fp))
- dbg.Verbose(1, "gdcmHeader::ReadInt16", " File Error");
+ dbg.Verbose(0, "gdcmHeader::ReadInt16", " File Error");
errno = 1;
return 0;
}
item_read = fread (&g, (size_t)4,(size_t)1, fp);
if ( item_read != 1 ) {
- dbg.Verbose(1, "gdcmHeader::ReadInt32", " Failed to read :");
+ dbg.Verbose(0, "gdcmHeader::ReadInt32", " Failed to read :");
if(feof(fp))
- dbg.Verbose(1, "gdcmHeader::ReadInt32", " End of File encountered");
+ dbg.Verbose(0, "gdcmHeader::ReadInt32", " End of File encountered");
if(ferror(fp))
- dbg.Verbose(1, "gdcmHeader::ReadInt32", " File Error");
+ dbg.Verbose(0, "gdcmHeader::ReadInt32", " File Error");
errno = 1;
return 0;
}
return atoi(StrSize.c_str());
}
+
/**
* \ingroup gdcmHeader
* \brief Retrieve the number of Samples Per Pixel
return atoi(StrSize.c_str());
}
+
+/* ================ COMMENT OUT after unfreeze
+**
+ * \ingroup gdcmHeader
+ * \brief Retrieve the Planar Configuration for RGB images
+ * (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane)
+ *
+ * @return The encountered Planar Configuration, 0 by default.
+ *
+int gdcmHeader::GetPlanarConfiguration(void) {
+ string StrSize = GetPubElValByNumber(0x0028,0x0006);
+ if (StrSize == "gdcm::Unfound")
+ return 0;
+ return atoi(StrSize.c_str());
+}
+
+ ======================================= */
+
/**
* \ingroup gdcmHeader
* \brief Return the size (in bytes) of a single pixel of data.
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.31 2003/07/01 15:14:36 frog Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.32 2003/07/02 16:47:22 jpr Exp $
#ifndef GDCMHEADER_H
#define GDCMHEADER_H
int GetZSize(void);
int GetBitsStored(void);
int GetSamplesPerPixel(void);
+
+/* ================ COMMENT OUT after unfreeze
+ int GetPlanarConfiguration(void);
+ ======================================= */
+
int GetPixelSize(void);
std::string GetPixelType(void);