]> Creatis software - creaMaracasVisu.git/commitdiff
no message
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Wed, 11 Apr 2012 15:41:06 +0000 (15:41 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Wed, 11 Apr 2012 15:41:06 +0000 (15:41 +0000)
bbtk/src/bbmaracasvisuImageChangeInformation.cxx
bbtk/src/bbmaracasvisuImageChangeInformation.h

index 7837d67e2ed56898ad62708f811b2cf08d304059..fecd553f35f348c6a31703ece26ca061047fa489 100644 (file)
@@ -9,6 +9,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ImageChangeInformation,bbtk::AtomicBlackBox);
 void ImageChangeInformation::Process()
 {
        int ext[6];
+       double spc[3];
        vtkImageData* img = bbGetInputIn();
        if(img!=NULL){
                if(mchange != NULL){
@@ -19,6 +20,16 @@ void ImageChangeInformation::Process()
                mchange->SetInput( img );
                mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
                mchange->SetOutputOrigin (0, 0, 0);
+               
+               if (bbGetInputNewSpacing().size()==3)
+               {
+                       spc[0] = bbGetInputNewSpacing()[0];
+                       spc[1] = bbGetInputNewSpacing()[1];
+                       spc[2] = bbGetInputNewSpacing()[2];
+                       mchange->SetOutputSpacing( spc[0] , spc[1] , spc [2] );    //spacing
+               }
+               
+               
                mchange->Update();    //important
                
                bbSetOutputOut( mchange->GetOutput() );
index be986bde72ee20a523de2449e942a8052865f448..4ea82ad3a375a30f93bdf705adce75b73891bbd0 100644 (file)
@@ -14,8 +14,10 @@ class /*BBTK_EXPORT*/ ImageChangeInformation
    public bbtk::AtomicBlackBox
 {
   BBTK_BLACK_BOX_INTERFACE(ImageChangeInformation,bbtk::AtomicBlackBox);
-  BBTK_DECLARE_INPUT(In,vtkImageData*);
-  BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
+       BBTK_DECLARE_INPUT(In,vtkImageData*);
+       BBTK_DECLARE_INPUT(NewSpacing,std::vector<double>);
+       
+       BBTK_DECLARE_OUTPUT(Out,vtkImageData*);
   BBTK_PROCESS(Process);
   void Process();
 
@@ -28,9 +30,10 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ImageChangeInformation,bbtk::AtomicBlackBox);
 BBTK_NAME("ImageChangeInformation");
 BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
 BBTK_DESCRIPTION("vtkImageData change information. Translate extern to 0,0,0");
-  BBTK_CATEGORY("filter");
-  BBTK_INPUT(ImageChangeInformation,In,"Input image",vtkImageData*,"");
-  BBTK_OUTPUT(ImageChangeInformation,Out,"Output image",vtkImageData*,"");
+       BBTK_CATEGORY("filter");
+       BBTK_INPUT(ImageChangeInformation,In,"Input image",vtkImageData*,"");
+       BBTK_INPUT(ImageChangeInformation,NewSpacing,"New spacing of the image (default: the same spacing of the original image)",std::vector<double>,"");
+       BBTK_OUTPUT(ImageChangeInformation,Out,"Output image",vtkImageData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(ImageChangeInformation);
 }
 // EO namespace bbcreaMaracasVisu