]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 22:23:41 +0000 (17:23 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 22:23:41 +0000 (17:23 -0500)
lib/cpExtensions/DataStructures/Skeleton.h
lib/cpInstances/CMakeLists.txt
plugins/CMakeLists.txt
plugins/Extensions/PolyLineParametricPathToSimple3DCurve.h [deleted file]
plugins/ITKIO/ImageReader.cxx
plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.cxx
plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx [moved from plugins/Extensions/PolyLineParametricPathToSimple3DCurve.cxx with 85% similarity]
plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.h [new file with mode: 0644]
plugins/cpExtensions/SkeletonToImageFilter.cxx [new file with mode: 0644]
plugins/cpExtensions/SkeletonToImageFilter.h [new file with mode: 0644]
plugins/cpExtensions/cpExtensions.i [new file with mode: 0644]

index f30b601714b59a490e03d33be62836041087af4c..9d0bd9b6296fabe2ab70993346984bda11054aa3 100644 (file)
@@ -20,6 +20,8 @@ namespace cpExtensions
       typedef typename TIndex::LexicographicCompare TIndexCompare;
       typedef typename TPath::Pointer TPathPointer;
 
+      itkStaticConstMacro( Dimension, unsigned int, _VDim );
+
       typedef Graph< TIndex, TPathPointer, TIndex, TIndexCompare > Superclass;
       typedef Skeleton                        Self;
       typedef itk::SmartPointer< Self >       Pointer;
index fc1eb7e24636cd43f7283284cfe78e842cd028c4..ece1f31bac6473e0f68e1125373d9de8d05ed893 100644 (file)
@@ -71,6 +71,9 @@ CreateLib(
   ${CMAKE_CURRENT_SOURCE_DIR}/Skeleton.cxx
   ${CMAKE_CURRENT_SOURCE_DIR}/Skeleton.h
   ${CMAKE_CURRENT_SOURCE_DIR}/Skeleton.d
+  ${CMAKE_CURRENT_SOURCE_DIR}/Simple3DCurve.cxx
+  ${CMAKE_CURRENT_SOURCE_DIR}/Simple3DCurve.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/Simple3DCurve.d
   )
 
 TARGET_LINK_LIBRARIES(
index c39894952492de5db063edf1b5be96ac99e888af..53d00f8cd5bcd1185dd214183bf10bcb210ec083 100644 (file)
@@ -20,12 +20,7 @@ SET(
   ITKSeparableFilters
   ITKMorphology
   ITKParaMorphology
-  #ITKSliceFilters
-  #ITKGenericFilters
-  #ImageParaMorphologyFilters
-  #ImageThresholdFilters
-  #ImageGradientFilters
-  #Extensions
+  cpExtensions
   )
 
 ## ===============================
diff --git a/plugins/Extensions/PolyLineParametricPathToSimple3DCurve.h b/plugins/Extensions/PolyLineParametricPathToSimple3DCurve.h
deleted file mode 100644 (file)
index 2a11a09..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __cpPluginsExtensions__PolyLineParametricPathToSimple3DCurve__h__
-#define __cpPluginsExtensions__PolyLineParametricPathToSimple3DCurve__h__
-
-#include <cpPluginsExtensions_Export.h>
-#include <cpPlugins/BaseObjects/ProcessObject.h>
-
-namespace cpPluginsExtensions
-{
-  /**
-   */
-  class cpPluginsExtensions_EXPORT PolyLineParametricPathToSimple3DCurve
-    : public cpPlugins::BaseObjects::ProcessObject
-  {
-    cpPluginsObject(
-      PolyLineParametricPathToSimple3DCurve,
-      cpPlugins::BaseObjects::ProcessObject,
-      Extensions
-      );
-  };
-
-} // ecapseman
-
-#endif // __cpPluginsExtensions__PolyLineParametricPathToSimple3DCurve__h__
-
-
-// eof - $RCSfile$
index 64d63a2b3dd4569c0305b7c55a80d7b914a1bf73..b336078ddb12d82010a298ba923a5bb085d1ed25 100644 (file)
@@ -55,12 +55,18 @@ _GenerateData( )
 {
   // Get filenames
   auto fnames = this->m_Parameters.GetOpenFileNameList( "FileNames" );
+  std::string fname = "";
   if( fnames.size( ) > 1 )
   {
     std::stringstream fname_str;
     fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
-    std::string fname = fname_str.str( );
+    fname = fname_str.str( );
+  }
+  else if( fnames.size( ) == 1 )
+    fname = fnames[ 0 ];
 
+  if( fname != "" )
+  {
     // Guess image properties
     itk::ImageIOBase::Pointer io =
       itk::ImageIOFactory::CreateImageIO(
@@ -210,10 +216,13 @@ _GD1( itk::ImageIOBase* io )
 
   // Get filenames
   auto fnames = this->m_Parameters.GetOpenFileNameList( "FileNames" );
-  if( fnames.size( ) == 2 )
+  if( fnames.size( ) == 1 || fnames.size( ) == 2 )
   {
     std::stringstream fname_str;
-    fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
+    if( fnames.size( ) == 1 )
+      fname_str << fnames[ 0 ];
+    else
+      fname_str << fnames[ 0 ] << cpPlugins_PATH_SEPARATOR << fnames[ 1 ];
 
     auto f = this->_CreateITK< itk::ImageFileReader< _TImage > >( );
     f->SetFileName( fname_str.str( ) );
index a93ba358dea45b7ea1af1d655fc90b6b894e461a..ca309c6e84aa9a56fa364334c424483899764335 100644 (file)
@@ -15,6 +15,7 @@ ImageToBoundingBoxFromThreshold( )
 
   this->m_Parameters.ConfigureAsReal( "LowerThreshold", 0 );
   this->m_Parameters.ConfigureAsReal( "UpperThreshold", 1 );
+  this->m_Parameters.ConfigureAsUint( "PAD", 0 );
 }
 
 // -------------------------------------------------------------------------
@@ -46,6 +47,7 @@ _GD0( _TImage* image )
   filter->SetImage( image );
   filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) );
   filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) );
+  filter->SetPAD( this->m_Parameters.GetUint( "PAD" ) );
   filter->Compute( );
 
   // Create output
similarity index 85%
rename from plugins/Extensions/PolyLineParametricPathToSimple3DCurve.cxx
rename to plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.cxx
index ec6cc016107c52ebacf6475e8a6be4328eb576c4..ec1cc9e5589293280cf39566adbe8fdb2e996fb9 100644 (file)
@@ -1,4 +1,4 @@
-#include <Extensions/PolyLineParametricPathToSimple3DCurve.h>
+#include <cpExtensions/PolyLineParametricPathToSimple3DCurve.h>
 #include <cpInstances/PolyLineParametricPath.h>
 #include <cpInstances/Simple3DCurve.h>
 
@@ -7,7 +7,7 @@
 #include <cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h>
 
 // -------------------------------------------------------------------------
-cpPluginsExtensions::PolyLineParametricPathToSimple3DCurve::
+cpPluginscpExtensions::PolyLineParametricPathToSimple3DCurve::
 PolyLineParametricPathToSimple3DCurve( )
   : Superclass( )
 {
@@ -19,13 +19,13 @@ PolyLineParametricPathToSimple3DCurve( )
 }
 
 // -------------------------------------------------------------------------
-cpPluginsExtensions::PolyLineParametricPathToSimple3DCurve::
+cpPluginscpExtensions::PolyLineParametricPathToSimple3DCurve::
 ~PolyLineParametricPathToSimple3DCurve( )
 {
 }
 
 // -------------------------------------------------------------------------
-void cpPluginsExtensions::PolyLineParametricPathToSimple3DCurve::
+void cpPluginscpExtensions::PolyLineParametricPathToSimple3DCurve::
 _GenerateData( )
 {
   typedef cpExtensions::DataStructures::PolyLineParametricPath< 3 > _TPath;
@@ -41,7 +41,6 @@ _GenerateData( )
   filter->SetNumberOfSamples( this->m_Parameters.GetUint( "NumberOfSamples" ) );
   filter->Update( );
   this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-
 }
 
 // eof - $RCSfile$
diff --git a/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.h b/plugins/cpExtensions/PolyLineParametricPathToSimple3DCurve.h
new file mode 100644 (file)
index 0000000..8c7c08d
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef __cpPluginscpExtensions__PolyLineParametricPathToSimple3DCurve__h__
+#define __cpPluginscpExtensions__PolyLineParametricPathToSimple3DCurve__h__
+
+#include <cpPluginscpExtensions_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginscpExtensions
+{
+  /**
+   */
+  class cpPluginscpExtensions_EXPORT PolyLineParametricPathToSimple3DCurve
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      PolyLineParametricPathToSimple3DCurve,
+      cpPlugins::BaseObjects::ProcessObject,
+      cpExtensions
+      );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginscpExtensions__PolyLineParametricPathToSimple3DCurve__h__
+
+
+// eof - $RCSfile$
diff --git a/plugins/cpExtensions/SkeletonToImageFilter.cxx b/plugins/cpExtensions/SkeletonToImageFilter.cxx
new file mode 100644 (file)
index 0000000..6b5e5a7
--- /dev/null
@@ -0,0 +1,54 @@
+#include <cpExtensions/SkeletonToImageFilter.h>
+#include <cpInstances/Image.h>
+#include <cpInstances/Skeleton.h>
+
+#include <cpExtensions/DataStructures/Skeleton.h>
+#include <cpExtensions/Algorithms/SkeletonToImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginscpExtensions::SkeletonToImageFilter::
+SkeletonToImageFilter( )
+  : Superclass( )
+{
+  this->_ConfigureInput< cpInstances::Skeleton >( "Skeleton", true, false );
+  this->_ConfigureInput< cpInstances::Image >( "TemplateImage", true, false );
+  this->_ConfigureOutput< cpInstances::Image >( "Output" );
+  this->m_Parameters.ConfigureAsUint( "InsideValue", 1 );
+  this->m_Parameters.ConfigureAsUint( "OutsideValue", 0 );
+}
+
+// -------------------------------------------------------------------------
+cpPluginscpExtensions::SkeletonToImageFilter::
+~SkeletonToImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginscpExtensions::SkeletonToImageFilter::
+_GenerateData( )
+{
+  auto o = this->GetInputData( "Skeleton" );
+  cpPlugins_Demangle_Skeleton_All_1( o, _GD0 )
+    this->_Error( "Invalid input skeleton." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TSkeleton >
+void cpPluginscpExtensions::SkeletonToImageFilter::
+_GD0( _TSkeleton* skeleton )
+{
+  typedef itk::ImageBase< _TSkeleton::Dimension > _TImageBase;
+  typedef itk::Image< unsigned char, _TSkeleton::Dimension > _TImage;
+  typedef cpExtensions::Algorithms::SkeletonToImageFilter< _TSkeleton, _TImage > _TFilter;
+
+  auto image = this->GetInputData< _TImageBase >( "TemplateImage" );
+  auto filter = this->_CreateITK< _TFilter >( );
+  filter->SetTemplateImage( image );
+  filter->SetSkeleton( skeleton );
+  filter->SetInsideValue( this->m_Parameters.GetUint( "InsideValue" ) );
+  filter->SetOutsideValue( this->m_Parameters.GetUint( "OutsideValue" ) );
+  filter->Update( );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/cpExtensions/SkeletonToImageFilter.h b/plugins/cpExtensions/SkeletonToImageFilter.h
new file mode 100644 (file)
index 0000000..6f7229e
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __cpPluginscpExtensions__SkeletonToImageFilter__h__
+#define __cpPluginscpExtensions__SkeletonToImageFilter__h__
+
+#include <cpPluginscpExtensions_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginscpExtensions
+{
+  /**
+   */
+  class cpPluginscpExtensions_EXPORT SkeletonToImageFilter
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      SkeletonToImageFilter,
+      cpPlugins::BaseObjects::ProcessObject,
+      cpExtensions
+      );
+
+  protected:
+    template< class _TSkeleton >
+    inline void _GD0( _TSkeleton* skeleton );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginscpExtensions__SkeletonToImageFilter__h__
+
+
+// eof - $RCSfile$
diff --git a/plugins/cpExtensions/cpExtensions.i b/plugins/cpExtensions/cpExtensions.i
new file mode 100644 (file)
index 0000000..f0099eb
--- /dev/null
@@ -0,0 +1,8 @@
+header #define ITK_MANUAL_INSTANTIATION
+
+tinclude cpExtensions/Algorithms/SkeletonToImageFilter:h|hxx
+cinclude cpExtensions/DataStructures/Skeleton.h
+
+instances cpExtensions::Algorithms::SkeletonToImageFilter< cpExtensions::DataStructures::Skeleton< #pdims# > , itk::Image< unsigned char, #pdims# > >
+
+** eof - $RCSfile$