Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selective Inference Calling #1651

Open
kenbutcher opened this issue Mar 8, 2024 · 1 comment
Open

Selective Inference Calling #1651

kenbutcher opened this issue Mar 8, 2024 · 1 comment

Comments

@kenbutcher
Copy link

Could we change the inference app call to allow it to skip an image under specific conditions? For instance, we do not want to trigger the inference label when we add a new secondary capture to Xnat.

It would also be useful if we could run batch inference on all images of one type (i.e. non-contrast CT), again preserving the ability to skip derived / secondary images.

@AHarouni
Copy link
Contributor

AHarouni commented Mar 8, 2024

A temp workaround for this now is to override the __call__ function as below.

    def __call__(self, request, callbacks: Union[Dict, None] = None) -> Union[Dict, Tuple[str, Dict[str, Any]]]:
        print(f"___________________________in my call, request {request} _ open dicom to check on metadata")
        from lib.datastore.xnat import DCMUtil
        dcm_ds = DCMUtil.open_one_dcm(request["image"])
        dcm_type= DCMUtil.get_key_value(dcm_ds, 0x00080008)
        print(f"___________________________dcm image type is {dcm_type=}")
        stop_run = (len(dcm_ds)>2 and dcm_type[2]=="AI")
        if stop_run:
            print(f"!!!!!!!!!!!!!!!! Condition not meet this image")
            return "",{}
        result_file_name, result_json = super().__call__(request, callbacks)

        return result_file_name, result_json

However, I think I cleaner solution since this would be a common situation is to add that feature in the BasicInferTask to call a new interface function skip_inference_for_this_image with a default implementation or return false then user can override it with his logic @SachidanandAlle what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants