Skip to content
Snippets Groups Projects
main.cpp 1.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • theazgra's avatar
    theazgra committed
    #include "czi_parser.h"
    
    #include "compression/rle.h"
    
    theazgra's avatar
    theazgra committed
    int main(int argc, char **argv)
    {
    
        std::string cziFile = (argc > 1) ? argv[1] : "/home/mor0146/gitlab/data_project/czi-format/data/CZT-Stack-Anno.czi"; //"/home/mor0146/gitlab/data_project/czi-format/data/m2/exampleSingleChannel.czi";
        if (cziFile == "-v" || cziFile == "--version")
        {
    #if DEBUG
            printf("Running `Debug` version\n.");
    #else
            printf("Running `Release` version\n.");
    #endif
            return 0;
        }
    
        always_assert(is_file(cziFile));
    
    
    theazgra's avatar
    theazgra committed
        std::string method = argc > 2 ? argv[2] : "";
        std::string dumpName = argc > 3 ? argv[3] : "";
    
    theazgra's avatar
    theazgra committed
        bool report = method == "--report";
        bool reportAll = method == "--report-verbose";
    
    theazgra's avatar
    theazgra committed
        bool dumpRawImageData = method == "--dump-raw-image-data";
    
        bool dumpImageData = method == "--dump-images";
    
        bool nextImageDiff = method == "--diff-next";
    
    theazgra's avatar
    theazgra committed
        bool testRle = method == "--rle-report";
    
        auto name = get_filename_without_extension(cziFile);
        auto x = get_files_in_parent_directory(cziFile, true);
        auto y = get_files_with_same_prefix(x, name);
    
    
        CziParser parser;
        auto parseResult = parser.parse_czi_file(cziFile);
    
    theazgra's avatar
    theazgra committed
            parseResult.report_verbose();
        else if (report)
            parseResult.report();
    
    theazgra's avatar
    theazgra committed
        else if (dumpRawImageData)
    
    theazgra's avatar
    theazgra committed
            parseResult.dump_image_data(dumpName);
    
    theazgra's avatar
    theazgra committed
        else if (dumpImageData)
    
    theazgra's avatar
    theazgra committed
        {
    
            parseResult.extract_images(dumpName);
    
    theazgra's avatar
    theazgra committed
        }
    
        else if (nextImageDiff)
        {
            always_assert(dumpName != "");
            parseResult.differences_between_next(dumpName);
        }
    
    theazgra's avatar
    theazgra committed
        else if (testRle)
        {
            parseResult.test_rle_encode();
        }
    
    theazgra's avatar
    theazgra committed
        return 0;