biotracker_core icon indicating copy to clipboard operation
biotracker_core copied to clipboard

Load media on start

Open amjadsaadeh opened this issue 9 years ago • 4 comments

Previously loaded media were loaded again by starting the Biotracker in old Biotracker. This behaviour has been ported to new Biotracker.

amjadsaadeh avatar Apr 24 '16 13:04 amjadsaadeh

Instead of manually concatenating and splitting a string with all the filenames in the case of an ImageStream you can directly store an std::vector<std::string> in the settings. This is how it was done in the old codebase. The code is simpler and also doesn't break if there's a ";" in a filename.

You can see the old implementation here: https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L250 https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L389

nebw avatar Apr 26 '16 12:04 nebw

Trying to read a std::vector<std::string> directly from settings, similar to https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L389, results in following compiler error: http://pastebin.com/ZkgHJcPw

Correspoding code:

...
boost::optional<std::vector<std::string>> filenamesStrOpt = m_settings.maybeGetValueOfParam<std::vector<std::string>>
                (PictureParam::PICTURE_FILES);

        if (!filenamesStrOpt) {
            m_settings.setParam<uint8_t>(GuiParam::MEDIA_TYPE, static_cast<uint8_t>(GuiParam::MediaType::NoMedia));
            return;
        }

        std::vector<boost::filesystem::path> filenames;
        for (std::string filenameStr : *filenamesStrOpt) {
            filenames.push_back(boost::filesystem::path(filenameStr));
        }
        try {
            loadPictures(std::move(filenames));
        } catch (file_not_found e) {
            m_settings.setParam<uint8_t>(GuiParam::MEDIA_TYPE, static_cast<uint8_t>(GuiParam::MediaType::NoMedia));
            Q_EMIT notifyGUI(e.what(), MessageType::FAIL);
        }
...

I don't know what this mean, maybe a deserializer is missing.

amjadsaadeh avatar Apr 27 '16 08:04 amjadsaadeh

Likely obsolete or requiring major rework in the Biotracker3. @hmoenck? Is that feature still wanted?

walachey avatar Sep 19 '17 10:09 walachey

@walachey Yup, the new tree structure is somewhat more complex than the old vector structure. I was striving to serialize these to/from CSV manually. This is only halfway done yet.

hmoenck avatar Sep 19 '17 10:09 hmoenck