polaroid-pp

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

SliceStat.h (1198B)


      1 // File       : SliceStat.h
      2 // Date       : Tue 12 Jul 2016 03:05:34 PM CEST
      3 // Author     : Fabian Wermelinger
      4 // Description: Extract statistics of current slice
      5 // Copyright 2016 ETH Zurich. All Rights Reserved.
      6 #ifndef SLICEINFO_H_FGI1MKEH
      7 #define SLICEINFO_H_FGI1MKEH
      8 
      9 #include <string>
     10 #include <sstream>
     11 #include <cassert>
     12 #include "Cartridge.h"
     13 #include "Types.h"
     14 #include "PhotoINFO.h"
     15 
     16 class SliceStat: public Cartridge
     17 {
     18 public:
     19     SliceStat(ArgumentParser& parser) : Cartridge(parser) {}
     20 
     21     virtual void capture(PhotoPaper& photo, Slice& data)
     22     {
     23         assert(photo.suffix() == std::string(".info"));
     24         PhotoINFO& pi = dynamic_cast<PhotoINFO&>(photo);
     25 
     26         // set description
     27         string desc("2D_Slice_Info");
     28         pi.set_description(desc.c_str());
     29 
     30         const std::string basename(pi.get_name());
     31 
     32         std::ostringstream buf;
     33         buf << "-info_sliceDir=" << data.get_sliceDir() << "_sliceID=" << data.get_sliceID();
     34         pi.make_new(basename+buf.str()+pi.suffix());
     35 
     36         // collect statistics
     37         Slice2D_Statistics stat(data);
     38         pi.write(stat);
     39     }
     40 
     41     virtual void compute(Slice& data) {}
     42 };
     43 
     44 #endif /* SLICEINFO_H_FGI1MKEH */