From ca860824d3376ac7cfec182098d54e08ea8383b5 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Feb 2022 13:08:48 +0100 Subject: [PATCH 01/14] VolInfo --- volumetric/CMakeLists.txt | 1 + volumetric/volInfo.cpp | 125 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 volumetric/volInfo.cpp diff --git a/volumetric/CMakeLists.txt b/volumetric/CMakeLists.txt index 943970e3..fb027102 100644 --- a/volumetric/CMakeLists.txt +++ b/volumetric/CMakeLists.txt @@ -14,6 +14,7 @@ SET(DGTAL_TOOLS_SRC volTrValues volIntensityScale volFillInterior + volInfo volMask ) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp new file mode 100644 index 00000000..1d665a40 --- /dev/null +++ b/volumetric/volInfo.cpp @@ -0,0 +1,125 @@ +/** + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + **/ + +/** + * @file volInfo.cpp + * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr ) + * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France + * + * @date 2021/02/11 + * + * + * This file is part of the DGtal library. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CLI11.hpp" + + +using namespace std; +using namespace DGtal; +using namespace Z3i; + +/** + @page volSubSample volSubSample + + @brief Get information from a vol file (size and values). + + + @b Usage: ./volumetric/volInfo [OPTIONS] 1 [2] + + + @b Allowed @b options @b are : + @code + Positionals: + 1 TEXT:FILE REQUIRED Input vol file. + + Options: + -h,--help Print this help message and exit + -i,--input TEXT:FILE REQUIRED Input vol file. + + Positionals: + 1 TEXT:FILE REQUIRED Input vol file. + + Options: + -h,--help Print this help message and exit + -i,--input TEXT:FILE REQUIRED Input vol file. + + @endcode + + @b Example: +You can apply several sub sampling: + @code + $ volInfo $DGtal/examples/samples/lobster.vol + @endcode + + @see + @ref volInfo.cpp + + */ + +/** + * Missing parameter error message. + * + * @param param + */ +void missingParam ( std::string param ) +{ + trace.error() <<" Parameter: "< "); + app.add_option("-i,--input,1", inputFileName, "Input vol file." )->required()->check(CLI::ExistingFile); + + app.get_formatter()->column_width(40); + CLI11_PARSE(app, argc, argv); + // END parse command line using CLI ---------------------------------------------- + + trace.beginBlock("Loading file"); + typedef ImageContainerBySTLVector MyImageC; + + MyImageC imageC = VolReader< MyImageC >::importVol ( inputFileName ); + + trace.info()< values; + for(auto v: imageC.range()) + values[ v ] ++; + + for(auto val: values) + std::cout<<"\tvalue "<< (int)val.first<<": "<< val.second<<" voxels."< Date: Fri, 11 Feb 2022 13:11:55 +0100 Subject: [PATCH 02/14] VolInfo --- ChangeLog.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 9879a869..7946298a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,7 +11,7 @@ - New cmake option (DGTAL_RANDOMIZED_BUILD_THRESHOLD) to set the (approximated) % of tools build (Bertrand Kerautret [#416](https://github.com/DGtal-team/DGtal/pull/416)) - + - *visualisation* - 3dImplicitSurfaceExtractorByThickening: adding OBJ export. (David Coeurjolly [#413](https://github.com/DGtal-team/DGtalTools/pull/413)) @@ -21,16 +21,16 @@ - *volumetric* - volSegment: adding new option to get long int images as output (for longvol exporting). (Bertrand Kerautret [#420](https://github.com/DGtal-team/DGtalTools/pull/420)) - + - volInfo: get information from a vol file. (David Coeurjolly, [#430](https://github.com/DGtal-team/DGtalTools/pull/430)) # DGtalTools 1.2 - *global* - Fix itk2vol and fix ITK cmake configuaration that was making issues with the ITK image read. (Bertrand Kerautret [#393](https://github.com/DGtal-team/DGtalTools/pull/393)) - Travis: Fix old default osx_image with xcode12.2 and remove non used boost - cmake references. (Bertrand Kerautret [#394](https://github.com/DGtal-team/DGtalTools/pull/394)) + cmake references. (Bertrand Kerautret [#394](https://github.com/DGtal-team/DGtalTools/pull/394)) - Uniform input/output option with previous use of CLI11 (issue #405). - (Bertrand Kerautret [#406](https://github.com/DGtal-team/DGtalTools/pull/406)) + (Bertrand Kerautret [#406](https://github.com/DGtal-team/DGtalTools/pull/406)) - Comply with cmake Policy CMP0115 "Source file extensions must be explicit". (Bertrand Kerautret and David Coeurjolly, [#407](https://github.com/DGtal-team/DGtalTools/pull/407)) From 91ff016a2d8e99ba39b6b4003035e0d74c5542fd Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Feb 2022 13:13:21 +0100 Subject: [PATCH 03/14] odc --- doc/volumetric.dox | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/volumetric.dox b/doc/volumetric.dox index 9644e478..cd8daee0 100644 --- a/doc/volumetric.dox +++ b/doc/volumetric.dox @@ -1,6 +1,6 @@ /** * @file volumetric.dox - * @author Bertrand Kerautret + * @author Bertrand Kerautret * LORIA (CNRS, UMR 7503), University of Lorraine, France * * @date 2016/05/12 @@ -19,7 +19,7 @@ - @ref criticalKernelsThinning3D : applies an criticalKernels thinning algorithm of a 3d image file (vol,longvol,pgm3d...) with 3D viewer. - - @ref Doc3dVolMarchingCubes : outputs the isosurface of the input volume as an OFF file. + - @ref Doc3dVolMarchingCubes : outputs the isosurface of the input volume as an OFF file. - @ref homotopicThinning3D : applies an homotopic thinning of a 3d image file (vol,longvol,pgm3d...) with 3D viewer. - @ref volAddBorder : adds a border of one voxel with value 0 around a vol file. - @ref volAddNoise : adds Kanungo noise to a binary object with 0 values as background points and values >0 for the foreground ones. @@ -32,9 +32,10 @@ - @ref volMask : extracts a new image from the a mask image. - @ref volReSample : re samples a 3D volumetric image (.vol, .longvol, .pgm3d) with a given grid size. - @ref volSegment : segments volumetric file from a simple threshold. - - @ref volShapeMetrics : applies shape measures to compare two volumetric images A and B (shape defined from thresholds). + - @ref volShapeMetrics : applies shape measures to compare two volumetric images A and B (shape defined from thresholds). - @ref volSubSample : brutally sub samples a vol file (division by 2 in each direction). - @ref volTrValues : applies basic vol image transform from the input values to output values. + - @ref volInfo : to get information (domain size, value distributions) from a VOL file. @@ -44,24 +45,24 @@ - + @ref Doc3dVolMarchingCubes - @ref homotopicThinning3D + @ref homotopicThinning3D @ref volReSample - + - + @ref volTrValues @ref volSegment -@ref volSubSample +@ref volSubSample From 7b287cdfb2328015e61b213e6d7361e38311a824 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Feb 2022 13:15:08 +0100 Subject: [PATCH 04/14] doc again --- doc/volumetric.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/volumetric.dox b/doc/volumetric.dox index cd8daee0..631c8b29 100644 --- a/doc/volumetric.dox +++ b/doc/volumetric.dox @@ -19,7 +19,7 @@ - @ref criticalKernelsThinning3D : applies an criticalKernels thinning algorithm of a 3d image file (vol,longvol,pgm3d...) with 3D viewer. - - @ref Doc3dVolMarchingCubes : outputs the isosurface of the input volume as an OFF file. + - @ref 3dVolMarchingCubes : outputs the isosurface of the input volume as an OFF file. - @ref homotopicThinning3D : applies an homotopic thinning of a 3d image file (vol,longvol,pgm3d...) with 3D viewer. - @ref volAddBorder : adds a border of one voxel with value 0 around a vol file. - @ref volAddNoise : adds Kanungo noise to a binary object with 0 values as background points and values >0 for the foreground ones. From 296f5419d21292f3419da3c5dbebd7da4b1ecc92 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Feb 2022 13:28:00 +0100 Subject: [PATCH 05/14] doc again --- volumetric/volInfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 1d665a40..b640f471 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -13,7 +13,6 @@ * along with this program. If not, see . * **/ - /** * @file volInfo.cpp * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr ) From c737901f79ba67ec5e97aa6d680ea6c393738a16 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:48:19 +0100 Subject: [PATCH 06/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index b640f471..cd026ee9 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -18,7 +18,7 @@ * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr ) * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France * - * @date 2021/02/11 + * @date 2022/02/11 * * * This file is part of the DGtal library. From ae9bee02888a7b109339f57bd828d842c560c243 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:48:43 +0100 Subject: [PATCH 07/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index cd026ee9..376a9d19 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include From 7a7bd41ef9ae9a1e1f7dab2c67b56fe59f15888f Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:48:48 +0100 Subject: [PATCH 08/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 376a9d19..a37dc29f 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include From 848610d8f1c0e60d60c59097561189a9d2aeac16 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:48:56 +0100 Subject: [PATCH 09/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index a37dc29f..50444e9e 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -106,7 +106,7 @@ int main(int argc, char**argv) trace.beginBlock("Loading file"); typedef ImageContainerBySTLVector MyImageC; - MyImageC imageC = VolReader< MyImageC >::importVol ( inputFileName ); + MyImageC imageC = GenericReader::import(inputFileName); trace.info()< Date: Fri, 11 Mar 2022 16:50:02 +0100 Subject: [PATCH 10/14] Update volInfo.cpp --- volumetric/volInfo.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 50444e9e..2e2db98b 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -60,14 +60,12 @@ using namespace Z3i; Positionals: 1 TEXT:FILE REQUIRED Input vol file. - Options: - -h,--help Print this help message and exit - -i,--input TEXT:FILE REQUIRED Input vol file. + @endcode @b Example: -You can apply several sub sampling: +You can retrieve information from the vol file as: @code $ volInfo $DGtal/examples/samples/lobster.vol @endcode From cf22b4e5cb54ff924c4cadc34128a0b4b71ad06e Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:50:22 +0100 Subject: [PATCH 11/14] Update volInfo.cpp --- volumetric/volInfo.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 2e2db98b..3b93f244 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -59,9 +59,6 @@ using namespace Z3i; Positionals: 1 TEXT:FILE REQUIRED Input vol file. - - - @endcode @b Example: From f5e60e8b48caac70f28a81fd23e4215a7fb4ed46 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 16:51:18 +0100 Subject: [PATCH 12/14] Update ChangeLog.md --- ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 7946298a..06453c4f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -21,7 +21,7 @@ - *volumetric* - volSegment: adding new option to get long int images as output (for longvol exporting). (Bertrand Kerautret [#420](https://github.com/DGtal-team/DGtalTools/pull/420)) - - volInfo: get information from a vol file. (David Coeurjolly, [#430](https://github.com/DGtal-team/DGtalTools/pull/430)) + - volInfo: get information from a volumetric file. (David Coeurjolly, [#430](https://github.com/DGtal-team/DGtalTools/pull/430)) # DGtalTools 1.2 - *global* From 1c6f739ac42b139a56c4e745d33f6430b632bdf6 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 17:17:18 +0100 Subject: [PATCH 13/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 3b93f244..523cd7db 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -40,7 +40,7 @@ using namespace DGtal; using namespace Z3i; /** - @page volSubSample volSubSample + @page volInfo volInfo @brief Get information from a vol file (size and values). From 0a6f47018cdeee231f83ee42a2bec5b3a3d037ef Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Fri, 11 Mar 2022 17:18:21 +0100 Subject: [PATCH 14/14] Update volumetric/volInfo.cpp Co-authored-by: Bertrand Kerautret --- volumetric/volInfo.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/volumetric/volInfo.cpp b/volumetric/volInfo.cpp index 523cd7db..95e94285 100644 --- a/volumetric/volInfo.cpp +++ b/volumetric/volInfo.cpp @@ -50,9 +50,6 @@ using namespace Z3i; @b Allowed @b options @b are : @code - Positionals: - 1 TEXT:FILE REQUIRED Input vol file. - Options: -h,--help Print this help message and exit -i,--input TEXT:FILE REQUIRED Input vol file.