[Insight-users] A memory issue

Kevin Keraudren kevin.keraudren10 at imperial.ac.uk
Mon Jan 23 03:32:20 EST 2012


Le 22/01/2012 22:35, Ali Mouizina a écrit :
> 	Weightimage::SizeType size;
> 	size[0]=nb_col; //->  nb_col is set in the constructor
> 	size[1]=nb_ln;
> 	size[2]=nb_slice;
> 	size[3]=124;
>
> 	for (int l=0;l<124;l++){ // -->  After a few iterations it crashes
> 		for (int i=0;i<nb_ln;i++)
> 			for (int j=0;j<nb_col;j++)
> 				for (int k=0;k<nb_slice;k++){
> 					pixelIndex_weight[0]=j;
> 					pixelIndex_weight[1]=i;
> 					pixelIndex_weight[2]=k;
> 					pixelIndex_weight[3]=l;

Why don't you put your coordinates in the same order as in the 
definition of the size variable?


     for (int i=0; i<nb_col; i++){
         for (int j=0;j<nb_ln; j++)
             for (int k=0; k<nb_slice; k++)
                 for (int l=0; l<124; l++){

                     pixelIndex_weight[0]=i;
                     pixelIndex_weight[1]=j;
                     pixelIndex_weight[2]=k;
                     pixelIndex_weight[3]=l;

Also, this is not a bug, but wouldn't it be nicer to write 152 instead 
of 'ÿ'?

Kind regards,

Kevin




More information about the Insight-users mailing list