]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbcreaMaracasVisuSliceImage.cxx
2027 FeatureImageSlice Create differents Orientations
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuSliceImage.cxx
index 06b3df614bd82df9efc2e375318e3c4961e619b3..f55ea4703c40cff05c617ee760f19695708b5a3a 100644 (file)
@@ -38,19 +38,31 @@ void SliceImage::Process()
        vtkImageData *imagedata=NULL;
 
        //std::cout<<"MSJ: test SliceImage::Process()"<<this<<std::endl;
-       if ( bbGetInputIn()!=NULL ){
-
+       if ( bbGetInputIn()!=NULL )
+       {
          imageReslice->SetInput( bbGetInputIn() );
          imageReslice->SetInformationInput(bbGetInputIn() );
-         imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
+
+         if (bbGetInputTypeOrientation()==2)
+         {
+              imageReslice->SetResliceAxesDirectionCosines(0,0,1, 1,0,0 ,0,1,0);  // 2=YZ
+         } else if (bbGetInputTypeOrientation()==1) {     
+              imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,-1 ,0,1,0);  // 1=XZ
+         } else    
+         {
+              imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);   // 0=XY
+         } 
+
+
+
          imageReslice->SetResliceAxesOrigin(0,0, bbGetInputZ()*bbGetInputIn()->GetSpacing()[2] );
          imageReslice->SetOutputDimensionality(2);
          imageReslice->SetInterpolationModeToLinear();
-          imagedata = imageReslice->GetOutput();
+         imagedata = imageReslice->GetOutput();
          imagedata->Update();
          imagedata->UpdateInformation();       
          //printf("EED 1 SliceImage::Process %p\n", imagedata);
-  }
+       }
   bbSetOutputOut( imagedata );
 }
        
@@ -60,6 +72,7 @@ void SliceImage::Process()
        {
                bbSetInputIn(NULL);
                bbSetInputZ(0);
+               bbSetInputTypeOrientation(0);
                imageReslice=NULL;
        }