]> Creatis software - creaMaracasVisu.git/commitdiff
2027 FeatureImageSlice Create differents Orientations
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 6 Jun 2013 06:06:56 +0000 (08:06 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 6 Jun 2013 06:06:56 +0000 (08:06 +0200)
bbtk/src/bbcreaMaracasVisuSliceImage.cxx
bbtk/src/bbcreaMaracasVisuSliceImage.h

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;
        }
        
index ac1cd50846d3d609b8ae73bd5a3304184f282264..b02f2eaabfaa3f006095040cda6115aeebb9b2c1 100644 (file)
@@ -42,6 +42,7 @@ class bbcreaMaracasVisu_EXPORT SliceImage
   BBTK_BLACK_BOX_INTERFACE(SliceImage,bbtk::AtomicBlackBox);
   BBTK_DECLARE_INPUT(In,vtkImageData*);
   BBTK_DECLARE_INPUT(Z, double );
+  BBTK_DECLARE_INPUT(TypeOrientation, int );
   BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
@@ -57,6 +58,7 @@ BBTK_DESCRIPTION("filter");
 BBTK_CATEGORY("");
 BBTK_INPUT(SliceImage,In,"Input image",vtkImageData *,"");
 BBTK_INPUT(SliceImage,Z,"Z",double,"");
+BBTK_INPUT(SliceImage,TypeOrientation,"Type orientation (default 0) 0=XY 1=XZ 2=YZ",int,"");
 BBTK_OUTPUT(SliceImage,Out,"Output image",vtkImageData *,"");
 BBTK_END_DESCRIBE_BLACK_BOX(SliceImage);
 }