Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

object-brain.c

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: object-brain.c,v 1.7 2005/09/07 07:13:32 yougz Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 #include "object-brain.h" 00036 #include <idseq.h> 00037 #include <idacr.h> 00038 #include <string.h> 00039 #include <idvol.h> 00040 #include <idima.h> 00041 #include "display.h" 00042 #include "noise.h" 00043 00054 PPPVOLUME_UCHAR ReadLabelVolume(char * filein,int x,int y,int z) 00055 { 00056 PPPVOLUME_UCHAR label; 00057 00058 label = (PPPVOLUME_UCHAR) IdVolReadRawFile(filein,x,y,z,VOL_UCHAR); 00059 if (!label) 00060 { 00061 printf("Unable to read %s \n",filein); 00062 exit(0); 00063 } 00064 00065 return label; 00066 } 00067 00080 PPPVOLUME_UCHAR GetVolumeVOI(PPPVOLUME_UCHAR label,int px,int py,int pz,int dimx,int dimy,int dimz) 00081 { 00082 PPPVOLUME_UCHAR vol; 00083 int i,j,k; 00084 00085 vol = (PPPVOLUME_UCHAR) IdVolAlloc(dimx,dimy,dimz,VOL_UCHAR); 00086 for (k=0;k<dimz;k++) for (j=0;j<dimy;j++) for (i=0;i<dimx;i++) 00087 vol[k][j][i]=label[k+pz][j+py][i+px]; 00088 00089 return vol; 00090 } 00091 00101 OBJECT3D* LabelToObject(PPPVOLUME_UCHAR label, PPIMAGE_FLOAT value) 00102 { 00103 int x,y,z; 00104 int ro,t1,t2,lab; 00105 OBJECT3D *object; 00106 int i,j,k; 00107 00108 x=IdVolDimX(label); 00109 y=IdVolDimY(label); 00110 z=IdVolDimZ(label); 00111 00112 object = AllocObject(x,y,z,1,3); 00113 00114 for (k=0;k<z;k++) for (j=0;j<y;j++) for (i=0;i<x;i++) 00115 { 00116 lab=label[k][j][i]; 00117 ro=(int) (value[lab][0]+RandGaussian(value[lab][1],0.0,0)); 00118 t1=(int) (value[lab][2]+RandGaussian(value[lab][3],0.0,0)); 00119 t2=(int) (value[lab][4]+RandGaussian(value[lab][5],0.0,0)); 00120 SetObjectPoint(object,i,j,k,ro,t1,t2,WATER); 00121 } 00122 return object; 00123 } 00124 00145 PPIMAGE_FLOAT GetBrainPhysicalValues(double B0) 00146 { 00147 int i,j; 00148 PPIMAGE_FLOAT value; 00149 value = (PPIMAGE_FLOAT) IdImaAlloc(8,10,IMA_FLOAT); 00150 for (j=0;j<10;j++) for (i=0;i<8;i++) 00151 value[j][i]=0.0; 00152 00153 /* Value for B0 = 1T */ 00154 /* Air */ 00155 value[0][0]=0.0; value[0][1]=0.0; /* Ro , Ro sd */ 00156 value[0][2]=0.0; value[0][3]=0.0; /* T1 , T1 sd */ 00157 value[0][4]=0.0; value[0][5]=0.0; /* T2 , T2 sd */ 00158 value[0][6]=0.0; value[0][7]=0.0; /* Ki , Ki sd */ 00159 /* CSF */ 00160 value[1][0]=100.0; value[1][1]=0.0; /* Ro , Ro sd */ 00161 value[1][2]=2569.0; value[1][3]=170.0; /* T1 , T1 sd */ 00162 value[1][4]=329.0; value[1][5]=13.0; /* T2 , T2 sd */ 00163 value[1][6]=-9.05e-6; value[1][7]=0.0; /* Ki , Ki sd */ 00164 /* Grey Matter */ 00165 value[2][0]=86.0; value[2][1]=0.4; /* Ro , Ro sd */ 00166 value[2][2]=833.0; value[2][3]=40.0; /* T1 , T1 sd */ 00167 value[2][4]=83.0; value[2][5]=8.0; /* T2 , T2 sd */ 00168 value[2][6]=-9.05e-6; value[2][7]=0.0; /* Ki , Ki sd */ 00169 /* White Matter */ 00170 value[3][0]=77.0; value[3][1]=3.00; /* Ro , Ro sd */ 00171 value[3][2]=500.0; value[3][3]=23.0; /* T1 , T1 sd */ 00172 value[3][4]=70.0; value[3][5]=3.0; /* T2 , T2 sd */ 00173 value[3][6]=-9.5e-6; value[3][7]=0.0; /* Ki , Ki sd */ 00174 /* Fat */ 00175 value[4][0]=100.0; value[4][1]=0.0; /* Ro , Ro sd */ 00176 value[4][2]=350.0; value[4][3]=0.0; /* T1 , T1 sd */ 00177 value[4][4]=70.0; value[4][5]=0.0; /* T2 , T2 sd */ 00178 value[4][6]=-7.5e-6; value[4][7]=0.0; /* Ki , Ki sd */ 00179 /* Muscle */ 00180 value[5][0]=100.0; value[5][1]=0.0; /* Ro , Ro sd */ 00181 value[5][2]=900.0; value[5][3]=0.0; /* T1 , T1 sd */ 00182 value[5][4]=47.0; value[5][5]=0.0; /* T2 , T2 sd */ 00183 value[5][6]=-9.5e-6; value[5][7]=0.0; /* Ki , Ki sd */ 00184 /* Skin */ 00185 value[6][0]=100.0; value[6][1]=0.0; /* Ro , Ro sd */ 00186 value[6][2]=2569.0; value[6][3]=0.0; /* T1 , T1 sd */ 00187 value[6][4]=329.0; value[6][5]=0.0; /* T2 , T2 sd */ 00188 value[6][6]=-9.05e-6; value[6][7]=0.0; /* Ki , Ki sd */ 00189 /* Skull */ 00190 value[7][0]=0.0; value[7][1]=0.0; /* Ro , Ro sd */ 00191 value[7][2]=0.0; value[7][3]=0.0; /* T1 , T1 sd */ 00192 value[7][4]=0.0; value[7][5]=0.0; /* T2 , T2 sd */ 00193 value[7][6]=-8.86e-6; value[7][7]=0.0; /* Ki , Ki sd */ 00194 /* Glial Matter */ 00195 value[8][0]=86.0; value[8][1]=0.0; /* Ro , Ro sd */ 00196 value[8][2]=833.0; value[8][3]=0.0; /* T1 , T1 sd */ 00197 value[8][4]=83.0; value[8][5]=0.0; /* T2 , T2 sd */ 00198 value[8][6]=-9.05e-6; value[8][7]=0.0; /* Ki , Ki sd */ 00199 /* Connective */ 00200 value[9][0]=77.0; value[9][1]=0.0; /* Ro , Ro sd */ 00201 value[9][2]=500.0; value[9][3]=0.0; /* T1 , T1 sd */ 00202 value[9][4]=70.0; value[9][5]=0.0; /* T2 , T2 sd */ 00203 value[9][6]=-9.05e-6; value[9][7]=0.0; /* Ki , Ki sd */ 00204 00205 return (value); 00206 }

Generated on Wed Oct 19 09:28:34 2005 for SIMRI3D by doxygen 1.3.7