fix(io): dicom::SReader does not support loading folders or resources
Description
Loading a fixed data (directory) with sight::module::io::dicom::SReader
currently does not work.
Steps to reproduce
I propose you slightly modify Sight Viewer
for this.
- Add this somewhere
<service uid="data_loader_srv" type="sight::module::io::dicom::SReader">
<inout key="data" uid="seriesSet" />
<resource>SightViewer/a_folder</resource>
<!-- Or, alternatively
<folder>/home/your/some_folder_with_dicom</folder>
-->
</service>
- Add this at the end of the XML
<start uid="data_loader_srv" />
<update uid="data_loader_srv" />
Nothing will happen.
Proposal
According to @dweckmann, that's a oversight in this reader. This is caused by
// If the user did not choose a series, we stop here
if(!m_pimpl->m_reader)
{
return;
}
A more correct but incomplete check would be the code below (credit to @dweckmann for this).
WARNING: this doesn't really work™.
A second update will fail because we call m_pimp->clear();
later in this method, which calls IReader::clearLocations();
and therefore loose the information.
if(!m_pimpl->m_reader)
{
if(m_pimpl->m_selection)
{
return;
}
if(!std::filesystem::is_directory(m_pimpl->m_owner->getFolder()))
{
return;
}
if(!m_pimpl->scan())
{
return;
}
}
Functional specifications
<resource>
and <folder>
tags should work for this reader.
Technical specifications
Details of the implementation of the fix
Test plan
Describe how you will verify that the implementation fulfils the specifications