-
-/*
-void * gdcmFile::GetImageData (void) {
-
- char* _Pixels;
-
- int nb, nbu, highBit, signe;
- string str_nbFrames, str_nb, str_nbu, str_highBit, str_signe;
-
- unsigned short int mask = 0xffff;
-
- // Nombre de Bits Alloues pour le stockage d'un Pixel
- str_nb=gdcmHeader::GetPubElValByNumber(0x0028,0x0100);
-
- if (str_nb == "gdcm::Unfound" ) {
- nb = 16;
- } else {
- nb = atoi(str_nb.c_str() );
- }
-
- // Nombre de Bits Utilises
- str_nbu=GetPubElValByNumber(0x0028,0x0101);
-
- if (str_nbu == "gdcm::Unfound" ) {
- nbu = nb;
- } else {
- nbu = atoi(str_nbu.c_str() );
- }
-
- // Position du Bit de Poids Fort
- str_highBit=GetPubElValByNumber(0x0028,0x0102);
-
- if (str_highBit == "gdcm::Unfound" ) {
- highBit = nb - 1;
- } else {
- highBit = atoi(str_highBit.c_str() );
- }
-
- // Signe des Pixels 0 : Unsigned
- str_signe=GetPubElValByNumber(0x0028,0x0103);
-
- if (str_signe == "gdcm::Unfound" ) {
- signe = 1;
- } else {
- signe = atoi(str_signe.c_str() );
- }
-
- // Longueur en Octets des Pixels a lire
- size_t _lgrTotale = GetImageDataSize();
-
- //Pixels = (char *) g_malloc(_lgrTotale);
- _Pixels = (char *) malloc(_lgrTotale);
-
- GetPixels(lgrTotale, _Pixels);
-
- // On remet les Octets dans le bon ordre si besoin est
- if (nb != 8) {
- int _sw = GetSwapCode();
-
- _Swap (_Pixels, _sw, _lgrTotale, nb);
- }
-
- // On remet les Bits des Octets dans le bon ordre si besoin est
- //
- // ATTENTION : Jamais confronté a des pixels stockes sur 32 bits
- // avec moins de 32 bits utilises
- // et dont le bit de poids fort ne serait pas la ou on l'attend ...
- // --> ne marchera pas dans ce cas
- if (nbu!=nb){
- mask = mask >> (nb-nbu);
- int l=(int)_lgrTotale/(nb/8);
- unsigned short *deb = (unsigned short *)_Pixels;
- for(int i=0;i<l;i++) {
- *deb = (*deb >> (nbu-highBit-1)) & mask;
- deb ++;
- }
- }
- // On l'affecte à un champ du dcmFile
-
- Pixels = _Pixels;
- lgrTotale = _lgrTotale;
-
- // et on le retourne
- // ca fait double emploi, il faudra nettoyer ça
-
- return (_Pixels);