* lazzara/igr/gui/viewer/src/main_window.cc: Avoid a warning.
* lazzara/igr/gui/viewer/src/mln_data.cc,
* lazzara/igr/gui/viewer/src/mln_data.hh: Change loaded image
value type from int_u8 to double.
---
milena/sandbox/ChangeLog | 10 +++++
.../lazzara/igr/gui/viewer/src/main_window.cc | 2 +-
.../sandbox/lazzara/igr/gui/viewer/src/mln_data.cc | 43 ++++++++++++--------
.../sandbox/lazzara/igr/gui/viewer/src/mln_data.hh | 8 +++-
4 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 62d9d00..eca9e24 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,15 @@
2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Store loaded image with double value type.
+
+ * lazzara/igr/gui/viewer/src/main_window.cc: Avoid a warning.
+
+ * lazzara/igr/gui/viewer/src/mln_data.cc,
+ * lazzara/igr/gui/viewer/src/mln_data.hh: Change loaded image
+ value type from int_u8 to double.
+
+2010-11-15 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add save button for function plots.
* lazzara/igr/gui/segmentation2dt/src/plot_widget.cc,
diff --git a/milena/sandbox/lazzara/igr/gui/viewer/src/main_window.cc
b/milena/sandbox/lazzara/igr/gui/viewer/src/main_window.cc
index 7770d7c..7d66659 100644
--- a/milena/sandbox/lazzara/igr/gui/viewer/src/main_window.cc
+++ b/milena/sandbox/lazzara/igr/gui/viewer/src/main_window.cc
@@ -141,7 +141,7 @@ namespace igr
}
- void main_window::clear_information_slot(const QPointF& p)
+ void main_window::clear_information_slot(const QPointF&)
{
point_info_->setText("");
}
diff --git a/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.cc
b/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.cc
index 7579c62..e9503c4 100644
--- a/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.cc
+++ b/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.cc
@@ -79,7 +79,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(tmp);
+ in_ = make::image3d(data::convert(double(), tmp));
in_dsp_ = data::convert(igr::dsp_data_t(),
data::stretch(value::int_u8(), in_));
@@ -107,7 +107,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(tmp);
+ in_ = make::image3d(data::convert(double(), tmp));
}
else if (header.value_type == "bool")
{
@@ -116,7 +116,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(data::convert(value::int_u12(), tmp));
+ in_ = make::image3d(data::convert(double(), tmp));
}
else if (header.value_type == "unsigned int")
{
@@ -125,7 +125,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(data::stretch(value::int_u12(), tmp));
+ in_ = make::image3d(data::convert(double(), tmp));
}
else if (header.value_type == "float")
{
@@ -134,7 +134,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(data::stretch(value::int_u12(), tmp));
+ in_ = make::image3d(data::convert(double(), tmp));
}
else
qDebug() << "Error while loading the image: unsupported value
type...";
@@ -148,10 +148,12 @@ namespace igr
{
if (header.value_type == "int_u12")
{
- io::raw::load(in_, filename.toStdString());
+ image2d<value::int_u12> tmp;
+ io::raw::load(tmp, filename.toStdString());
- if (!in_.is_valid())
+ if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
+ in_ = make::image3d(data::convert(double(), tmp));
}
else if (header.value_type == "bool")
{
@@ -160,7 +162,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = data::convert(value::int_u12(), tmp);
+ in_ = data::convert(double(), tmp);
}
else if (header.value_type == "unsigned int")
{
@@ -169,7 +171,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = data::stretch(value::int_u12(), tmp);
+ in_ = data::convert(double(), tmp);
}
else if (header.value_type == "float")
{
@@ -178,7 +180,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = data::stretch(value::int_u12(), tmp);
+ in_ = data::convert(double(), tmp);
}
else
qDebug() << "Error while loading the image: unsupported value type "
@@ -215,14 +217,17 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(tmp);
+ in_ = make::image3d(data::convert(double(), tmp));
in_dsp_ = data::convert(igr::dsp_data_t(),
data::stretch(value::int_u8(), in_));
}
else if (header.dim == 3)
{
- io::dicom::load(in_, filename.toStdString());
+ image3d<value::int_u12> tmp;
+ io::dicom::load(tmp, filename.toStdString());
+
+ in_ = data::convert(double(), tmp);
if (!in_.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
@@ -257,7 +262,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(tmp);
+ in_ = make::image3d(data::convert(double(), tmp));
}
else if (header.value_type == "unsigned int")
{
@@ -266,7 +271,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = make::image3d(data::stretch(value::int_u12(), tmp));
+ in_ = make::image3d(data::convert(double(), tmp));
}
else
qDebug() << "Error while loading the image: unsupported value type "
@@ -276,7 +281,10 @@ namespace igr
{
if (header.value_type == "int_u12")
{
- io::dump::load(in_, filename.toStdString());
+ image2d<value::int_u12> tmp;
+ io::dicom::load(tmp, filename.toStdString());
+
+ in_ = make::image3d(data::convert(double(), tmp));
if (!in_.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
@@ -288,7 +296,7 @@ namespace igr
if (!tmp.is_valid())
emit error_loading("Cannot open file! Please checkout the permissions.");
- in_ = data::stretch(value::int_u12(), tmp);
+ in_ = data::convert(double(), tmp);
}
else
qDebug() << "Error while loading the image: unsupported value type "
@@ -328,7 +336,8 @@ namespace igr
else if (ext == "raw")
io::raw::save(slice(in_, sli), filename.toStdString());
else if (ext == "pgm")
- io::pgm::save(slice(in_, sli), filename.toStdString());
+ io::pgm::save(data::convert(value::int_u8(), slice(in_, sli)),
+ filename.toStdString());
else
emit error_saving(tr("Error while saving. Output format not supported."));
}
diff --git a/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.hh
b/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.hh
index 57ee01f..fdd72d9 100644
--- a/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.hh
+++ b/milena/sandbox/lazzara/igr/gui/viewer/src/mln_data.hh
@@ -41,7 +41,13 @@ namespace igr
Q_OBJECT
public:
- typedef image3d<value::int_u12> in_t;
+
+ /*! We want to store every loaded images with double data type
+ to avoid data stretching/saturation. Since both float and
+ integer images can be loaded we that to preserve the
+ precision.
+ */
+ typedef image3d<double> in_t;
typedef image3d<igr::dsp_data_t> in_dsp_t;
mln_data();
--
1.5.6.5