begin process at 2013 05 23 19:01:31
  Trouver un code source :
 
dans
 
Accueil > Forum > 

C++ & C++ .NET

 > 

Divers

 > 

Divers

 > 

Image format Analyze 7.5


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Image format Analyze 7.5

lundi 25 juin 2012 à 20:01:42 | Image format Analyze 7.5

inkognitodz

Pourriez-vous m'aider Je n'arrive pas à lire une image IRM de format Analyze 7.5 (comprenant deux fichiers : header *.hdr et image *.img) sous C++ Builder.
mardi 26 juin 2012 à 10:49:37 | Re : Image format Analyze 7.5

buno

Administrateur CodeS-SourceS
Hello,
Voici les specs du format Analyse 7.5


@+
Buno, Admin CS
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
mardi 26 juin 2012 à 11:57:08 | Re : Image format Analyze 7.5

inkognitodz

mmmmmmm ok !!!

voici ce que j'ai trouvé :

Code C/C++ :

void __fastcall TForm1::Button1Click(TObject *Sender)
{

TOpenDialog* dlgOuvrir = new TOpenDialog(this);
dlgOuvrir->Title = "Ouvrir l'image IRM 3D";
dlgOuvrir->DefaultExt= "*.hdr" ;
dlgOuvrir->FileName= "*.hdr" ;

if (dlgOuvrir->Execute())
{
    String strFichierHDR = dlgOuvrir->FileName;

//lecture fichier header
    dsr hdr;
    FILE *fp;
    if((fp = fopen(strFichierHDR.c_str(), "r")) == NULL)
    {
        ShowMessage("le fichier n'existe pas !!");
    }
    else
    {
        fread(&hdr, 1,sizeof(dsr), fp);
	fclose(fp);
    }

//lecture fichier image
    FILE *id;
    short buf[1];
    short mat3[100][100][100];
    id=fopen(strFichierIMG.c_str(),"rb");
    for (int k=0;k<100;k++)
       for (int i=0;i<100;i++)
           for (int j=0;j<100;j++)
           {
               fread(buf,1,1,id);
               mat3[i][j][k] = buf[1];
           }
    fclose(id);
 }

}


mais je n'arrive pas à lire l'image !!!! blocage !
mardi 26 juin 2012 à 12:00:44 | Re : Image format Analyze 7.5

inkognitodz

plutôt ça
Code C/C++ :
void __fastcall TForm1::Button1Click(TObject *Sender)
{

TOpenDialog* dlgOuvrir = new TOpenDialog(this);
dlgOuvrir->Title = "Ouvrir l'image IRM 3D";
dlgOuvrir->DefaultExt= "*.hdr" ;
dlgOuvrir->FileName= "*.hdr" ;

if (dlgOuvrir->Execute())
{
    String strFichierHDR = dlgOuvrir->FileName;
    String strFichierIMG = ChangeFileExt(dlgOuvrir->FileName, ".img");

//lecture fichier header
    dsr hdr;
    FILE *fp;
    if((fp = fopen(strFichierHDR.c_str(), "r")) == NULL)
    {
        ShowMessage("le fichier n'exist pas !!");
    }
    else
    {
        //Form1->Cursor =crAppStart ;
        fread(&hdr, 1,sizeof(dsr), fp);
	fclose(fp);
    }
//lecture fichier image
    FILE *id;
    short buf[1];
    short mat3[100][100][100];
    id=fopen(strFichierIMG.c_str(),"rb");
    for (int k=0;k<cp;k++)
       for (int i=0;i<h;i++)
           for (int j=0;j<w;j++)
           {
               fread(buf,1,1,id);
               mat3[i][j][k] = buf[1];
           }
    fclose(id);
 }

}
//---------------------------------------------------------------------------
mardi 26 juin 2012 à 12:02:55 | Re : Image format Analyze 7.5

inkognitodz

supposons cp=h=w=100
mardi 26 juin 2012 à 13:54:43 | Re : Image format Analyze 7.5

inkognitodz

Je viens de modifier le code mais je n'arrive toujours pas à afficher l'image... résultat : image unie !

Code C/C++ :
//---------------------------------------------------------------------------

#include <vcl.h>
#include <stdio.h>


#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

short mat3[300][300][300];

struct header_key
{                               /* off + size */
    int sizeof_hdr;             /* 0 + 4 */
    char data_type[10];         /* 4 + 10 */
    char db_name[18];           /* 14 + 18 */
    int extents;                /* 32 + 4 */
    short int session_error;    /* 36 + 2 */
    char regular;               /* 38 + 1 */
    char hkey_un0;              /* 39 + 1 */
};
 
struct image_dimension
{                       /* off + size */
    short int dim[8];   /* 0 + 16 */
    short int unused8;  /* 16 + 2 */
    short int unused9;  /* 18 + 2 */
    short int unused10; /* 20 + 2 */
    short int unused11; /* 22 + 2 */
    short int unused12; /* 24 + 2 */
    short int unused13; /* 26 + 2 */
    short int unused14; /* 28 + 2 */
    short int datatype; /* 30 + 2 */
    short int bitpix;   /* 32 + 2 */
    short int dim_un0;  /* 34 + 2 */
    float pixdim[8];    /* 36 + 32 */
    float vox_offset;   /* 68 + 4 */
    float funused1;     /* 72 + 4 */
    float funused2;     /* 76 + 4 */
    float funused3;     /* 80 + 4 */
    float cal_max;      /* 84 + 4 */
    float cal_min;      /* 88 + 4 */
    float compressed;   /* 92 + 4 */
    float verified;     /* 96 + 4 */
    int glmax,glmin;    /* 100 + 8 */
};
 
