forked from elhuhdron/pylibczi
-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.cpp
46 lines (34 loc) · 1.44 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// This is a test program fro profiling performance
//
#include <cstdio>
#include <cstdlib>
#include <locale>
#include <codecvt>
#include <string>
#include "_aicspylibczi/Reader.h"
int
main(int argc, char *argv[]){
if(argc != 2){
std::cout << "This executable is intended for profiling. It requires the user provide the path to a large czi file." << std::endl;\
std::cout << "Example Usage: profile_me /Users/jamies/Data/s_1_t_10_c_3_z_1.czi" << std::endl;
std::cerr << "Program called with insufficient or excess arguments!" << std::endl;
exit(0);
}
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring wide = converter.from_bytes(argv[1]);
pylibczi::Reader czi( wide.c_str() ); // L"/Users/jamies/Data/s_1_t_10_c_3_z_1.czi");
libCZI::CDimCoordinate dm = libCZI::CDimCoordinate{{libCZI::DimensionIndex::B, 0}};
std::cout << "Dims: " << czi.dimsString() << std::endl;
auto dSizes = czi.dimSizes();
std::cout << "Shape: {" ;
for_each(dSizes.begin(), dSizes.end(), [](const int &x){
std::cout << x << ", ";
});
std::cout << "}" << std::endl;
auto start = std::chrono::high_resolution_clock::now();
auto pr = czi.readSelected(dm);
auto done = std::chrono::high_resolution_clock::now();
std::cout << "Duration(milliseconds): " << std::chrono::duration_cast<std::chrono::milliseconds>(done-start).count() << std::endl;
return 0;
}