Project-MONAI / monai-deploy-app-sdk

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.
Apache License 2.0
91 stars 48 forks source link

Develop advanced series selection logic and operators utilizing pixel processing algorithms. #204

Open MMelQin opened 2 years ago

MMelQin commented 2 years ago

Is your feature request related to a problem? Please describe. Series selection can be very complex and often needs to be customized for a specific application use, and for specific modality. DICOM metadata matching based selection rule is a good start, and is simple to use for many basic use cases. There are complex use cases which will require more advanced selection rules and/or pixel level evaluation, requiring the use of traditional computer vision based and/or DL based algorithms.

App SDK v0.2 provides Domain classes encapsulating the selected series of a study, and has the base Series Selection operator with metadata matching selection logic. It is feasible to develop more advanced derived classes to cater for more advanced use cases.

The following RFE's has been copied over from issue 175 so that they are properly recorded.

Describe the solution you'd like Leaving some thoughts here on series selection capabilities that will be required or highly desirable:

Feel free to assign specific tasks from this to me once the way rules should be specified are sorted out.

Overall, the complexity of series selection is absolutely not to be underestimated. I would suggest that we have classes implementing individual series selection steps that can be composed by the user to form a series selection pipeline in the DICOMSeriesSelector, much like transforms are composed in MONAI Core. The ability to extend via subclassing would be extremely helpful for the trickier situations that may need custom logic.

Describe alternatives you've considered Dedicated application specific operators can be developed, for examples, to further sifting through a already coarsely selected set of series in a study. The Domain class, StudySelectedSeries, supports a list of matching series for a input study, and can be used in the chain of selection operators.

Additional context Thanks @CPBridge for providing the advanced, and real world, use cases and the RFE's.

CPBridge commented 2 years ago

I posted here already but realized this is a better place...

For special cases such as view selection (axial/sagittal/coronal) I think the approach of subclassing and overriding filter makes sense. However I still feel that ranges (e.g. Slice Thickness between 1 and 5mm) would be better handled in the base class. Could we somehow add in this functionality in how the conditions are specified. E.g.:

{
    "selections": [
        {
            "name": "CT Series 1",
            "conditions": {
                "StudyDescription": "(?i)^Spleen",
                "Modality": "(?i)CT",
                "SeriesDescription": "(?i)^No series description|(.*?)",
                "SliceThickness": {"range_minimum": 1, "range_maximum": 5}
            }
        }
    ]
}

Thoughts @MMelQin ?

MMelQin commented 2 years ago

@CPBridge Definitely this is something that we can put on the priority list, along with date range and a few others. The current implicit evaluators include only numerical equality, str equality or regex match, and set union/superset (for multi value attributes, e.g. Image Type. The logical operator between conditions is also limited to "AND". Very limited, as I was trying to avoid having a DSL for expressing the rules.

I was considering supporting the requested procedure at the study level and performed procedure step with performed protocol code sequence at the series level, but they require supporting multi-valued structure data matching. Also, these attribute bias more toward integrating with RIS, and maybe it makes more sense that this level of filtering be in the MONAI Deploy Workflow Manager.

Implementation wise, I was looking into Durable Rules package, which may be used as a more advanced selector/decision maker, albeit without configuration file support; at least I have not found it yet.

dcsst47 commented 1 year ago

fantastic work on monai-app-sdk. for someone new, how to get this series selector to work ? Can someone please show how to get the minimum rules, what I am looking for is Modality CT / Slice thickness between 1 to 5/ Image type Primary / Axial only. No derived or secondary series. Can someone please help. Is there been some development on this, since the status still shows as backlog.

MMelQin commented 1 year ago

fantastic work on monai-app-sdk. for someone new, how to get this series selector to work ? Can someone please show how to get the minimum rules, what I am looking for is Modality CT / Slice thickness between 1 to 5/ Image type Primary / Axial only. No derived or secondary series. Can someone please help. Is there been some development on this, since the status still shows as backlog.

Thank you @dcsst47 for your comments and question.

The App SDK provides a very primitive series selection rule processor for a few example use cases, and for sure the built-in operator can be derived and specialized with more advanced logic by adopters/contributors. As it stands now, your requirements, except the logically numerical slice thickness, can be supported, because the processing is limited to string matching and subset of strings. A example is shown in the Liver Tumor Seg example with following rule definition, whose selected series will have the index name of CT Series (please note multiple selections can be specified each with its independent rules, and potentially each selection may yield the same series, but with each selection's defined index name):

Sample_Rules_Text = """
{
    "selections": [
        {
            "name": "CT Series",
            "conditions": {
                "Modality": "(?i)CT",
                "ImageType": ["PRIMARY", "ORIGINAL"],
                "PhotometricInterpretation": "MONOCHROME2"
            }
        }
    ]
}
""" 
dcsst47 commented 1 year ago

Thank you @MMelQin for your answer, that explnation helped to figure out the selection.