00001
00002
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <string.h>
00006
00007 #include "marDictionary.h"
00008
00009
00010 marDictFrase::marDictFrase(int idfrase,char*frase){
00011 _idfrase = idfrase;
00012 _frase=(char*)malloc(strlen(frase));
00013 memcpy( _frase , frase , strlen(frase));
00014 _frase[strlen(frase)-1]='\0';
00015 }
00016
00017
00018 marDictFrase::~marDictFrase(){
00019 free(_frase);
00020 }
00021
00022
00023 int marDictFrase::GetIdFrase(){
00024 return _idfrase;
00025 }
00026
00027
00028 char* marDictFrase::GetFrase(){
00029 return _frase;
00030 }
00031
00032
00033
00034
00035
00036 int marDictionary::_language = 0;
00037 std::vector<marDictFrase*>* marDictionary::_frases = 0;
00038
00039
00040
00041 marDictionary::marDictionary(){
00042 strcpy( _emptyStr , "(...)" );
00043 }
00044
00045 marDictionary::~marDictionary(){
00046 }
00047
00048 bool marDictionary::ExistFileDictionary(char *dictionaryFileName){
00049
00050 bool result=true;
00051 FILE *ff=fopen(dictionaryFileName,"r");
00052 if (ff==NULL){
00053 result=false;
00054 }
00055 return result;
00056 }
00057
00058 void marDictionary::ResetDictionary(){
00059 if (_frases!=NULL){
00060 FreeDictionary();
00061 delete _frases;
00062 }
00063 _frases=new std::vector<marDictFrase*>();
00064 }
00065
00066 bool marDictionary::LoadDictionaryFile(char *dictionaryFileName){
00067 ResetDictionary();
00068
00069 bool result=false;
00070
00071 if ((_frases->size()==0) && (ExistFileDictionary(dictionaryFileName)==true) ){
00072 long idText;
00073 long idLanguage;
00074 char idTextStr[50];
00075 char idLanguageStr[50];
00076 char text[256];
00077 char line[256];
00078 char name[50];
00079 FILE *fileIn;
00080 fileIn=fopen(dictionaryFileName,"r");
00081
00082 fgets(line, 256, fileIn);
00083 sscanf(line,"%s %d" , name,&idLanguage);
00084
00085 if (strcmp(name,"MARACAS_LANGUAGE")==0){
00086 SetLanguage(idLanguage);
00087 while (!feof(fileIn)) {
00088 fgets(line, 256, fileIn);
00089 if (strlen(line)>5){
00090 sscanf(line,"%s %s " , idLanguageStr,idTextStr);
00091 sscanf(idLanguageStr,"%d " , &idLanguage);
00092 if (GetLanguage()==idLanguage){
00093 sscanf(idTextStr,"%d " , &idText);
00094 char *start = line + strlen(idLanguageStr)+1 + strlen(idTextStr)+1;
00095 int size = strlen(line) - (strlen(idLanguageStr)+1 + strlen(idTextStr)+1);
00096 memcpy(text,start,size-1);
00097 text[size]='\0';
00098 SetString(idText,text);
00099 }
00100 }
00101 }
00102 result=true;
00103 } else {
00104 }
00105 fclose(fileIn);
00106 }
00107 return result;
00108 }
00109
00110
00111 void marDictionary::LoadDictionary_English(){
00112 ResetDictionary();
00113 SetLanguage(1);
00114
00115 SetString( 5 , "MARACAS: MAgnetic Resonance Angiography Computer ASisted analysis ");
00116 SetString( 10 , "Iso Surface values ");
00117 SetString( 15 , "Iso visible ");
00118 SetString( 20 , "Opacity (%) ");
00119 SetString( 25 , "Isovalue ");
00120 SetString( 30 , "0 ");
00121 SetString( 35 , "Select ");
00122 SetString( 40 , "artery ");
00123 SetString( 45 , "1 ");
00124 SetString( 50 , "Axis Extraction ");
00125 SetString( 55 , "2 ");
00126 SetString( 60 , "Quantification ");
00127 SetString( 65 , "Set an initial point. ");
00128 SetString( 70 , "(Double click over the interest artery.) ");
00129 SetString( 73 , "OK ");
00130 SetString( 75 , "Start 3D ");
00131 SetString( 80 , "Plan ");
00132 SetString( 85 , "Parameters ");
00133 SetString( 90 , "Slice ");
00134 SetString( 205 , "Healthy slice ");
00135 SetString( 210 , "Perpendicular section ");
00136 SetString( 215 , "Visible ring ");
00137 SetString( 220 , "Show surface ");
00138 SetString( 225 , "Opacity ");
00139 SetString( 230 , "grayscale ");
00140 SetString( 235 , "color ");
00141 SetString( 240 , "Isovalue ");
00142 SetString( 245 , "Add mark contour ");
00143 SetString( 248 , "Save Contours ");
00144 SetString( 250 , "Erase marks contours ");
00145 SetString( 253 , "Erase all marks contours ");
00146 SetString( 255 , "Stenosis (area) ");
00147 SetString( 260 , "Stenosis (diameter) ");
00148 SetString( 265 , "Stenosis search ");
00149 SetString( 270 , "Automatic stenosis search ");
00150 SetString( 273 , "0 ");
00151 SetString( 275 , "Select ");
00152 SetString( 280 , " slice ");
00153 SetString( 283 , "1 ");
00154 SetString( 285 , " Validate ");
00155 SetString( 290 , "Healthy Slice ");
00156 SetString( 293 , "2 ");
00157 SetString( 295 , " Validate ");
00158 SetString( 300 , "End Region ");
00159 SetString( 303 , "3 ");
00160 SetString( 305 , " Find ");
00161 SetString( 310 , "stenosis ");
00162 SetString( 315 , "Automatic ");
00163 SetString( 320 , "Manual ");
00164 SetString( 325 , "Manual stenosis search ");
00165 SetString( 328 , "0 ");
00166 SetString( 330 , "Select ");
00167 SetString( 335 , " slice ");
00168 SetString( 338 , "1 ");
00169 SetString( 340 , " Select ");
00170 SetString( 345 , "other slice ");
00171 SetString( 348 , "2 ");
00172 SetString( 350 , " Validate ");
00173 SetString( 355 , "Healthy Slice ");
00174 SetString( 360 , "Healthy region size ");
00175 SetString( 365 , "Healthy region size ");
00176 SetString( 370 , "Size of the healthy region ( 2xn+1 ) ");
00177 SetString( 373 , "n : ");
00178 SetString( 375 , "Refresh healthy region ");
00179 SetString( 380 , "Total Axis Lenght ");
00180 SetString( 385 , "Seg. Length ");
00181 SetString( 390 , "Area ");
00182 SetString( 395 , "Ref. Area ");
00183 SetString( 400 , "Perimeter ");
00184 SetString( 405 , "Minimum Diameter ");
00185 SetString( 410 , "Maximum Diameter ");
00186 SetString( 415 , "Average Diameter ");
00187 SetString( 420 , "Ref Average Diam. ");
00188 SetString( 500 , "Maracas parameters... ");
00189 SetString( 505 , "Contour parameters ");
00190 SetString( 510 , "Contour calculation algorithm ");
00191 SetString( 515 , "% Thereshold ");
00192 SetString( 520 , "Debug ");
00193 SetString( 525 , "Visible Diameter? ");
00194 SetString( 530 , "Axis Parameters ");
00195 SetString( 535 , "Extraction parameters ");
00196 SetString( 540 , "Flexion coefficient: ");
00197 SetString( 545 , "Tension coefficient: ");
00198 SetString( 550 , "Mask size (2*n+1), n: ");
00199 SetString( 555 , "Discret step for axis (1/N): ");
00200 SetString( 560 , "OK ");
00201 SetString( 565 , "Cancel ");
00202 SetString( 570 , "Default ");
00203 SetString( 575 , "Reset ");
00204 SetString( 580 , "Apply ");
00205 SetString( 605 , "The mask size was modified. ");
00206 SetString( 610 , "The threshold was modified. ");
00207 SetString( 615 , "The flexion coeficient was modified. ");
00208 SetString( 620 , "The tension coeficient was modified. ");
00209 SetString( 625 , "The discret step of the axis was modified. ");
00210 SetString( 630 , " The axe will be regenereted and the contours will be eresed. ");
00211 SetString( 635 , " All contours will be erase. ");
00212 SetString( 640 , " Do you want to continue? ");
00213 SetString( 645 , "Alert ");
00214 SetString( 650 , " % Threshold : ");
00215 SetString( 655 , "Visible diameters? ");
00216 SetString( 660 , "Flexion coefficient: ");
00217 SetString( 665 , "Tension coefficient: ");
00218 SetString( 670 , "Mask size (2*n+1). n: ");
00219 SetString( 675 , "Discret step for axis (1/N): ");
00220 SetString( 680 , "OK ");
00221 SetString( 685 , "Cancel ");
00222 SetString( 690 , "Reset ");
00223 SetString( 695 , "Apply ");
00224 SetString( 700 , "Default ");
00225 SetString( 710 , "MARACAS Parameters... ");
00226 SetString( 720 , "Extraction parameters ");
00227 SetString( 725 , "Debug ");
00228 SetString( 730 , "Contour calculation algorithm ");
00229 SetString( 735 , "Contour Parameters ");
00230 SetString( 740 , "Axis Parameters ");
00231 SetString( 745 , "Invert slice order ");
00232 SetString( 800 , "Contour modification ");
00233 SetString( 803 , "Contour modification ");
00234 SetString( 805 , "1 ");
00235 SetString( 810 , "2 ");
00236 SetString( 815 , "3 ");
00237 SetString( 820 , "New ");
00238 SetString( 825 , "Contour ");
00239 SetString( 830 , "Replace ");
00240 SetString( 835 , "End ");
00241 SetString( 840 , "Insert point ");
00242 SetString( 845 , "Delete point ");
00243 SetString( 850 , "Move point ");
00244 SetString( 855 , "Use mouse left button to ");
00245 SetString( 860 , "create the new contour. ");
00246 SetString( 865 , "Alert ");
00247 SetString( 870 , "This option erase all 3D contours. ");
00248 SetString( 875 , "Do you want to continue? ");
00249 SetString( 905 , "Set an initial point. ");
00250 SetString( 910 , "(Double click over the interest artery.) ");
00251 SetString( 915 , "The initial point should be far ");
00252 SetString( 920 , "of the limits of the volume. ");
00253 SetString( 925 , "Threshold ");
00254 SetString( 930 , "Lumen Intensity % ");
00255 SetString( 935 , "Calcification Intensity % ");
00256 SetString( 940 , "Contour control ");
00257 }
00258
00259 void marDictionary::LoadDictionary_French(){
00260 ResetDictionary();
00261 SetLanguage(2);
00262
00263 SetString( 5 , "MARACAS: MAgnetic Resonance Angiography Computer ASisted analysis ");
00264 SetString( 10 , "Valeurs de l'Iso surface ");
00265 SetString( 15 , "Iso visible");
00266 SetString( 20 , "Opacit (%) ");
00267 SetString( 25 , "Isovalue ");
00268 SetString( 30 , "0 ");
00269 SetString( 35 , "Choisir ");
00270 SetString( 40 , "l'artre ");
00271 SetString( 45 , "1 ");
00272 SetString( 50 , "Extraction de l'axe ");
00273 SetString( 55 , "2 ");
00274 SetString( 60 , "Quantification ");
00275 SetString( 65 , "Placez un premier point. ");
00276 SetString( 70 , "(Double clique au-dessus de l'artre d'intrt.) ");
00277 SetString( 73 , "OK ");
00278 SetString( 75 , "Commencer 3D ");
00279 SetString( 80 , "Plan ");
00280 SetString( 85 , "Paramtres ");
00281 SetString( 90 , "Coupe ");
00282 SetString( 205 , "Coupe saine ");
00283 SetString( 210 , "Section perpendiculaire ");
00284 SetString( 215 , "Visibilit des anneaux ");
00285 SetString( 220 , "Montrer la surface ");
00286 SetString( 225 , "Opacit ");
00287 SetString( 230 , "Niveaux des gris ");
00288 SetString( 235 , "Couleur ");
00289 SetString( 240 , "Isovaleur ");
00290 SetString( 245 , "Ajouter un marqueur de coupe ");
00291 SetString( 248 , "Enregistre les contours ");
00292 SetString( 250 , "Effacer un marqueur de coupe ");
00293 SetString( 253 , "Effacer les marquer des coupes ");
00294 SetString( 255 , "Stnoses (surface) ");
00295 SetString( 260 , "Stnoses (diamtre ) ");
00296 SetString( 265 , "Recherche des stnoses ");
00297 SetString( 270 , "Recherche automatique de la stnose ");
00298 SetString( 273 , "0 ");
00299 SetString( 275 , "Choisissez ");
00300 SetString( 280 , " la coupe ");
00301 SetString( 283 , "1 ");
00302 SetString( 285 , "Valider la ");
00303 SetString( 290 , "coupe saine ");
00304 SetString( 293 , "2 ");
00305 SetString( 295 , "Valider la fin ");
00306 SetString( 300 , "de la rgion ");
00307 SetString( 303 , "3 ");
00308 SetString( 305 , " Chercher ");
00309 SetString( 310 , " stnoses ");
00310 SetString( 315 , "Automatique ");
00311 SetString( 320 , "Manuel ");
00312 SetString( 325 , "Recherche manuel de la stnose ");
00313 SetString( 328 , "0 ");
00314 SetString( 330 , "Choisir ");
00315 SetString( 335 , " la coupe ");
00316 SetString( 338 , "1 ");
00317 SetString( 340 , " Choisissez ");
00318 SetString( 345 , "autre coupe ");
00319 SetString( 348 , "2 ");
00320 SetString( 350 , "Valider la ");
00321 SetString( 355 , "coupe saine ");
00322 SetString( 360 , "Taille de rgion saine ");
00323 SetString( 365 , "Taille de rgion saine ");
00324 SetString( 370 , "( 2xn+1 ) ");
00325 SetString( 373 , "n : ");
00326 SetString( 375 , "Rgnrer la rgion saine ");
00327 SetString( 380 , "Longeur total de l'axe ");
00328 SetString( 385 , "Longueur du segment ");
00329 SetString( 390 , "Surface ");
00330 SetString( 395 , "Surface de ref. ");
00331 SetString( 400 , "Primtre ");
00332 SetString( 405 , "Diamtre minimum ");
00333 SetString( 410 , "Diamtre maximum ");
00334 SetString( 415 , "Diamtre moyen ");
00335 SetString( 420 , "Diamtre moyen de ref. ");
00336 SetString( 500 , "Paramtres de MARACAS... ");
00337 SetString( 505 , "Paramtres du contour ");
00338 SetString( 510 , "Algorithme pour le calcule de contour ");
00339 SetString( 515 , "% Seuillage ");
00340 SetString( 520 , "Debug ");
00341 SetString( 525 , "Montrer diamtre? ");
00342 SetString( 530 , "Paramtres de l'axe ");
00343 SetString( 535 , "Paramtres d'extraction ");
00344 SetString( 540 , "Coefficient de flexion: ");
00345 SetString( 545 , "Coefficient de tension : ");
00346 SetString( 550 , "Taille du masque (2*n+1), n: ");
00347 SetString( 555 , "Pas de discrtisation pour l'axe (1/N): ");
00348 SetString( 560 , "OK ");
00349 SetString( 565 , "Annule ");
00350 SetString( 570 , "Dfaut ");
00351 SetString( 575 , "Remise ");
00352 SetString( 580 , "Appliquer ");
00353 SetString( 605 , "La taille de masque a t modifie. ");
00354 SetString( 610 , "Le seuil a t modifi . ");
00355 SetString( 615 , "Le coefficient de flexion a t modifi. ");
00356 SetString( 620 , "Le coefficient de tension a t modifi . ");
00357 SetString( 625 , "Le pas de discrtisations a t modifi. ");
00358 SetString( 630 , " L'axe sera rgnr et les coupes seront effaces. ");
00359 SetString( 635 , " Tous les contours seront effacs. ");
00360 SetString( 640 , " Voulez-vous continuer ? ");
00361 SetString( 645 , "Atention ");
00362 SetString( 650 , " % Seuillage : ");
00363 SetString( 655 , "Diamtres visible? ");
00364 SetString( 660 , "Coefficient de flexion: ");
00365 SetString( 665 , "Coefficient de tension: ");
00366 SetString( 670 , "Taille du masque (2*n+1). n: ");
00367 SetString( 675 , "Pas de discrtisations pour l'axe (1/N): ");
00368 SetString( 680 , "OK ");
00369 SetString( 685 , "Annule ");
00370 SetString( 690 , "Rinitialisation ");
00371 SetString( 695 , "Appliquez ");
00372 SetString( 700 , "Dfaut ");
00373 SetString( 710 , "Paramtres de MARACAS... ");
00374 SetString( 720 , "Extraction de paramtres ");
00375 SetString( 725 , "Debug ");
00376 SetString( 730 , "Algorithme pour le calcul de contour ");
00377 SetString( 735 , "Paramtres du contour ");
00378 SetString( 740 , "Paramtres de l'axe ");
00379 SetString( 745 , "Invertir l'ordre des coupes ");
00380 SetString( 800 , "Contour modification ");
00381 SetString( 803 , "Modification du contour ");
00382 SetString( 805 , "1 ");
00383 SetString( 810 , "2 ");
00384 SetString( 815 , "3 ");
00385 SetString( 820 , "Nouveau ");
00386 SetString( 825 , "contour ");
00387 SetString( 830 , "Remplacer ");
00388 SetString( 835 , "Fin ");
00389 SetString( 840 , "Insertion de point ");
00390 SetString( 845 , "Effacement de point ");
00391 SetString( 850 , "Dplacement de point ");
00392 SetString( 855 , "Bouton gauche de la sourie ");
00393 SetString( 860 , "pour crer le contour. ");
00394 SetString( 865 , "Atention ");
00395 SetString( 870 , "Cette option efface tous les contours 3D. ");
00396 SetString( 875 , "Voulez-vous continuer ? ");
00397 SetString( 905 , "Dfinissez un point initial. ");
00398 SetString( 910 , "(Double clique sur le vaisseau d'intrt.) ");
00399 SetString( 915 , "Le point initial doit tre ");
00400 SetString( 920 , "loin des bords du volume. ");
00401 SetString( 925 , "Seuil ");
00402 SetString( 930 , "Intensit du Lumen % ");
00403 SetString( 935 , "Intensit des calcifications % ");
00404 SetString( 940 , "Control du contour ");
00405
00406 }
00407
00408 void marDictionary::LoadDictionary_Japanese (){
00409 ResetDictionary();
00410 SetLanguage(3);
00411 }
00412
00413 void marDictionary::FreeDictionary(){
00414 int i,size=_frases->size();
00415 for (i=0;i < size;i++){
00416 marDictFrase* tmp=(*_frases)[i];
00417 delete tmp;
00418 }
00419 _frases->clear();
00420 }
00421
00422
00423 void marDictionary::SetLanguage(int language){
00424 _language=language;
00425 }
00426
00427 char* marDictionary::GetString(int idfrase){
00428 int i,size;
00429 char *result=NULL;
00430 size=_frases->size();
00431 for (i=0;i<size;i++){
00432 marDictFrase* tmp=(*_frases)[i];
00433 if (tmp->GetIdFrase()==idfrase){
00434 result=tmp->GetFrase();
00435 }
00436 }
00437 if (result==NULL){
00438 sprintf(_emptyStr,"(...%d-%d...)",_language,idfrase);
00439 result=_emptyStr;
00440 }
00441 return result;
00442 }
00443
00444 int marDictionary::GetLanguage(){
00445 return _language;
00446 }
00447
00448 void marDictionary::SetString(int id,char *ss){
00449 if (_frases!=NULL){
00450 marDictFrase *mf = new marDictFrase(id,ss);
00451 _frases->push_back(mf);
00452 }
00453 }
00454
00455