]> Creatis software - creaMaracasVisu.git/commitdiff
2041 Feature box SliceImage of XY,YZ,XZ and FREE planes
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 9 Jul 2013 20:56:39 +0000 (22:56 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 9 Jul 2013 20:56:39 +0000 (22:56 +0200)
bbtk/src/bbcreaMaracasVisuSliceImage.cxx

index 9b015c22aeda7dc3d9e006a02b452e7dbaf8e5a4..10306c6f34b3fc7a16292bc9746365c101369cc2 100644 (file)
@@ -42,6 +42,12 @@ void SliceImage::Process()
          imageReslice->SetInput( bbGetInputIn() );
          imageReslice->SetInformationInput(bbGetInputIn() );
 
+         double slice=bbGetInputSlice();
+         if (slice<0) 
+          { 
+               slice=0;
+          } 
+       
          if (bbGetInputTypeOrientation()==3)
          {
                // Orientation 3 = FREE
@@ -59,7 +65,7 @@ void SliceImage::Process()
                                                              bbGetInputResliceAxesDirectionCosines()[5],  // v2z
                                                              bbGetInputResliceAxesDirectionCosines()[8]   // v3z
                                                            );  
-              imageReslice->SetResliceAxesOrigin( bbGetInputSlice()*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
+              imageReslice->SetResliceAxesOrigin( slice*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
          } else if (bbGetInputTypeOrientation()==2)
          {
                // Orientation 2 = YZ
@@ -68,7 +74,7 @@ void SliceImage::Process()
                // v3 = [ 0 ,-1 , 0 ]
                // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
               imageReslice->SetResliceAxesDirectionCosines(0,1,0, 0,0,-1 ,-1,0,0);  
-              imageReslice->SetResliceAxesOrigin( bbGetInputSlice()*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
+              imageReslice->SetResliceAxesOrigin( slice*bbGetInputIn()->GetSpacing()[0] ,0 ,0);
          } else if (bbGetInputTypeOrientation()==1) {     
                // Orientation 1 = XZ
                // v1 = [ 1 , 0 , 0 ]
@@ -76,7 +82,7 @@ void SliceImage::Process()
                // v3 = [ 0 ,-1 , 0 ]
                // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,-1 ,0,1,0); 
-              imageReslice->SetResliceAxesOrigin(0, bbGetInputSlice()*bbGetInputIn()->GetSpacing()[1],0 );
+              imageReslice->SetResliceAxesOrigin(0, slice*bbGetInputIn()->GetSpacing()[1],0 );
          } else    
          {
                // Orientation 0 = XY
@@ -85,7 +91,7 @@ void SliceImage::Process()
                // v3 = [ 0 , 0 , 1 ]
                // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z);
               imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);   
-              imageReslice->SetResliceAxesOrigin(0,0, bbGetInputSlice()*bbGetInputIn()->GetSpacing()[2] );
+              imageReslice->SetResliceAxesOrigin(0,0, slice*bbGetInputIn()->GetSpacing()[2] );
          } 
          imageReslice->SetOutputDimensionality(2);
          imageReslice->SetInterpolationModeToLinear();