From: Eduardo DAVILA Date: Mon, 10 Jun 2013 15:26:19 +0000 (+0200) Subject: 2041 Feature box SliceImage of XY,YZ,XZ and FREE planes X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b4bce14f26c91c5baae09cbba7fb1af9c8f22e86;p=creaMaracasVisu.git 2041 Feature box SliceImage of XY,YZ,XZ and FREE planes --- diff --git a/bbtk/src/bbcreaMaracasVisuSliceImage.cxx b/bbtk/src/bbcreaMaracasVisuSliceImage.cxx index d8a4b75..03cbf72 100644 --- a/bbtk/src/bbcreaMaracasVisuSliceImage.cxx +++ b/bbtk/src/bbcreaMaracasVisuSliceImage.cxx @@ -34,7 +34,6 @@ BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SliceImage) BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox); void SliceImage::Process() { - //printf("EED 0 SliceImage::Process \n"); vtkImageData *imagedata=NULL; //std::cout<<"MSJ: test SliceImage::Process()"<SetInput( bbGetInputIn() ); imageReslice->SetInformationInput(bbGetInputIn() ); - if (bbGetInputTypeOrientation()==2) + + if (bbGetInputTypeOrientation()==3) + { + // Orientation 3 = FREE + // v1 = [ v1x , v1y , v1z ] + // v2 = [ v2x , v2y , v2z ] + // v3 = [ v3x , v3y , v3z ] + // SetResliceAxesDirectionCosines(v1x,v2x,v3x,v1y,v2y,v3y,v1z,v2z,v3z); + imageReslice->SetResliceAxesDirectionCosines( bbGetInputResliceAxesDirectionCosines()[0], // v1x + bbGetInputResliceAxesDirectionCosines()[3], // v2x + bbGetInputResliceAxesDirectionCosines()[6], // v3x + bbGetInputResliceAxesDirectionCosines()[1], // v1y + bbGetInputResliceAxesDirectionCosines()[4], // v2y + bbGetInputResliceAxesDirectionCosines()[7], // v3y + bbGetInputResliceAxesDirectionCosines()[2], // v1z + bbGetInputResliceAxesDirectionCosines()[5], // v2z + bbGetInputResliceAxesDirectionCosines()[8] // v3z + ); + imageReslice->SetResliceAxesOrigin( bbGetInputSlice()*bbGetInputIn()->GetSpacing()[0] ,0 ,0); + } else if (bbGetInputTypeOrientation()==2) { - imageReslice->SetResliceAxesDirectionCosines(0,0,-1, 1,0,0 ,0,-1,0); // 2=YZ - imageReslice->SetResliceAxesOrigin( bbGetInputZ()*bbGetInputIn()->GetSpacing()[0] ,0 ,0); + // Orientation 2 = YZ + // v1 = [ 0 , 0 ,-1 ] + // v2 = [ 1 , 0 , 0 ] + // 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); } else if (bbGetInputTypeOrientation()==1) { - imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,0,-1 ,0,1,0); // 1=XZ - imageReslice->SetResliceAxesOrigin(0, bbGetInputZ()*bbGetInputIn()->GetSpacing()[1],0 ); + // Orientation 1 = XZ + // v1 = [ 1 , 0 , 0 ] + // v2 = [ 0 , 0 , 1 ] + // 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 ); } else { - imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1); // 0=XY - imageReslice->SetResliceAxesOrigin(0,0, bbGetInputZ()*bbGetInputIn()->GetSpacing()[2] ); + // Orientation 0 = XY + // v1 = [ 1 , 0 , 0 ] + // v2 = [ 0 , 1 , 0 ] + // 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->SetOutputDimensionality(2); imageReslice->SetInterpolationModeToLinear(); imagedata = imageReslice->GetOutput(); imagedata->Update(); imagedata->UpdateInformation(); - //printf("EED 1 SliceImage::Process %p\n", imagedata); } bbSetOutputOut( imagedata ); } @@ -71,8 +103,22 @@ void SliceImage::Process() { bbSetInputIn(NULL); bbSetInputZ(0); + bbSetInputSlice(0); bbSetInputTypeOrientation(0); imageReslice=NULL; + std::vector lstCos; + lstCos.push_back(1); // v1x + lstCos.push_back(0); // v1y + lstCos.push_back(0); // v1z + + lstCos.push_back(0); // v2x + lstCos.push_back(1); // v2y + lstCos.push_back(0); // v2z + + lstCos.push_back(0); // v3x + lstCos.push_back(0); // v3y + lstCos.push_back(1); // v3z + bbSetInputResliceAxesDirectionCosines(lstCos); } //----------------------------------------------------------------- diff --git a/bbtk/src/bbcreaMaracasVisuSliceImage.h b/bbtk/src/bbcreaMaracasVisuSliceImage.h index b02f2ea..f1ed07a 100644 --- a/bbtk/src/bbcreaMaracasVisuSliceImage.h +++ b/bbtk/src/bbcreaMaracasVisuSliceImage.h @@ -42,7 +42,9 @@ class bbcreaMaracasVisu_EXPORT SliceImage BBTK_BLACK_BOX_INTERFACE(SliceImage,bbtk::AtomicBlackBox); BBTK_DECLARE_INPUT(In,vtkImageData*); BBTK_DECLARE_INPUT(Z, double ); + BBTK_DECLARE_INPUT(Slice, double ); BBTK_DECLARE_INPUT(TypeOrientation, int ); + BBTK_DECLARE_INPUT(ResliceAxesDirectionCosines, std::vector ); BBTK_DECLARE_OUTPUT(Out,vtkImageData*); BBTK_PROCESS(Process); void Process(); @@ -57,8 +59,10 @@ BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr"); 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_INPUT(SliceImage,Slice,"Slice",double,""); +BBTK_INPUT(SliceImage,Z,"Z (deprecated)",double,""); +BBTK_INPUT(SliceImage,ResliceAxesDirectionCosines,"ResliceAxesDirectionCosines [v1x,v1y,v1z,v2x,v2y,v2z,v3x,v3y,v3z], ",std::vector,""); +BBTK_INPUT(SliceImage,TypeOrientation,"Type orientation (default 0) 0=XY, 1=XZ, 2=YZ, 3=Free (Set the input ResliceAxesDirectionCosines)",int,""); BBTK_OUTPUT(SliceImage,Out,"Output image",vtkImageData *,""); BBTK_END_DESCRIBE_BLACK_BOX(SliceImage); }