polaroid-pp

Schlieren and contour plot tool
git clone https://git.0xfab.ch/polaroid-pp.git
Log | Files | Refs | Submodules | README | LICENSE

commit 78e2a32c6c1c442b3d8e4583175fc869f1578216
parent 22d791feed4357cbcf4bfd84d0806b6c11d7ebcb
Author: Fabian Wermelinger <fabianw@mavt.ethz.ch>
Date:   Thu, 30 Jun 2016 15:00:47 +0200

photo naming based on cartridge

Diffstat:
Mapps/polaroidCamera/BoundedLogNormalizerCartridge.h | 2+-
Mapps/polaroidCamera/BoundedNormalizerCartridge.h | 2+-
Mapps/polaroidCamera/BoundedTransmissionCartridge.h | 2+-
Mapps/polaroidCamera/LogNormalizerCartridge.h | 2+-
Mapps/polaroidCamera/NormalizerCartridge.h | 2+-
Mapps/polaroidCamera/SceneProcessor.cpp | 4++--
Mapps/polaroidCamera/SchlierenCartridge.h | 2+-
Mapps/polaroidCamera/TransmissionCartridge.h | 2+-
Minclude/PhotoHDF5.h | 8+++-----
Minclude/PhotoPNG.h | 7+++----
Minclude/PhotoPaper.h | 9++++++---
11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/apps/polaroidCamera/BoundedLogNormalizerCartridge.h b/apps/polaroidCamera/BoundedLogNormalizerCartridge.h @@ -21,7 +21,7 @@ public: const Real upper = m_parser("-upper_bound").asDouble(10.0); const Real lower = m_parser("-lower_bound").asDouble(1.0); - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-boundedLogNormalizer", data.width(), data.height()); // set description string desc("2D_Bounded_Log_Normalized"); diff --git a/apps/polaroidCamera/BoundedNormalizerCartridge.h b/apps/polaroidCamera/BoundedNormalizerCartridge.h @@ -19,7 +19,7 @@ public: const Real upper = m_parser("-upper_bound").asDouble(1.0); const Real lower = m_parser("-lower_bound").asDouble(0.0); - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-boundedNormalizer", data.width(), data.height()); // set description string desc("2D_Bounded_Normalized"); diff --git a/apps/polaroidCamera/BoundedTransmissionCartridge.h b/apps/polaroidCamera/BoundedTransmissionCartridge.h @@ -19,7 +19,7 @@ public: const Real upper = m_parser("-upper_bound").asDouble(1.0); const Real lower = m_parser("-lower_bound").asDouble(0.0); - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-boundedTransmission", data.width(), data.height()); // set description string desc("2D_Bounded_Transmission"); diff --git a/apps/polaroidCamera/LogNormalizerCartridge.h b/apps/polaroidCamera/LogNormalizerCartridge.h @@ -17,7 +17,7 @@ public: virtual void capture(PhotoPaper& photo, Slice& data) { - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-logNormalizer", data.width(), data.height()); // set description string desc("2D_Log_Normalized"); diff --git a/apps/polaroidCamera/NormalizerCartridge.h b/apps/polaroidCamera/NormalizerCartridge.h @@ -16,7 +16,7 @@ public: virtual void capture(PhotoPaper& photo, Slice& data) { - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-normalizer", data.width(), data.height()); // set description string desc("2D_Normalized"); diff --git a/apps/polaroidCamera/SceneProcessor.cpp b/apps/polaroidCamera/SceneProcessor.cpp @@ -84,7 +84,7 @@ void SceneProcessor::process1212(const vector<char*>& scenes) if (basename.find_last_of(".") != string::npos) basename = basename.substr(0, basename.find_last_of(".")); - m_photo->make_new(basename+"-polaroid", mycam.width(), mycam.height()); + m_photo->set_name(basename); mycam.capture(*m_photo); if (m_mpi.isroot()) @@ -125,7 +125,7 @@ void SceneProcessor::process1122(const vector<char*>& scenes) if (basename.find_last_of(".") != string::npos) basename = basename.substr(0, basename.find_last_of(".")); - m_photo->make_new(basename+"-polaroid", cam.width(), cam.height()); + m_photo->set_name(basename); cam.capture(*m_photo); if (m_mpi.isroot()) diff --git a/apps/polaroidCamera/SchlierenCartridge.h b/apps/polaroidCamera/SchlierenCartridge.h @@ -35,7 +35,7 @@ public: const Real k1 = m_parser("-k1").asDouble(1.0); GammaCorrection gammaCorrect(m_parser); - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-schlieren", data.width(), data.height()); // set description string desc("2D_Schlieren"); diff --git a/apps/polaroidCamera/TransmissionCartridge.h b/apps/polaroidCamera/TransmissionCartridge.h @@ -15,7 +15,7 @@ public: virtual void capture(PhotoPaper& photo, Slice& data) { - photo.resize(data.width(), data.height()); + photo.make_new(photo.get_name()+"-transmission", data.width(), data.height()); // set description string desc("2D_Transmission"); diff --git a/include/PhotoHDF5.h b/include/PhotoHDF5.h @@ -17,7 +17,6 @@ class PhotoHDF5 : public PhotoPaper { private: - std::string m_fname; std::string m_description; bool m_open; Real* m_hdfraw; @@ -35,12 +34,12 @@ private: void _dump_xmf() const; public: - PhotoHDF5(const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0), m_fname(filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) {} - PhotoHDF5(const Polaroid& cam, const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0), m_fname(filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) + PhotoHDF5(const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0,filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) {} + PhotoHDF5(const Polaroid& cam, const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0,filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) { resize(cam.width(), cam.height()); } - PhotoHDF5(const int width, const int height, const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0), m_fname(filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) + PhotoHDF5(const int width, const int height, const std::string filename="hdf5", const Real t=0) : PhotoPaper(0,0,filename), m_description("data"), m_open(false), m_hdfraw(nullptr), m_time(t) { resize(width,height); } @@ -53,7 +52,6 @@ public: virtual std::string suffix() const { return std::string(".h5"); } virtual void set_description(const char* const desc) { m_description = std::string(desc); } inline void set_time(const Real t) { m_time = t; } - inline void set_filename(const std::string new_name) { m_fname = new_name; } }; #endif /* _USE_HDF_ */ diff --git a/include/PhotoPNG.h b/include/PhotoPNG.h @@ -13,7 +13,6 @@ class PNG_HSV : public PhotoPaper { protected: - std::string m_fname; std::string m_description; bool m_open; pngwriter* m_png; @@ -32,20 +31,20 @@ protected: public: PNG_HSV(const std::string filename="hsv", const double saturation=1.0, const double value=1.0, const double bg=1.0) : - PhotoPaper(0,0), m_fname(filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), + PhotoPaper(0,0,filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), m_saturation(saturation), m_value(value), m_background(bg) { _default_info(); } PNG_HSV(const Polaroid& cam, const std::string filename="hsv", const double saturation=1.0, const double value=1.0, const double bg=1.0) : - PhotoPaper(0,0), m_fname(filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), + PhotoPaper(0,0,filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), m_saturation(saturation), m_value(value), m_background(bg) { _default_info(); resize(cam.width(), cam.height()); } PNG_HSV(const int width, const int height, const std::string filename="hsv", const double saturation=1.0, const double value=1.0, const double bg=1.0) : - PhotoPaper(0,0), m_fname(filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), + PhotoPaper(0,0,filename), m_description("PNG HSV colorscheme"), m_open(false), m_png(nullptr), m_saturation(saturation), m_value(value), m_background(bg) { _default_info(); diff --git a/include/PhotoPaper.h b/include/PhotoPaper.h @@ -13,17 +13,20 @@ class PhotoPaper { protected: int m_width, m_height; + std::string m_fname; public: - PhotoPaper(const int width, const int height) : m_width(width), m_height(height) {}; + PhotoPaper(const int width, const int height, const std::string& name) : m_width(width), m_height(height), m_fname(name) {}; virtual ~PhotoPaper() {}; - virtual void make_new(const std::string name, const int width, const int height) = 0; - virtual void resize(const int width, const int height) = 0; + virtual void make_new(const std::string name, const int width, const int height=1) = 0; + virtual void resize(const int width, const int height=1) = 0; virtual void write() = 0; virtual void set_pixel(const int x, const int y, const double phi) = 0; virtual std::string suffix() const = 0; virtual void set_description(const char* const desc) { } + inline void set_name(const std::string& name) { m_fname = name; } + inline std::string get_name() const { return m_fname; } }; #endif /* PHOTOPAPER_H_B0K8P9TO */