Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix guards.
* mln/canvas/morpho/internal/find_root.hh: Fix guards.
find_root.hh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: mln/canvas/morpho/internal/find_root.hh
--- mln/canvas/morpho/internal/find_root.hh (revision 3433)
+++ mln/canvas/morpho/internal/find_root.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CANVAS_MORPHO_FIND_ROOT_HH
-# define MLN_CANVAS_MORPHO_FIND_ROOT_HH
+#ifndef MLN_CANVAS_MORPHO_INTERNAL_FIND_ROOT_HH
+# define MLN_CANVAS_MORPHO_INTERNAL_FIND_ROOT_HH
/// \file mln/canvas/morpho/internal/find_root.hh.hh
///
@@ -98,5 +98,5 @@
} // end of namespace mln
-#endif // ! MLN_CANVAS_MORPHO_FIND_ROOT_HH
+#endif // ! MLN_CANVAS_MORPHO_INTERNAL_FIND_ROOT_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-02-27 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Fix dimensions bug.
* mln/io/dicom/load.hh: Fix dimensions bug.
---
load.hh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: trunk/milena/mln/io/dicom/load.hh
===================================================================
--- trunk/milena/mln/io/dicom/load.hh (revision 3432)
+++ trunk/milena/mln/io/dicom/load.hh (revision 3433)
@@ -139,14 +139,14 @@
algebra::vec<mln_site_(I)::dim, unsigned int> vmin;
algebra::vec<mln_site_(I)::dim, unsigned int> vmax;
algebra::vec<mln_site_(I)::dim, unsigned int> vdims;
- for (int i = ndims - 1; i >= 0; --i)
+ for (int i = 0; i < ndims; ++i)
{
vmin[i] = 0;
- vmax[i] = dims[ndims - i - 1] - 1;
- if (i == ndims - 1)
+ vmax[i] = dims[i] - 1;
+ if (i == 0)
vdims[i] = 1;
else
- vdims[i] = dims[ndims - i - 2] * vdims[i + 1];
+ vdims[i] = dims[i - 1] * vdims[i - 1];
}
mln_site(I) pmin(vmin);
@@ -169,9 +169,9 @@
{
ima(p) += ((unsigned char) dataBuffer[(index * bytes_allocated + j) * samples_per_pixel]) * 256 * j;
}
- /*std::cout << "[ x = " << p.to_site().to_vec()[2]
+ /*std::cout << "[ x = " << p.to_site().to_vec()[0]
<< " | y = " << p.to_site().to_vec()[1]
- << " | z = " << p.to_site().to_vec()[0]
+ << " | z = " << p.to_site().to_vec()[2]
<< " ] => " << ima(p)
<< std::endl;*/
}
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-02-27 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Clean sandbox.
* fabien/dcmtk/Makefile: New.
* fabien/dcmtk/dicom.cc: New.
* fabien/dcmtk: New.
* fabien/dicom/load.hh: Remove.
* fabien/dicom/save.hh: Remove.
* fabien/dicom: Remove.
* fabien/gdcm/Makefile: Remove.
* fabien/gdcm/dump2pgm.cc: Remove.
* fabien/gdcm/gdcm.cc: Remove.
* fabien/gdcm/load.hh: Remove.
* fabien/gdcm: Remove.
* fabien/igr/Makefile: New.
* fabien/igr/dump2pbm.cc: New.
* fabien/igr/seg_vol_irm.cc: New.
---
dcmtk/Makefile | 2
dcmtk/dicom.cc | 14
dcmtk/load.hh | 388 +++++++++++++++++++++
dcmtk/save.hh | 951 +++++++++++++++++++++++++++++++++++++++++++++++++++++
igr/Makefile | 15
igr/dump2pbm.cc | 35 +
igr/seg_vol_irm.cc | 267 ++++++++++++++
7 files changed, 1672 insertions(+)
Index: trunk/milena/sandbox/fabien/igr/seg_vol_irm.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/seg_vol_irm.cc (revision 0)
+++ trunk/milena/sandbox/fabien/igr/seg_vol_irm.cc (revision 3432)
@@ -0,0 +1,267 @@
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development
+// Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#include <mln/core/concept/image.hh>
+#include <mln/core/concept/neighborhood.hh>
+#include <mln/core/alias/neighb1d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/alias/neighb3d.hh>
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/image3d.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u12.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/rgb8.hh>
+
+#include <mln/io/pgm/all.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/all.hh>
+#include <mln/io/cloud/all.hh>
+#include <mln/io/dump/all.hh>
+#include <mln/io/dicom/load.hh>
+
+#include <mln/labeling/flat_zones.hh>
+#include <mln/labeling/background.hh>
+#include <mln/literal/colors.hh>
+#include <mln/norm/l1.hh>
+
+#include <mln/geom/bbox.hh>
+
+#include <mln/labeling/blobs.hh>
+#include <mln/labeling/compute.hh>
+#include <mln/labeling/fill_holes.hh>
+#include <mln/labeling/n_max.hh>
+
+#include <mln/level/compare.hh>
+#include <mln/level/compute.hh>
+#include <mln/level/transform.hh>
+
+#include <mln/fun/internal/selector.hh>
+
+#include <mln/fun/v2b/threshold.hh>
+#include <mln/level/transform.hh>
+
+#include <mln/accu/count.hh>
+#include <mln/accu/center.hh>
+#include <mln/accu/max.hh>
+
+#include <mln/histo/compute.hh>
+
+#include <mln/set/compute.hh>
+#include <mln/value/label_16.hh>
+#include <mln/data/fill.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/morpho/elementary/gradient_internal.hh>
+#include <mln/morpho/opening_area.hh>
+
+#include <mln/convert/from_to.hh>
+
+//FIXME: remove
+#include <mln/essential/2d.hh>
+#include <iostream>
+#include <mln/debug/println.hh>
+
+using namespace mln;
+using value::int_u8;
+using value::int_u12;
+using value::int_u16;
+using value::rgb8;
+using value::label_16;
+
+
+
+template <typename T>
+struct L_to_int_u8
+: mln::fun::internal::selector_<int_u8, T, L_to_int_u8<T> >::ret
+{
+ typedef int_u8 result;
+ int_u8 operator()(const T& t) const;
+};
+
+
+template <typename T>
+inline
+int_u8
+L_to_int_u8<T>::operator()(const T& t) const
+{
+ return static_cast<int_u8>(t == 0 ? 0 : 1 + ((unsigned) t - 1) % 255);
+}
+
+
+template <typename I>
+unsigned
+find_threshold_value(const Image<I>& input_)
+{
+ const I& input = exact(input_);
+
+ histo::array<mln_value(I)> arr_histo = histo::compute(input);
+
+ image1d<unsigned> ima_histo;
+ convert::from_to(arr_histo, ima_histo);
+
+ ima_histo(point1d(0)) = 0;
+
+ //ima_histo = morpho::opening_area(ima_histo, c2(), 5);
+ //mln_fwd_piter(image1d<unsigned>) p(ima_histo.domain());
+ for (unsigned int i = 1; i < ima_histo.nelements(); ++i)
+ {
+ ima_histo(point1d(i)) += ima_histo(point1d(i - 1));
+ }
+ accu::max<unsigned> max_accu;
+ unsigned max = level::compute(max_accu, ima_histo);
+ for (unsigned int i = 0; i < ima_histo.nelements(); ++i)
+ {
+ //std::cout << "[" << i << "] => " << ((ima_histo(point1d(i)) * 100) / max) << std::endl;
+ if (((ima_histo(point1d(i)) * 100) / max) > 70)
+ return i;
+ }
+}
+
+
+template <typename I, typename N, typename L>
+mln_ch_value(I, bool)
+igr(const Image<I>& input_, const mln::Neighborhood<N>& nbh_, L& nlabels)
+{
+ const I& input = exact(input_);
+ const N& nbh = exact(nbh_);
+
+ // Threshold.
+
+ unsigned threshold_value = find_threshold_value(input_);
+ mln_ch_value(I, bool) ima_thres;
+ initialize(ima_thres, input);
+ data::fill((ima_thres | pw::value(input) < pw::cst(threshold_value)).rw(), true);
+
+ return ima_thres;
+
+ // Labeling.
+
+ /*mln_ch_value(I, L) labels = labeling::flat_zones(threshold, nbh, nlabels);
+ accu::count<int_u8> a_;
+ util::array<unsigned> a = labeling::compute(a_, threshold, labels, nlabels);
+
+ // We keep the third and second biggest object.
+
+ mln_ch_value(I, bool) big_second;
+ initialize(big_second, input);
+ data::fill(big_second, false);
+
+ util::array<L> arr_big = labeling::n_max<L>(a, 3);
+ data::fill((big_second | (pw::value(labels) == arr_big[2])).rw(), true);
+ mln_VAR(big_third, threshold | pw::value(labels) == arr_big[3]);
+
+ // Fill holes.
+
+ big_second = labeling::fill_holes(big_second, nbh, nlabels);
+
+ // Gradient.
+
+ mln_ch_value(I, bool) gradient = morpho::elementary::gradient_internal(big_second, nbh);
+ mln_VAR(gradient_map, gradient | pw::value(gradient) == true);
+
+ mln_ch_value(I, rgb8) result = level::convert(rgb8(), input);
+ data::fill((result | gradient_map.domain()).rw(), literal::red);
+
+ // Center.
+
+ accu::center<mln_site(I)> center_;
+ mln_site(I) center = set::compute(center_, big_third.domain());
+ result(center) = literal::blue;
+
+ // Distance.
+
+ mln_fwd_piter(gradient_map_t) p(gradient_map.domain());
+ p_array<mln_site(I)> arr;
+ for_all(p)
+ {
+ if (mln::norm::l1_distance(p.to_site().to_vec(), center.to_vec()) < 200)
+ {
+ result(p) = literal::green;
+
+ arr.append(p);
+ }
+ }
+
+ // Save the cloud in a file.
+
+ io::cloud::save(arr, "cloud.txt");
+
+ return result;*/
+}
+
+int main()
+{
+ //trace::quiet = false;
+
+ label_16 nlabels;
+
+ std::cout << "Processing IM_0043..." << std::endl;
+ image3d<int_u12> im43;
+ io::dicom::load(im43, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0043.dcm");
+ io::dump::save(igr(im43, c6(), nlabels), "IM_0043.dump");
+
+ std::cout << "Processing IM_0046..." << std::endl;
+ image3d<int_u12> im46;
+ io::dicom::load(im46, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0046.dcm");
+ io::dump::save(igr(im46, c6(), nlabels), "IM_0046.dump");
+
+ std::cout << "Processing IM_0049..." << std::endl;
+ image2d<int_u12> im49;
+ io::dicom::load(im49, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0049.dcm");
+ io::pbm::save(igr(im49, c6(), nlabels), "IM_0049.pbm");
+
+ std::cout << "Processing IM_0052..." << std::endl;
+ image3d<int_u12> im52;
+ io::dicom::load(im52, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0052.dcm");
+ io::dump::save(igr(im52, c6(), nlabels), "IM_0052.dump");
+
+ std::cout << "Processing IM_0055..." << std::endl;
+ image2d<int_u12> im55;
+ io::dicom::load(im55, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0055.dcm");
+ io::pbm::save(igr(im55, c6(), nlabels), "IM_0055.pbm");
+
+ std::cout << "Processing IM_0058..." << std::endl;
+ image2d<int_u12> im58;
+ io::dicom::load(im58, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0058.dcm");
+ io::pbm::save(igr(im58, c6(), nlabels), "IM_0058.pbm");
+
+ std::cout << "Processing IM_0061..." << std::endl;
+ image3d<int_u12> im61;
+ io::dicom::load(im61, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0061.dcm");
+ io::dump::save(igr(im61, c6(), nlabels), "IM_0061.dump");
+
+ std::cout << "Processing IM_0064..." << std::endl;
+ image3d<int_u12> im64;
+ io::dicom::load(im64, "/Users/HiSoKa/Work/IGR/souris18/irm/IM_0064.dcm");
+ io::dump::save(igr(im64, c6(), nlabels), "IM_0064.dump");
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/igr/dump2pbm.cc
===================================================================
--- trunk/milena/sandbox/fabien/igr/dump2pbm.cc (revision 0)
+++ trunk/milena/sandbox/fabien/igr/dump2pbm.cc (revision 3432)
@@ -0,0 +1,35 @@
+
+#include <mln/core/image/image2d.hh>
+#include <mln/make/image3d.hh>
+#include <mln/debug/slices_2d.hh>
+
+#include <mln/value/int_u16.hh>
+#include <mln/io/dump/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <mln/literal/colors.hh>
+
+
+void usage(char* argv[])
+{
+ std::cerr << "usage: " << argv[0] << " input.dump output.pbm" << std::endl;
+ abort();
+}
+
+
+
+int main(int argc, char* argv[])
+{
+ using namespace mln;
+ using value::int_u16;
+
+ if (argc != 3)
+ usage(argv);
+
+ image3d<bool> vol;
+ io::dump::load(vol, argv[1]);
+
+ int_u16 bg = 0;
+ image2d<bool> ima = debug::slices_2d(vol, 1.f, bg);
+ io::pbm::save(ima, argv[2]);
+}
Index: trunk/milena/sandbox/fabien/igr/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/igr/Makefile (revision 0)
+++ trunk/milena/sandbox/fabien/igr/Makefile (revision 3432)
@@ -0,0 +1,15 @@
+all: seg_vol_irm.cc
+ g++ -I../../../ \
+ -I/Users/HiSoKa/Downloads/gdcm-2.0.10/Source/Common/ \
+ -I/Users/HiSoKa/Downloads/gdcmbin/Source/Common/ \
+ -I/Users/HiSoKa/Downloads/gdcm-2.0.10/Source/DataDictionary/ \
+ -I/Users/HiSoKa/Downloads/gdcm-2.0.10/Source/MediaStorageAndFileFormat/ \
+ -I/Users/HiSoKa/Downloads/gdcm-2.0.10/Source/DataStructureAndEncodingDefinition/ \
+ -L/Users/HiSoKa/Downloads/gdcmbin/bin \
+ -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmIOD -lgdcmMSFF -lgdcmexpat -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmjpeg8 -lgdcmopenjpeg -lgdcmuuid -lgdcmzlib \
+ -framework CoreFoundation \
+ -g \
+ seg_vol_irm.cc -o seg_vol_irm
+
+clean:
+ rm -rf *.dump *.p?m
Index: trunk/milena/sandbox/fabien/dcmtk/dicom.cc
===================================================================
--- trunk/milena/sandbox/fabien/dcmtk/dicom.cc (revision 0)
+++ trunk/milena/sandbox/fabien/dcmtk/dicom.cc (revision 3432)
@@ -0,0 +1,14 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/value/int_u8.hh>
+
+#include "load.hh"
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ image2d<int_u8> lena;
+
+ io::dicom::load(lena, "/Users/HiSoKa/Work/LRDE/Olena/resources/data/IM_0001");
+}
Index: trunk/milena/sandbox/fabien/dcmtk/save.hh
===================================================================
--- trunk/milena/sandbox/fabien/dcmtk/save.hh (revision 0)
+++ trunk/milena/sandbox/fabien/dcmtk/save.hh (revision 3432)
@@ -0,0 +1,951 @@
+/*
+ *
+ * Copyright (C) 1994-2005, OFFIS
+ *
+ * This software and supporting documentation were developed by
+ *
+ * Kuratorium OFFIS e.V.
+ * Healthcare Information and Communication Systems
+ * Escherweg 2
+ * D-26121 Oldenburg, Germany
+ *
+ * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY
+ * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
+ * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR
+ * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
+ *
+ * Module: dcmdata
+ *
+ * Author: Andreas Barth
+ *
+ * Purpose: create a Dicom FileFormat or DataSet from an ASCII-dump
+ *
+ * Last Update: $Author: onken $
+ * Update Date: $Date: 2005/12/16 09:07:03 $
+ * CVS/RCS Revision: $Revision: 1.51 $
+ * Status: $State: Exp $
+ *
+ * CVS/RCS Log at end of file
+ *
+ */
+
+/*
+ * Input File Description:
+ * The input file be an output of dcmdump. One element (Tag, VR, value) must
+ * be written into one line separated by arbitrary spaces or tab characters.
+ * A # begins a comment that ends at the line end. Empty lines are allowed.
+ * This parts of a line have the following syntax:
+ * Tag: (gggg,eeee)
+ * with gggg and eeee are 4 character hexadecimal values representing
+ * group- and element-tag. Spaces and Tabs can be anywhere in a Tag
+ * specification
+ * VR: Value Representation must be written as 2 characters as in Part 6
+ * of the DICOM 3.0 standard. No Spaces or Tabs are allowed between the
+ * two characters. If the VR can determined from the Tag, this part of
+ * a line is optional.
+ * Value: There are several rules for writing values:
+ * 1. US, SS, SL, UL, FD, FL are written as
+ * decimal strings that can be read by scanf.
+ * 2. AT is written as (gggg,eeee) with additional spaces stripped off
+ * automatically and gggg and eeee being decimal strings that
+ * can be read by scanf.
+ * 3. OB, OW values are written as byte or word hexadecimal values
+ * separated by '\' character. Alternatively, OB or OW values can
+ * be read from a separate file by writing the filename prefixed
+ * by a '=' character (e.g. =largepixeldata.dat). The contents of
+ * the file will be read as is. OW data is expected to be little
+ * endian ordered and will be swapped if necessary. No checks will
+ * be made to ensure that the amount of data is reasonable in terms
+ * of other attributes such as Rows or Columns.
+ * 4. UI is written as =Name in data dictionary or as
+ * unique identifer string (see 6.) , e.g. [1.2.840.....]
+ * 5. Strings without () <> [] spaces, tabs and # can be
+ * written directly
+ * 6. Other strings with must be surrounded by [ ]. No
+ * bracket structure is passed. The value ends at the last ] in
+ * the line. Anything after the ] is interpreted as comment.
+ * 7. ( < are interpreted special and may not be used when writing
+ * an input file by hand as beginning characters of a string.
+ * Multiple Value are separated by \
+ * The sequence of lines must not be ordered but they can.
+ * References in DICOM Directories are not supported.
+ * Semantic errors are not detected.
+ *
+ * Examples:
+ * (0008,0020) DA [19921012] # 8, 1 StudyDate
+ * (0008,0016) UI =MRImageStorage # 26, 1 SOPClassUID
+ * (0002,0012) UI [1.2.276.0.7230010.100.1.1]
+ * (0020,0032) DS [0.0\0.0] # 8, 2 ImagePositionPatient
+ * (0028,0009) AT (3004,000c) # 4, 1 FrameIncrementPointer
+ * (0028,0010) US 256 # 4, 1 Rows
+ * (0002,0001) OB 01\00
+ *
+ */
+
+#include "dcmtk/config/osconfig.h"
+
+#define INCLUDE_CSTDLIB
+#define INCLUDE_CSTDIO
+#define INCLUDE_CCTYPE
+#include "dcmtk/ofstd/ofstdinc.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_STAT_H
+#include <stat.h>
+#endif
+#ifdef HAVE_GUSI_H
+#include <GUSI.h>
+#endif
+
+#include "dcmtk/ofstd/ofstream.h"
+#include "dcmtk/dcmdata/dctk.h"
+#include "dcmtk/dcmdata/dcdebug.h"
+#include "dcmtk/dcmdata/cmdlnarg.h"
+#include "dcmtk/ofstd/ofconapp.h"
+#include "dcmtk/ofstd/ofstd.h"
+#include "dcmtk/dcmdata/dcuid.h" /* for dcmtk version name */
+
+#ifdef WITH_ZLIB
+#include <zlib.h> /* for zlibVersion() */
+#endif
+
+#define OFFIS_CONSOLE_APPLICATION "dump2dcm"
+
+static char rcsid[] = "$dcmtk: " OFFIS_CONSOLE_APPLICATION " v"
+ OFFIS_DCMTK_VERSION " " OFFIS_DCMTK_RELEASEDATE " $";
+
+#define SHORTCOL 3
+#define LONGCOL 21
+
+// Maximum Line Size
+
+const unsigned int DCM_DumpMaxLineSize = 4096;
+
+
+// Field definition separators
+
+#define DCM_DumpCommentChar '#'
+#define DCM_DumpTagDelim ')'
+#define DCM_DumpOpenString '['
+#define DCM_DumpCloseString ']'
+#define DCM_DumpOpenDescription '('
+#define DCM_DumpOpenFile '<'
+#define DCM_DumpCloseFile '>'
+
+static void
+stripWhitespace(char* s)
+{
+ char* p;
+
+ if (s == NULL) return;
+
+ p = s;
+ while (*s != '\0') {
+ if (isspace(*s) == OFFalse) {
+ *p++ = *s;
+ }
+ s++;
+ }
+ *p = '\0';
+}
+
+static char*
+stripTrailingWhitespace(char* s)
+{
+ int i, n;
+ if (s == NULL) return s;
+
+ n = strlen(s);
+ for (i = n - 1; i >= 0 && isspace(s[i]); i--)
+ s[i] = '\0';
+ return s;
+}
+
+
+static char *
+stripPrecedingWhitespace(char * s)
+{
+ char * p;
+ if (s == NULL) return s;
+
+ for(p = s; *p && isspace(*p); p++)
+ ;
+
+ return p;
+}
+
+static OFBool
+onlyWhitespace(const char* s)
+{
+ int len = strlen(s);
+ int charsFound = OFFalse;
+
+ for (int i=0; (!charsFound) && (i<len); i++) {
+ charsFound = !isspace(s[i]);
+ }
+ return (!charsFound)?(OFTrue):(OFFalse);
+}
+
+static char*
+getLine(char* line, int maxLineLen, FILE* f, const unsigned long lineNumber)
+{
+ char* s;
+
+ s = fgets(line, maxLineLen, f);
+
+ // if line is too long, throw rest of it away
+ if (s && strlen(s) == size_t(maxLineLen-1) && s[maxLineLen-2] != '\n')
+ {
+ int c = fgetc(f);
+ while(c != '\n' && c != EOF)
+ c = fgetc(f);
+ CERR << "line " << lineNumber << " too long." << endl;
+ }
+
+ /* strip any trailing white space */
+ stripTrailingWhitespace(s);
+
+ return s;
+}
+
+static OFBool
+isaCommentLine(const char* s)
+{
+ OFBool isComment = OFFalse; /* assumption */
+ int len = strlen(s);
+ int i = 0;
+ for (i=0; i<len && isspace(s[i]); i++) /*loop*/;
+ isComment = (s[i] == DCM_DumpCommentChar);
+ return isComment;
+}
+
+static OFBool
+parseTag(char* & s, DcmTagKey& key)
+{
+ OFBool ok = OFTrue;
+ char * p;
+ unsigned int g, e;
+
+ // find tag begin
+ p = strchr(s, DCM_DumpTagDelim);
+ if (p)
+ {
+ // string all white spaces and read tag
+ int len = p-s+1;
+ p = new char[len+1];
+ OFStandard::strlcpy(p, s, len+1);
+ stripWhitespace(p);
+ s += len;
+
+ if (sscanf(p, "(%x,%x)", &g, &e) == 2) {
+ key.set(g, e);
+ } else {
+ ok = OFFalse;
+ }
+ delete[] p;
+ }
+ else ok = OFFalse;
+
+ return ok;
+}
+
+
+static OFBool
+parseVR(char * & s, DcmEVR & vr)
+{
+ OFBool ok = OFTrue;
+
+ s = stripPrecedingWhitespace(s);
+
+ // Are there two upper characters?
+ if (isupper(*s) && isupper(*(s+1)))
+ {
+ char c_vr[3];
+ OFStandard::strlcpy(c_vr, s, 3);
+ // Convert to VR
+ DcmVR dcmVR(c_vr);
+ vr = dcmVR.getEVR();
+ s+=2;
+ }
+ else if ((*s == 'p')&&(*(s+1) == 'i'))
+ {
+ vr = EVR_pixelItem;
+ s+=2;
+ }
+ else if (((*s == 'o')&&(*(s+1) == 'x')) || ((*s == 'x')&&(*(s+1) == 's')) ||
+ (*s == 'n')&&(*(s+1) == 'a') || ((*s == 'u')&&(*(s+1) == 'p')))
+ {
+ // swallow internal VRs
+ vr = EVR_UNKNOWN;
+ s+=2;
+ }
+ else ok = OFFalse;
+
+ return ok;
+}
+
+
+static int
+searchLastClose(char *s, char closeChar)
+{
+ // search last close bracket in a line
+ // no bracket structure will be considered
+
+ char * found = NULL;
+ char * p = s;
+
+ while(p && *p)
+ {
+ p = strchr(p, closeChar);
+ if (p)
+ {
+ found = p;
+ p++;
+ }
+ }
+
+ if (found)
+ return (found - s) + 1;
+ else
+ return 0;
+}
+
+
+static int
+searchCommentOrEol(char *s)
+{
+ char * comment = strchr(s, DCM_DumpCommentChar);
+ if (comment)
+ return comment - s;
+ else if (s)
+ return strlen(s);
+ else
+ return 0;
+}
+
+
+static char*
+convertNewlineCharacters(char* s)
+{
+ // convert the string "\n" into the \r\n combination required by DICOM
+ if (s == NULL || s[0] == '\0') return s;
+ int len = strlen(s);
+ int i = 0;
+ for (i=0; i<(len-1); i++) {
+ if (s[i] == '\\' && s[i+1] == 'n') {
+ s[i] = '\r';
+ s[i+1] = '\n';
+ i++;
+ }
+ }
+
+ return s;
+}
+
+static OFBool
+parseValue(char * & s, char * & value, const DcmEVR & vr)
+{
+ OFBool ok = OFTrue;
+ int len;
+ value = NULL;
+
+ s = stripPrecedingWhitespace(s);
+
+ switch (*s)
+ {
+ case DCM_DumpOpenString:
+ len = searchLastClose(s, DCM_DumpCloseString);
+ if (len == 0)
+ ok = OFFalse;
+ else if (len > 2)
+ {
+ value = new char[len-1];
+ OFStandard::strlcpy(value, s+1, len-1);
+ value = convertNewlineCharacters(value);
+ }
+ else
+ value = NULL;
+ break;
+
+ case DCM_DumpOpenDescription:
+ /* need to distinguish vr=AT from description field */
+ /* NB: if the vr is unknown this workaround will not succeed */
+ if (vr == EVR_AT)
+ {
+ len = searchLastClose(s, DCM_DumpTagDelim);
+ if (len >= 11) // (gggg,eeee) allow non-significant spaces
+ {
+ char *pv = s;
+ DcmTagKey tag;
+ if (parseTag(pv, tag)) // check for valid tag format
+ {
+ value = new char[len+1];
+ OFStandard::strlcpy(value, s, len+1);
+ stripWhitespace(value);
+ } else
+ ok = OFFalse; // skip description
+ }
+ else
+ ok = OFFalse; // skip description
+ }
+ break;
+
+ case DCM_DumpOpenFile:
+ ok = OFFalse; // currently not supported
+ break;
+
+ case DCM_DumpCommentChar:
+ break;
+
+ default:
+ len = searchCommentOrEol(s);
+ if (len)
+ {
+ value = new char[len+1];
+ OFStandard::strlcpy(value, s, len+1);
+ stripTrailingWhitespace(value);
+ }
+ break;
+ }
+ return ok;
+}
+
+
+static unsigned long
+fileSize(const char *fname)
+{
+ struct stat s;
+ unsigned long nbytes = 0;
+
+ if (stat(fname, &s) == 0) {
+ nbytes = s.st_size;
+ }
+ return nbytes;
+}
+
+static OFCondition
+putFileContentsIntoElement(DcmElement* elem, const char* filename)
+{
+ FILE* f = NULL;
+ OFCondition ec = EC_Normal;
+
+ if ((f = fopen(filename, "rb")) == NULL) {
+ CERR << "ERROR: cannot open binary data file: " << filename << endl;
+ return EC_InvalidTag;
+ }
+
+ unsigned long len = fileSize(filename);
+ unsigned long buflen = len;
+ if (buflen & 1) buflen++; /* if odd then make even (DICOM required even length values) */
+
+ Uint8* buf = new Uint8[buflen];
+ if (buf == NULL) {
+ CERR << "ERROR: out of memory reading binary data file: " << filename << endl;
+ ec = EC_MemoryExhausted;
+ } else if (fread(buf, 1, OFstatic_cast(size_t, len), f) != len) {
+ CERR << "ERROR: error reading binary data file: " << filename << ": ";
+ perror(NULL);
+ ec = EC_CorruptedData;
+ } else {
+ /* assign buffer to attribute */
+ DcmEVR evr = elem->getVR();
+ if (evr == EVR_OB) {
+ /* put 8 bit OB data into the attribute */
+ ec = elem->putUint8Array(buf, buflen);
+ } else if (evr == EVR_OW) {
+ /* put 16 bit OW data into the attribute */
+ swapIfNecessary(gLocalByteOrder, EBO_LittleEndian, buf, buflen, sizeof(Uint16));
+ ec = elem->putUint16Array(OFreinterpret_cast(Uint16 *, buf), buflen / 2);
+ } else if (evr == EVR_pixelItem) {
+ /* pixel item not yet supported */
+ }
+ }
+
+ fclose(f);
+ delete[] buf;
+ return ec;
+}
+
+static OFCondition
+insertIntoSet(DcmStack & stack, DcmTagKey tagkey, DcmEVR vr, char * value)
+{
+ // insert new Element into dataset or metaheader
+
+ OFCondition l_error = EC_Normal;
+ OFCondition newElementError = EC_Normal;
+
+ if (stack.empty())
+ l_error = EC_CorruptedData;
+
+ if (l_error == EC_Normal)
+ {
+ DcmElement * newElement = NULL;
+ DcmObject * topOfStack = stack.top();
+
+ // convert tagkey to tag including VR
+ DcmTag tag(tagkey);
+ DcmVR dcmvr(vr);
+
+ const DcmEVR tagvr = tag.getEVR();
+ if (tagvr != vr && vr != EVR_UNKNOWN && tagvr != EVR_UNKNOWN &&
+ (tagkey != DCM_LUTData || (vr != EVR_US && vr != EVR_SS && vr != EVR_OW)) &&
+ (tagvr != EVR_xs || (vr != EVR_US && vr != EVR_SS)) &&
+ (tagvr != EVR_ox || (vr != EVR_OB && vr != EVR_OW)) &&
+ (tagvr != EVR_na || vr != EVR_pixelItem))
+ {
+ CERR << "Warning: Tag " << tag << " with wrong VR "
+ << dcmvr.getVRName() << " found, correct is "
+ << tag.getVR().getVRName() << endl;
+ }
+
+ if (vr != EVR_UNKNOWN)
+ tag.setVR(dcmvr);
+
+ // create new element
+ newElementError = newDicomElement(newElement, tag);
+
+ if (newElementError == EC_Normal)
+ {
+ // tag describes an Element
+ if (!newElement)
+ // Tag was ambiguous
+ l_error = EC_InvalidVR;
+ else
+ {
+ // fill value
+ if (value)
+ {
+ if (value[0] == '=' && (tag.getEVR() == EVR_OB || tag.getEVR() == EVR_OW))
+ {
+ /*
+ * Special case handling for OB or OW data.
+ * Allow a value beginning with a '=' character to represent
+ * a file containing data to be used as the attribute value.
+ * A '=' character is not a normal value since OB and OW values
+ * must be written as multivalued hexidecimal (e.g. "00\ff\0d\8f");
+ */
+ l_error = putFileContentsIntoElement(newElement, value+1);
+ }
+ else if (tag.getEVR() == EVR_pixelItem)
+ {
+ /* pixel items not yet supported */
+ l_error = EC_InvalidTag;
+ } else {
+ l_error = newElement->putString(value);
+ }
+ }
+
+ // insert element into hierarchy
+ if (l_error == EC_Normal)
+ {
+ switch(topOfStack->ident())
+ {
+ case EVR_item:
+ case EVR_dirRecord:
+ case EVR_dataset:
+ case EVR_metainfo:
+ {
+ DcmItem *item = OFstatic_cast(DcmItem *, topOfStack);
+ item -> insert(newElement);
+ if (newElement->ident() == EVR_SQ || newElement->ident() == EVR_pixelSQ)
+ stack.push(newElement);
+ }
+ break;
+ default:
+ l_error = EC_InvalidTag;
+ break;
+ }
+ }
+ }
+ }
+ else if (newElementError == EC_SequEnd)
+ {
+ // pop stack if stack object was a sequence
+ if (topOfStack->ident() == EVR_SQ || topOfStack->ident() == EVR_pixelSQ)
+ stack.pop();
+ else
+ l_error = EC_InvalidTag;
+ }
+ else if (newElementError == EC_ItemEnd)
+ {
+ // pop stack if stack object was an item
+ switch (topOfStack->ident())
+ {
+ case EVR_item:
+ case EVR_dirRecord:
+ case EVR_dataset:
+ case EVR_metainfo:
+ stack.pop();
+ break;
+
+ default:
+ l_error = EC_InvalidTag;
+ break;
+ }
+ }
+ else if (newElementError == EC_InvalidTag)
+ {
+ if (tag.getXTag() == DCM_Item)
+ {
+ DcmItem * item = NULL;
+ if (topOfStack->getTag().getXTag() == DCM_DirectoryRecordSequence)
+ {
+ // an Item must be pushed to the stack
+ item = new DcmDirectoryRecord(tag, 0);
+ OFstatic_cast(DcmSequenceOfItems *, topOfStack) -> insert(item);
+ stack.push(item);
+ }
+ else if (topOfStack->ident() == EVR_SQ)
+ {
+ // an item must be pushed to the stack
+ item = new DcmItem(tag);
+ OFstatic_cast(DcmSequenceOfItems *, topOfStack) -> insert(item);
+ stack.push(item);
+ }
+ else
+ l_error = EC_InvalidTag;
+ }
+ else
+ l_error = EC_InvalidTag;
+ }
+ else
+ {
+ l_error = EC_InvalidTag;
+ }
+ }
+
+ return l_error;
+}
+
+static OFBool
+readDumpFile(DcmMetaInfo * metaheader, DcmDataset * dataset,
+ FILE * infile, const char * ifname, const OFBool stopOnErrors,
+ const unsigned long maxLineLength)
+{
+ char * lineBuf = new char[maxLineLength];
+ int lineNumber = 0;
+ OFBool errorOnThisLine = OFFalse;
+ char * parse = NULL;
+ char * value = NULL;
+ DcmEVR vr = EVR_UNKNOWN;
+ int errorsEncountered = 0;
+ DcmTagKey tagkey;
+ DcmStack metaheaderStack;
+ DcmStack datasetStack;
+
+ if (metaheader)
+ metaheaderStack.push(metaheader);
+
+ datasetStack.push(dataset);
+
+ while(getLine(lineBuf, int(maxLineLength), infile, lineNumber+1))
+ {
+ lineNumber++;
+
+ // ignore empty lines and comment lines
+ if (onlyWhitespace(lineBuf))
+ continue;
+ if (isaCommentLine(lineBuf))
+ continue;
+
+ errorOnThisLine = OFFalse;
+
+ parse = &lineBuf[0];
+
+ // parse tag an the line
+ if (!parseTag(parse, tagkey))
+ {
+ CERR << OFFIS_CONSOLE_APPLICATION ": "<< ifname << ": "
+ << "no Tag found (line " << lineNumber << ")"<< endl;
+ errorOnThisLine = OFTrue;
+ }
+
+ // parse optional VR
+ if (!errorOnThisLine && !parseVR(parse, vr))
+ vr = EVR_UNKNOWN;
+
+ // parse optional value
+ if (!errorOnThisLine && !parseValue(parse, value, vr))
+ {
+ CERR << OFFIS_CONSOLE_APPLICATION ": "<< ifname << ": "
+ << "incorrect value specification (line " << lineNumber << ")"<< endl;
+ errorOnThisLine = OFTrue;
+ }
+
+
+ // insert new element that consists of tag, VR, and value
+ if (!errorOnThisLine)
+ {
+ OFCondition l_error = EC_Normal;
+ if (tagkey.getGroup() == 2)
+ {
+ if (metaheader)
+ l_error = insertIntoSet(metaheaderStack, tagkey, vr, value);
+ }
+ else
+ l_error = insertIntoSet(datasetStack, tagkey, vr, value);
+
+ if (value)
+ {
+ delete[] value;
+ value = NULL;
+ }
+ if (l_error != EC_Normal)
+ {
+ errorOnThisLine = OFTrue;
+ CERR << OFFIS_CONSOLE_APPLICATION ": " << ifname << ": Error in creating Element: "
+ << l_error.text() << " (line " << lineNumber << ")"<< endl;
+ }
+
+ }
+
+ if (errorOnThisLine)
+ errorsEncountered++;
+ }
+
+
+ // test blocking structure
+ if (metaheader && metaheaderStack.card() != 1)
+ {
+ CERR << OFFIS_CONSOLE_APPLICATION ": " << ifname << ": Block Error in metaheader" << endl;
+ errorsEncountered++;
+ }
+
+ if (datasetStack.card() != 1)
+ {
+ CERR << OFFIS_CONSOLE_APPLICATION ": " << ifname << ": Block Error in dataset" << endl;
+ errorsEncountered++;
+ }
+
+ delete[] lineBuf;
+
+ if (errorsEncountered)
+ {
+ CERR << errorsEncountered << " Errors found in " << ifname << endl;
+ return !stopOnErrors;
+ }
+ else
+ return OFTrue;
+}
+
+// ********************************************
+
+int main(int argc, char *argv[])
+{
+#ifdef HAVE_GUSI_H
+ GUSISetup(GUSIwithSIOUXSockets);
+ GUSISetup(GUSIwithInternetSockets);
+#endif
+
+ SetDebugLevel(( 0 ));
+
+ OFConsoleApplication app(OFFIS_CONSOLE_APPLICATION , "Convert ASCII dump to DICOM file", rcsid);
+ OFCommandLine cmd;
+
+ cmd.setOptionColumns(LONGCOL, SHORTCOL);
+ cmd.setParamColumn(LONGCOL + SHORTCOL + 4);
+
+ cmd.addParam("dumpfile-in", "dump input filename");
+ cmd.addParam("dcmfile-out", "DICOM output filename");
+
+ cmd.addGroup("general options:", LONGCOL, SHORTCOL + 2);
+ cmd.addOption("--help", "-h", "print this help text and exit");
+ cmd.addOption("--version", "print version information and exit", OFTrue /* exclusive */);
+ cmd.addOption("--verbose", "-v", "verbose mode, print processing details");
+ cmd.addOption("--debug", "-d", "debug mode, print debug information");
+
+ cmd.addGroup("input options:", LONGCOL, SHORTCOL + 2);
+ cmd.addOption("--line", "+l", 1, "[m]ax-length: integer",
+ "maximum line length m (default 4096)");
+
+ cmd.addGroup("output options:");
+ cmd.addSubGroup("output file format:");
+ cmd.addOption("--write-file", "+F", "write file format (default)");
+ cmd.addOption("--write-dataset", "-F", "write data set without file meta information");
+ cmd.addSubGroup("output transfer syntax:");
+ cmd.addOption("--write-xfer-little", "+te", "write with explicit VR little endian (default)");
+ cmd.addOption("--write-xfer-big", "+tb", "write with explicit VR big endian TS");
+ cmd.addOption("--write-xfer-implicit", "+ti", "write with implicit VR little endian TS");
+ cmd.addSubGroup("error handling:");
+ cmd.addOption("--stop-on-error", "-E", "do not write if dump is damaged (default)");
+ cmd.addOption("--ignore-errors", "+E", "attempt to write even if dump is damaged");
+ cmd.addSubGroup("post-1993 value representations:");
+ cmd.addOption("--enable-new-vr", "+u", "enable support for new VRs (UN/UT) (default)");
+ cmd.addOption("--disable-new-vr", "-u", "disable support for new VRs, convert to OB");
+ cmd.addSubGroup("group length encoding:");
+ cmd.addOption("--group-length-recalc", "+g=", "recalculate group lengths if present (default)");
+ cmd.addOption("--group-length-create", "+g", "always write with group length elements");
+ cmd.addOption("--group-length-remove", "-g", "always write without group length elements");
+ cmd.addSubGroup("length encoding in sequences and items:");
+ cmd.addOption("--length-explicit", "+e", "write with explicit lengths (default)");
+ cmd.addOption("--length-undefined", "-e", "write with undefined lengths");
+ cmd.addSubGroup("data set trailing padding (not with --write-dataset):");
+ cmd.addOption("--padding-retain", "-p=", "do not change padding\n(default if not --write-dataset)");
+ cmd.addOption("--padding-off", "-p", "no padding (implicit if --write-dataset)");
+ cmd.addOption("--padding-create", "+p", 2, "[f]ile-pad [i]tem-pad: integer",
+ "align file on multiple of f bytes\nand items on multiple of i bytes");
+
+ int opt_debugMode = 0;
+ const char* ifname = NULL;
+ const char* ofname = NULL;
+ E_TransferSyntax oxfer = EXS_LittleEndianExplicit;
+ E_EncodingType oenctype = EET_ExplicitLength;
+ E_GrpLenEncoding oglenc = EGL_recalcGL;
+ E_PaddingEncoding opadenc = EPD_withoutPadding;
+ OFCmdUnsignedInt opt_filepad = 0;
+ OFCmdUnsignedInt opt_itempad = 0;
+ OFCmdUnsignedInt opt_linelength = DCM_DumpMaxLineSize;
+ OFBool verbosemode = OFFalse;
+ OFBool stopOnErrors = OFTrue;
+ OFBool createFileFormat = OFTrue;
+
+ /* evaluate command line */
+ prepareCmdLineArgs(argc, argv, OFFIS_CONSOLE_APPLICATION);
+ if (app.parseCommandLine(cmd, argc, argv, OFCommandLine::ExpandWildcards))
+ {
+ /* check exclusive options first */
+
+ if (cmd.getParamCount() == 0)
+ {
+ if (cmd.findOption("--version"))
+ {
+ app.printHeader(OFTrue /*print host identifier*/); // uses ofConsole.lockCerr()
+ CERR << endl << "External libraries used:";
+#ifdef WITH_ZLIB
+ CERR << endl << "- ZLIB, Version " << zlibVersion() << endl;
+#else
+ CERR << " none" << endl;
+#endif
+ return 0;
+ }
+ }
+
+ /* command line parameters */
+
+ cmd.getParam(1, ifname);
+ cmd.getParam(2, ofname);
+
+ if (cmd.findOption("--verbose")) verbosemode = OFTrue;
+ if (cmd.findOption("--debug")) opt_debugMode = 5;
+
+ if (cmd.findOption("--line"))
+ {
+ app.checkValue(cmd.getValueAndCheckMin(opt_linelength, 80));
+ }
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--write-file")) createFileFormat = OFTrue;
+ if (cmd.findOption("--write-dataset")) createFileFormat = OFFalse;
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--write-xfer-little")) oxfer = EXS_LittleEndianExplicit;
+ if (cmd.findOption("--write-xfer-big")) oxfer = EXS_BigEndianExplicit;
+ if (cmd.findOption("--write-xfer-implicit")) oxfer = EXS_LittleEndianImplicit;
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--stop-on-error")) stopOnErrors = OFTrue;
+ if (cmd.findOption("--ignore-errors")) stopOnErrors = OFFalse;
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--enable-new-vr"))
+ {
+ dcmEnableUnknownVRGeneration.set(OFTrue);
+ dcmEnableUnlimitedTextVRGeneration.set(OFTrue);
+ }
+ if (cmd.findOption("--disable-new-vr"))
+ {
+ dcmEnableUnknownVRGeneration.set(OFFalse);
+ dcmEnableUnlimitedTextVRGeneration.set(OFFalse);
+ }
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--group-length-recalc")) oglenc = EGL_recalcGL;
+ if (cmd.findOption("--group-length-create")) oglenc = EGL_withGL;
+ if (cmd.findOption("--group-length-remove")) oglenc = EGL_withoutGL;
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--length-explicit")) oenctype = EET_ExplicitLength;
+ if (cmd.findOption("--length-undefined")) oenctype = EET_UndefinedLength;
+ cmd.endOptionBlock();
+
+ cmd.beginOptionBlock();
+ if (cmd.findOption("--padding-retain"))
+ {
+ if (!createFileFormat) app.printError("--padding-retain not allowed with --write-dataset");
+ opadenc = EPD_noChange;
+ }
+ if (cmd.findOption("--padding-off")) opadenc = EPD_withoutPadding;
+ if (cmd.findOption("--padding-create"))
+ {
+ if (!createFileFormat) app.printError("--padding-create not allowed with --write-dataset");
+ app.checkValue(cmd.getValueAndCheckMin(opt_filepad, 0));
+ app.checkValue(cmd.getValueAndCheckMin(opt_itempad, 0));
+ opadenc = EPD_withPadding;
+ }
+ cmd.endOptionBlock();
+
+ }
+
+ DcmFileFormat fileformat;
+ DcmMetaInfo * metaheader = fileformat.getMetaInfo();
+ DcmDataset * dataset = fileformat.getDataset();
+
+ SetDebugLevel((opt_debugMode));
+
+ /* make sure data dictionary is loaded */
+ if (!dcmDataDict.isDictionaryLoaded()) {
+ CERR << "Warning: no data dictionary loaded, "
+ << "check environment variable: "
+ << DCM_DICT_ENVIRONMENT_VARIABLE << endl;
+ }
+
+ if (verbosemode)
+ COUT << "reading dump file: " << ifname << endl;
+
+ // open input dump file
+ if ((ifname == NULL) || (strlen(ifname) == 0))
+ {
+ CERR << "invalid input filename: <empty string>" << endl;
+ return 1;
+ }
+ FILE * dumpfile = fopen(ifname, "r");
+ if (!dumpfile)
+ {
+ CERR << "input file does not exist: " << ifname << endl;
+ return 1;
+ }
+
+ // read dump file into metaheader and dataset
+ if (readDumpFile(metaheader, dataset, dumpfile, ifname, stopOnErrors,
+ OFstatic_cast(unsigned long, opt_linelength)))
+ {
+ // write into file format or dataset
+ if (verbosemode)
+ COUT << "writing DICOM file" << endl;
+
+ OFCondition l_error = fileformat.saveFile(ofname, oxfer, oenctype, oglenc, opadenc,
+ OFstatic_cast(Uint32, opt_filepad), OFstatic_cast(Uint32, opt_itempad), !createFileFormat);
+
+ if (l_error == EC_Normal)
+ COUT << "dump successfully converted." << endl;
+ else
+ {
+ CERR << "Error: " << l_error.text()
+ << ": writing file: " << ofname << endl;
+ return 1;
+ }
+ }
+
+ return 0;
+}
Index: trunk/milena/sandbox/fabien/dcmtk/Makefile
===================================================================
--- trunk/milena/sandbox/fabien/dcmtk/Makefile (revision 0)
+++ trunk/milena/sandbox/fabien/dcmtk/Makefile (revision 3432)
@@ -0,0 +1,2 @@
+all: dicom.cc
+ g++-4.2 -DHAVE_CONFIG_H -I../../../ -I/opt/local/include/ -L/opt/local/lib/ -ldcmdata -ldcmdsig -ldcmimage -ldcmimgle -ldcmjpeg -ldcmnet -ldcmpstat -ldcmqrdb -ldcmsr -ldcmtls -ldcmwlm dicom.cc -o dicom
Index: trunk/milena/sandbox/fabien/dcmtk/load.hh
===================================================================
--- trunk/milena/sandbox/fabien/dcmtk/load.hh (revision 0)
+++ trunk/milena/sandbox/fabien/dcmtk/load.hh (revision 3432)
@@ -0,0 +1,388 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*
+ *
+ * Copyright (C) 1994-2005, OFFIS
+ *
+ * This software and supporting documentation were developed by
+ *
+ * Kuratorium OFFIS e.V.
+ * Healthcare Information and Communication Systems
+ * Escherweg 2
+ * D-26121 Oldenburg, Germany
+ *
+ * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY
+ * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR
+ * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR
+ * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
+ * PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
+ *
+ * Module: dcmdata
+ *
+ * Author: Gerd Ehlers
+ *
+ * Purpose: List the contents of a dicom file
+ *
+ * Last Update: $Author: meichel $
+ * Update Date: $Date: 2005/12/08 15:40:46 $
+ * CVS/RCS Revision: $Revision: 1.55 $
+ * Status: $State: Exp $
+ *
+ * CVS/RCS Log at end of file
+ *
+ */
+
+#ifndef MLN_IO_DICOM_LOAD_HH
+# define MLN_IO_DICOM_LOAD_HH
+
+/*!
+ * \file mln/io/dicom/load.hh
+ *
+ * \brief Define a function which loads an image of kind dicom with
+ * given path.
+ *
+ */
+
+# include <mln/io/pnm/load.hh>
+
+# include <dcmtk/config/osconfig.h> /* make sure OS specific configuration is included first */
+# include <dcmtk/ofstd/ofstream.h>
+# include <dcmtk/dcmdata/dctk.h>
+# include <dcmtk/dcmdata/dcdebug.h>
+# include <dcmtk/dcmdata/cmdlnarg.h>
+# include <dcmtk/ofstd/ofconapp.h>
+# include <dcmtk/dcmdata/dcuid.h> /* for dcmtk version name */
+# include <dcmtk/dcmdata/dcistrmz.h> /* for dcmZlibExpectRFC1950Encoding */
+
+# define INCLUDE_CSTDLIB
+# define INCLUDE_CSTRING
+# include <dcmtk/ofstd/ofstdinc.h>
+
+# ifdef WITH_ZLIB
+# include <zlib.h> /* for zlibVersion() */
+# endif
+
+# define SHORTCOL 3
+# define LONGCOL 20
+# define PATH_SEPARATOR '/'
+
+
+
+namespace mln
+{
+
+ namespace io
+ {
+
+ namespace dicom
+ {
+
+ /*! Load a dicom image in a Milena image.
+ *
+ * \param[out] ima A reference to the image which will receive
+ * data.
+ * \param[in] filename The source.
+ */
+ template <typename I>
+ void load(Image<I>& ima,
+ const std::string& filename);
+
+ /*! Load a dicom image in a Milena image. To use this routine, you
+ * should specialize the template whith the value type of the
+ * image loaded. (ex : load<value::int_u8>("...") )
+ *
+ * \param[in] filename The image source.
+ *
+ * \return An image2d which contains loaded data.
+ */
+ template <typename V>
+ image2d<V> load(const std::string& filename);
+
+ /*! Load a dicom image in a Milena image. To use this routine, you
+ * should specialize the template whith the value type of the
+ * image loaded. (ex : load<value::int_u8>("...") )
+ *
+ * \param[in] filename The image source.
+ *
+ * \return An image2d which contains loaded data.
+ */
+ template <typename V>
+ image3d<V> load(const std::string& filename);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V>
+ inline
+ image2d<V> load(const std::string& filename)
+ {
+ trace::entering("mln::io::dicom::load");
+ image2d<V> ima;// = io::pnm::load<V>(DICOM, filename);
+ trace::exiting("mln::io::dicom::load");
+ return ima;
+ }
+
+ template <typename V>
+ inline
+ image3d<V> load(const std::string& filename)
+ {
+ trace::entering("mln::io::dicom::load");
+ image2d<V> ima;// = io::pnm::load<V>(DICOM, filename);
+ trace::exiting("mln::io::dicom::load");
+ return ima;
+ }
+
+
+
+
+
+
+ static OFBool printAllInstances = OFTrue;
+ static OFBool prependSequenceHierarchy = OFFalse;
+ static int printTagCount = 0;
+ static const int MAX_PRINT_TAG_NAMES = 1024;
+ static const char* printTagNames[MAX_PRINT_TAG_NAMES];
+ static const DcmTagKey* printTagKeys[MAX_PRINT_TAG_NAMES];
+ static OFCmdUnsignedInt maxReadLength = 4096; // default is 4 KB
+
+ static OFBool addPrintTagName(const char* tagName)
+ {
+ if (printTagCount >= MAX_PRINT_TAG_NAMES) {
+ std::cerr << "error: too many print Tag options (max: " << MAX_PRINT_TAG_NAMES << ")" << endl;
+ return OFFalse;
+ }
+
+ unsigned int group = 0xffff;
+ unsigned int elem = 0xffff;
+ if (sscanf(tagName, "%x,%x", &group, &elem) != 2)
+ {
+ /* it is a name */
+ const DcmDataDictionary& globalDataDict = dcmDataDict.rdlock();
+ const DcmDictEntry *dicent = globalDataDict.findEntry(tagName);
+ if (dicent == NULL)
+ {
+ std::cerr << "error: unrecognised tag name: '" << tagName << "'" << endl;
+ dcmDataDict.unlock();
+ return OFFalse;
+ }
+ else
+ {
+ /* note for later */
+ printTagKeys[printTagCount] = new DcmTagKey(dicent->getKey());
+ }
+ dcmDataDict.unlock();
+ }
+ else
+ {
+ /* tag name has format xxxx,xxxx */
+ /* do not lookup in dictionary, tag could be private */
+ printTagKeys[printTagCount] = NULL;
+ }
+
+ printTagNames[printTagCount] = strcpy(OFstatic_cast(char*, malloc(strlen(tagName)+1)), tagName);
+ printTagCount++;
+ return OFTrue;
+ }
+
+
+ template <typename I>
+ static void printResult(Image<I>& ima, DcmStack& stack, size_t printFlags)
+ {
+ unsigned long n = stack.card();
+ if (n == 0)
+ return;
+
+ if (prependSequenceHierarchy) {
+ /* print the path leading up to the top stack elem */
+ for (unsigned long i = n - 1; i >= 1; i--) {
+ DcmObject *dobj = stack.elem(i);
+ /* do not print if a DCM_Item as this is not
+ * very helpful to distinguish instances.
+ */
+ if (dobj != NULL && dobj->getTag().getXTag() != DCM_Item) {
+ char buf[512];
+ sprintf(buf, "(%x,%x).",
+ OFstatic_cast(unsigned, dobj->getGTag()),
+ OFstatic_cast(unsigned, dobj->getETag()));
+ std::cout << buf;
+ }
+ }
+ }
+
+ /* print the tag and its value */
+ DcmObject *dobj = stack.top();
+ dobj->print(std::cout, printFlags);
+ }
+
+ template <typename I>
+ static int dumpFile(Image<I>& ima,
+ const char *ifname,
+ const E_FileReadMode readMode,
+ const E_TransferSyntax xfer,
+ const size_t printFlags,
+ const OFBool loadIntoMemory,
+ const OFBool stopOnErrors,
+ const OFBool writePixelData,
+ const char *pixelDirectory)
+ {
+ int result = 0;
+
+ DcmFileFormat dfile;
+ DcmObject *dset = &dfile;
+
+ if (readMode == ERM_dataset)
+ dset = dfile.getDataset();
+
+ // Load file
+
+ OFCondition cond = dfile.loadFile(ifname, xfer, EGL_noChange, maxReadLength, readMode);
+
+ // Read error
+
+ if (!cond.good())
+ {
+ std::cerr << "error: " << dfile.error().text()
+ << ": reading file: "<< ifname << endl;
+ result = 1;
+ if (stopOnErrors)
+ return result;
+ }
+
+ if (loadIntoMemory)
+ dfile.loadAllDataIntoMemory();
+
+ if (printTagCount == 0)
+ {
+ if (writePixelData)
+ {
+ OFString str = ifname;
+ OFString rname = pixelDirectory;
+ if ((rname.length() > 0) && (rname[rname.length() - 1] != PATH_SEPARATOR))
+ rname += PATH_SEPARATOR;
+ size_t pos = str.find_last_of(PATH_SEPARATOR);
+ if (pos == OFString_npos)
+ rname += str;
+ else
+ rname += str.substr(pos + 1);
+ size_t counter = 0;
+ dset->print(std::cout, printFlags, 0 /*level*/, rname.c_str(), &counter);
+ }
+ else
+ dset->print(std::cout, printFlags);
+ }
+ else
+ {
+ /* only print specified tags */
+ for (int i = 0; i < printTagCount; i++)
+ {
+ unsigned int group = 0xffff;
+ unsigned int elem = 0xffff;
+ DcmTagKey searchKey;
+ const char* tagName = printTagNames[i];
+ if (printTagKeys[i])
+ searchKey = *printTagKeys[i];
+ else
+ {
+ if (sscanf(tagName, "%x,%x", &group, &elem) == 2)
+ searchKey.set(group, elem);
+ else
+ {
+ std::cerr << "Internal ERROR in File " << __FILE__ << ", Line "
+ << __LINE__ << std::endl
+ << "-- Named tag inconsistency" << std::endl;
+ abort();
+ }
+ }
+
+ DcmStack stack;
+ if (dset->search(searchKey, stack, ESM_fromHere, OFTrue) == EC_Normal)
+ {
+ printResult(ima, stack, printFlags);
+ if (printAllInstances)
+ {
+ while (dset->search(searchKey, stack, ESM_afterStackTop, OFTrue) == EC_Normal)
+ printResult(ima, stack, printFlags);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+
+ template <typename I>
+ inline
+ void load(Image<I>& ima,
+ const std::string& filename)
+ {
+ trace::entering("mln::io::dicom::load");
+
+ std::ifstream file(filename.c_str());
+ if (! file)
+ {
+ std::cerr << "error: cannot open file '" << filename << "'!";
+ abort();
+ }
+
+ int opt_debugMode = 0;
+ OFBool loadIntoMemory = OFTrue;
+ size_t printFlags = DCMTypes::PF_shortenLongTagValues /*| DCMTypes::PF_showTreeStructure*/;
+ OFBool printFilename = OFFalse;
+ OFBool writePixelData = OFFalse;
+ E_FileReadMode readMode = ERM_autoDetect;
+ E_TransferSyntax xfer = EXS_Unknown;
+ OFBool stopOnErrors = OFTrue;
+ const char *current = NULL;
+ const char *pixelDirectory = NULL;
+
+
+ /* make sure data dictionary is loaded */
+ if (!dcmDataDict.isDictionaryLoaded())
+ {
+ std::cerr << "Warning: no data dictionary loaded, "
+ << "check environment variable: "
+ << DCM_DICT_ENVIRONMENT_VARIABLE;
+ }
+
+ int errorCount = 0;
+ dumpFile(ima, current, readMode, xfer, printFlags, loadIntoMemory, stopOnErrors,
+ writePixelData, pixelDirectory);
+
+ trace::exiting("mln::io::dicom::load");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::io::dicom
+
+ } // end of namespace mln::io
+
+} // end of namespace mln
+
+
+#endif // ! MLN_IO_DICOM_LOAD_HH
1
0
* mln/test/predicate.hh: add predicate_tests() function and call it
in test::impl::* functions.
Fix a wrong pixter type.
---
milena/ChangeLog | 8 ++++
milena/mln/test/predicate.hh | 96 +++++++++++++++++++++++++++++++----------
2 files changed, 80 insertions(+), 24 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 6f46274..85e2329 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2009-02-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Make test::predicate more robust.
+
+ * mln/test/predicate.hh: add predicate_tests() function and call it
+ in test::impl::* functions.
+ Fix a wrong pixter type.
+
+2009-02-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Small fixes for doc generation.
* doc/Doxyfile.in: add doc/tutorial/img to IMAGE_PATH.
diff --git a/milena/mln/test/predicate.hh b/milena/mln/test/predicate.hh
index f2f44e3..2949490 100644
--- a/milena/mln/test/predicate.hh
+++ b/milena/mln/test/predicate.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
@@ -44,38 +44,77 @@ namespace mln
namespace test
{
- /*! Test if all pixel values of \p ima verify the predicate \p
- * f.
- *
- * \param[in] ima The image.
- * \param[in] f The predicate.
- */
+ /// Test if all pixel values of \p ima verify the predicate \p
+ /// f.
+ ///
+ /// \param[in] ima The image.
+ /// \param[in] f The predicate.
template <typename I, typename F>
bool predicate(const Image<I>& ima, const Function_v2b<F>& f);
- /*! Test if all pixel values of \p lhs and \p rhs verify the
- * predicate \p f.
- *
- * \param[in] lhs The image.
- * \param[in] rhs The image.
- * \param[in] f The predicate.
- */
+ /// Test if all pixel values of \p lhs and \p rhs verify the
+ /// predicate \p f.
+ ///
+ /// \param[in] lhs The image.
+ /// \param[in] rhs The image.
+ /// \param[in] f The predicate.
template <typename I, typename J, typename F>
bool predicate(const Image<I>& lhs, const Image<J>& rhs, const Function_vv2b<F>& f);
- /*! Test if all points of \p pset verify the predicate \p f.
- *
- * \param[in] pset The point set.
- * \param[in] f The predicate.
- */
+ /// Test if all points of \p pset verify the predicate \p f.
+ ///
+ /// \param[in] pset The point set.
+ /// \param[in] f The predicate.
template <typename S, typename F>
bool predicate(const Site_Set<S>& pset, const Function_p2b<F>& f);
# ifndef MLN_INCLUDE_ONLY
+ namespace internal
+ {
+
+ template <typename I, typename F>
+ inline
+ void predicate_tests(const Image<I>& ima,
+ const Function_v2b<F>& f)
+ {
+ mln_precondition(exact(ima).is_valid());
+ (void) ima;
+ (void) f;
+ }
+
+ template <typename I, typename J, typename F>
+ inline
+ void predicate_tests(const Image<I>& lhs_,
+ const Image<J>& rhs_,
+ const Function_vv2b<F>& f)
+ {
+ const I& lhs = exact(lhs_);
+ const J& rhs = exact(rhs_);
+
+ mln_precondition(lhs.is_valid());
+ mln_precondition(rhs.is_valid());
+ mln_precondition(lhs.domain() == rhs.domain());
+ (void) lhs;
+ (void) rhs;
+ (void) f;
+ }
+
+ template <typename S, typename F>
+ inline
+ void predicate_tests(const Site_Set<S>& pset,
+ const Function_p2b<F>& f)
+ {
+ mln_precondition(exact(pset).is_valid());
+ (void) pset;
+ (void) f;
+ }
+
+ } // end of namespace mln::test::internal
+
namespace impl
{
@@ -83,6 +122,8 @@ namespace mln
inline
bool predicate_(trait::image::speed::any, const I& ima, const F& f)
{
+ internal::predicate_tests(ima, f);
+
mln_piter(I) p(ima.domain());
for_all(p)
if (! f(ima(p)))
@@ -94,6 +135,8 @@ namespace mln
inline
bool predicate_(trait::image::speed::fastest, const I& ima, const F& f)
{
+ internal::predicate_tests(ima, f);
+
mln_pixter(const I) pxl(ima);
for_all(pxl)
if (! f(pxl.val()))
@@ -107,6 +150,8 @@ namespace mln
trait::image::speed::any,
const I& lhs, const J& rhs, const F& f)
{
+ internal::predicate_tests(lhs, rhs, f);
+
mln_piter(I) p(lhs.domain());
for_all(p)
if (! f(lhs(p), rhs(p)))
@@ -120,8 +165,10 @@ namespace mln
trait::image::speed::fastest,
const I& lhs, const J& rhs, const F& f)
{
+ internal::predicate_tests(lhs, rhs, f);
+
mln_pixter(const I) pxl1(lhs);
- mln_pixter(const I) pxl2(rhs);
+ mln_pixter(const J) pxl2(rhs);
for_all_2(pxl1, pxl2)
if (! f(pxl1.val(), pxl2.val()))
return false;
@@ -132,6 +179,8 @@ namespace mln
inline
bool predicate_(const Site_Set<S>& pset, const F& f)
{
+ internal::predicate_tests(pset, f);
+
mln_piter(S) p(exact(pset));
for_all(p)
if (! f(p))
@@ -148,7 +197,7 @@ namespace mln
inline
bool predicate(const Image<I>& ima, const Function_v2b<F>& f)
{
- mln_precondition(exact(ima).is_valid());
+ internal::predicate_tests(ima, f);
return impl::predicate_(mln_trait_image_speed(I)(), exact(ima),
exact(f));
}
@@ -161,9 +210,7 @@ namespace mln
const I& lhs = exact(lhs_);
const J& rhs = exact(rhs_);
- mln_precondition(lhs.is_valid());
- mln_precondition(rhs.is_valid());
- mln_precondition(lhs.domain() == rhs.domain());
+ internal::predicate_tests(lhs_, rhs_, f);
return impl::predicate_(mln_trait_image_speed(I)(),
mln_trait_image_speed(J)(),
@@ -175,6 +222,7 @@ namespace mln
inline
bool predicate(const Site_Set<S>& pset, const Function_p2b<F>& f)
{
+ internal::predicate_tests(pset, f);
return impl::predicate_(exact(pset), exact(f));
}
--
1.5.6.5
1
0
* doc/Doxyfile.in: add doc/tutorial/img to IMAGE_PATH.
* doc/doc.mk: Set the path to doc/tutorial/img in a variable.
* doc/tutorial/Makefile.am: Add IMG_SRCDIR to to TEXINPUTS.
* img/small-enlarged.png,
* img/small.png: move...
* doc/tutorial/img/small-enlarged.png,
* doc/tutorial/img/small.png: ... here.
* doc/tutorial/samples/accu-wrong-instanciation.cc.raw: use a
different accumulator.
* doc/tutorial/tools/sample_utils.hh: do not include all io headers.
---
milena/ChangeLog | 20 ++++++++++++++++++++
milena/doc/Doxyfile.in | 2 +-
milena/doc/doc.mk | 2 ++
milena/doc/tutorial/Makefile.am | 2 +-
milena/{ => doc/tutorial}/img/small-enlarged.png | Bin 91556 -> 91556 bytes
milena/{ => doc/tutorial}/img/small.png | Bin 22653 -> 22653 bytes
.../samples/accu-wrong-instanciation.cc.raw | 2 +-
milena/doc/tutorial/tools/sample_utils.hh | 4 +++-
8 files changed, 28 insertions(+), 4 deletions(-)
rename milena/{ => doc/tutorial}/img/small-enlarged.png (100%)
rename milena/{ => doc/tutorial}/img/small.png (100%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index e26f8d4..6f46274 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,23 @@
+2009-02-27 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Small fixes for doc generation.
+
+ * doc/Doxyfile.in: add doc/tutorial/img to IMAGE_PATH.
+
+ * doc/doc.mk: Set the path to doc/tutorial/img in a variable.
+
+ * doc/tutorial/Makefile.am: Add IMG_SRCDIR to to TEXINPUTS.
+
+ * img/small-enlarged.png,
+ * img/small.png: move...
+ * doc/tutorial/img/small-enlarged.png,
+ * doc/tutorial/img/small.png: ... here.
+
+ * doc/tutorial/samples/accu-wrong-instanciation.cc.raw: use a
+ different accumulator.
+
+ * doc/tutorial/tools/sample_utils.hh: do not include all io headers.
+
2009-02-26 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add int_u12 type and fix DICOM support.
diff --git a/milena/doc/Doxyfile.in b/milena/doc/Doxyfile.in
index cda47dc..5d657a4 100644
--- a/milena/doc/Doxyfile.in
+++ b/milena/doc/Doxyfile.in
@@ -96,7 +96,7 @@ EXAMPLE_PATH = @top_srcdir@/milena/doc/tutorial/samples \
@top_srcdir@/milena/doc/tutorial/outputs
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = @top_srcdir@/milena/img \
+IMAGE_PATH = @top_srcdir@/milena/doc/tutorial/img \
@top_srcdir@/milena/doc/tutorial/figures \
@top_builddir@/milena/doc/tutorial/figures
INPUT_FILTER =
diff --git a/milena/doc/doc.mk b/milena/doc/doc.mk
index b41750d..938c4c3 100644
--- a/milena/doc/doc.mk
+++ b/milena/doc/doc.mk
@@ -4,10 +4,12 @@ include $(top_srcdir)/milena/tests/tests.mk
AM_CPPFLAGS += -I$(top_srcdir)/milena/doc/tutorial/tools
+
TUTORIAL_SRCDIR = $(top_srcdir)/milena/doc/tutorial
OUTPUTS_SRCDIR = $(TUTORIAL_SRCDIR)/outputs
FIGURES_SRCDIR = $(TUTORIAL_SRCDIR)/figures
SAMPLES_SRCDIR = $(TUTORIAL_SRCDIR)/samples
+IMG_SRCDIR = $(TUTORIAL_SRCDIR)/img
TUTORIAL_BUILDDIR = $(top_builddir)/milena/doc/tutorial
OUTPUTS_BUILDDIR = $(TUTORIAL_BUILDDIR)/outputs
diff --git a/milena/doc/tutorial/Makefile.am b/milena/doc/tutorial/Makefile.am
index ceb4534..53c9521 100644
--- a/milena/doc/tutorial/Makefile.am
+++ b/milena/doc/tutorial/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = samples
.PHONY: tutorial tuto_html
include $(top_srcdir)/milena/doc/doc.mk
-TEXINPUTS = $(TUTORIAL_SRCDIR):$(TUTORIAL_BUILDDIR):$(OUTPUTS_SRCDIR):
+TEXINPUTS = $(TUTORIAL_SRCDIR):$(TUTORIAL_BUILDDIR):$(OUTPUTS_SRCDIR):$(IMG_SRCDIR):
tutorial: data fig-convert
TEXINPUTS=$(TEXINPUTS) pdflatex $(TUTORIAL_SRCDIR)/tutorial.tex
diff --git a/milena/img/small-enlarged.png b/milena/doc/tutorial/img/small-enlarged.png
similarity index 100%
rename from milena/img/small-enlarged.png
rename to milena/doc/tutorial/img/small-enlarged.png
diff --git a/milena/img/small.png b/milena/doc/tutorial/img/small.png
similarity index 100%
rename from milena/img/small.png
rename to milena/doc/tutorial/img/small.png
diff --git a/milena/doc/tutorial/samples/accu-wrong-instanciation.cc.raw b/milena/doc/tutorial/samples/accu-wrong-instanciation.cc.raw
index 25e943d..895c9f4 100644
--- a/milena/doc/tutorial/samples/accu-wrong-instanciation.cc.raw
+++ b/milena/doc/tutorial/samples/accu-wrong-instanciation.cc.raw
@@ -1 +1 @@
-level::compute(accu::meta::bbox, ima);
+level::compute(accu::meta::max, ima);
diff --git a/milena/doc/tutorial/tools/sample_utils.hh b/milena/doc/tutorial/tools/sample_utils.hh
index 36536ba..d819cff 100644
--- a/milena/doc/tutorial/tools/sample_utils.hh
+++ b/milena/doc/tutorial/tools/sample_utils.hh
@@ -29,7 +29,9 @@
# define DOC_TUTORIAL_TOOLS_SAMPLE_UTILS_HH
# include <mln/core/image/image2d.hh>
-# include <mln/io/all.hh>
+# include <mln/io/pbm/all.hh>
+# include <mln/io/pgm/all.hh>
+# include <mln/io/ppm/all.hh>
namespace doc
{
--
1.5.6.5
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-02-26 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add int_u12 type and fix DICOM support.
* mln/convert/from_to.hxx: Convert histo::array into image1d.
* mln/core/image/image1d.hh: Convert histo::array into image1d.
* mln/io/all.hh: Add dicom include file.
* mln/io/dicom/load.hh: Fix load support.
* mln/value/int_u12.hh: New, implement int_u12 type.
---
image1d.hh | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
Index: trunk/milena/mln/core/image/image1d.hh
===================================================================
--- trunk/milena/mln/core/image/image1d.hh (revision 3428)
+++ trunk/milena/mln/core/image/image1d.hh (revision 3429)
@@ -118,6 +118,27 @@
+ // Forward declaration.
+ template <typename T> struct image1d;
+
+
+
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ // histo::array -> image1d.
+ template <typename V, typename T>
+ void from_to_(const histo::array<V>& from, image1d<T>& to);
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+
+
+
/*! \brief Basic 1D image class.
*
* The parameter \c T is the type of pixel values. This image class
@@ -520,9 +541,33 @@
# include <mln/core/w_window.hh>
+
namespace mln
{
+
+ namespace convert
+ {
+
+ namespace over_load
+ {
+
+ // histo::array -> image1d.
+ template <typename V, typename T>
+ inline
+ void
+ from_to_(const histo::array<V>& from, image1d<T>& to)
+ {
+ to.init_(make::box1d(from.nvalues()), 0);
+ for (unsigned i = 0; i < from.nvalues(); ++i)
+ from_to(from[i], to(point1d(i)));
+ }
+
+ } // end of namespace mln::convert::over_load
+
+ } // end of namespace mln::convert
+
+
namespace trait
{
Index: trunk/milena/mln/value/int_u12.hh
===================================================================
--- trunk/milena/mln/value/int_u12.hh (revision 0)
+++ trunk/milena/mln/value/int_u12.hh (revision 3429)
@@ -0,0 +1,55 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_INT_U12_HH
+# define MLN_VALUE_INT_U12_HH
+
+/*! \file mln/value/int_u12.hh
+ *
+ * \brief Define the alias value::int_u12.
+ */
+
+# include <mln/value/int_u.hh>
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+
+ /// Alias for unsigned 12-bit integers.
+ typedef int_u<12> int_u12;
+
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_INT_U12_HH
Index: trunk/milena/mln/convert/from_to.hxx
===================================================================
--- trunk/milena/mln/convert/from_to.hxx (revision 3428)
+++ trunk/milena/mln/convert/from_to.hxx (revision 3429)
@@ -65,6 +65,8 @@
template <typename D> class window;
template <typename D, typename W> class w_window;
+ template <typename T> struct image1d;
+
namespace algebra {
template <unsigned n, typename T> class vec;
template <unsigned d, typename C> class h_vec;
@@ -76,6 +78,10 @@
}
}
+ namespace histo {
+ template <typename T> struct array;
+ }
+
namespace util {
template <typename T> class array;
}
@@ -360,6 +366,11 @@
void
from_to_(const std::set<P,_C>& from, Site_Set<S>& to);
+ // histo::array -> image1d
+ template <typename V, typename T>
+ void
+ from_to_(const histo::array<V>& from, image1d<T>& to);
+
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
Index: trunk/milena/mln/io/dicom/load.hh
===================================================================
--- trunk/milena/mln/io/dicom/load.hh (revision 3428)
+++ trunk/milena/mln/io/dicom/load.hh (revision 3429)
@@ -95,9 +95,8 @@
void load(Image<I>& ima_,
const std::string& filename)
{
- trace::entering("mln::io::gdcm::load");
+ trace::entering("mln::io::dicom::load");
- using value::int_u16;
I& ima = exact(ima_);
gdcm::ImageReader r;
@@ -119,9 +118,18 @@
int ndims = image.GetNumberOfDimensions();
const unsigned int* dims = image.GetDimensions();
- unsigned short bytes_allocated = image.GetPixelFormat().GetBitsAllocated() / 8;
+ unsigned short bits_allocated = image.GetPixelFormat().GetBitsAllocated();
+ unsigned short bytes_allocated = bits_allocated / 8;
+ unsigned short bits_stored = image.GetPixelFormat().GetBitsStored();
unsigned short samples_per_pixel = image.GetPixelFormat().GetSamplesPerPixel();
+ unsigned int offset = 8 - (bits_allocated - bits_stored);
+ unsigned int off_pow = 1;
+ for (int i = 0; i < offset; ++i)
+ {
+ off_pow *= 2;
+ }
+
if (mln_site_(I)::dim != ndims)
{
std::cerr << "error: dimension mismatch" << std::endl;
@@ -154,13 +162,18 @@
{
index += p.to_site().to_vec()[i] * vdims[i];
}
- ima(p) = dataBuffer[index * bytes_allocated * samples_per_pixel];
- // FIXME: RGB support, HighBit
- for (int j = 1; j < bytes_allocated; ++j)
- {
- ima(p) *= 256;
- ima(p) += dataBuffer[(index * bytes_allocated + j) * samples_per_pixel];
- }
+
+ ima(p) = (unsigned char) dataBuffer[(index * bytes_allocated) * samples_per_pixel];
+ // FIXME: RGB support, HighBit if HB == 1
+ for (int j = 0; j < bytes_allocated; ++j)
+ {
+ ima(p) += ((unsigned char) dataBuffer[(index * bytes_allocated + j) * samples_per_pixel]) * 256 * j;
+ }
+ /*std::cout << "[ x = " << p.to_site().to_vec()[2]
+ << " | y = " << p.to_site().to_vec()[1]
+ << " | z = " << p.to_site().to_vec()[0]
+ << " ] => " << ima(p)
+ << std::endl;*/
}
delete(dataBuffer);
Index: trunk/milena/mln/io/all.hh
===================================================================
--- trunk/milena/mln/io/all.hh (revision 3428)
+++ trunk/milena/mln/io/all.hh (revision 3429)
@@ -48,6 +48,7 @@
# include <mln/io/cloud/all.hh>
# include <mln/io/dump/all.hh>
+# include <mln/io/dicom/load.hh>
# include <mln/io/pbm/all.hh>
# include <mln/io/pfm/all.hh>
# include <mln/io/pgm/all.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-02-26 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Continue experiments about attribute and morpho math.
* edwin/attributes/occupation.hh: Correct bugs.
* edwin/tree/tree.cc: Test file.
---
attributes/occupation.hh | 6 +-
tree/Makefile | 2
tree/tree.cc | 117 +++++++++++++++++++++++------------------------
3 files changed, 62 insertions(+), 63 deletions(-)
Index: trunk/milena/sandbox/edwin/tree/tree.cc
===================================================================
--- trunk/milena/sandbox/edwin/tree/tree.cc (revision 3427)
+++ trunk/milena/sandbox/edwin/tree/tree.cc (revision 3428)
@@ -18,42 +18,13 @@
#include <mln/morpho/tree/compute_attribute_image.hh>
#include <mln/morpho/attribute/card.hh>
#include "../attributes/occupation.hh"
+#include "propagate.hh"
#include <mln/debug/println.hh>
namespace mln
{
-
- template <typename T, typename A>
- void
- back_propagate(const T& t, A& a)
- // a value propagates from the representative point to every point
- // of the component at the same level (NOT to the branch points!)
- {
- mln_fwd_piter(T) p(t.domain());
- for_all(p)
- if (! t.is_a_node(p))
- {
- mln_assertion(t.is_a_node(t.parent(p)));
- a(p) = a(t.parent(p)); // ...here!
- }
- }
-
-
- template <typename T, typename A>
- void
- back_propagate_II(const T& t, A& a)
- // a value propagates from a representative point to every point
- // of the component and the children components (branch).
- {
- mln_bkd_piter(T) p(t.domain());
- for_all(p)
- if (t.is_a_node(p) && a(t.parent(p)) == true)
- a(p) = a(t.parent(p));
- }
-
-
template <typename T, typename A>
inline
void
@@ -67,33 +38,65 @@
mln_fwd_piter(N) n(t.nodes());
for_all(n)
// We only keep "highest" nodes at 'true' => largest component.
- aa(n) = (a(n) == true && a(t.parent(n)) == false);
+ //aa(n) = (a(n) == true && a(t.parent(n)) == false);
+ aa(n) = a(n);
if (echo) io::pbm::save(aa, "before.pbm");
if (echo > 1) debug::println("aa (before)", aa);
- back_propagate_II(t, aa);
- back_propagate(t, aa);
+ //back_propagate_subbranch(t, aa, true);
+ //if (echo > 1) debug::println("aa (After subbranch propagation)", aa);
+ back_propagate_level(t, aa);
- if (echo > 1) debug::println("aa (after)", aa);
+ if (echo > 1) debug::println("aa (Final)", aa);
io::pbm::save(aa, "out.pbm");
}
+
+
} // mln
+int echo = 0;
+
+template <typename I, typename A>
+inline
+void
+create_tree_and_compute(I& f_, A a_, float lambda = mln_min(float), float lambda2 = mln_max(float))
+{
+ using namespace mln;
+ using value::int_u8;
+
+ I f = exact(f_);
+ typedef p_array< mln_site(I) > S;
+ S s = level::sort_psites_decreasing(f);
+ typedef morpho::tree::data<I,S> tree_t;
+ tree_t t(f, s, c4());
+
+ mln_VAR(a, morpho::tree::compute_attribute_image(a_, t));
+
+ if (echo > 1)
+ {
+ debug::println("parent imagee", t.parent_image());
+ debug::println("a", a);
+ debug::println("a | nodes", a | t.nodes());
+ }
+
+ image2d<bool> b = duplicate((pw::value(a) < pw::cst(lambda1) && pw::value(a) < pw::cst(lambda2)) | a.domain());
+ sample(t, b, echo);
+}
void usage(char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.pgm echo lambda" << std::endl;
- std::cerr << " echo: 0 (none) or 1 (verbose)" << std::endl;
+ std::cerr << "\techo:\t0 (none)" << std::endl
+ << "\t\t1 (img output)" << std::endl
+ << "\t\t2 (debug)" << std::endl;
abort();
}
-
-
int main(int argc, char* argv[])
{
using namespace mln;
@@ -104,12 +107,7 @@
if (argc != 4)
usage(argv);
- int echo = std::atoi(argv[2]);
- if (echo != 0 && echo != 1)
- {
- std::cerr << "bad 'echo' value!" << std::endl;
- usage(argv);
- }
+ echo = std::atoi(argv[2]);
typedef image2d<int_u8> I;
@@ -121,25 +119,26 @@
// I f = morpho::elementary::gradient(input, nbh);
if (echo > 1) debug::println("f", f);
+ // test de volume
+ typedef image1d<int> IM;
+ IM img(6);
+ morpho::attribute::volume<IM> accu;
+ img.element(0) = 50;
+ img.element(1) = 40;
+ img.element(2) = 20;
+ img.element(3) = 20;
+ img.element(4) = 40;
+ img.element(5) = 50;
- typedef p_array<point2d> S;
- S s = level::sort_psites_decreasing(f);
+ mln_piter_(image1d<int>) p(img.domain());
- typedef morpho::tree::data<I,S> tree_t;
- tree_t t(f, s, nbh);
-
- morpho::attribute::occupation<I> a_;
- mln_VAR(a, morpho::tree::compute_attribute_image(a_, t));
+ for_all(p)
+ accu.take(img(p));
- if (echo > 1)
- {
- debug::println("parent imagee", t.parent_image());
- debug::println("a", a);
- debug::println("a | nodes", a | t.nodes());
- }
+ std::cout << "Volume:" << accu.to_result() << std::endl;
+ //create_tree_and_compute(img, morpho::attribute::volume<I2>());
+ //
- image2d<bool> b = duplicate((pw::value(a) < pw::cst(atoi(argv[3]))) | a.domain());
- if (echo > 1) debug::println("b", b | t.nodes());
+ create_tree_and_compute(f, morpho::attribute::card<I>(), std::atof(argv[3]));
- sample(t, b, echo);
}
Index: trunk/milena/sandbox/edwin/tree/Makefile
===================================================================
--- trunk/milena/sandbox/edwin/tree/Makefile (revision 3427)
+++ trunk/milena/sandbox/edwin/tree/Makefile (revision 3428)
@@ -14,7 +14,7 @@
LD=g++
LDFLAGS=
-all: $(TARGET)
+all: clean $(TARGET)
$(TARGET): $(OBJS) $(SRC)
$(LD) $(LDFLAGS) -o $@ $(OBJS)
Index: trunk/milena/sandbox/edwin/attributes/occupation.hh
===================================================================
--- trunk/milena/sandbox/edwin/attributes/occupation.hh (revision 3427)
+++ trunk/milena/sandbox/edwin/attributes/occupation.hh (revision 3428)
@@ -157,7 +157,7 @@
volume_.take(v);
if (v < min_)
min_ = v;
- else if (v > max_)
+ if (v > max_)
max_ = v;
}
@@ -178,7 +178,7 @@
volume_.take(other.volume_);
if (other.min_ < min_)
min_ = other.min_;
- else if (other.max_ > max_)
+ if (other.max_ > max_)
max_ = other.max_;
}
@@ -205,7 +205,7 @@
double
occupation<I>::to_result() const
{
- return (double)volume_.to_result() / (double)(volume_.area() * (max_ - min_));
+ return (double)volume_.to_result() / (double)(volume_.area() * height());
}
template <typename I>
1
0
25 Feb '09
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
ChangeLog:
2009-02-25 Edwin Carlinet <carlinet(a)lrde.epita.fr>
Separate propagation method and some tries about attributes.
* edwin/filtres/connectes/Makefile
* edwin/filtres/connectes/connected_filter.hh: Fix some bugs.
* edwin/tree/Makefile: New.
* edwin/tree/propagate.hh: Propagation methods.
* edwin/tree/tree.cc: New.
* edwin/tree: New.
---
filtres/connectes/Makefile | 4
filtres/connectes/connected_filter.hh | 67 +--------------
tree/Makefile | 33 +++++++
tree/propagate.hh | 77 ++++++++++++++++++
tree/tree.cc | 144 ++++++++++++++++++++++++++++++++++
5 files changed, 259 insertions(+), 66 deletions(-)
Index: trunk/milena/sandbox/edwin/tree/propagate.hh
===================================================================
--- trunk/milena/sandbox/edwin/tree/propagate.hh (revision 0)
+++ trunk/milena/sandbox/edwin/tree/propagate.hh (revision 3426)
@@ -0,0 +1,77 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library 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 library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MORPHO_TREE_PROPAGATE_HH_
+# define MLN_MORPHO_TREE_PROPAGATE_HH_
+
+/// \file mln/morpho/tree/propagate.hh
+///
+/// Functions to propagate a node value in the tree.
+
+#include <mln/morpho/tree/data.hh>
+
+namespace mln {
+ namespace morpho {
+ namespace tree {
+
+
+ /// The representative point propagates its value to
+ /// its non-representative children nodes.
+ template <typename T, typename A>
+ void
+ back_propagate_level(const T& t, A& a)
+ {
+ mln_fwd_piter(T) p(t.domain());
+ for_all(p)
+ if (! t.is_a_node(p))
+ {
+ mln_assertion(t.is_a_node(t.parent(p)));
+ a(p) = a(t.parent(p));
+ }
+ }
+
+ /// The representative point having the right
+ /// value propagates to the nodes of its sub-branch.
+ template <typename T, typename A>
+ void
+ back_propagate_subbranch(const T& t, A& a, mln_value(A) v)
+ {
+ mln_fwd_piter(T) p(t.domain());
+ for_all(p)
+ if (t.is_a_node(p) && a(t.parent(p)) == v)
+ {
+ mln_assertion(t.is_a_node(t.parent(p)));
+ a(p) = a(t.parent(p));
+ }
+ }
+ } // end of namespace mln::morpho::tree
+ } // end of namespace mln::morpho
+} // end of namespace mln
+
+#endif /* !MLN_MORPHO_TREE_PROPAGATE_HH_ */
+
+
Index: trunk/milena/sandbox/edwin/tree/tree.cc
===================================================================
--- trunk/milena/sandbox/edwin/tree/tree.cc (revision 0)
+++ trunk/milena/sandbox/edwin/tree/tree.cc (revision 3426)
@@ -0,0 +1,144 @@
+
+#include <mln/core/var.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/core/routine/duplicate.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/label_8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pbm/save.hh>
+
+#include <mln/level/sort_psites.hh>
+#include <mln/morpho/elementary/gradient.hh>
+
+#include <mln/morpho/tree/data.hh>
+#include <mln/morpho/tree/compute_attribute_image.hh>
+#include <mln/morpho/attribute/card.hh>
+
+#include <mln/debug/println.hh>
+
+
+namespace mln
+{
+
+ template <typename T, typename A>
+ void
+ back_propagate(const T& t, A& a)
+ // a value propagates from the representative point to every point
+ // of the component at the same level (NOT to the branch points!)
+ {
+ mln_fwd_piter(T) p(t.domain());
+ for_all(p)
+ if (! t.is_a_node(p))
+ {
+ mln_assertion(t.is_a_node(t.parent(p)));
+ a(p) = a(t.parent(p)); // ...here!
+ }
+ }
+
+
+ template <typename T, typename A>
+ void
+ back_propagate_II(const T& t, A& a)
+ // a value propagates from a representative point to every point
+ // of the component and the children components (branch).
+ {
+ mln_bkd_piter(T) p(t.domain());
+ for_all(p)
+ if (t.is_a_node(p) && a(t.parent(p)) == true)
+ a(p) = a(t.parent(p));
+ }
+
+
+ template <typename T, typename A>
+ inline
+ void
+ sample(const T& t, const A& a, int echo)
+ {
+ A aa;
+ initialize(aa, a);
+ data::fill(aa, false); // 'aa' is false /a priori/.
+
+ typedef typename T::nodes_t N;
+ mln_fwd_piter(N) n(t.nodes());
+ for_all(n)
+ // We only keep "highest" nodes at 'true' => largest component.
+ aa(n) = (a(n) == true && a(t.parent(n)) == false);
+
+ if (echo) io::pbm::save(aa, "before.pbm");
+ if (echo > 1) debug::println("aa (before)", aa);
+
+ back_propagate_II(t, aa);
+ back_propagate(t, aa);
+
+ if (echo > 1) debug::println("aa (after)", aa);
+ io::pbm::save(aa, "out.pbm");
+
+ }
+
+} // mln
+
+
+
+
+void usage(char* argv[])
+{
+ std::cerr << "usage: " << argv[0] << " input.pgm echo lambda" << std::endl;
+ std::cerr << " echo: 0 (none) or 1 (verbose)" << std::endl;
+ abort();
+}
+
+
+
+int main(int argc, char* argv[])
+{
+ using namespace mln;
+ using value::int_u8;
+
+ mln_VAR(nbh, c4());
+
+ if (argc != 4)
+ usage(argv);
+
+ int echo = std::atoi(argv[2]);
+ if (echo != 0 && echo != 1)
+ {
+ std::cerr << "bad 'echo' value!" << std::endl;
+ usage(argv);
+ }
+
+ typedef image2d<int_u8> I;
+
+ I input;
+ io::pgm::load(input, argv[1]);
+ if (echo > 1) debug::println("input", input);
+
+ I f = input;
+ // I f = morpho::elementary::gradient(input, nbh);
+ if (echo > 1) debug::println("f", f);
+
+
+ typedef p_array<point2d> S;
+ S s = level::sort_psites_decreasing(f);
+
+ typedef morpho::tree::data<I,S> tree_t;
+ tree_t t(f, s, nbh);
+
+ morpho::attribute::card<I> a_;
+ mln_VAR(a, morpho::tree::compute_attribute_image(a_, t));
+
+ if (echo > 1)
+ {
+ debug::println("parent imagee", t.parent_image());
+ debug::println("a", a);
+ debug::println("a | nodes", a | t.nodes());
+ }
+
+ image2d<bool> b = duplicate((pw::value(a) < pw::cst(atoi(argv[3]))) | a.domain());
+ if (echo > 1) debug::println("b", b | t.nodes());
+
+ sample(t, b, echo);
+}
Index: trunk/milena/sandbox/edwin/tree/Makefile
===================================================================
--- trunk/milena/sandbox/edwin/tree/Makefile (revision 0)
+++ trunk/milena/sandbox/edwin/tree/Makefile (revision 3426)
@@ -0,0 +1,33 @@
+TARGET=a.out
+SRC=edwin.cc
+OBJS=${SRC:.cc=.o}
+
+OLENADIR=../../..
+MILENADIR=$(OLENADIR)/milena
+
+CXXFLAGS=-I$(MILENADIR) -I./
+
+CXXFLAGS += "-DNDEBUG -O1"
+
+
+CXX=g++
+LD=g++
+LDFLAGS=
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(SRC)
+ $(LD) $(LDFLAGS) -o $@ $(OBJS)
+
+
+$(REF): $(OBJS_REF) $(SRC_REF)
+ $(LD) $(LDFLAGS) -o $@ $(OBJS_REF)
+
+%.o: %.cc
+ $(CXX) $(CXXFLAGS) -c $<
+
+%.o: %.hh
+ $(CXX) $(CXXFLAGS) -c $<
+
+clean:
+ rm -f *.o $(REF) $(TARGET)
\ No newline at end of file
Index: trunk/milena/sandbox/edwin/filtres/connectes/connected_filter.hh
===================================================================
--- trunk/milena/sandbox/edwin/filtres/connectes/connected_filter.hh (revision 3425)
+++ trunk/milena/sandbox/edwin/filtres/connectes/connected_filter.hh (revision 3426)
@@ -74,6 +74,8 @@
void take_as_init_fastest (trait::accumulator::when_pix::use_none, A& accu,
const I& input, const unsigned p)
{
+ (void)input;
+ (void)p;
accu.take_as_init ();
}
@@ -81,6 +83,7 @@
void take_as_init (trait::accumulator::when_pix::use_p, A& accu,
const I& input, const P& p)
{
+ (void)input;
accu.take_as_init (p);
}
@@ -88,6 +91,7 @@
void take_as_init (trait::accumulator::when_pix::use_none, A& accu,
const I& input, const P& p)
{
+ (void)input;
accu.take_as_init (p);
}
@@ -279,11 +283,11 @@
const typename A::result& lambda)
{
trace::entering("canvas::morpho::impl::connected_filter_fastest");
-
// FIXME: Tests?
const I& input = exact(input_);
const N& nbh = exact(nbh_);
+ (void)a_;
mln_concrete(I) output;
initialize(output, input);
@@ -372,71 +376,10 @@
} // end of namespace mln::canvas::morpho::impl
-
-
// Dispatch.
-
namespace internal
{
- // Leveling
- template <typename I, typename N, typename A>
- mln_concrete(I)
- leveling_filter_dispatch(metal::false_,
- const Image<I>& input,
- const Neighborhood<N>& nbh,
- const Accumulator<A>& a,
- const typename A::result& lambda,
- bool increasing)
- {
- p_array < mln_psite(I) > s =
- increasing ?
- level::sort_psites_increasing(input) :
- level::sort_psites_decreasing(input);
- return impl::generic::connected_filter(input, nbh, s, a, lambda);
- }
-
- template <typename I, typename N, typename A>
- mln_concrete(I)
- leveling_filter_dispatch(metal::true_,
- const Image<I>& input,
- const Neighborhood<N>& nbh,
- const Accumulator<A>& a,
- const typename A::result& lambda,
- bool increasing)
- {
- util::array<unsigned> s =
- increasing ?
- level::sort_offsets_increasing(input) :
- level::sort_offsets_decreasing(input);
- return impl::connected_filter_fastest(input, nbh, s, a, lambda);
- }
-
- template <typename I, typename N, typename A>
- inline
- mln_concrete(I)
- leveling_filter_dispatch(const Image<I>& input,
- const Neighborhood<N>& nbh,
- const Accumulator<A>& a,
- const typename A::result& lambda,
- bool increasing)
- {
- mlc_or(mlc_equal(mln_trait_accumulator_when_pix(A),
- trait::accumulator::when_pix::use_pix),
- mlc_equal(mln_trait_accumulator_when_pix(A),
- trait::accumulator::when_pix::use_v))::check();
-
- enum
- {
- test = mlc_equal(mln_trait_image_speed(I),
- trait::image::speed::fastest)::value
- && mlc_equal(mln_trait_accumulator_when_pix(A),
- trait::accumulator::when_pix::use_v)::value
- && mln_is_simple_neighborhood(N)::value
- };
- return leveling_filter_dispatch(metal::bool_<test>(),
- input, nbh, a, lambda, increasing);
- }
// Alegebraic
template <typename I, typename N, typename A>
Index: trunk/milena/sandbox/edwin/filtres/connectes/Makefile
===================================================================
--- trunk/milena/sandbox/edwin/filtres/connectes/Makefile (revision 3425)
+++ trunk/milena/sandbox/edwin/filtres/connectes/Makefile (revision 3426)
@@ -1,9 +1,6 @@
TARGET=filter
-REF=leveling
SRC=filter.cc
-SRC_REF=leveling.cc
OBJS=${SRC:.cc=.o}
-OBJS_REF=${SRC_REF:.cc=.o}
OLENADIR=../../../../..
MILENADIR=$(OLENADIR)/milena
@@ -29,4 +26,4 @@
$(CXX) $(CXXFLAGS) -c $<
clean:
- rm -f *.o $(REF) $(TARGET)
\ No newline at end of file
+ rm -f *.o *.pgm $(TARGET)
\ No newline at end of file
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update Fred's overload code.
* fred/overload.cc: Update.
overload.cc | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
Index: fred/overload.cc
--- fred/overload.cc (revision 3424)
+++ fred/overload.cc (working copy)
@@ -3,6 +3,11 @@
#include <mln/fun/internal/resolve.hh>
#include <mln/trait/op/plus.hh>
+
+#define mln_result__1comma(Tleft, Tright) \
+ typename Tleft, Tright ::result
+
+
// Avantage de cette methode:
// - la surcharge est rendue effectivement possible pour des familles de types
// et permet de passer en argument une fonction meme s'il existe de multiple definitions
@@ -163,13 +168,18 @@
{
// Default (whatever the category):
- // "inf" performs a "min"!
- template <template <class> class Category_L, typename L, template <class> class Category_R, typename R>
- struct set_binary_< fun::vv2v::plus, Category_L, L, Category_R, R>
+ // "plus(l, r)" performs "l + r"!
+ template <template <class> class Category_L, typename L,
+ template <class> class Category_R, typename R>
+ struct set_binary_< fun::vv2v::plus,
+ Category_L, L,
+ Category_R, R>
{
typedef set_binary_< fun::vv2v::plus, Category_L, L, Category_R, R> ret;
- static mln_trait_op_plus(L,R) exec(const L& t1, const R& t2)
+ typedef mln_trait_op_plus(L,R) result;
+
+ static result exec(const L& t1, const R& t2)
{
return t1 + t2;
}
@@ -194,9 +204,8 @@
template <typename L, typename R>
struct plus : Function_vv2v< plus<L,R> >
{
- typedef mln_trait_op_plus(L,R) result;
-
typedef mln_fun_internal_resolve(plus) impl;
+ typedef mln_result(impl) result;
result operator()(const L& t1, const R& t2) const
{
@@ -216,9 +225,10 @@
// A meta-fun can act as a function :-)
template <typename L, typename R>
- typename fun::vv2v::plus<L,R>::result operator()(const L& t1, const R& t2) const
- // Here, we know the result type of vv2v::plus<L,R> so
- // we explictly write it.
+ mln_result__1comma(fun::vv2v::plus<L,R>)
+ operator()(const L& t1, const R& t2) const
+ // Here, we do NOT know the result type of vv2v::plus<L,R> so
+ // we cannot explictly write it.
{
fun::vv2v::plus<L,R> f;
return f(t1, t2);
@@ -239,6 +249,7 @@
} // mln::fun
+
namespace trait
{
@@ -246,10 +257,11 @@
struct set_precise_binary_< fun::vv2v::plus, rgb, rgb >
{
typedef set_precise_binary_< fun::vv2v::plus, rgb, rgb > ret;
+ typedef rgb result;
static rgb exec(const rgb& c1, const rgb& c2)
{
- // "Inf" is component-wise "min".
+ // "plus" is component-wise "plus".
return rgb(c1.r + c2.r,
c1.g + c2.g,
c1.b + c2.b);
@@ -266,6 +278,7 @@
} // mln
+
using namespace mln;
int main()
1
0
* tests/unit_test/unit-tests.mk,
* doc/tutorial/figures/figures.mk,
* doc/tutorial/outputs/outputs.mk,
* doc/tutorial/samples/samples.mk,
* headers.mk: include new files in distribution.
* mln/canvas/morpho/algebraic_filter.hh
* mln/canvas/morpho/algebraic_union_find.hh: fix wrong call to
find_root.
* mln/canvas/morpho/internal/find_root.hh: add missing include.
---
milena/ChangeLog | 16 ++++++++++++++++
milena/doc/tutorial/figures/figures.mk | 5 +++++
milena/doc/tutorial/outputs/outputs.mk | 1 +
milena/doc/tutorial/samples/samples.mk | 1 +
milena/headers.mk | 7 ++++++-
milena/mln/canvas/morpho/algebraic_filter.hh | 4 ++--
milena/mln/canvas/morpho/algebraic_union_find.hh | 4 ++--
milena/mln/canvas/morpho/internal/find_root.hh | 2 ++
milena/tests/unit_test/unit-tests.mk | 12 ++++++++++++
9 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 62bbc11..131f040 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,19 @@
+2009-02-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Small fixes.
+
+ * tests/unit_test/unit-tests.mk,
+ * doc/tutorial/figures/figures.mk,
+ * doc/tutorial/outputs/outputs.mk,
+ * doc/tutorial/samples/samples.mk,
+ * headers.mk: include new files in distribution.
+
+ * mln/canvas/morpho/algebraic_filter.hh
+ * mln/canvas/morpho/algebraic_union_find.hh: fix wrong call to
+ find_root.
+
+ * mln/canvas/morpho/internal/find_root.hh: add missing include.
+
2009-02-25 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Fix DICOM implementation: was DCMTK, now is GDCM.
diff --git a/milena/doc/tutorial/figures/figures.mk b/milena/doc/tutorial/figures/figures.mk
index 400b2ff..41dba2b 100644
--- a/milena/doc/tutorial/figures/figures.mk
+++ b/milena/doc/tutorial/figures/figures.mk
@@ -1,6 +1,7 @@
## Generated by ../generate_dist_files, do not modify.
EXTRA_DIST += \
+figures/extend-1.ppm \
figures/ima2d-rot-2.ppm \
figures/tuto3_rw_image-1.ppm \
figures/logical-not-2.pbm \
@@ -17,17 +18,21 @@ figures/ima_save.pbm \
figures/tuto2_first_image-1.pbm \
figures/figures.mk \
figures/fill-subimage-cfun-1.ppm \
+figures/extend-3.ppm \
figures/fill-subdomain-4.ppm \
figures/tuto4_genericity_and_algorithms-7.ppm \
figures/tuto4_genericity_and_algorithms-6.ppm \
+figures/extend-5.ppm \
figures/logical-not-3.pbm \
figures/tuto4_genericity_and_algorithms-3.pbm \
figures/tuto4_genericity_and_algorithms-1.ppm \
+figures/extend-4.ppm \
figures/tuto4_genericity_and_algorithms-8.ppm \
figures/labeling-compute-1.pbm \
figures/tuto3_rw_image-3.ppm \
figures/tuto4_genericity_and_algorithms-4.ppm \
figures/tuto4_genericity_and_algorithms-8.pgm \
+figures/extend-2.ppm \
figures/tuto4_genericity_and_algorithms-2.ppm \
figures/fill-subdomain-1.pbm \
figures/tuto3_rw_image-2.ppm
diff --git a/milena/doc/tutorial/outputs/outputs.mk b/milena/doc/tutorial/outputs/outputs.mk
index dfba0d6..1e4c9cf 100644
--- a/milena/doc/tutorial/outputs/outputs.mk
+++ b/milena/doc/tutorial/outputs/outputs.mk
@@ -4,6 +4,7 @@ EXTRA_DIST += \
outputs/win-create-1-display.txt \
outputs/win-create-2.txt \
outputs/accu-right-instanciation.txt \
+outputs/extend.txt \
outputs/ima2d-1.txt \
outputs/borderthickness.txt \
outputs/ima-save.txt \
diff --git a/milena/doc/tutorial/samples/samples.mk b/milena/doc/tutorial/samples/samples.mk
index 442eec6..e0e3f5d 100644
--- a/milena/doc/tutorial/samples/samples.mk
+++ b/milena/doc/tutorial/samples/samples.mk
@@ -30,6 +30,7 @@ samples/fill-subdomain-shorter.cc \
samples/tuto3_rw_image.cc \
samples/ima2d-2.cc \
samples/extension-ignore.cc \
+samples/extend.cc \
samples/Makefile.am \
samples/parray-bbox.cc \
samples/graph-data.cc \
diff --git a/milena/headers.mk b/milena/headers.mk
index d3c584f..6460d8f 100644
--- a/milena/headers.mk
+++ b/milena/headers.mk
@@ -59,7 +59,6 @@ mln/registration/get_rtransf.hh \
mln/registration/internal/rms.hh \
mln/registration/get_rot.hh \
mln/registration/all.hh \
-mln/registration/multiscale.hh \
mln/registration/registration.hh \
mln/registration/essential.hh \
mln/registration/icp.hh \
@@ -116,6 +115,7 @@ mln/data/all.hh \
mln/data/paste.hh \
mln/data/fill_with_image.hh \
mln/data/fill_with_image.spe.hh \
+mln/data/swap.hh \
mln/data/fill_with_value.hh \
mln/data/fill_with_value.spe.hh \
mln/data/fill.hh \
@@ -207,6 +207,7 @@ mln/fun/vv2v/essential.hh \
mln/fun/internal/array_base.hh \
mln/fun/internal/x2x_linear_impl.hh \
mln/fun/internal/ch_function_value_impl.hh \
+mln/fun/internal/resolve.hh \
mln/fun/internal/selector.hh \
mln/fun/v2w_w2v/norm.hh \
mln/fun/p2v/ternary.hh \
@@ -448,8 +449,10 @@ mln/math/essential.hh \
mln/math/acos.hh \
mln/math/round_sat.hh \
mln/opt/at.hh \
+mln/opt/all.hh \
mln/opt/element.hh \
mln/opt/value.hh \
+mln/opt/essential.hh \
mln/binarization/includes.hh \
mln/binarization/all.hh \
mln/binarization/binarization.hh \
@@ -529,6 +532,7 @@ mln/canvas/chamfer.hh \
mln/canvas/distance_geodesic.hh \
mln/canvas/all.hh \
mln/canvas/distance_front.hh \
+mln/canvas/morpho/internal/find_root.hh \
mln/canvas/morpho/all.hh \
mln/canvas/morpho/connected_filter.hh \
mln/canvas/morpho/algebraic_filter.hh \
@@ -1036,6 +1040,7 @@ mln/io/pnm/save.hh \
mln/io/pnm/save_header.hh \
mln/io/txt/all.hh \
mln/io/txt/save.hh \
+mln/io/dicom/load.hh \
mln/io/abort.hh \
mln/io/fits/load.hh \
mln/io/fits/all.hh \
diff --git a/milena/mln/canvas/morpho/algebraic_filter.hh b/milena/mln/canvas/morpho/algebraic_filter.hh
index bfcf55e..883b959 100644
--- a/milena/mln/canvas/morpho/algebraic_filter.hh
+++ b/milena/mln/canvas/morpho/algebraic_filter.hh
@@ -136,7 +136,7 @@ namespace mln
if (input.domain().has(n) && deja_vu(n))
{
// Do-Union.
- P r = find_root(parent, n);
+ P r = internal::find_root(parent, n);
if (r != p)
{
if (input(r) == input(p) || (activity(r) && data(r) < lambda)) // Equiv(r, p)
@@ -258,7 +258,7 @@ namespace mln
if (! deja_vu.element(n))
continue;
- unsigned r = find_root_fastest(parent, n);
+ unsigned r = internal::find_root_fastest(parent, n);
if (r != p)
{
if (input.element(r) == input.element(p)
diff --git a/milena/mln/canvas/morpho/algebraic_union_find.hh b/milena/mln/canvas/morpho/algebraic_union_find.hh
index 75ac3f6..f99ac3d 100644
--- a/milena/mln/canvas/morpho/algebraic_union_find.hh
+++ b/milena/mln/canvas/morpho/algebraic_union_find.hh
@@ -148,7 +148,7 @@ namespace mln
if (input.domain().has(n) && deja_vu(n))
{
//do_union(n, p);
- P r = find_root(parent, n);
+ P r = internal::find_root(parent, n);
if (r != p)
{
if (input(r) == input(p) || (activity(r) && f.is_active(data(r)))) // Equiv(r, p)
@@ -274,7 +274,7 @@ namespace mln
if (! deja_vu.element(n))
continue;
- unsigned r = find_root_fastest(parent, n);
+ unsigned r = internal::find_root_fastest(parent, n);
if (r != p)
{
if (input.element(r) == input.element(p)
diff --git a/milena/mln/canvas/morpho/internal/find_root.hh b/milena/mln/canvas/morpho/internal/find_root.hh
index 8011122..3ca0717 100644
--- a/milena/mln/canvas/morpho/internal/find_root.hh
+++ b/milena/mln/canvas/morpho/internal/find_root.hh
@@ -34,6 +34,8 @@
///
/// \todo write a 'parent' image instead?
+# include <mln/core/concept/image.hh>
+
namespace mln
{
diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk
index 9bb3a70..055ede1 100644
--- a/milena/tests/unit_test/unit-tests.mk
+++ b/milena/tests/unit_test/unit-tests.mk
@@ -111,6 +111,7 @@ mln_data_memcpy_ \
mln_data_all \
mln_data_paste \
mln_data_fill_with_image \
+mln_data_swap \
mln_data_fill_with_value \
mln_data_fill \
mln_data_essential \
@@ -201,6 +202,7 @@ mln_fun_vv2v_essential \
mln_fun_internal_array_base \
mln_fun_internal_x2x_linear_impl \
mln_fun_internal_ch_function_value_impl \
+mln_fun_internal_resolve \
mln_fun_internal_selector \
mln_fun_v2w_w2v_norm \
mln_fun_p2v_ternary \
@@ -440,8 +442,10 @@ mln_math_essential \
mln_math_acos \
mln_math_round_sat \
mln_opt_at \
+mln_opt_all \
mln_opt_element \
mln_opt_value \
+mln_opt_essential \
mln_binarization_includes \
mln_binarization_all \
mln_binarization_binarization \
@@ -521,6 +525,7 @@ mln_canvas_chamfer \
mln_canvas_distance_geodesic \
mln_canvas_all \
mln_canvas_distance_front \
+mln_canvas_morpho_internal_find_root \
mln_canvas_morpho_all \
mln_canvas_morpho_connected_filter \
mln_canvas_morpho_algebraic_filter \
@@ -1006,6 +1011,7 @@ mln_io_pnm_save \
mln_io_pnm_save_header \
mln_io_txt_all \
mln_io_txt_save \
+mln_io_dicom_load \
mln_io_abort \
mln_io_fits_load \
mln_io_fits_all \
@@ -1180,6 +1186,7 @@ mln_data_memcpy__SOURCES = mln_data_memcpy_.cc
mln_data_all_SOURCES = mln_data_all.cc
mln_data_paste_SOURCES = mln_data_paste.cc
mln_data_fill_with_image_SOURCES = mln_data_fill_with_image.cc
+mln_data_swap_SOURCES = mln_data_swap.cc
mln_data_fill_with_value_SOURCES = mln_data_fill_with_value.cc
mln_data_fill_SOURCES = mln_data_fill.cc
mln_data_essential_SOURCES = mln_data_essential.cc
@@ -1270,6 +1277,7 @@ mln_fun_vv2v_essential_SOURCES = mln_fun_vv2v_essential.cc
mln_fun_internal_array_base_SOURCES = mln_fun_internal_array_base.cc
mln_fun_internal_x2x_linear_impl_SOURCES = mln_fun_internal_x2x_linear_impl.cc
mln_fun_internal_ch_function_value_impl_SOURCES = mln_fun_internal_ch_function_value_impl.cc
+mln_fun_internal_resolve_SOURCES = mln_fun_internal_resolve.cc
mln_fun_internal_selector_SOURCES = mln_fun_internal_selector.cc
mln_fun_v2w_w2v_norm_SOURCES = mln_fun_v2w_w2v_norm.cc
mln_fun_p2v_ternary_SOURCES = mln_fun_p2v_ternary.cc
@@ -1509,8 +1517,10 @@ mln_math_essential_SOURCES = mln_math_essential.cc
mln_math_acos_SOURCES = mln_math_acos.cc
mln_math_round_sat_SOURCES = mln_math_round_sat.cc
mln_opt_at_SOURCES = mln_opt_at.cc
+mln_opt_all_SOURCES = mln_opt_all.cc
mln_opt_element_SOURCES = mln_opt_element.cc
mln_opt_value_SOURCES = mln_opt_value.cc
+mln_opt_essential_SOURCES = mln_opt_essential.cc
mln_binarization_includes_SOURCES = mln_binarization_includes.cc
mln_binarization_all_SOURCES = mln_binarization_all.cc
mln_binarization_binarization_SOURCES = mln_binarization_binarization.cc
@@ -1590,6 +1600,7 @@ mln_canvas_chamfer_SOURCES = mln_canvas_chamfer.cc
mln_canvas_distance_geodesic_SOURCES = mln_canvas_distance_geodesic.cc
mln_canvas_all_SOURCES = mln_canvas_all.cc
mln_canvas_distance_front_SOURCES = mln_canvas_distance_front.cc
+mln_canvas_morpho_internal_find_root_SOURCES = mln_canvas_morpho_internal_find_root.cc
mln_canvas_morpho_all_SOURCES = mln_canvas_morpho_all.cc
mln_canvas_morpho_connected_filter_SOURCES = mln_canvas_morpho_connected_filter.cc
mln_canvas_morpho_algebraic_filter_SOURCES = mln_canvas_morpho_algebraic_filter.cc
@@ -2075,6 +2086,7 @@ mln_io_pnm_save_SOURCES = mln_io_pnm_save.cc
mln_io_pnm_save_header_SOURCES = mln_io_pnm_save_header.cc
mln_io_txt_all_SOURCES = mln_io_txt_all.cc
mln_io_txt_save_SOURCES = mln_io_txt_save.cc
+mln_io_dicom_load_SOURCES = mln_io_dicom_load.cc
mln_io_abort_SOURCES = mln_io_abort.cc
mln_io_fits_load_SOURCES = mln_io_fits_load.cc
mln_io_fits_all_SOURCES = mln_io_fits_all.cc
--
1.5.6.5
1
0