]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 22 Nov 2017 06:57:01 +0000 (01:57 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Wed, 22 Nov 2017 06:57:01 +0000 (01:57 -0500)
appli/CTBronchi/AndSegmentations.cxx [new file with mode: 0644]
appli/CTBronchi/CMakeLists.txt
appli/CTBronchi/Process.sh

diff --git a/appli/CTBronchi/AndSegmentations.cxx b/appli/CTBronchi/AndSegmentations.cxx
new file mode 100644 (file)
index 0000000..4bd76a7
--- /dev/null
@@ -0,0 +1,81 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <string>
+#include <tclap/CmdLine.h>
+#include <itkImage.h>
+#include <itkAndImageFilter.h>
+#include "Functions.h"
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 3;
+typedef unsigned char             TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  typedef TCLAP::ValueArg< std::string > _TStringArg;
+
+  // Parse input line
+  _TStringArg in1( "i", "input1", "Input image 1", true, "", "file" );
+  _TStringArg in2( "j", "input2", "Input image 2", true, "", "file" );
+  _TStringArg out( "o", "output", "Output image", true, "", "file" );
+  try
+  {
+    TCLAP::CmdLine cmd( "FastRandomWalker", ' ', "1.0.0" );
+    cmd.add( out );
+    cmd.add( in2 );
+    cmd.add( in1 );
+    cmd.parse( argc, argv );
+  }
+  catch( TCLAP::ArgException& err )
+  {
+    std::cerr
+      << "===============================" << std::endl
+      << "Error caught: " << std::endl
+      << err.error( ) << " " << err.argId( ) << std::endl
+      << "===============================" << std::endl
+      << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  try
+  {
+    // Read input image 1
+    TImage::Pointer input_image1;
+    CTBronchi::ReadImage( input_image1, in1.getValue( ) );
+
+    // Read input image 2
+    TImage::Pointer input_image2;
+    CTBronchi::ReadImage( input_image2, in2.getValue( ) );
+
+    // And images
+    typedef itk::AndImageFilter< TImage, TImage, TImage > TFilter;
+    TFilter::Pointer filter = TFilter::New( );
+    filter->SetInput1( input_image1 );
+    filter->SetInput2( input_image2 );
+    double t = CTBronchi::MeasureTime( filter );
+    std::cout << "And filter executed in " << t << " s" << std::endl;
+
+    // Write result
+    CTBronchi::WriteImage( filter->GetOutput( ), out.getValue( ) );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr
+      << "===============================" << std::endl
+      << "Error caught: " << std::endl
+      << err.what( ) << std::endl
+      << "===============================" << std::endl
+      << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
index 79a58ad24cdb82bba14070aa348e03b11ecbd211..5f10a8ed58718c72f11c32b167c756aeafe2d205 100644 (file)
@@ -12,6 +12,7 @@ if(fpa_BUILD_CTBronchi)
     MoriLabelling
     FastRandomWalker
     SliceBySliceRandomWalker
+    AndSegmentations
     )
   foreach(_e ${_examples})
     BuildApplication(
@@ -22,6 +23,16 @@ if(fpa_BUILD_CTBronchi)
       LINKS fpa cpPlugins::tclap
       )
   endforeach(_e)
+
+  configure_file(
+    Process.sh
+    ${PROJECT_BINARY_DIR}/${_pfx}Process.sh
+    COPYONLY
+    )
+  install(
+    FILES ${PROJECT_BINARY_DIR}/${_pfx}Process.sh
+    DESTINATION bin
+    )
 endif(fpa_BUILD_CTBronchi)
 
 ## eof - $RCSfile$
index bebf539f5a067b7ea35a3035cec1b52eb77908e6..47954b752fac95797956d3c0e1313a180255f1a1 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 ## -- Command line options
+exec_dir=`dirname $0`
 vesselness_sigma="0.5"
 vesselness_alpha1="0.5"
 vesselness_alpha2="2"
@@ -11,7 +12,8 @@ mori_signal_influence="0.5"
 mori_lower="-1024"
 mori_upper="0"
 mori_delta="1"
-labels_vesselness_thr="5"
+slicebyslice_vesselness_thr="5"
+fast_vesselness_thr="95"
 labels_upper_thr="-400"
 beta="2.5"
 epsilon="1e-5"
@@ -65,8 +67,12 @@ while [[ "$#" -gt 0 ]]; do
         mori_delta="$2"
         shift
         ;;
-        -labels_vesselness_thr)
-        labels_vesselness_thr="$2"
+        -slicebyslice_vesselness_thr)
+        slicebyslice_vesselness_thr="$2"
+        shift
+        ;;
+        -fast_vesselness_thr)
+        fast_vesselness_thr="$2"
         shift
         ;;
         -labels_upper_thr)
@@ -114,13 +120,13 @@ echo "************************************************"
 (>&2 echo "Processing $input... ")
 echo "Processing $input..."
 if [ ! -f $vesselness ] || [ -n "$force" ] ; then
-    ./fpa_CTBronchi_Vesselness \
+    $exec_dir/fpa_CTBronchi_Vesselness \
         -i $input -o $vesselness \
         -s $vesselness_sigma -a $vesselness_alpha1 -b $vesselness_alpha2
 fi
 
 if [ ! -f $mori ] || [ -n "$force" ] ; then
-    ./fpa_CTBronchi_MoriSegmentation \
+    $exec_dir/fpa_CTBronchi_MoriSegmentation \
         -i $input \
         -o $mori \
         -s $mori_signal \
@@ -135,17 +141,17 @@ if [ ! -f $mori ] || [ -n "$force" ] ; then
 fi
 
 if [ ! -f $labels ] || [ -n "$force" ] ; then
-    ./fpa_CTBronchi_MoriLabelling \
+    $exec_dir/fpa_CTBronchi_MoriLabelling \
         -i $input \
         -l $mori \
         -v $vesselness \
         -o $labels \
-        -a $labels_vesselness_thr \
+        -a $fast_vesselness_thr \
         -u $labels_upper_thr
 fi
 
 if [ ! -f $fastrw ] || [ -n "$force" ] ; then
-    ./fpa_CTBronchi_FastRandomWalker \
+    $exec_dir/fpa_CTBronchi_FastRandomWalker \
         -i $input \
         -l $labels \
         -o $fastrw \
@@ -154,12 +160,12 @@ if [ ! -f $fastrw ] || [ -n "$force" ] ; then
 fi
 
 if [ ! -f $slicerw ] || [ -n "$force" ] ; then
-    ./fpa_CTBronchi_SliceBySliceRandomWalker \
+    $exec_dir/fpa_CTBronchi_SliceBySliceRandomWalker \
         -i $input \
         -l $mori \
         -v $vesselness \
         -o $slicerw \
-        -t $labels_vesselness_thr \
+        -t $slicebyslice_vesselness_thr \
         -b $beta \
         -e $epsilon
 fi