struct data_history
{                           /* off + size */
    char descrip[80];       /* 0 + 80 */
    char aux_file[24];      /* 80 + 24 */
    char orient;            /* 104 + 1 */
    char originator[10];    /* 105 + 10 */
    char generated[10];     /* 115 + 10 */
    char scannum[10];       /* 125 + 10 */
    char patient_id[10];    /* 135 + 10 */
    char exp_date[10];      /* 145 + 10 */
    char exp_time[10];      /* 155 + 10 */
    char hist_un0[3];       /* 165 + 3 */
    int views;              /* 168 + 4 */
    int vols_added;         /* 172 + 4 */
    int start_field;        /* 176 + 4 */
    int field_skip;         /* 180 + 4 */
    int omax, omin;         /* 184 + 8 */
    int smax, smin;         /* 192 + 8 */
};
 
struct dsr
{
    struct header_key hk;           /* 0 + 40 */
    struct image_dimension dime;    /* 40 + 108 */
    struct data_history hist;       /* 148 + 200 */
};


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{

TOpenDialog* dlgOuvrir = new TOpenDialog(this);
dlgOuvrir->Title = "Ouvrir l'image IRM 3D";
dlgOuvrir->DefaultExt= "*.hdr" ;
dlgOuvrir->FileName= "*.hdr" ;

if (dlgOuvrir->Execute())
{
    String strFichierHDR = dlgOuvrir->FileName;
    String strFichierIMG = ChangeFileExt(dlgOuvrir->FileName, ".img");

//lecture fichier header
    dsr hdr;
    FILE *fp;
    if((fp = fopen(strFichierHDR.c_str(), "r")) == NULL)
    {
        ShowMessage("le fichier n'existe pas !!");
    }
    else
    {
        Form1->Cursor =crAppStart ;
        fread(&hdr, 1,sizeof(dsr), fp);
	fclose(fp);
    }
//lecture fichier image
    FILE *id;
    short buf[1];

    id=fopen(strFichierIMG.c_str(),"rb");
    for (int i=0;i<218;i++)
       for (int j=0;j<182;j++)
           for (int k=0;k<218;k++)
           {
                fread(buf,1,1,id);
                mat3[i][j][k] = buf[1];

           }
    fclose(id);
 }

//afficher une coupe
    for (int i=0;i<218;i++)
      for (int j=0;j<182;j++)
          {Image1->Canvas->Pixels[j][i]=RGB(mat3[i][j][73],0,0); }

Form1->Cursor =crDefault ;
}
//---------------------------------------------------------------------------


Cette discussion est classée dans : image, format, analyze


Répondre à ce message

Sujets en rapport avec ce message

conversion d'un format png en image bmp [ par REk2002 ] bonjour je cherche un programme simple permettant de convertir une image png en bmp. merci d'avance au revoir Recherche format d'image le plus simple !! [ par ymerej ] Bonjour,je souhaite connaitre quel est le format d'image le plus simple a lire car en fait je veu récupérer une image en noir et blanc de 128 x 64 et image au format clipart [ par anthony00 ] bonjour a vous tous,voila je voudrais avoir des inforamtions sur les images vectorielles de type clipart.comment peut on ouvrir une image clipart sous acquisition d'une image sous format BMP à partir d'un scaneur [ par mil_kha_lar ] j'ai besion de récvupérer une imager sous format BMP à partir d'un scanneur; ça fait partie de mon projet de fin d'études. merci lecture d image au format jpeg [ par a-sophie ] Salut,Je souhaite lire et sauvegarder des images au format jpeg avec visual c++ .Si jamais quelqu un a des conseils ou des pistes a me donner, ce sera dessiner sur une image jpg sous builder [ par jojos89 ] Je voudrais savoir comment je pourrais faire pour dessiner des cercles sur image au format jpeg, car j'utilise buider c++ 5 et celui si ne dessine que Sauvegarde du rendu ds un fichier image [ par titeufxp ] Bonjour,J'aurai besoin d'aide pour sauvegarder le contenu de ma fenetre opengl ds un format image genre BMP ou JPG.J'arrive a faire un fichier image a conversion en BMP [ par anthony00 ] voila je suis sur un projet de traitement d'image. je souhaiterai savoir comment on peu charger une image au format BMP sous forme matricielle sous vi fichier cso et Alcohol 120% [ par igore62 ] bonjour avant je monté une image au format cso avec Alcohol 120% mais j ai du formaté mon pc cause de probleme après reinstallation de Alcohol 120% je [C++ Builder] Comment charger un JPG puis le gérer ensuite comme un BMP ? [ par MikeGyver ] Bonjour à tous !Je suis en train de concevoir un petit soft qui permettrait de redimensionner, recadrer, etc...des photos issues d'un APN afin de les


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2013
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 2,777 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales