From: Eduardo DAVILA Date: Fri, 20 Dec 2019 07:48:27 +0000 (+0100) Subject: #3329 creaVtk Feature New Normal - new options for Applay mask box X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4cd7fa894ced073f6f803228c4f52755ecf41d75;p=creaVtk.git #3329 creaVtk Feature New Normal - new options for Applay mask box --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx index 264f55e..74a7ce5 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkApplyMask.cxx @@ -34,56 +34,91 @@ void ApplyMask::Process() if ((bbGetInputImage()!=NULL) && (bbGetInputMask()!=NULL)) { - int extImage[6]; + int extImage[6]; + int extMask[6]; + vtkImageData *resultImage=NULL; bbGetInputImage()->GetExtent( extImage ); - int dimXImage = extImage[1]-extImage[0]+1; - int dimYImage = extImage[3]-extImage[2]+1; - int dimZImage = extImage[5]-extImage[4]+1; - - int extMask[6]; bbGetInputImage()->GetExtent( extMask ); - int dimXMask = extMask[1]-extMask[0]+1; - int dimYMask = extMask[3]-extMask[2]+1; - int dimZMask = extMask[5]-extMask[4]+1; + int dimXImage = extImage[1]-extImage[0]+1; + int dimYImage = extImage[3]-extImage[2]+1; + int dimZImage = extImage[5]-extImage[4]+1; + int dimXMask = extMask[1]-extMask[0]+1; + int dimYMask = extMask[3]-extMask[2]+1; + int dimZMask = extMask[5]-extMask[4]+1; + + if (bbGetInputType()==0) + { + if (bbGetOutputOut()!=NULL) + { + bbGetOutputOut()->Delete(); + } + + resultImage = vtkImageData::New(); + resultImage->Initialize(); + resultImage->SetSpacing( bbGetInputImage()->GetSpacing() ); + resultImage->SetDimensions( dimXImage, dimYImage, dimZImage ); + resultImage->AllocateScalars( bbGetInputImage()->GetScalarType(),1 ); + } // if Type==0 + if (bbGetInputType()==1) + { + resultImage=bbGetInputImage(); + } // if Type==1 + + if (bbGetInputType()==2) + { + resultImage=bbGetInputImage(); + } // if Type==2 - if (bbGetOutputOut()!=NULL) + if (bbGetInputType()==3) { - bbGetOutputOut()->Delete(); - } + resultImage=bbGetInputImage(); + } // if Type==3 - vtkImageData *resultImage=NULL; - resultImage = vtkImageData::New(); - resultImage->Initialize(); - resultImage->SetSpacing( bbGetInputImage()->GetSpacing() ); - resultImage->SetDimensions( dimXImage, dimYImage, dimZImage ); - resultImage->AllocateScalars( bbGetInputImage()->GetScalarType(),1 ); - if ((dimXImage==dimXMask) && (dimYImage==dimYMask) && (dimZImage==dimZMask)) { - - long int i, size = dimXImage * dimYImage * dimZImage; #pragma omp parallel for for (i=0; i