X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Lib%2FSpatioTemporalMeanShift%2FitkSTMS_BlurringSTMS.txx;fp=Lib%2FSpatioTemporalMeanShift%2FitkSTMS_BlurringSTMS.txx;h=1e37fbdb3581916f6fbad649bc4d79187477345c;hb=52d9a4ff6a971908206fcb9bed99942480de4ef8;hp=8dda23294f68d22d78f162114c33d79b41374739;hpb=bd84bb06e5d774db2969d836670bddefbed6a1b9;p=STMS.git diff --git a/Lib/SpatioTemporalMeanShift/itkSTMS_BlurringSTMS.txx b/Lib/SpatioTemporalMeanShift/itkSTMS_BlurringSTMS.txx index 8dda232..1e37fbd 100755 --- a/Lib/SpatioTemporalMeanShift/itkSTMS_BlurringSTMS.txx +++ b/Lib/SpatioTemporalMeanShift/itkSTMS_BlurringSTMS.txx @@ -60,6 +60,7 @@ #ifndef itkSTMS_BlurringSTMS_TXX #define itkSTMS_BlurringSTMS_TXX +#include #include #include #include @@ -524,7 +525,7 @@ void itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType > ::FinalMerging() { - unsigned int size = INFINITY; + unsigned int size = std::numeric_limits::max() - 1; // INFINITY; std::string imagePath = expDescription->experimentPath+expDescription->inputFolder+expDescription->inputCommonRoot+STMS_NUMBERING_FORM_ONE+expDescription->imageExtension; while(size > classSet->size()){ @@ -628,7 +629,8 @@ itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType > idx[0] = refClass->at(m)[0]+x; idx[1] = refClass->at(m)[1]+y; - if(idx[0]GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]GetBufferedRegion().GetSize()[1] && idx[1]>0) + if( ( idx[0] < static_cast(image->GetBufferedRegion().GetSize()[0]) ) && (idx[0]>0) + && (idx[1] < static_cast(image->GetBufferedRegion().GetSize()[1]) ) && (idx[1]>0) ) { if(image->GetPixel(idx) == 2) { @@ -656,7 +658,8 @@ itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType > idx[0] = candClass->at(m)[0]+x; idx[1] = candClass->at(m)[1]+y; - if(idx[0]GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]GetBufferedRegion().GetSize()[1] && idx[1]>0) + if( ( idx[0] < static_cast(image->GetBufferedRegion().GetSize()[0]) ) && ( idx[0] > 0 ) + && ( idx[1] < static_cast(image->GetBufferedRegion().GetSize()[1]) ) && ( idx[1] > 0 ) ) { if(image->GetPixel(idx) == 1) { @@ -691,7 +694,9 @@ itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType > idx[1] = refClass->at(m)[1]+y; idx[2] = refClass->at(m)[2]+z; - if(idx[0]GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]GetBufferedRegion().GetSize()[1] && idx[1]>0 && idx[2]GetBufferedRegion().GetSize()[2] && idx[2]>0) + if( ( idx[0] < static_cast(image->GetBufferedRegion().GetSize()[0]) ) && (idx[0] > 0) && + ( idx[1] < static_cast(image->GetBufferedRegion().GetSize()[1]) ) && (idx[1] > 0) && + ( idx[2] < static_cast(image->GetBufferedRegion().GetSize()[2]) ) && (idx[2] > 0) ) { if(image->GetPixel(idx) == 2) { @@ -724,7 +729,9 @@ itkSTMS_BlurringSTMS< IndexType, SpatialType, PixelType, ImageType > idx[1] = candClass->at(m)[1]+y; idx[2] = candClass->at(m)[2]+z; - if(idx[0]GetBufferedRegion().GetSize()[0] && idx[0]>0 && idx[1]GetBufferedRegion().GetSize()[1] && idx[1]>0 && idx[2]GetBufferedRegion().GetSize()[2] && idx[2]>0) + if( ( idx[0] < static_cast(image->GetBufferedRegion().GetSize()[0]) ) && ( idx[0] > 0 ) && + ( idx[1] < static_cast(image->GetBufferedRegion().GetSize()[1]) ) && ( idx[1] > 0 ) && + ( idx[2] < static_cast(image->GetBufferedRegion().GetSize()[2]) ) && ( idx[2] > 0 ) ) { if(image->GetPixel(idx) == 1) {