From e83dea4e0109933a006bfd8960972e6a559fce15 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Mon, 18 Jul 2011 17:00:21 +0200 Subject: [PATCH] create_mhd_4D - avoid recusrive directory searches + find -maxdepth 1 ... --- ...clitkConditionalBinaryDilateImageFilter.txx | 6 +++--- scripts/create_mhd_4D.sh | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/itk/clitkConditionalBinaryDilateImageFilter.txx b/itk/clitkConditionalBinaryDilateImageFilter.txx index 2059f9d..f3c66d3 100644 --- a/itk/clitkConditionalBinaryDilateImageFilter.txx +++ b/itk/clitkConditionalBinaryDilateImageFilter.txx @@ -277,9 +277,9 @@ namespace clitk IndexType idx = tmpRegIndexIt.GetIndex() + *itIdx; if( outputRegion.IsInside( idx ) ) { - // JV output->SetPixel( idx, static_cast ( foregroundValue ) ); } - if (input->GetPixel(idx)==backgroundValue) - output->SetPixel( idx, static_cast ( foregroundValue ) ); + // JV output->SetPixel( idx, static_cast ( foregroundValue ) ); } + if (input->GetPixel(idx)==backgroundValue) + output->SetPixel( idx, static_cast ( foregroundValue ) ); } } diff --git a/scripts/create_mhd_4D.sh b/scripts/create_mhd_4D.sh index 00df85c..bc51da4 100755 --- a/scripts/create_mhd_4D.sh +++ b/scripts/create_mhd_4D.sh @@ -28,7 +28,7 @@ then exit 1 fi -nb_phase_file=`find $1 -iname "*[0-9]*.mhd" -o -iname "*[0-9]*\]*.mhd" | wc -l` +nb_phase_file=`find $1 -maxdepth 1 -iname "*[0-9]*.mhd" -o -iname "*[0-9]*\]*.mhd" | wc -l` if [ $nb_phase_file = 0 ] then echo "Error: no phase found" @@ -38,7 +38,7 @@ fi ########## CT ######### list_pattern="" -list_phase_file=`find $1 -iname "*[0-9]*.mhd"` +list_phase_file=`find $1 -maxdepth 1 -iname "*[0-9]*.mhd"` for phase_file in $list_phase_file do phase_file_name=`basename $phase_file` @@ -63,9 +63,9 @@ do pattern="" fi - nbph=`find $1 -iname "${pattern}*[0-9]*.mhd" | wc -l` - orig=`find $1 -iname "${pattern}*[0-9]*.mhd" | sort | head -n 1` - listph=`find $1 -iname "${pattern}*[0-9]*.raw" | sort` + nbph=`find $1 -maxdepth 1 -iname "${pattern}*[0-9]*.mhd" | wc -l` + orig=`find $1 -maxdepth 1 -iname "${pattern}*[0-9]*.mhd" | sort | head -n 1` + listph=`find $1 -maxdepth 1 -iname "${pattern}*[0-9]*.raw" | sort` file_name_4D="${pattern}_4D.mhd" echo $file_name_4D @@ -78,7 +78,7 @@ done ############ PET ########### list_pattern="" -list_phase_file=`find $1 -iname "*[0-9]*\]*.mhd"` +list_phase_file=`find $1 -maxdepth 1 -iname "*[0-9]*\]*.mhd"` for phase_file in $list_phase_file do phase_file_name=`basename $phase_file` @@ -103,9 +103,9 @@ do pattern="" fi - nbph=`find $1 -iname "*[0-9]${pattern}\]*.mhd" | wc -l` - orig=`find $1 -iname "*[0-9]${pattern}\]*.mhd" | sort | head -n 1` - listph=`find $1 -iname "*[0-9]${pattern}\]*.raw" | sort` + nbph=`find $1 -maxdepth 1 -iname "*[0-9]${pattern}\]*.mhd" | wc -l` + orig=`find $1 -maxdepth 1 -iname "*[0-9]${pattern}\]*.mhd" | sort | head -n 1` + listph=`find $1 -maxdepth 1 -iname "*[0-9]${pattern}\]*.raw" | sort` file_name_4D=`basename "$orig" | sed "s/[0-9]${pattern}\]/${pattern}\]/;s/_.mhd/_4D.mhd/"` -- 2.45.1