From b46d61160cde02fc8f1c01ea90a7ba4c688c20a7 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 19 Apr 2020 13:31:36 +0900 Subject: [PATCH] :pencil: add document for N-channel data --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index bacac18..de3c2a0 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,41 @@ int main() Here you can access each frame, line, and pixel intuitively by using range-based for loops. +For the N-channel data, you need one more loop. + +```cpp +#include +#include +#include + +int main() +{ + std::ifstream ifs("example.asd"); + const auto data = asd::read_asd>(ifs); + + std::cout << "x_pixel = " << data.header.x_pixel << '\n'; + std::cout << "y_pixel = " << data.header.y_pixel << '\n'; + + for(auto const& frames : data.channels) + { + for(auto const& frame : frames) + { + for(auto const& line : frame) + { + for(auto const& pixel : line) + { + std::cout << pixel << ','; // height [nm] for topography, ... + } + std::cout << '\n'; + } + std::cout << "\n\n"; + } + } + std::cout << std::flush; + return 0; +} +``` + You can set file version and channel as a template parameter. ```cpp