├── .dockerignore ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── codecov.yml ├── dependabot.yml └── workflows │ ├── blossom-ci.yml │ ├── codeql-analysis.yml │ ├── docker-plugin.yml │ ├── docker.yml │ ├── pythonapp.yml │ └── release.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yml ├── CHANGELOG.md ├── CITATION.cff ├── CMakeLists.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MANIFEST.in ├── README.md ├── docs ├── Makefile ├── _static │ └── custom.css ├── images │ ├── DSAPerf1.png │ ├── DSAPerf2.png │ ├── DSAPerf3.png │ ├── DeeEditPretrainedTaskSpecific.png │ ├── DeepEdit - Cold Start.png │ ├── DeepEdit_testing.png │ ├── MONAI-logo-color.png │ ├── MONAILabel_API.png │ ├── active_learning.png │ ├── active_learning_endoscopy_results.png │ ├── bundleapp │ │ └── monaibundle.png │ ├── cellprofiler.jpg │ ├── cellprofiler_plugin.png │ ├── classes_monailabel.png │ ├── cvat2.png │ ├── cvat3.png │ ├── cvat7.png │ ├── cvat_active_learning.jpeg │ ├── cvat_al_workflow.png │ ├── cvat_detector.jpeg │ ├── cvat_interactor.jpeg │ ├── cvat_models.jpeg │ ├── data_organization.png │ ├── deepEdit_training.png │ ├── deepEditor.png │ ├── deepedit_multilabel_schema.png │ ├── deepgrow_2d_workflow.png │ ├── deepgrow_spleen_testing.png │ ├── demo.png │ ├── dropout_active_learning.png │ ├── dsa.jpg │ ├── favicon.ico │ ├── infer_API.png │ ├── install_steps.jpeg │ ├── invert_transforms.png │ ├── localization_spine.png │ ├── mlflow0.png │ ├── mlflow1.png │ ├── mlflow2.png │ ├── mlflow3.png │ ├── modules.svg │ ├── monai-server-application-callflow.svg │ ├── multilabel_deepedit_unetr.png │ ├── new_interaction.png │ ├── ohif.png │ ├── quickstart │ │ ├── 3dslicer-extensions-manager.png │ │ ├── MONAILabel.png │ │ ├── bundle_tutorial_1.jpeg │ │ ├── bundle_tutorial_2.jpeg │ │ ├── bundle_tutorial_3.jpeg │ │ ├── bundle_tutorial_4.jpeg │ │ ├── bundle_tutorial_5.jpeg │ │ ├── monai-label-iconinput-field-refresh.png │ │ ├── monai-label-plugin-favorite-modules-1.png │ │ ├── monai-smartedit-section.png │ │ ├── next-sample.png │ │ └── uploadnew-image-icon.png │ ├── qupath.jpg │ ├── sampleApps_index.jpeg │ ├── scribbles-GeneralScribblesFlow.png │ ├── scribbles-boundingbox-roi-apply.png │ ├── scribbles-on-the-fly-scribbles.png │ ├── scribbles-scribbles-based-label-refine.png │ ├── scribbles-scribbles-only-mode.png │ ├── tta.png │ ├── validation_left_atrium.png │ ├── validation_spleen.png │ ├── variance_uncertainty_wikifigure_sep_2022.png │ ├── vertebra-pipeline.png │ ├── wholeBody.png │ └── workflow.jpeg ├── requirements.txt └── source │ ├── apis.rst │ ├── appdeployment.rst │ ├── conf.py │ ├── index.rst │ ├── installation.rst │ ├── modules.rst │ ├── quickstart.rst │ └── whatsnew.rst ├── monailabel ├── __init__.py ├── _version.py ├── app.py ├── client │ ├── __init__.py │ └── client.py ├── config.py ├── datastore │ ├── __init__.py │ ├── cvat.py │ ├── dicom.py │ ├── dsa.py │ ├── local.py │ ├── utils │ │ ├── __init__.py │ │ ├── colors.py │ │ ├── convert.py │ │ └── dicom.py │ └── xnat.py ├── deepedit │ ├── __init__.py │ ├── handlers.py │ ├── interaction.py │ └── transforms.py ├── endpoints │ ├── __init__.py │ ├── activelearning.py │ ├── batch_infer.py │ ├── datastore.py │ ├── infer.py │ ├── info.py │ ├── login.py │ ├── logs.py │ ├── model.py │ ├── ohif.py │ ├── proxy.py │ ├── scoring.py │ ├── session.py │ ├── static │ │ ├── .gitignore │ │ └── favicon.ico │ ├── train.py │ ├── user │ │ ├── __init__.py │ │ └── auth.py │ └── wsi_infer.py ├── interfaces │ ├── __init__.py │ ├── app.py │ ├── config.py │ ├── datastore.py │ ├── exception.py │ ├── tasks │ │ ├── __init__.py │ │ ├── batch_infer.py │ │ ├── infer.py │ │ ├── infer_v2.py │ │ ├── scoring.py │ │ ├── strategy.py │ │ └── train.py │ └── utils │ │ ├── __init__.py │ │ ├── app.py │ │ ├── transform.py │ │ └── wsi.py ├── logging.json ├── main.py ├── sam2 │ ├── __init__.py │ ├── infer.py │ └── utils.py ├── scribbles │ ├── __init__.py │ ├── infer.py │ ├── transforms.py │ └── utils.py ├── scripts │ ├── monailabel │ └── monailabel.bat ├── tasks │ ├── __init__.py │ ├── activelearning │ │ ├── __init__.py │ │ ├── epistemic.py │ │ ├── first.py │ │ └── random.py │ ├── infer │ │ ├── __init__.py │ │ ├── basic_infer.py │ │ └── bundle.py │ ├── scoring │ │ ├── __init__.py │ │ ├── dice.py │ │ ├── epistemic.py │ │ ├── epistemic_v2.py │ │ └── sum.py │ └── train │ │ ├── __init__.py │ │ ├── basic_train.py │ │ ├── bundle.py │ │ ├── handler.py │ │ └── utils.py ├── transform │ ├── __init__.py │ ├── cache.py │ ├── post.py │ ├── pre.py │ └── writer.py └── utils │ ├── __init__.py │ ├── async_tasks │ ├── __init__.py │ ├── task.py │ └── utils.py │ ├── others │ ├── __init__.py │ ├── class_utils.py │ ├── detection.py │ ├── generic.py │ ├── label_colors.py │ ├── modelzoo_list.py │ ├── pathology.py │ └── planner.py │ └── sessions.py ├── plugins ├── README.md ├── cellprofiler │ ├── README.md │ ├── resources │ │ └── vista2d_test.tiff │ ├── runvista2d.py │ └── test_runvista2d.py ├── cvat │ ├── README.md │ ├── deploy.sh │ ├── detector.py │ ├── endoscopy │ │ ├── deepedit.yaml │ │ ├── inbody.yaml │ │ └── tooltracking.yaml │ ├── interactor.py │ ├── pathology │ │ ├── deepedit_nuclei.yaml │ │ ├── nuclick.yaml │ │ └── segmentation_nuclei.yaml │ ├── sam2 │ │ ├── interactor.yaml │ │ └── tracker.yaml │ └── tracker.py ├── dsa │ ├── Dockerfile │ ├── README.md │ └── cli │ │ ├── MONAILabelAnnotation │ │ ├── MONAILabelAnnotation.py │ │ ├── MONAILabelAnnotation.xml │ │ └── __init__.py │ │ ├── MONAILabelTraining │ │ ├── MONAILabelTraining.py │ │ ├── MONAILabelTraining.xml │ │ └── __init__.py │ │ ├── __init__.py │ │ ├── client.py │ │ ├── docker-entrypoint.sh │ │ └── slicer_cli_list.json ├── mitk │ ├── README.md │ └── Screenshots │ │ ├── mitk_monailabel.png │ │ └── mitk_monailabel_2d.png ├── ohif │ ├── .gitignore │ ├── README.md │ ├── Screenshots │ │ └── 1.png │ ├── build.sh │ ├── monai-label │ │ ├── .webpack │ │ │ ├── webpack.dev.js │ │ │ └── webpack.prod.js │ │ ├── package.json │ │ └── src │ │ │ ├── commandsModule.js │ │ │ ├── components │ │ │ ├── ModelSelector.js │ │ │ ├── ModelSelector.styl │ │ │ ├── MonaiLabelPanel.js │ │ │ ├── MonaiLabelPanel.styl │ │ │ ├── SegmentationLabelForm.js │ │ │ ├── SegmentationLabelForm.styl │ │ │ ├── SegmentationList.js │ │ │ ├── SegmentationList.styl │ │ │ ├── SettingsTable.js │ │ │ ├── SettingsTable.styl │ │ │ ├── actions │ │ │ │ ├── ActiveLearning.js │ │ │ │ ├── ActiveLearning.styl │ │ │ │ ├── AutoSegmentation.js │ │ │ │ ├── AutoSegmentation.styl │ │ │ │ ├── BaseTab.js │ │ │ │ ├── BaseTab.styl │ │ │ │ ├── NextSampleForm.js │ │ │ │ ├── NextSampleForm.styl │ │ │ │ ├── OptionTable.js │ │ │ │ ├── OptionTable.styl │ │ │ │ ├── Scribbles.js │ │ │ │ ├── Scribbles.styl │ │ │ │ ├── SmartEdit.js │ │ │ │ └── SmartEdit.styl │ │ │ └── index.js │ │ │ ├── icons │ │ │ └── MONAILabel.png │ │ │ ├── index.js │ │ │ ├── init.js │ │ │ ├── panelModule.js │ │ │ ├── services │ │ │ └── MonaiLabelClient.js │ │ │ ├── toolbarModule.js │ │ │ ├── tools │ │ │ └── DeepgrowProbeTool.js │ │ │ └── utils │ │ │ ├── GenericAnatomyColors.js │ │ │ ├── GenericUtils.js │ │ │ ├── SegmentationReader.js │ │ │ └── SegmentationUtils.js │ └── requirements.sh ├── ohifv3 │ ├── .gitignore │ ├── README.md │ ├── build.sh │ ├── config │ │ ├── mime.types │ │ ├── monai_label.js │ │ └── nginx.conf │ ├── extensions.patch │ ├── extensions │ │ └── monai-label │ │ │ ├── .gitignore │ │ │ ├── .prettierrc │ │ │ ├── .webpack │ │ │ ├── webpack.dev.js │ │ │ └── webpack.prod.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── babel.config.js │ │ │ ├── package.json │ │ │ └── src │ │ │ ├── components │ │ │ ├── ModelSelector.css │ │ │ ├── ModelSelector.tsx │ │ │ ├── MonaiLabelPanel.css │ │ │ ├── MonaiLabelPanel.tsx │ │ │ ├── OptionsInputDialog.tsx │ │ │ ├── SettingsTable.css │ │ │ ├── SettingsTable.tsx │ │ │ ├── Toolbox │ │ │ │ └── ThresholdSettingsPreset.tsx │ │ │ └── actions │ │ │ │ ├── ActiveLearning.tsx │ │ │ │ ├── AutoSegmentation.tsx │ │ │ │ ├── BaseTab.css │ │ │ │ ├── BaseTab.tsx │ │ │ │ ├── ClassPrompts.tsx │ │ │ │ ├── NextSampleForm.css │ │ │ │ ├── NextSampleForm.tsx │ │ │ │ ├── OptionTable.tsx │ │ │ │ ├── OptionsForm.css │ │ │ │ ├── OptionsForm.tsx │ │ │ │ ├── PointPrompts.css │ │ │ │ └── PointPrompts.tsx │ │ │ ├── getCommandsModule.ts │ │ │ ├── getPanelModule.tsx │ │ │ ├── id.js │ │ │ ├── index.tsx │ │ │ ├── init.ts │ │ │ ├── services │ │ │ └── MonaiLabelClient.js │ │ │ ├── tools │ │ │ └── ProbeMONAILabelTool.ts │ │ │ └── utils │ │ │ ├── GenericAnatomyColors.js │ │ │ ├── GenericUtils.js │ │ │ ├── SegUtils.js │ │ │ ├── SegmentationReader.js │ │ │ └── addToolInstance.ts │ ├── images │ │ └── ohifv3.jpg │ ├── modes │ │ └── monai-label │ │ │ ├── .gitignore │ │ │ ├── .prettierrc │ │ │ ├── .webpack │ │ │ └── webpack.prod.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── babel.config.js │ │ │ ├── package.json │ │ │ └── src │ │ │ ├── id.js │ │ │ ├── index.tsx │ │ │ ├── initToolGroups.js │ │ │ └── toolbarButtons.js │ ├── requirements.sh │ └── run.sh ├── qupath │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── build.gradle │ ├── settings.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── qupath │ │ │ │ ├── lib │ │ │ │ └── extension │ │ │ │ │ └── monailabel │ │ │ │ │ ├── Extension.java │ │ │ │ │ ├── InteractorTool.java │ │ │ │ │ ├── MonaiLabelClient.java │ │ │ │ │ ├── RequestUtils.java │ │ │ │ │ ├── SegmentationTool.java │ │ │ │ │ ├── Settings.java │ │ │ │ │ ├── Utils.java │ │ │ │ │ ├── commands │ │ │ │ │ ├── NextSample.java │ │ │ │ │ ├── RunInference.java │ │ │ │ │ ├── RunTraining.java │ │ │ │ │ └── SubmitLabel.java │ │ │ │ │ └── package-info.java │ │ │ │ └── module-info.java.bkp │ │ └── resources │ │ │ ├── META-INF │ │ │ └── services │ │ │ │ └── qupath.lib.gui.extensions.QuPathExtension │ │ │ ├── MONAI-Label.png │ │ │ ├── VERSION │ │ │ └── licenses │ │ │ └── MONAILabel │ │ │ └── LICENSE.txt │ │ └── test │ │ └── java │ │ └── .gitkeep └── slicer │ ├── .gitignore │ ├── CMakeLists.txt │ ├── MONAI-Label.png │ ├── MONAILabel │ ├── CMakeLists.txt │ ├── MONAILabel.py │ ├── MONAILabelLib │ │ ├── __init__.py │ │ ├── client.py │ │ └── labelcolors.py │ ├── Resources │ │ ├── Icons │ │ │ ├── MONAILabel.png │ │ │ ├── bg_red.png │ │ │ ├── contour.svg │ │ │ ├── download.png │ │ │ ├── eraser.png │ │ │ ├── fg_green.png │ │ │ ├── gray.svg │ │ │ ├── paint.png │ │ │ ├── refresh-icon.png │ │ │ ├── save.png │ │ │ ├── segment.png │ │ │ ├── stop.png │ │ │ ├── training.png │ │ │ └── upload.svg │ │ └── UI │ │ │ ├── LoginDialog.ui │ │ │ └── MONAILabel.ui │ ├── Screenshots │ │ ├── 1.png │ │ ├── 2.png │ │ └── 3.png │ └── Testing │ │ ├── CMakeLists.txt │ │ └── Python │ │ └── CMakeLists.txt │ ├── MONAILabelReviewer │ ├── .qt_for_python │ │ └── uic │ │ │ └── MONAILabelReviewer.py │ ├── CMakeLists.txt │ ├── MONAILabelReviewer.py │ ├── MONAILabelReviewerLib │ │ ├── DataStoreKeys.py │ │ ├── ImageData.py │ │ ├── ImageDataController.py │ │ ├── ImageDataExtractor.py │ │ ├── ImageDataStatistics.py │ │ ├── JsonParser.py │ │ ├── MONAILabelReviewerEnum.py │ │ ├── MonaiServerREST.py │ │ ├── SegmentationMeta.py │ │ └── __init__.py │ ├── README.md │ ├── ReadMeImages │ │ ├── MONAILabelReviewerEditorTools_1.png │ │ ├── MONAILabelReviewerEditorTools_2.png │ │ ├── MONAILabelReviewerEditorTools_3.png │ │ ├── MONAILabelReviewerEditorTools_4.png │ │ └── MONAILabelReviewerEditorTools_5.png │ ├── Resources │ │ ├── Icons │ │ │ └── MONAILabelReviewer.png │ │ └── UI │ │ │ └── MONAILabelReviewer.ui │ ├── Testing │ │ ├── CMakeLists.txt │ │ └── Python │ │ │ └── CMakeLists.txt │ └── UnitTests │ │ ├── ImageDataControllerTest.py │ │ ├── ImageDataExtractorTest.py │ │ ├── ImageDataTest.py │ │ ├── JsonParserTest.py │ │ ├── MonaiServerRESTTest.py │ │ └── TestDataSet │ │ ├── test_datastore_v2_image_with_multiple_versions.json │ │ ├── test_datastore_v2_image_with_segmentation.json │ │ ├── test_datastore_v2_image_without_segmentation.json │ │ └── test_json_datastore_v2.json │ └── README.md ├── pyproject.toml ├── requirements-dev.txt ├── requirements.txt ├── runtests.sh ├── sample-apps ├── README.md ├── endoscopy │ ├── README.md │ ├── __init__.py │ ├── lib │ │ ├── __init__.py │ │ ├── configs │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── inbody.py │ │ │ └── tooltracking.py │ │ ├── infers │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── inbody.py │ │ │ └── tooltracking.py │ │ ├── scoring │ │ │ ├── __init__.py │ │ │ └── cvat.py │ │ ├── trainers │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── inbody.py │ │ │ └── tooltracking.py │ │ └── transforms.py │ ├── main.py │ ├── model │ │ └── .gitignore │ ├── requirements.txt │ └── update_cvat_model.sh ├── monaibundle │ ├── README.md │ ├── __init__.py │ ├── lib │ │ ├── __init__.py │ │ ├── activelearning │ │ │ └── __init__.py │ │ ├── infers │ │ │ └── __init__.py │ │ └── trainers │ │ │ └── __init__.py │ ├── main.py │ ├── model │ │ └── .gitignore │ └── requirements.txt ├── pathology │ ├── README.md │ ├── __init__.py │ ├── lib │ │ ├── __init__.py │ │ ├── activelearning │ │ │ ├── __init__.py │ │ │ └── random.py │ │ ├── configs │ │ │ ├── __init__.py │ │ │ ├── classification_nuclei.py │ │ │ ├── hovernet_nuclei.py │ │ │ ├── nuclick.py │ │ │ └── segmentation_nuclei.py │ │ ├── handlers.py │ │ ├── hovernet.py │ │ ├── infers │ │ │ ├── __init__.py │ │ │ ├── classification_nuclei.py │ │ │ ├── hovernet_nuclei.py │ │ │ ├── nuclick.py │ │ │ └── segmentation_nuclei.py │ │ ├── trainers │ │ │ ├── __init__.py │ │ │ ├── classification_nuclei.py │ │ │ ├── hovernet_nuclei.py │ │ │ ├── nuclick.py │ │ │ └── segmentation_nuclei.py │ │ ├── transforms.py │ │ └── utils.py │ ├── main.py │ ├── model │ │ └── .gitignore │ └── requirements.txt ├── radiology │ ├── README.md │ ├── __init__.py │ ├── lib │ │ ├── __init__.py │ │ ├── activelearning │ │ │ ├── __init__.py │ │ │ └── last.py │ │ ├── configs │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── deepgrow_2d.py │ │ │ ├── deepgrow_3d.py │ │ │ ├── localization_spine.py │ │ │ ├── localization_vertebra.py │ │ │ ├── segmentation.py │ │ │ ├── segmentation_spleen.py │ │ │ ├── segmentation_vertebra.py │ │ │ └── sw_fastedit.py │ │ ├── infers │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── deepgrow.py │ │ │ ├── deepgrow_pipeline.py │ │ │ ├── localization_spine.py │ │ │ ├── localization_vertebra.py │ │ │ ├── segmentation.py │ │ │ ├── segmentation_spleen.py │ │ │ ├── segmentation_vertebra.py │ │ │ ├── sw_fastedit.py │ │ │ └── vertebra_pipeline.py │ │ ├── trainers │ │ │ ├── __init__.py │ │ │ ├── deepedit.py │ │ │ ├── deepgrow.py │ │ │ ├── localization_spine.py │ │ │ ├── localization_vertebra.py │ │ │ ├── segmentation.py │ │ │ ├── segmentation_spleen.py │ │ │ └── segmentation_vertebra.py │ │ └── transforms │ │ │ ├── __init__.py │ │ │ └── transforms.py │ ├── main.py │ ├── model │ │ └── .gitignore │ └── requirements.txt └── vista2d │ ├── README.md │ ├── __init__.py │ ├── lib │ ├── __init__.py │ ├── activelearning │ │ └── __init__.py │ ├── infers │ │ ├── __init__.py │ │ └── vista2d.py │ └── trainers │ │ └── __init__.py │ ├── main.py │ └── requirements.txt ├── setup.cfg ├── setup.py ├── tests ├── __init__.py ├── integration │ ├── __init__.py │ ├── endoscopy │ │ ├── __init__.py │ │ ├── test_infer.py │ │ └── test_trainer.py │ ├── monaibundle │ │ ├── __init__.py │ │ ├── bundles │ │ │ ├── test_infer.py │ │ │ └── test_trainer.py │ │ └── detection │ │ │ ├── test_infer.py │ │ │ └── test_trainer.py │ ├── pathology │ │ ├── __init__.py │ │ ├── test_infer.py │ │ └── test_info.py │ └── radiology │ │ ├── __init__.py │ │ ├── test_batch_infer.py │ │ ├── test_infer.py │ │ ├── test_info.py │ │ ├── test_session.py │ │ └── test_trainer.py ├── setup.py └── unit │ ├── __init__.py │ ├── activelearning │ ├── __init__.py │ └── test_epistemic.py │ ├── client │ ├── __init__.py │ └── test_client.py │ ├── datastore │ ├── __init__.py │ ├── test_convert.py │ ├── test_cvat.py │ ├── test_dicom.py │ └── test_xnat.py │ ├── deepedit │ ├── __init__.py │ ├── test_deepedit_handler.py │ ├── test_deepedit_interaction.py │ ├── test_deepedit_transforms.py │ └── test_planner.py │ ├── endpoints │ ├── __init__.py │ ├── context.py │ ├── test_activelearning.py │ ├── test_batch_infer.py │ ├── test_datastore.py │ ├── test_dicomwebcache.py │ ├── test_infer.py │ ├── test_infer_v2.py │ ├── test_infer_wsi.py │ ├── test_info.py │ ├── test_logs.py │ ├── test_model.py │ ├── test_ohif.py │ ├── test_proxy.py │ ├── test_scoring.py │ ├── test_scoring_v2.py │ ├── test_session.py │ └── test_train.py │ ├── interfaces │ ├── __init__.py │ ├── test_app.py │ └── test_utils.py │ ├── scribbles │ ├── __init__.py │ └── test_transforms_infer.py │ ├── test_main.py │ ├── transform │ ├── __init__.py │ ├── test_post.py │ ├── test_pre.py │ └── test_writer.py │ └── utils │ ├── __init__.py │ ├── test_class_utils.py │ └── test_sessions.py └── versioneer.py /.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | __pycache__ 13 | .idea 14 | .vscode 15 | .webpack 16 | node_modules/ 17 | *.log 18 | 19 | # Environments 20 | .env 21 | .venv 22 | env/ 23 | venv/ 24 | ENV/ 25 | env.bak/ 26 | venv.bak/ 27 | .venv/ 28 | ubuntu_venv/ 29 | 30 | # apps 31 | sample-apps/*/logs 32 | sample-apps/*/train 33 | sample-apps/*/model 34 | docs/build 35 | docs/source/apidocs 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Server logs** 14 | If applicable attach 100+ lines of monailabel server logs which covers the error trace etc... 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 1. Go to '...' 19 | 2. Install '....' 20 | 3. Run commands '....' (how you have started monailabel server) 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Environment** 29 | 30 | Ensuring you use the relevant python executable, please paste the output of: 31 | 32 | ``` 33 | python -c 'import monai; monai.config.print_debug_info()' 34 | ``` 35 | 36 | **Additional context** 37 | Add any other context about the problem here. 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Question relating to MONAILabel 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Please use MONAILabel's Discussions tab** 11 | For questions relating to MONAILabel usage, please do not create an issue. 12 | 13 | Instead, use [MONAI's GitHub Discussions tab](https://github.com/Project-MONAI/MONAILabel/discussions). This can be found next to Issues and Pull Requests along the top of our repository. 14 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | coverage: 13 | status: 14 | project: 15 | default: 16 | target: 45% 17 | threshold: 10 18 | base: parent 19 | if_no_uploads: error 20 | if_not_found: success 21 | if_ci_failed: error 22 | only_pulls: false 23 | flags: null 24 | paths: null 25 | patch: 26 | default: 27 | target: auto 28 | # Allows PRs without tests, overall stats count 29 | threshold: 100 30 | base: auto 31 | if_no_uploads: error 32 | if_not_found: success 33 | if_ci_failed: error 34 | only_pulls: false 35 | flags: null 36 | paths: null 37 | 38 | # Disable comments on PR 39 | comment: false 40 | 41 | ignore: 42 | - "versioneer.py" 43 | - "monailabel/_version.py" 44 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | # Check for updates to GitHub Actions every week 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | # .readthedocs.yml 13 | # Read the Docs configuration file 14 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 15 | 16 | # Required 17 | version: 2 18 | 19 | # Set the version of Python and other tools you might need 20 | build: 21 | os: ubuntu-22.04 22 | tools: 23 | python: "3.10" 24 | 25 | # Build documentation in the docs/ directory with Sphinx 26 | sphinx: 27 | configuration: docs/source/conf.py 28 | 29 | # Optionally set the version of Python and requirements required to build your docs 30 | python: 31 | install: 32 | - requirements: docs/requirements.txt 33 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | title: MONAI Label 3 | message: >- 4 | If you use this software, please cite it using the 5 | metadata from this file. 6 | type: software 7 | repository-code: 'https://github.com/Project-MONAI/MONAILabel' 8 | url: 'https://docs.monai.io/projects/label/' 9 | license: Apache-2.0 10 | preferred-citation: 11 | type: article 12 | authors: 13 | - given-names: Andres 14 | family-names: Diaz-Pinto 15 | - given-names: Sachidanand 16 | family-names: Alle 17 | - given-names: Alvin 18 | family-names: Ihsani 19 | - given-names: Muhammad 20 | family-names: Asad 21 | - given-names: Vishwesh 22 | family-names: Nath 23 | - given-names: Fernando 24 | family-names: Pérez-García 25 | orcid: 'https://orcid.org/0000-0001-9090-3024' 26 | - given-names: Pritesh 27 | family-names: Mehta 28 | - given-names: Wenqi 29 | family-names: Li 30 | - given-names: Holger R. 31 | family-names: Roth 32 | - given-names: Tom 33 | family-names: Vercauteren 34 | - given-names: Daguang 35 | family-names: Xu 36 | - given-names: Prerna 37 | family-names: Dogra 38 | - given-names: Sebastien 39 | family-names: Ourselin 40 | - given-names: Andrew 41 | family-names: Feng 42 | - given-names: M. Jorge 43 | family-names: Cardoso 44 | doi: '10.1016/j.media.2024.103207' 45 | journal: 'Medical Image Analysis' 46 | title: 'MONAI Label: A framework for AI-assisted interactive labeling of 3D medical images' 47 | volume: 95 48 | year: 2024 49 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | cmake_minimum_required(VERSION 3.12.1) 13 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 14 | 15 | project(MONAILabel) 16 | add_subdirectory(plugins/slicer) 17 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include versioneer.py 2 | include monailabel/_version.py 3 | 4 | recursive-include monailabel/endpoints/static * 5 | 6 | include README.md 7 | include LICENSE 8 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | # Minimal makefile for Sphinx documentation 13 | # 14 | 15 | # You can set these variables from the command line, and also 16 | # from the environment for the first two. 17 | SPHINXOPTS ?= 18 | SPHINXBUILD ?= sphinx-build 19 | SOURCEDIR = source 20 | BUILDDIR = build 21 | 22 | # Put it first so that "make" without argument is like "make help". 23 | help: 24 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 25 | 26 | .PHONY: help Makefile 27 | 28 | # Catch-all target: route all unknown targets to Sphinx using the new 29 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 30 | %: Makefile 31 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 32 | 33 | clean: 34 | rm -rf build/ 35 | rm -rf source/apidocs/ 36 | -------------------------------------------------------------------------------- /docs/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import url('https://fonts.googleapis.com/css?family=Lekton:700|Roboto&display=swap'); 15 | body{font-family:'Roboto',sans-serif;}.wy-menu-vertical p.caption{color:#7cccc7;} 16 | *{font-variant-ligatures: none;}.autoclasstoc td {padding:0.2rem;line-height:normal;} 17 | dl.field-list>dt{word-break: normal} 18 | -------------------------------------------------------------------------------- /docs/images/DSAPerf1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DSAPerf1.png -------------------------------------------------------------------------------- /docs/images/DSAPerf2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DSAPerf2.png -------------------------------------------------------------------------------- /docs/images/DSAPerf3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DSAPerf3.png -------------------------------------------------------------------------------- /docs/images/DeeEditPretrainedTaskSpecific.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DeeEditPretrainedTaskSpecific.png -------------------------------------------------------------------------------- /docs/images/DeepEdit - Cold Start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DeepEdit - Cold Start.png -------------------------------------------------------------------------------- /docs/images/DeepEdit_testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/DeepEdit_testing.png -------------------------------------------------------------------------------- /docs/images/MONAI-logo-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/MONAI-logo-color.png -------------------------------------------------------------------------------- /docs/images/MONAILabel_API.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/MONAILabel_API.png -------------------------------------------------------------------------------- /docs/images/active_learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/active_learning.png -------------------------------------------------------------------------------- /docs/images/active_learning_endoscopy_results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/active_learning_endoscopy_results.png -------------------------------------------------------------------------------- /docs/images/bundleapp/monaibundle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/bundleapp/monaibundle.png -------------------------------------------------------------------------------- /docs/images/cellprofiler.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cellprofiler.jpg -------------------------------------------------------------------------------- /docs/images/cellprofiler_plugin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cellprofiler_plugin.png -------------------------------------------------------------------------------- /docs/images/classes_monailabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/classes_monailabel.png -------------------------------------------------------------------------------- /docs/images/cvat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat2.png -------------------------------------------------------------------------------- /docs/images/cvat3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat3.png -------------------------------------------------------------------------------- /docs/images/cvat7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat7.png -------------------------------------------------------------------------------- /docs/images/cvat_active_learning.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat_active_learning.jpeg -------------------------------------------------------------------------------- /docs/images/cvat_al_workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat_al_workflow.png -------------------------------------------------------------------------------- /docs/images/cvat_detector.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat_detector.jpeg -------------------------------------------------------------------------------- /docs/images/cvat_interactor.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat_interactor.jpeg -------------------------------------------------------------------------------- /docs/images/cvat_models.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/cvat_models.jpeg -------------------------------------------------------------------------------- /docs/images/data_organization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/data_organization.png -------------------------------------------------------------------------------- /docs/images/deepEdit_training.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/deepEdit_training.png -------------------------------------------------------------------------------- /docs/images/deepEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/deepEditor.png -------------------------------------------------------------------------------- /docs/images/deepedit_multilabel_schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/deepedit_multilabel_schema.png -------------------------------------------------------------------------------- /docs/images/deepgrow_2d_workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/deepgrow_2d_workflow.png -------------------------------------------------------------------------------- /docs/images/deepgrow_spleen_testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/deepgrow_spleen_testing.png -------------------------------------------------------------------------------- /docs/images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/demo.png -------------------------------------------------------------------------------- /docs/images/dropout_active_learning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/dropout_active_learning.png -------------------------------------------------------------------------------- /docs/images/dsa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/dsa.jpg -------------------------------------------------------------------------------- /docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/favicon.ico -------------------------------------------------------------------------------- /docs/images/infer_API.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/infer_API.png -------------------------------------------------------------------------------- /docs/images/install_steps.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/install_steps.jpeg -------------------------------------------------------------------------------- /docs/images/invert_transforms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/invert_transforms.png -------------------------------------------------------------------------------- /docs/images/localization_spine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/localization_spine.png -------------------------------------------------------------------------------- /docs/images/mlflow0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/mlflow0.png -------------------------------------------------------------------------------- /docs/images/mlflow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/mlflow1.png -------------------------------------------------------------------------------- /docs/images/mlflow2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/mlflow2.png -------------------------------------------------------------------------------- /docs/images/mlflow3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/mlflow3.png -------------------------------------------------------------------------------- /docs/images/multilabel_deepedit_unetr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/multilabel_deepedit_unetr.png -------------------------------------------------------------------------------- /docs/images/new_interaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/new_interaction.png -------------------------------------------------------------------------------- /docs/images/ohif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/ohif.png -------------------------------------------------------------------------------- /docs/images/quickstart/3dslicer-extensions-manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/3dslicer-extensions-manager.png -------------------------------------------------------------------------------- /docs/images/quickstart/MONAILabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/MONAILabel.png -------------------------------------------------------------------------------- /docs/images/quickstart/bundle_tutorial_1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/bundle_tutorial_1.jpeg -------------------------------------------------------------------------------- /docs/images/quickstart/bundle_tutorial_2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/bundle_tutorial_2.jpeg -------------------------------------------------------------------------------- /docs/images/quickstart/bundle_tutorial_3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/bundle_tutorial_3.jpeg -------------------------------------------------------------------------------- /docs/images/quickstart/bundle_tutorial_4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/bundle_tutorial_4.jpeg -------------------------------------------------------------------------------- /docs/images/quickstart/bundle_tutorial_5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/bundle_tutorial_5.jpeg -------------------------------------------------------------------------------- /docs/images/quickstart/monai-label-iconinput-field-refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/monai-label-iconinput-field-refresh.png -------------------------------------------------------------------------------- /docs/images/quickstart/monai-label-plugin-favorite-modules-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/monai-label-plugin-favorite-modules-1.png -------------------------------------------------------------------------------- /docs/images/quickstart/monai-smartedit-section.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/monai-smartedit-section.png -------------------------------------------------------------------------------- /docs/images/quickstart/next-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/next-sample.png -------------------------------------------------------------------------------- /docs/images/quickstart/uploadnew-image-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/quickstart/uploadnew-image-icon.png -------------------------------------------------------------------------------- /docs/images/qupath.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/qupath.jpg -------------------------------------------------------------------------------- /docs/images/sampleApps_index.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/sampleApps_index.jpeg -------------------------------------------------------------------------------- /docs/images/scribbles-GeneralScribblesFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/scribbles-GeneralScribblesFlow.png -------------------------------------------------------------------------------- /docs/images/scribbles-boundingbox-roi-apply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/scribbles-boundingbox-roi-apply.png -------------------------------------------------------------------------------- /docs/images/scribbles-on-the-fly-scribbles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/scribbles-on-the-fly-scribbles.png -------------------------------------------------------------------------------- /docs/images/scribbles-scribbles-based-label-refine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/scribbles-scribbles-based-label-refine.png -------------------------------------------------------------------------------- /docs/images/scribbles-scribbles-only-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/scribbles-scribbles-only-mode.png -------------------------------------------------------------------------------- /docs/images/tta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/tta.png -------------------------------------------------------------------------------- /docs/images/validation_left_atrium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/validation_left_atrium.png -------------------------------------------------------------------------------- /docs/images/validation_spleen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/validation_spleen.png -------------------------------------------------------------------------------- /docs/images/variance_uncertainty_wikifigure_sep_2022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/variance_uncertainty_wikifigure_sep_2022.png -------------------------------------------------------------------------------- /docs/images/vertebra-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/vertebra-pipeline.png -------------------------------------------------------------------------------- /docs/images/wholeBody.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/wholeBody.png -------------------------------------------------------------------------------- /docs/images/workflow.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/docs/images/workflow.jpeg -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | -r ../requirements.txt 13 | 14 | commonmark==0.9.1 15 | recommonmark==0.7.1 16 | pydata-sphinx-theme==0.7.2 17 | Sphinx==4.3.0 18 | sphinx-autodoc-typehints==1.12.0 19 | sphinxcontrib-applehelp==1.0.2 20 | sphinxcontrib-devhelp==1.0.2 21 | sphinxcontrib-exceltable==0.2.2 22 | sphinxcontrib-htmlhelp==2.0.0 23 | sphinxcontrib-jsmath==1.0.1 24 | sphinxcontrib-qthelp==1.0.3 25 | sphinxcontrib-serializinghtml==1.1.5 26 | markupsafe==2.0.1 27 | -------------------------------------------------------------------------------- /monailabel/client/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .client import MONAILabelClient 13 | -------------------------------------------------------------------------------- /monailabel/datastore/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/datastore/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/deepedit/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/endpoints/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/endpoints/info.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from fastapi import APIRouter, Depends 13 | 14 | from monailabel.config import RBAC_USER, settings 15 | from monailabel.endpoints.user.auth import RBAC, User 16 | from monailabel.interfaces.app import MONAILabelApp 17 | from monailabel.interfaces.utils.app import app_instance 18 | 19 | router = APIRouter( 20 | prefix="/info", 21 | tags=["App"], 22 | responses={404: {"description": "Not found"}}, 23 | ) 24 | 25 | 26 | def app_info(): 27 | instance: MONAILabelApp = app_instance() 28 | return instance.info() 29 | 30 | 31 | @router.get("/", summary=f"{RBAC_USER}Get App Info") 32 | async def api_app_info(user: User = Depends(RBAC(settings.MONAI_LABEL_AUTH_ROLE_USER))): 33 | return app_info() 34 | -------------------------------------------------------------------------------- /monailabel/endpoints/static/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | ohif 13 | -------------------------------------------------------------------------------- /monailabel/endpoints/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/monailabel/endpoints/static/favicon.ico -------------------------------------------------------------------------------- /monailabel/endpoints/user/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/interfaces/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/interfaces/tasks/infer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | from abc import ABCMeta 14 | 15 | from monai.utils import deprecated 16 | 17 | from monailabel.interfaces.tasks.infer_v2 import InferType as InferTypeV2 18 | from monailabel.tasks.infer.basic_infer import BasicInferTask 19 | 20 | logger = logging.getLogger(__name__) 21 | 22 | # Alias 23 | InferType = InferTypeV2 24 | 25 | 26 | @deprecated(since="0.5.2", msg_suffix="please use monailabel.tasks.infer.basic_infer.BasicInferTask instead") 27 | class InferTask(BasicInferTask, metaclass=ABCMeta): 28 | pass 29 | -------------------------------------------------------------------------------- /monailabel/interfaces/tasks/scoring.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from abc import ABCMeta, abstractmethod 13 | 14 | from monailabel.interfaces.datastore import Datastore 15 | 16 | 17 | class ScoringMethod(metaclass=ABCMeta): 18 | """ 19 | Basic Scoring Method 20 | """ 21 | 22 | def __init__(self, description): 23 | self.description = description 24 | 25 | def info(self): 26 | return { 27 | "description": self.description, 28 | } 29 | 30 | @abstractmethod 31 | def __call__(self, request, datastore: Datastore): 32 | pass 33 | -------------------------------------------------------------------------------- /monailabel/interfaces/tasks/strategy.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from abc import ABCMeta, abstractmethod 13 | 14 | from monailabel.interfaces.datastore import Datastore 15 | 16 | 17 | class Strategy(metaclass=ABCMeta): 18 | """ 19 | Basic Active Learning Strategy 20 | """ 21 | 22 | def __init__(self, description): 23 | self.description = description 24 | 25 | def info(self): 26 | return { 27 | "description": self.description, 28 | } 29 | 30 | @abstractmethod 31 | def __call__(self, request, datastore: Datastore): 32 | pass 33 | -------------------------------------------------------------------------------- /monailabel/interfaces/tasks/train.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from abc import ABCMeta, abstractmethod 13 | 14 | from monailabel.interfaces.datastore import Datastore 15 | 16 | 17 | class TrainTask(metaclass=ABCMeta): 18 | """ 19 | Train Task 20 | """ 21 | 22 | def __init__(self, description): 23 | self.description = description 24 | 25 | def info(self): 26 | return {"description": self.description, "config": self.config()} 27 | 28 | def config(self): 29 | return {} 30 | 31 | def stats(self): 32 | return {} 33 | 34 | @abstractmethod 35 | def __call__(self, request, datastore: Datastore): 36 | pass 37 | -------------------------------------------------------------------------------- /monailabel/interfaces/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/sam2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/monailabel/sam2/__init__.py -------------------------------------------------------------------------------- /monailabel/sam2/utils.py: -------------------------------------------------------------------------------- 1 | from monai.utils import optional_import 2 | 3 | 4 | def is_sam2_module_available(): 5 | try: 6 | _, flag = optional_import("sam2") 7 | return flag 8 | except ImportError: 9 | return False 10 | -------------------------------------------------------------------------------- /monailabel/scribbles/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/scripts/monailabel: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | set -e 15 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd)" 16 | 17 | export PYTHONPATH=$DIR:$PYTHONPATH 18 | echo Using PYTHONPATH=$PYTHONPATH 19 | echo "" 20 | 21 | PYEXE=${MONAILABEL_PYEXE:-python} 22 | version=$(${PYEXE} --version 2>&1) 23 | if echo "$version" | grep "Python 2"; then 24 | echo "Trying python3 instead of python ($version)" 25 | PYEXE=python3 26 | fi 27 | 28 | exec ${PYEXE} -m monailabel.main $* 29 | -------------------------------------------------------------------------------- /monailabel/scripts/monailabel.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) MONAI Consortium 2 | :: Licensed under the Apache License, Version 2.0 (the "License"); 3 | :: you may not use this file except in compliance with the License. 4 | :: You may obtain a copy of the License at 5 | :: http://www.apache.org/licenses/LICENSE-2.0 6 | :: Unless required by applicable law or agreed to in writing, software 7 | :: distributed under the License is distributed on an "AS IS" BASIS, 8 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | :: See the License for the specific language governing permissions and 10 | :: limitations under the License. 11 | 12 | @echo off 13 | 14 | set DIR=%~dp0 15 | pushd %DIR%\..\.. 16 | set PARENT=%cd% 17 | popd 18 | 19 | 20 | set BAK_PYTHONPATH=%PYTHONPATH% 21 | 22 | set PYTHONPATH=%PARENT%;%PYTHONPATH% 23 | echo Using PYTHONPATH=%PYTHONPATH% 24 | echo "" 25 | 26 | python -m monailabel.main %* 27 | set PYTHONPATH=%BAK_PYTHONPATH% 28 | -------------------------------------------------------------------------------- /monailabel/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/tasks/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/tasks/activelearning/first.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | 14 | from monailabel.interfaces.datastore import Datastore 15 | from monailabel.interfaces.tasks.strategy import Strategy 16 | 17 | logger = logging.getLogger(__name__) 18 | 19 | 20 | class First(Strategy): 21 | """ 22 | Consider implementing a first strategy for active learning 23 | """ 24 | 25 | def __init__(self): 26 | super().__init__("Get First Sample") 27 | 28 | def __call__(self, request, datastore: Datastore): 29 | label_tag = request.get("label_tag") 30 | labels = request.get("labels") 31 | images = datastore.get_unlabeled_images(label_tag, labels) 32 | if not len(images): 33 | return None 34 | 35 | images.sort() 36 | image = images[0] 37 | 38 | logger.info(f"First: Selected Image: {image}") 39 | return {"id": image} 40 | -------------------------------------------------------------------------------- /monailabel/tasks/infer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/tasks/scoring/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/tasks/train/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/transform/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/utils/async_tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/utils/others/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /monailabel/utils/others/label_colors.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import random 13 | from typing import Any, Dict 14 | 15 | label_color_map: Dict[str, Any] = dict() 16 | 17 | 18 | def get_color(label, color_map): 19 | color = color_map.get(label) if color_map else None 20 | color = color if color else color_map.get(label.lower()) if color_map and isinstance(label, str) else None 21 | color = label_color_map.get(label) if not color else color 22 | if color is None: 23 | color = [random.randint(0, 255) for _ in range(3)] 24 | label_color_map[label] = color 25 | return color 26 | 27 | 28 | def to_hex(color): 29 | return "#%02x%02x%02x" % tuple(color) if color else "#000000" 30 | 31 | 32 | def to_rgb(color): 33 | return "rgb(" + ",".join([str(x) for x in color]) + ")" if color else "rgb(0,0,0)" 34 | -------------------------------------------------------------------------------- /plugins/cellprofiler/resources/vista2d_test.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/cellprofiler/resources/vista2d_test.tiff -------------------------------------------------------------------------------- /plugins/cvat/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | # Sample commands to deploy MONAILabel nuclio functions 15 | # ./deploy.sh 16 | 17 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" 18 | FUNCTION=${1:-**} 19 | MODEL=${2:-*} 20 | FUNCTIONS_DIR=${3:-$SCRIPT_DIR} 21 | MONAI_LABEL_SERVER="${MONAI_LABEL_SERVER:-http://`hostname -I | awk '{print $1}'`:8000}" 22 | 23 | nuctl create project cvat 24 | 25 | shopt -s globstar 26 | 27 | for func_config in "$FUNCTIONS_DIR"/$FUNCTION/${MODEL}.yaml 28 | do 29 | func_root="$FUNCTIONS_DIR" 30 | echo "Using MONAI Label Server: $MONAI_LABEL_SERVER" 31 | cp $func_config ${func_config}.bak 32 | sed -i "s|http://monailabel.com|$MONAI_LABEL_SERVER|g" $func_config 33 | echo "Deploying $func_config..." 34 | nuctl deploy --project-name cvat --path "$func_root" --file "$func_config" --platform local 35 | mv ${func_config}.bak $func_config 36 | done 37 | 38 | nuctl get function 39 | -------------------------------------------------------------------------------- /plugins/cvat/sam2/tracker.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | metadata: 13 | name: monailabel.sam2.tracker 14 | namespace: cvat 15 | annotations: 16 | name: SAM2T 17 | type: tracker 18 | spec: 19 | 20 | spec: 21 | description: A pre-trained SAM2 model for tracking model 22 | runtime: 'python:3.8' 23 | handler: tracker:handler 24 | eventTimeout: 30s 25 | 26 | build: 27 | image: cvat/monailabel.sam2.tracker 28 | baseImage: projectmonai/monailabel:latest 29 | 30 | directives: 31 | preCopy: 32 | - kind: ENV 33 | value: MONAI_LABEL_SERVER=http://monailabel.com 34 | - kind: ENV 35 | value: MONAI_LABEL_MODEL=sam_2d 36 | 37 | triggers: 38 | myHttpTrigger: 39 | maxWorkers: 1 40 | kind: 'http' 41 | workerAvailabilityTimeoutMilliseconds: 10000 42 | attributes: 43 | maxRequestBodySize: 33554432 # 32MB 44 | 45 | platform: 46 | attributes: 47 | restartPolicy: 48 | name: always 49 | maximumRetryCount: 1 50 | mountMode: volume 51 | network: cvat_cvat 52 | -------------------------------------------------------------------------------- /plugins/dsa/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | FROM python:3.9-slim 13 | 14 | RUN python -m pip install histomicstk --find-links https://girder.github.io/large_image_wheels 15 | 16 | ADD . /opt/monailabel/dsa 17 | WORKDIR /opt/monailabel/dsa/cli 18 | 19 | ENV PYTHONPATH=$PYTHONPATH:/opt/monailabel/dsa 20 | 21 | RUN python -m slicer_cli_web.cli_list_entrypoint --list_cli 22 | RUN python -m slicer_cli_web.cli_list_entrypoint MONAILabelAnnotation --help 23 | RUN python -m slicer_cli_web.cli_list_entrypoint MONAILabelTraining --help 24 | 25 | ENTRYPOINT ["/bin/bash", "docker-entrypoint.sh"] 26 | -------------------------------------------------------------------------------- /plugins/dsa/cli/MONAILabelAnnotation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /plugins/dsa/cli/MONAILabelTraining/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /plugins/dsa/cli/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /plugins/dsa/cli/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | # Calling the slicer_cli_web.cli_list_entrypoint always works, but we can skip 15 | # an extra exec if we find the path directly 16 | POSSIBLE_PATH="$1/$1.py" 17 | if [[ -f "$POSSIBLE_PATH" ]]; then 18 | python "$POSSIBLE_PATH" "${@:2}" 19 | else 20 | python -m slicer_cli_web.cli_list_entrypoint "$@" 21 | fi 22 | -------------------------------------------------------------------------------- /plugins/dsa/cli/slicer_cli_list.json: -------------------------------------------------------------------------------- 1 | { 2 | "MONAILabelAnnotation": { 3 | "type": "python", 4 | "docker-params": { 5 | "network_mode": "host" 6 | } 7 | }, 8 | "MONAILabelTraining": { 9 | "type": "python" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plugins/mitk/Screenshots/mitk_monailabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/mitk/Screenshots/mitk_monailabel.png -------------------------------------------------------------------------------- /plugins/mitk/Screenshots/mitk_monailabel_2d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/mitk/Screenshots/mitk_monailabel_2d.png -------------------------------------------------------------------------------- /plugins/ohif/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | node_modules/ 13 | -------------------------------------------------------------------------------- /plugins/ohif/Screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/ohif/Screenshots/1.png -------------------------------------------------------------------------------- /plugins/ohif/monai-label/.webpack/webpack.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpackCommon = require('./../../../.webpack/webpack.commonjs.js'); 3 | const SRC_DIR = path.join(__dirname, '../src'); 4 | const DIST_DIR = path.join(__dirname, '../dist'); 5 | 6 | module.exports = (env, argv) => { 7 | return webpackCommon(env, argv, { SRC_DIR, DIST_DIR }); 8 | }; 9 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/.webpack/webpack.prod.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const merge = require('webpack-merge'); 3 | const path = require('path'); 4 | const webpackCommon = require('./../../../.webpack/webpack.commonjs.js'); 5 | const pkg = require('./../package.json'); 6 | 7 | const ROOT_DIR = path.join(__dirname, './..'); 8 | const SRC_DIR = path.join(__dirname, '../src'); 9 | const DIST_DIR = path.join(__dirname, '../dist'); 10 | 11 | module.exports = (env, argv) => { 12 | const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR }); 13 | 14 | return merge(commonConfig, { 15 | devtool: 'source-map', 16 | optimization: { 17 | minimize: true, 18 | sideEffects: true, 19 | }, 20 | output: { 21 | path: ROOT_DIR, 22 | library: 'OHIFMONAILabelExt', 23 | libraryTarget: 'umd', 24 | libraryExport: 'default', 25 | filename: pkg.main, 26 | }, 27 | plugins: [ 28 | new webpack.optimize.LimitChunkCountPlugin({ 29 | maxChunks: 1, 30 | }), 31 | ], 32 | }); 33 | }; 34 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/ModelSelector.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .modelSelector 15 | .table 16 | border-collapse: collapse; 17 | border: 0 solid; 18 | width: 100%; 19 | 20 | .table tr td 21 | border: 0 solid; 22 | 23 | .selectBox 24 | width: 100% 25 | 26 | .actionButton 27 | border: 1px solid var(--ui-border-color-active) 28 | border-radius: 15px 29 | background-color: var(--active-color) 30 | color: var(--ui-gray-dark) 31 | line-height: 25px 32 | padding: 0 15px 33 | outline: none 34 | cursor: pointer 35 | 36 | &:hover, &:active 37 | background-color: var(--ui-sky-blue) 38 | 39 | &:disabled 40 | background-color: var(--ui-sky-blue) 41 | 42 | svg 43 | margin-right: 4px 44 | position: relative 45 | top: 2px 46 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/SegmentationLabelForm.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .segmentationLabelForm 15 | width: 600px 16 | 17 | .actionButton 18 | border: 1px solid var(--ui-border-color-active) 19 | border-radius: 15px 20 | background-color: var(--active-color) 21 | color: var(--ui-gray-dark) 22 | line-height: 25px 23 | padding: 0 15px 24 | outline: none 25 | cursor: pointer 26 | 27 | &:hover, &:active 28 | background-color: var(--ui-sky-blue) 29 | 30 | &:disabled 31 | background-color: var(--ui-sky-blue) 32 | 33 | svg 34 | margin-right: 4px 35 | position: relative 36 | top: 2px 37 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/SegmentationList.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .segmentationList 15 | .subtitle 16 | font-size: 14px 17 | text-decoration: underline 18 | font-weight 500 19 | 20 | .segSection 21 | height: 200px; 22 | overflow-y: auto; 23 | overflow-x: hidden; 24 | border: 1px solid; 25 | 26 | .segTable 27 | border-collapse: collapse; 28 | border: 1px dotted; 29 | width: 100%; 30 | display: block; 31 | white-space: nowrap; 32 | overflow-x: auto; 33 | 34 | .segTable tr:nth-child(even) { 35 | background-color: #333333 36 | } 37 | 38 | .segTable tr th 39 | background-color: #333333; 40 | border: 1px dotted; 41 | padding: 2px; 42 | 43 | .segTable tr td 44 | padding: 2px; 45 | 46 | .segColor 47 | height: 15px; 48 | width: 15px; 49 | background-color: #bbb; 50 | border-radius: 50%; 51 | display: inline-block 52 | 53 | .segEdit 54 | display: flex 55 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/SettingsTable.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .settingsTable 15 | border-collapse: collapse; 16 | border: 0 solid; 17 | width: 100%; 18 | font-size: small 19 | 20 | .settingsTable tr td 21 | border: 0 solid; 22 | 23 | .settings_active, 24 | .settings_header { 25 | background-color: black; 26 | color: white; 27 | cursor: pointer; 28 | padding: 5px; 29 | width: 100%; 30 | border: none; 31 | text-align: left; 32 | outline: none; 33 | } 34 | 35 | .settings_active { 36 | background-color: #403f3d; 37 | } 38 | 39 | .settings_header:hover { 40 | background-color: #2b2a28; 41 | } 42 | 43 | .settings_header:after { 44 | content: '\002B'; 45 | color: white; 46 | font-weight: bold; 47 | float: right; 48 | margin-left: 5px; 49 | } 50 | 51 | .settings_active:after { 52 | content: '\2212'; 53 | color: white; 54 | font-weight: bold; 55 | float: right; 56 | margin-left: 5px; 57 | } 58 | 59 | .settings_content { 60 | cursor: pointer; 61 | color: #fff; 62 | background-color: #2b2a28; 63 | padding: 10px 64 | font-size: smaller 65 | } 66 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/ActiveLearning.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "BaseTab.styl" 15 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/AutoSegmentation.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "BaseTab.styl" 15 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/BaseTab.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "../ModelSelector.styl" 15 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/NextSampleForm.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .nextSampleForm 15 | width: 750px 16 | 17 | .actionButton 18 | border: 1px solid var(--ui-border-color-active) 19 | border-radius: 15px 20 | background-color: var(--active-color) 21 | color: var(--ui-gray-dark) 22 | line-height: 25px 23 | padding: 0 15px 24 | outline: none 25 | cursor: pointer 26 | 27 | &:hover, &:active 28 | background-color: var(--ui-sky-blue) 29 | 30 | &:disabled 31 | background-color: var(--ui-sky-blue) 32 | 33 | svg 34 | margin-right: 4px 35 | position: relative 36 | top: 2px 37 | 38 | .optionsTable { 39 | font-family: arial, sans-serif; 40 | border-collapse: collapse; 41 | width: 100%; 42 | font-size: smaller; 43 | } 44 | 45 | .optionsTable th { 46 | border: 1px solid #dddddd; 47 | text-align: left; 48 | background-color: lightslategray; 49 | } 50 | 51 | .optionsTable td { 52 | border: 1px solid #dddddd; 53 | text-align: left; 54 | } 55 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/OptionTable.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "BaseTab.styl" 15 | 16 | .optionsTable { 17 | font-family: arial, sans-serif; 18 | border-collapse: collapse; 19 | width: 100%; 20 | font-size: smaller; 21 | } 22 | 23 | .optionsTable th { 24 | border: 1px solid #dddddd; 25 | text-align: left; 26 | background-color: lightslategray; 27 | } 28 | 29 | .optionsTable td { 30 | border: 1px solid #dddddd; 31 | text-align: left; 32 | } 33 | 34 | .optionsInput 35 | width: 100% 36 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/Scribbles.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "BaseTab.styl" 15 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/actions/SmartEdit.styl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | @import "BaseTab.styl" 15 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/components/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/icons/MONAILabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/ohif/monai-label/src/icons/MONAILabel.png -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | import toolbarModule from './toolbarModule'; 15 | import panelModule from './panelModule.js'; 16 | import init from './init'; 17 | import { DeepgrowProbeTool } from './tools/DeepgrowProbeTool'; 18 | 19 | export { DeepgrowProbeTool }; 20 | 21 | export default { 22 | id: 'com.ohif.monai-label', 23 | 24 | preRegistration({ servicesManager, configuration = {} }) { 25 | init({ servicesManager, configuration }); 26 | }, 27 | getToolbarModule({ servicesManager }) { 28 | return toolbarModule; 29 | }, 30 | getPanelModule({ servicesManager, commandsManager }) { 31 | return panelModule({ servicesManager, commandsManager }); 32 | }, 33 | }; 34 | -------------------------------------------------------------------------------- /plugins/ohif/monai-label/src/panelModule.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | import MonaiLabelPanel from './components/MonaiLabelPanel.js'; 15 | 16 | const panelModule = ({ commandsManager }) => { 17 | return { 18 | menuOptions: [ 19 | { 20 | icon: 'list', 21 | label: 'MONAI Label', 22 | from: 'right', 23 | target: 'monai-label-panel', 24 | }, 25 | ], 26 | components: [ 27 | { 28 | id: 'monai-label-panel', 29 | component: MonaiLabelPanel, 30 | }, 31 | ], 32 | defaultContext: ['VIEWER'], 33 | }; 34 | }; 35 | 36 | export default panelModule; 37 | -------------------------------------------------------------------------------- /plugins/ohif/requirements.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | if which yarn >/dev/null; then 15 | echo "node/yarn is already installed" 16 | else 17 | echo "installing yarn..." 18 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 19 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 20 | apt update 21 | apt-get install yarn -y 22 | fi 23 | -------------------------------------------------------------------------------- /plugins/ohifv3/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | logs 13 | Viewers 14 | www 15 | -------------------------------------------------------------------------------- /plugins/ohifv3/config/monai_label.js: -------------------------------------------------------------------------------- 1 | window.config = { 2 | routerBasename: '/ohif/', 3 | showStudyList: true, 4 | extensions: [], 5 | modes: [], 6 | // below flag is for performance reasons, but it might not work for all servers 7 | 8 | showWarningMessageForCrossOrigin: true, 9 | showCPUFallbackMessage: true, 10 | showLoadingIndicator: true, 11 | strictZSpacingForVolumeViewport: true, 12 | defaultDataSourceName: 'dicomweb', 13 | useSharedArrayBuffer: 'FALSE', 14 | dataSources: [ 15 | { 16 | namespace: '@ohif/extension-default.dataSourcesModule.dicomweb', 17 | sourceName: 'dicomweb', 18 | configuration: { 19 | friendlyName: 'Orthanc Server', 20 | name: 'Orthanc', 21 | wadoUriRoot: '/proxy/dicom/wado', 22 | qidoRoot: '/proxy/dicom/qido', 23 | wadoRoot: '/proxy/dicom/wado', 24 | qidoSupportsIncludeField: true, 25 | supportsReject: true, 26 | imageRendering: 'wadors', 27 | thumbnailRendering: 'wadors', 28 | enableStudyLazyLoad: false, 29 | supportsFuzzyMatching: true, 30 | supportsWildcard: true, 31 | dicomUploadEnabled: true, 32 | bulkDataURI: { 33 | enabled: true, 34 | }, 35 | }, 36 | }, 37 | ], 38 | }; 39 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions.patch: -------------------------------------------------------------------------------- 1 | diff --git a/platform/app/pluginConfig.json b/platform/app/pluginConfig.json 2 | index 06ae62e55..d0be6b022 100644 3 | --- a/platform/app/pluginConfig.json 4 | +++ b/platform/app/pluginConfig.json 5 | @@ -57,6 +57,10 @@ 6 | "default": false, 7 | "version": "3.0.0" 8 | }, 9 | + { 10 | + "packageName": "@ohif/extension-monai-label", 11 | + "version": "3.0.0" 12 | + }, 13 | { 14 | "packageName": "@ohif/extension-cornerstone-dicom-rt", 15 | "default": false, 16 | @@ -84,6 +88,10 @@ 17 | "default": false, 18 | "version": "3.0.0" 19 | }, 20 | + { 21 | + "packageName": "@ohif/mode-monai-label", 22 | + "version": "3.0.0" 23 | + }, 24 | { 25 | "packageName": "@ohif/mode-basic-dev-mode", 26 | "default": false, 27 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "printWidth": 80, 4 | "proseWrap": "always", 5 | "tabWidth": 2, 6 | "semi": true, 7 | "singleQuote": true 8 | } 9 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/.webpack/webpack.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const webpackCommon = require('./../../../.webpack/webpack.base.js'); 3 | const SRC_DIR = path.join(__dirname, '../src'); 4 | const DIST_DIR = path.join(__dirname, '../dist'); 5 | 6 | const ENTRY = { 7 | app: `${SRC_DIR}/index.tsx`, 8 | }; 9 | 10 | module.exports = (env, argv) => { 11 | return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY }); 12 | }; 13 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/.webpack/webpack.prod.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const { merge } = require('webpack-merge'); 3 | const path = require('path'); 4 | const webpackCommon = require('./../../../.webpack/webpack.base.js'); 5 | const pkg = require('./../package.json'); 6 | 7 | const ROOT_DIR = path.join(__dirname, './..'); 8 | const SRC_DIR = path.join(__dirname, '../src'); 9 | const DIST_DIR = path.join(__dirname, '../dist'); 10 | 11 | const ENTRY = { 12 | app: `${SRC_DIR}/index.tsx`, 13 | }; 14 | 15 | module.exports = (env, argv) => { 16 | const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY }); 17 | 18 | return merge(commonConfig, { 19 | stats: { 20 | colors: true, 21 | hash: true, 22 | timings: true, 23 | assets: true, 24 | chunks: false, 25 | chunkModules: false, 26 | modules: false, 27 | children: false, 28 | warnings: true, 29 | }, 30 | optimization: { 31 | minimize: true, 32 | sideEffects: false, 33 | }, 34 | output: { 35 | path: ROOT_DIR, 36 | library: 'ohif-extension-monai-label', 37 | libraryTarget: 'umd', 38 | libraryExport: 'default', 39 | filename: pkg.main, 40 | }, 41 | externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/], 42 | plugins: [ 43 | new webpack.optimize.LimitChunkCountPlugin({ 44 | maxChunks: 1, 45 | }), 46 | ], 47 | }); 48 | }; 49 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 extension-monai-label (adiazpinto@nvidia.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/README.md: -------------------------------------------------------------------------------- 1 | # extension-monai-label 2 | ## Description 3 | OHIFv3 extension for MONAI Label 4 | ## Author 5 | OHIF,NVIDIA,KCL 6 | ## License 7 | MIT 8 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/ModelSelector.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .modelSelector .table { 15 | border-collapse: collapse; 16 | border: 0 solid; 17 | width: 100%; 18 | } 19 | .modelSelector .table tr td { 20 | border: 0 solid; 21 | } 22 | .modelSelector .selectBox { 23 | width: 100%; 24 | color: #000; 25 | font-size: smaller; 26 | height: 18px; 27 | } 28 | .modelSelector .actionButton { 29 | border: 2px solid #000; 30 | border-radius: 15px; 31 | background-color: #00a4d9; 32 | color: var(--ui-gray-dark); 33 | line-height: 20px; 34 | padding: 0 15px; 35 | outline: none; 36 | cursor: pointer; 37 | } 38 | .modelSelector .actionButton:hover, 39 | .modelSelector .actionButton:active { 40 | background-color: #00a4d9; 41 | } 42 | .modelSelector .actionButton:disabled { 43 | background-color: #00a4d9; 44 | } 45 | .modelSelector .actionButton svg { 46 | margin-right: 4px; 47 | position: relative; 48 | top: 2px; 49 | } 50 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/SettingsTable.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .settingsTable { 15 | border-collapse: collapse; 16 | border: 0 solid; 17 | width: 100%; 18 | font-size: small; 19 | color: #fff; 20 | } 21 | .settingsTable tr td { 22 | border: 0 solid; 23 | } 24 | .settings_active, 25 | .settings_header { 26 | background-color: #000; 27 | color: #fff; 28 | cursor: pointer; 29 | padding: 5px; 30 | width: 100%; 31 | border: none; 32 | text-align: left; 33 | outline: none; 34 | } 35 | .settings_active { 36 | background-color: #403f3d; 37 | } 38 | .settings_header:hover { 39 | background-color: #2b2a28; 40 | } 41 | .settings_header:after { 42 | content: '\002B'; 43 | color: #fff; 44 | font-weight: bold; 45 | float: right; 46 | margin-left: 5px; 47 | } 48 | .settings_active:after { 49 | content: '\2212'; 50 | color: #fff; 51 | font-weight: bold; 52 | float: right; 53 | margin-left: 5px; 54 | } 55 | .settings_content { 56 | cursor: pointer; 57 | color: #fff; 58 | background-color: #2b2a28; 59 | padding: 10px; 60 | font-size: smaller; 61 | } 62 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/actions/BaseTab.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .optionsTable { 15 | font-family: arial, sans-serif; 16 | border-collapse: collapse; 17 | width: 99%; 18 | font-size: smaller; 19 | } 20 | .optionsTable th { 21 | border: 1px solid #070303; 22 | text-align: left; 23 | background-color: #789; 24 | } 25 | .optionsTable td { 26 | border: 1px solid #070202; 27 | text-align: left; 28 | } 29 | .optionsInput { 30 | width: 100%; 31 | } 32 | .bodyTableContainer { 33 | max-height: 300px; 34 | overflow-y: auto; 35 | } 36 | .segColor { 37 | height: 15px; 38 | width: 15px; 39 | background-color: #bbb; 40 | border-radius: 50%; 41 | display: inline-block; 42 | } 43 | .clickable-row { 44 | cursor: pointer; 45 | } 46 | .clickable-row:hover { 47 | background: #add8e6 !important; 48 | } 49 | .actionInput { 50 | padding: '8px 16px'; 51 | borderRadius: '4px'; 52 | border: '2px'; 53 | cursor: 'pointer'; 54 | } 55 | hr { 56 | margin-top: 6px; 57 | } 58 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/actions/NextSampleForm.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .nextSampleForm { 15 | } 16 | .nextSampleForm .actionButton { 17 | border: 1px solid var(--ui-border-color-active); 18 | border-radius: 15px; 19 | background-color: var(--active-color); 20 | color: var(--ui-gray-dark); 21 | line-height: 25px; 22 | padding: 0 15px; 23 | outline: none; 24 | cursor: pointer; 25 | } 26 | .nextSampleForm .actionButton:hover, 27 | .nextSampleForm .actionButton:active { 28 | background-color: var(--ui-sky-blue); 29 | } 30 | .nextSampleForm .actionButton:disabled { 31 | background-color: var(--ui-sky-blue); 32 | } 33 | .nextSampleForm .actionButton svg { 34 | margin-right: 4px; 35 | position: relative; 36 | top: 2px; 37 | } 38 | .nextSampleForm .optionsTable { 39 | font-family: arial, sans-serif; 40 | border-collapse: collapse; 41 | width: 100%; 42 | font-size: smaller; 43 | background-color: azure; 44 | color: black; 45 | } 46 | .nextSampleForm .optionsTable th { 47 | border: 1px solid #ddd; 48 | text-align: left; 49 | background-color: #789; 50 | } 51 | .nextSampleForm .optionsTable td { 52 | border: 1px solid #ddd; 53 | text-align: left; 54 | } 55 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/actions/OptionsForm.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .optionsForm { 15 | background-color: white; 16 | } 17 | .optionsSection { 18 | background-color: lightyellow; 19 | width: 100%; 20 | border-collapse: collapse; 21 | } 22 | .optionsSection .selectBox { 23 | background-color: white; 24 | border: 1px solid grey; 25 | font-size: medium; 26 | height: fit-content; 27 | } 28 | .optionsConfig { 29 | width: 800px; 30 | height: 300px; 31 | overflow: auto; 32 | } 33 | .optionsConfigTable { 34 | background-color: azure; 35 | font-family: arial, sans-serif; 36 | border-collapse: collapse; 37 | width: 100%; 38 | font-size: smaller; 39 | } 40 | .optionsConfigTable th { 41 | border: 1px solid #070303; 42 | text-align: left; 43 | background-color: #789; 44 | } 45 | .optionsConfigTable td { 46 | border: 1px solid #070202; 47 | text-align: left; 48 | } 49 | .optionsInput { 50 | width: 100%; 51 | color: #000; 52 | } 53 | .selectBox { 54 | width: 100%; 55 | color: #000; 56 | font-size: smaller; 57 | height: 18px; 58 | } 59 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/components/actions/PointPrompts.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | .tmpActionButton { 15 | border: 2px solid #000; 16 | border-radius: 15px; 17 | background-color: #00a4d9; 18 | color: var(--ui-gray-dark); 19 | line-height: 25px; 20 | padding: 0 15px; 21 | outline: none; 22 | cursor: pointer; 23 | } 24 | .tmpActionButton:hover, 25 | .tmpActionButton:active { 26 | background-color: #00a4d9; 27 | } 28 | .tmpActionButton:disabled { 29 | background-color: #00a4d9; 30 | } 31 | .tmpActionButton svg { 32 | margin-right: 4px; 33 | position: relative; 34 | top: 2px; 35 | } 36 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/getCommandsModule.ts: -------------------------------------------------------------------------------- 1 | export default function getCommandsModule({ servicesManager }) { 2 | const { uiNotificationService } = servicesManager.services; 3 | 4 | const actions = { 5 | setToolActive: ({ toolName }) => { 6 | uiNotificationService.show({ 7 | title: 'MONAI Label probe', 8 | message: 'MONAI Label Probe Activated.', 9 | type: 'info', 10 | duration: 3000, 11 | }); 12 | }, 13 | }; 14 | 15 | const definitions = { 16 | }; 17 | 18 | return { 19 | actions, 20 | definitions, 21 | defaultContext: 'MONAILabel', 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/getPanelModule.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import MonaiLabelPanel from './components/MonaiLabelPanel'; 3 | 4 | function getPanelModule({ 5 | commandsManager, 6 | extensionManager, 7 | servicesManager, 8 | }) { 9 | const WrappedMonaiLabelPanel = () => { 10 | return ( 11 | 16 | ); 17 | }; 18 | 19 | return [ 20 | { 21 | name: 'monailabel', 22 | iconName: 'tab-patient-info', 23 | iconLabel: 'MONAI', 24 | label: 'MONAI Label', 25 | secondaryLabel: 'MONAI Label', 26 | component: WrappedMonaiLabelPanel, 27 | }, 28 | ]; 29 | } 30 | 31 | export default getPanelModule; 32 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/id.js: -------------------------------------------------------------------------------- 1 | import packageJson from '../package.json'; 2 | 3 | const id = packageJson.name; 4 | 5 | export { id }; 6 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { id } from './id'; 2 | import getPanelModule from './getPanelModule'; 3 | import getCommandsModule from './getCommandsModule'; 4 | import preRegistration from './init'; 5 | 6 | export default { 7 | id, 8 | preRegistration, 9 | getPanelModule, 10 | getCommandsModule, 11 | }; 12 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/init.ts: -------------------------------------------------------------------------------- 1 | import { addTool } from '@cornerstonejs/tools'; 2 | import { Types } from '@ohif/core'; 3 | import ProbeMONAILabelTool from './tools/ProbeMONAILabelTool'; 4 | 5 | /** 6 | * @param {object} configuration 7 | */ 8 | export default function init({ 9 | servicesManager, 10 | configuration = {}, 11 | }: Types.Extensions.ExtensionParams): void { 12 | addTool(ProbeMONAILabelTool); 13 | } 14 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/utils/SegUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | function currentSegmentsInfo(segmentationService) { 15 | const info = {}; 16 | const indices = new Set(); 17 | 18 | const segmentations = segmentationService.getSegmentations(); 19 | if (segmentations && Object.keys(segmentations).length > 0) { 20 | const segmentation = segmentations['0']; 21 | const { segments } = segmentation.config; 22 | for (const segmentIndex of Object.keys(segments)) { 23 | const segment = segments[segmentIndex]; 24 | info[segment.label] = { 25 | segmentIndex: segment.segmentIndex, 26 | color: segment.color, 27 | }; 28 | indices.add(segment.segmentIndex); 29 | } 30 | } 31 | return { info, indices }; 32 | } 33 | 34 | export { currentSegmentsInfo }; 35 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/utils/SegmentationReader.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | import nrrd from 'nrrd-js'; 15 | import pako from 'pako'; 16 | 17 | export default class SegmentationReader { 18 | static parseNrrdData(data) { 19 | let nrrdfile = nrrd.parse(data); 20 | 21 | // Currently gzip is not supported in nrrd.js 22 | if (nrrdfile.encoding === 'gzip') { 23 | const buffer = pako.inflate(nrrdfile.buffer).buffer; 24 | 25 | nrrdfile.encoding = 'raw'; 26 | nrrdfile.data = new Uint16Array(buffer); 27 | nrrdfile.buffer = buffer; 28 | } 29 | 30 | const image = nrrdfile.buffer; 31 | const header = nrrdfile; 32 | delete header.data; 33 | delete header.buffer; 34 | 35 | return { 36 | header, 37 | image, 38 | }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugins/ohifv3/extensions/monai-label/src/utils/addToolInstance.ts: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | import { addTool } from '@cornerstonejs/tools'; 15 | 16 | export default function addToolInstance( 17 | name: string, 18 | toolClass, 19 | configuration? 20 | ): void { 21 | class InstanceClass extends toolClass { 22 | static toolName = name; 23 | } 24 | 25 | addTool(InstanceClass); 26 | } 27 | -------------------------------------------------------------------------------- /plugins/ohifv3/images/ohifv3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/ohifv3/images/ohifv3.jpg -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "printWidth": 80, 4 | "proseWrap": "always", 5 | "tabWidth": 2, 6 | "semi": true, 7 | "singleQuote": true 8 | } 9 | -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/.webpack/webpack.prod.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const { merge } = require('webpack-merge'); 3 | const path = require('path'); 4 | const MiniCssExtractPlugin = require('mini-css-extract-plugin'); 5 | 6 | const pkg = require('./../package.json'); 7 | const webpackCommon = require('./../../../.webpack/webpack.base.js'); 8 | 9 | const ROOT_DIR = path.join(__dirname, './../'); 10 | const SRC_DIR = path.join(__dirname, '../src'); 11 | const DIST_DIR = path.join(__dirname, '../dist'); 12 | 13 | const ENTRY = { 14 | app: `${SRC_DIR}/index.ts`, 15 | }; 16 | 17 | module.exports = (env, argv) => { 18 | const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY }); 19 | 20 | return merge(commonConfig, { 21 | stats: { 22 | colors: true, 23 | hash: true, 24 | timings: true, 25 | assets: true, 26 | chunks: false, 27 | chunkModules: false, 28 | modules: false, 29 | children: false, 30 | warnings: true, 31 | }, 32 | optimization: { 33 | minimize: true, 34 | sideEffects: false, 35 | }, 36 | output: { 37 | path: ROOT_DIR, 38 | library: 'ohif-mode-monai-label', 39 | libraryTarget: 'umd', 40 | libraryExport: 'default', 41 | filename: pkg.main, 42 | }, 43 | externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/], 44 | plugins: [ 45 | new webpack.optimize.LimitChunkCountPlugin({ 46 | maxChunks: 1, 47 | }), 48 | // new MiniCssExtractPlugin({ 49 | // filename: './dist/[name].css', 50 | // chunkFilename: './dist/[id].css', 51 | // }), 52 | ], 53 | }); 54 | }; 55 | -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 mode-monai-label (adiazpinto@nvidia.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/README.md: -------------------------------------------------------------------------------- 1 | # mode-monai-label 2 | ## Description 3 | OHIFv3 mode for MONAI Label 4 | ## Author 5 | OHIF,NVIDIA,KCL 6 | ## License 7 | MIT 8 | -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['inline-react-svg', '@babel/plugin-proposal-class-properties'], 3 | env: { 4 | test: { 5 | presets: [ 6 | [ 7 | // TODO: https://babeljs.io/blog/2019/03/19/7.4.0#migration-from-core-js-2 8 | '@babel/preset-env', 9 | { 10 | modules: 'commonjs', 11 | debug: false, 12 | }, 13 | "@babel/preset-typescript", 14 | ], 15 | '@babel/preset-react', 16 | ], 17 | plugins: [ 18 | '@babel/plugin-proposal-object-rest-spread', 19 | '@babel/plugin-syntax-dynamic-import', 20 | '@babel/plugin-transform-regenerator', 21 | '@babel/plugin-transform-runtime', 22 | ], 23 | }, 24 | production: { 25 | presets: [ 26 | // WebPack handles ES6 --> Target Syntax 27 | ['@babel/preset-env', { modules: false }], 28 | '@babel/preset-react', 29 | "@babel/preset-typescript", 30 | ], 31 | ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'], 32 | }, 33 | development: { 34 | presets: [ 35 | // WebPack handles ES6 --> Target Syntax 36 | ['@babel/preset-env', { modules: false }], 37 | '@babel/preset-react', 38 | "@babel/preset-typescript", 39 | ], 40 | plugins: ['react-hot-loader/babel'], 41 | ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'], 42 | }, 43 | }, 44 | }; 45 | -------------------------------------------------------------------------------- /plugins/ohifv3/modes/monai-label/src/id.js: -------------------------------------------------------------------------------- 1 | import packageJson from '../package.json'; 2 | 3 | const id = packageJson.name; 4 | 5 | export { id }; 6 | -------------------------------------------------------------------------------- /plugins/ohifv3/requirements.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | if which yarn >/dev/null; then 15 | echo "node/yarn is already installed" 16 | else 17 | echo "installing yarn..." 18 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - 19 | echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list 20 | apt update 21 | apt-get install yarn -y 22 | fi 23 | 24 | if which nginx >/dev/null; then 25 | echo "nginx is already installed" 26 | else 27 | apt-get install nginx -y 28 | fi 29 | -------------------------------------------------------------------------------- /plugins/ohifv3/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) MONAI Consortium 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | mkdir -p logs 15 | 16 | rm -rf www 17 | mkdir -p www/html 18 | 19 | cp -r ../../monailabel/endpoints/static/ohif www/html/ohif 20 | cp -f config/monai_label.js www/html/ohif/app-config.js 21 | 22 | nginx -p `pwd` -c config/nginx.conf -e logs/error.log 23 | -------------------------------------------------------------------------------- /plugins/qupath/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | # Javadocs 13 | docs/ 14 | 15 | # Maven 16 | deploy/ 17 | target/ 18 | log/ 19 | 20 | # IntelliJ 21 | .idea/ 22 | *.iml 23 | out/ 24 | 25 | # Gradle 26 | # Use local properties (e.g. to set a specific JDK) 27 | gradle.properties 28 | build/ 29 | .gradle/ 30 | gradle.properties 31 | 32 | # Eclipse 33 | .settings/ 34 | .project 35 | .classpath 36 | 37 | # Mac 38 | .DS_Store 39 | 40 | # Java 41 | hs_err*.log 42 | 43 | # Other 44 | *.tmp 45 | *.bak 46 | *.swp 47 | *~.nib 48 | *thumbs.db 49 | bin/ 50 | -------------------------------------------------------------------------------- /plugins/qupath/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | ## Version 0.3.1 15 | 16 | - Bring your own image (not required be shared/located with MONAI Label) 17 | - Region/ROI based annotation 18 | - Save/Submit ROI + annotation to server 19 | - Submit multiple patches per image 20 | - Accelerator Keys for MONAILabel actions 21 | - Enhanced Training Options 22 | - Enhance Toolbar Options to directly run segmentation/interaction models 23 | - Option to Fetch Next Sample/Patch (Active Learning) 24 | 25 | ## Version 0.3.0 26 | 27 | - Auto Segmentation (DeepEdit/Segmentation models) 28 | - Interactive Segmentation (DeepEdit/NuClick models) 29 | - Submit Label 30 | - Train model 31 | -------------------------------------------------------------------------------- /plugins/qupath/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-library' 3 | id 'com.github.johnrengelman.shadow' version '7.0.0' 4 | id 'org.bytedeco.gradle-javacpp-platform' version '1.5.6' 5 | } 6 | 7 | ext.moduleName = 'qupath.extension.monailabel' 8 | archivesBaseName = 'qupath-extension-monailabel' 9 | description = "QuPath extension for MONAILabel" 10 | version = "0.3.1" 11 | 12 | repositories { 13 | mavenCentral() 14 | 15 | maven { 16 | url "https://maven.scijava.org/content/repositories/releases" 17 | } 18 | 19 | maven { 20 | url "https://maven.scijava.org/content/repositories/snapshots" 21 | } 22 | 23 | } 24 | 25 | dependencies { 26 | shadow "io.github.qupath:qupath-gui-fx:0.3.0" 27 | shadow "org.slf4j:slf4j-api:1.7.30" 28 | implementation "com.google.code.gson:gson:2.10" 29 | } 30 | 31 | tasks.register("copyDependencies", Copy) { 32 | description "Copy dependencies into the output libs directory" 33 | group "QuPath" 34 | 35 | from configurations.default 36 | into 'build/libs' 37 | } 38 | 39 | java { 40 | def version = project.findProperty('toolchain') 41 | if (!version) 42 | version = 11 43 | else if (version.strip() == 'skip') 44 | version = null 45 | if (version != null) { 46 | logger.quiet("Setting toolchain to {}", version) 47 | toolchain { 48 | languageVersion = JavaLanguageVersion.of(version) 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /plugins/qupath/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'qupath-extension-monailabel' 2 | -------------------------------------------------------------------------------- /plugins/qupath/src/main/java/qupath/lib/extension/monailabel/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) MONAI Consortium 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | package qupath.lib.extension.monailabel; 15 | -------------------------------------------------------------------------------- /plugins/qupath/src/main/java/qupath/module-info.java.bkp: -------------------------------------------------------------------------------- 1 | module qupath.extension.monailabel { 2 | 3 | requires java.base; 4 | requires java.desktop; 5 | 6 | requires qupath.gui.fx; 7 | 8 | requires slf4j.api; 9 | 10 | provides qupath.lib.gui.extensions.QuPathExtension with 11 | qupath.lib.extension.monailabel.Extension; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /plugins/qupath/src/main/resources/META-INF/services/qupath.lib.gui.extensions.QuPathExtension: -------------------------------------------------------------------------------- 1 | qupath.lib.extension.monailabel.Extension 2 | -------------------------------------------------------------------------------- /plugins/qupath/src/main/resources/MONAI-Label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/qupath/src/main/resources/MONAI-Label.png -------------------------------------------------------------------------------- /plugins/qupath/src/main/resources/VERSION: -------------------------------------------------------------------------------- 1 | 0.4.0-SNAPSHOT 2 | -------------------------------------------------------------------------------- /plugins/qupath/src/test/java/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/qupath/src/test/java/.gitkeep -------------------------------------------------------------------------------- /plugins/slicer/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /plugins/slicer/MONAI-Label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAI-Label.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/MONAILabelLib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .client import * 13 | from .labelcolors import * 14 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/MONAILabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/MONAILabel.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/bg_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/bg_red.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/download.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/eraser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/eraser.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/fg_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/fg_green.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/gray.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/paint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/paint.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/refresh-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/refresh-icon.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/save.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/segment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/segment.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/stop.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/training.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Resources/Icons/training.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Resources/Icons/upload.svg: -------------------------------------------------------------------------------- 1 | Upload 2 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Screenshots/1.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Screenshots/2.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabel/Screenshots/3.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | add_subdirectory(Python) 13 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabel/Testing/Python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | 13 | #slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py) 14 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/MONAILabelReviewerLib/MONAILabelReviewerEnum.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | 13 | class SegStatus: 14 | def __init__(self): 15 | self.NOT_SEGMENTED = "not segmented" 16 | self.APPROVED = "approved" 17 | self.SEGMENTED = "segmented" 18 | self.FLAGGED = "flagged" 19 | 20 | 21 | class Level: 22 | def __init__(self): 23 | self.EASY = "easy" 24 | self.MEDIUM = "medium" 25 | self.HARD = "hard" 26 | 27 | 28 | class Label: 29 | def __init__(self): 30 | self.ORIGINAL = "original" 31 | self.FINAL = "final" 32 | self.VERSION = "version" 33 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/MONAILabelReviewerLib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .DataStoreKeys import DataStoreKeys 13 | from .ImageData import ImageData 14 | from .ImageDataController import ImageDataController 15 | from .ImageDataExtractor import ImageDataExtractor 16 | from .JsonParser import JsonParser 17 | from .MONAILabelReviewerEnum import * 18 | from .MonaiServerREST import MonaiServerREST 19 | from .SegmentationMeta import SegmentationMeta 20 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_1.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_2.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_3.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_4.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/ReadMeImages/MONAILabelReviewerEditorTools_5.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/Resources/Icons/MONAILabelReviewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/MONAILabel/d8896864ca1264e25016f52bd1bf72e579e8134c/plugins/slicer/MONAILabelReviewer/Resources/Icons/MONAILabelReviewer.png -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/Testing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | add_subdirectory(Python) 13 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/Testing/Python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | 13 | #slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py) 14 | -------------------------------------------------------------------------------- /plugins/slicer/MONAILabelReviewer/UnitTests/TestDataSet/test_datastore_v2_image_without_segmentation.json: -------------------------------------------------------------------------------- 1 | { 2 | "image": { 3 | "ext": ".dcm", 4 | "info": { 5 | "ts": 1642170799, 6 | "checksum": "SHA256:f1f8ef13433b1f0966e589818f3180750606eff69b3bc4a55e0181d7a9da8da1", 7 | "name": "6245968.dcm", 8 | "strategy": { 9 | "Random": { 10 | "ts": 1642371057, 11 | "client_id": "Dr Radiologist" 12 | } 13 | } 14 | } 15 | }, 16 | "labels": { 17 | "original": { 18 | "ext": ".seg.nrrd", 19 | "info": { 20 | "label_names": [ 21 | "Background", 22 | "Mediastinum", 23 | "Lung", 24 | "Heart", 25 | "Trachea", 26 | "Clavicle" 27 | ], 28 | "ts": 1642371078, 29 | "checksum": "SHA256:18f67b39871c68c7d62292b0b8bbec97dafeee66c607cf823d67303b8a59c953", 30 | "name": "6245968.seg.nrrd" 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | [build-system] 13 | requires = [ 14 | "wheel", 15 | "setuptools", 16 | "torch>=1.7", 17 | "ninja", 18 | ] 19 | 20 | [tool.black] 21 | line-length = 120 22 | target-version = ['py36', 'py37', 'py38'] 23 | include = '\.pyi?$' 24 | exclude = ''' 25 | ( 26 | /( 27 | # exclude a few common directories in the root of the project 28 | \.eggs 29 | | \.git 30 | | \.hg 31 | | \.mypy_cache 32 | | \.tox 33 | | \.venv 34 | | \.pytype 35 | | _build 36 | | buck-out 37 | | build 38 | | dist 39 | | plugins/ohif 40 | )/ 41 | # also separately exclude a file named versioneer.py 42 | | monailabel/_version.py 43 | | plugins/ohif 44 | ) 45 | ''' 46 | 47 | [tool.pytest.ini_options] 48 | log_cli = true 49 | log_cli_level = "INFO" 50 | log_cli_format = "[%(threadName)s] [%(levelname)s] (%(name)s:%(lineno)d) %(message)s" 51 | 52 | #log_file = "pytest.log" 53 | #log_file_level = "INFO" 54 | #log_file_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" 55 | #log_file_date_format = "%Y-%m-%d %H:%M:%S" 56 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | # Full requirements for developments 13 | -r requirements.txt 14 | setuptools 15 | pybind11 16 | flake8 17 | pytest 18 | pytest-xdist 19 | pytest-cov 20 | flake8-bugbear 21 | flake8-comprehensions 22 | flake8-executable 23 | flake8-pyi 24 | mccabe 25 | pep8-naming 26 | pycodestyle 27 | pyflakes 28 | black 29 | isort 30 | pytype; sys_platform != 'win32' 31 | mypy 32 | parameterized 33 | types-PyYAML 34 | types-filelock 35 | types-requests 36 | types-cachetools 37 | click>=8.1.2 38 | testresources 39 | pre-commit 40 | attrs>=22.1.0 41 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/configs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/infers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .deepedit import DeepEdit 13 | from .inbody import InBody 14 | from .tooltracking import ToolTracking 15 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/infers/inbody.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | from typing import Any, Dict 14 | 15 | from monailabel.interfaces.tasks.infer_v2 import InferType 16 | from monailabel.tasks.infer.bundle import BundleInferTask 17 | 18 | logger = logging.getLogger(__name__) 19 | 20 | 21 | class InBody(BundleInferTask): 22 | """ 23 | This provides Inference Engine for pre-trained classification model for InBody/OutBody. 24 | """ 25 | 26 | def __init__(self, path: str, conf: Dict[str, str], **kwargs): 27 | super().__init__(path, conf, type=InferType.CLASSIFICATION, add_post_restore=False, load_strict=False, **kwargs) 28 | 29 | # Override Labels 30 | self.labels = {"InBody": 0, "OutBody": 1} 31 | 32 | def info(self) -> Dict[str, Any]: 33 | d = super().info() 34 | d["endoscopy"] = True 35 | return d 36 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/scoring/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .cvat import CVATEpistemicScoring 13 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .deepedit import DeepEdit 13 | from .inbody import InBody 14 | from .tooltracking import ToolTracking 15 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/trainers/tooltracking.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | from typing import Dict, Optional 14 | 15 | from monailabel.tasks.train.bundle import BundleConstants, BundleTrainTask 16 | 17 | logger = logging.getLogger(__name__) 18 | 19 | 20 | class ToolTracking(BundleTrainTask): 21 | def __init__(self, path: str, conf: Dict[str, str], const: Optional[BundleConstants] = None): 22 | super().__init__(path, conf, const, enable_tracking=True) 23 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/lib/transforms.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | 14 | import torch 15 | from monai.config import KeysCollection 16 | from monai.transforms import MapTransform 17 | 18 | logger = logging.getLogger(__name__) 19 | 20 | 21 | class LabelToBinaryClassd(MapTransform): 22 | def __init__(self, keys: KeysCollection, allow_missing_keys: bool = False, offset=2) -> None: 23 | super().__init__(keys, allow_missing_keys) 24 | self.offset = offset 25 | 26 | def __call__(self, data): 27 | d = dict(data) 28 | for key in self.keys: 29 | label = int(torch.max(d[key])) 30 | d[key] = label - self.offset if label else 0 31 | return d 32 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/model/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | * 13 | -------------------------------------------------------------------------------- /sample-apps/endoscopy/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/lib/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/lib/infers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/lib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/model/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | * 13 | -------------------------------------------------------------------------------- /sample-apps/monaibundle/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/pathology/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/pathology/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import ctypes.util 13 | import platform 14 | from ctypes import cdll 15 | 16 | # For windows (preload openslide dll using file_library) https://github.com/openslide/openslide-python/pull/151 17 | if platform.system() == "Windows": 18 | cdll.LoadLibrary(str(ctypes.util.find_library("libopenslide-0.dll"))) 19 | -------------------------------------------------------------------------------- /sample-apps/pathology/lib/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .random import WSIRandom 13 | -------------------------------------------------------------------------------- /sample-apps/pathology/lib/configs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/pathology/lib/infers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .classification_nuclei import ClassificationNuclei 13 | from .hovernet_nuclei import HovernetNuclei 14 | from .nuclick import NuClick 15 | from .segmentation_nuclei import SegmentationNuclei 16 | -------------------------------------------------------------------------------- /sample-apps/pathology/lib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .classification_nuclei import ClassificationNuclei 13 | from .hovernet_nuclei import HovernetNuclei 14 | from .nuclick import NuClick 15 | from .segmentation_nuclei import SegmentationNuclei 16 | -------------------------------------------------------------------------------- /sample-apps/pathology/model/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | * 13 | -------------------------------------------------------------------------------- /sample-apps/pathology/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/radiology/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .last import Last 13 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/activelearning/last.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import logging 13 | 14 | from monailabel.interfaces.datastore import Datastore 15 | from monailabel.interfaces.tasks.strategy import Strategy 16 | 17 | logger = logging.getLogger(__name__) 18 | 19 | 20 | class Last(Strategy): 21 | """ 22 | Consider implementing a first strategy for active learning 23 | """ 24 | 25 | def __init__(self): 26 | super().__init__("Get Last Sample") 27 | 28 | def __call__(self, request, datastore: Datastore): 29 | images = datastore.get_unlabeled_images() 30 | if not len(images): 31 | return None 32 | 33 | images.sort() 34 | image = images[-1] 35 | 36 | logger.info(f"First: Selected Image: {image}") 37 | return {"id": image} 38 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/configs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/infers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .deepedit import DeepEdit 13 | from .deepgrow import Deepgrow 14 | from .localization_spine import LocalizationSpine 15 | from .localization_vertebra import LocalizationVertebra 16 | from .segmentation import Segmentation 17 | from .segmentation_spleen import SegmentationSpleen 18 | from .segmentation_vertebra import SegmentationVertebra 19 | from .sw_fastedit import SWFastEdit 20 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .deepedit import DeepEdit 13 | from .deepgrow import Deepgrow 14 | from .localization_spine import LocalizationSpine 15 | from .localization_vertebra import LocalizationVertebra 16 | from .segmentation import Segmentation 17 | from .segmentation_spleen import SegmentationSpleen 18 | from .segmentation_vertebra import SegmentationVertebra 19 | -------------------------------------------------------------------------------- /sample-apps/radiology/lib/transforms/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/radiology/model/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | * 13 | -------------------------------------------------------------------------------- /sample-apps/radiology/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/vista2d/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/vista2d/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/vista2d/lib/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/vista2d/lib/infers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | from .vista2d import VISTA2DInfer 13 | -------------------------------------------------------------------------------- /sample-apps/vista2d/lib/infers/vista2d.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | from typing import Any, Dict, Tuple 4 | 5 | from monai.utils import ImageMetaKey 6 | 7 | from monailabel.tasks.infer.bundle import BundleInferTask 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | class VISTA2DInfer(BundleInferTask): 13 | """ 14 | This provides Inference Engine for pre-trained VISTA segmentation model. 15 | """ 16 | 17 | def writer(self, data: Dict[str, Any], extension=None, dtype=None) -> Tuple[Any, Any]: 18 | d = dict(data) 19 | output_dir = self.bundle_config.get_parsed_content("output_dir", instantiate=True) 20 | output_ext = self.bundle_config.get_parsed_content("output_ext", instantiate=True) 21 | image_key = self.bundle_config.get_parsed_content("image_key", instantiate=True) 22 | output_postfix = self.bundle_config.get_parsed_content("output_postfix", instantiate=True) 23 | 24 | img = d.get(image_key, None) 25 | filename = img.meta.get(ImageMetaKey.FILENAME_OR_OBJ) if img is not None else None 26 | basename = os.path.splitext(os.path.basename(filename))[0] if filename else "mask" 27 | output_filename = f"{basename}{'_' + output_postfix if output_postfix else ''}{output_ext}" 28 | output_filepath = os.path.join(output_dir, output_filename) 29 | if os.path.exists(output_filepath): 30 | logger.info(f"Reusing the bundle output {output_filepath}.") 31 | return output_filepath, {} 32 | else: 33 | return super().writer(data=data, extension=extension, dtype=dtype) 34 | -------------------------------------------------------------------------------- /sample-apps/vista2d/lib/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /sample-apps/vista2d/requirements.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License Version 2.0 (the License); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing software 7 | # distributed under the License is distributed on an AS IS BASIS 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | cellpose==3.0.8 12 | natsort==8.4.0 13 | roifile==2024.5.24 14 | fastremap==1.15.0 15 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/integration/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import os 13 | 14 | SERVER_URI = f"http://127.0.0.1:{os.getenv('MONAILABEL_SERVER_PORT', '8000')}" 15 | -------------------------------------------------------------------------------- /tests/integration/endoscopy/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/integration/monaibundle/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/integration/monaibundle/detection/test_infer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | import unittest 12 | 13 | import requests 14 | import torch 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointInfer(unittest.TestCase): 20 | def test_lung_nodule_detection(self): 21 | if not torch.cuda.is_available(): 22 | return 23 | 24 | model = "lung_nodule_ct_detection" 25 | image = "1.3.6.1.4.1.14519.5.2.1.6279.6001.188385286346390202873004762827" 26 | 27 | response = requests.post(f"{SERVER_URI}/infer/{model}?image={image}") 28 | assert response.status_code == 200 29 | 30 | 31 | if __name__ == "__main__": 32 | unittest.main() 33 | -------------------------------------------------------------------------------- /tests/integration/monaibundle/detection/test_trainer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | import unittest 12 | 13 | import requests 14 | import torch 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointSession(unittest.TestCase): 20 | def test_lung_nodule_detection(self): 21 | if not torch.cuda.is_available(): 22 | return 23 | 24 | params = { 25 | "model": "lung_nodule_ct_detection", 26 | "max_epochs": 1, 27 | "name": "net_test_lung_nodule_detection_trainer_01", 28 | "val_split": 0.5, 29 | "multi_gpu": False, 30 | } 31 | response = requests.post(f"{SERVER_URI}/train/lung_nodule_ct_detection?run_sync=True", json=params) 32 | assert response.status_code == 200 33 | 34 | 35 | if __name__ == "__main__": 36 | unittest.main() 37 | -------------------------------------------------------------------------------- /tests/integration/pathology/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/integration/pathology/test_info.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | import requests 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointInfo(unittest.TestCase): 20 | def test_info(self): 21 | response = requests.get(f"{SERVER_URI}/info/") 22 | assert response.status_code == 200 23 | 24 | # check if following fields exist in the response 25 | res = response.json() 26 | for f in ["version", "name", "labels"]: 27 | assert res[f] 28 | 29 | 30 | if __name__ == "__main__": 31 | unittest.main() 32 | -------------------------------------------------------------------------------- /tests/integration/radiology/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/integration/radiology/test_batch_infer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | import unittest 12 | 13 | import requests 14 | import torch 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointBatchInfer(unittest.TestCase): 20 | def test_batch_segmentation_spleen(self): 21 | if not torch.cuda.is_available(): 22 | return 23 | 24 | model = "segmentation_spleen" 25 | params = { 26 | "device": "cuda", 27 | "multi_gpu": True, 28 | "gpus": "all", 29 | "logging": "WARNING", 30 | "save_label": True, 31 | "label_tag": "original", 32 | "max_workers": 0, 33 | "max_batch_size": 3, 34 | } 35 | 36 | response = requests.post(f"{SERVER_URI}/batch/infer/{model}?images=all&run_sync=true", json=params) 37 | assert response.status_code == 200 38 | 39 | 40 | if __name__ == "__main__": 41 | unittest.main() 42 | -------------------------------------------------------------------------------- /tests/integration/radiology/test_info.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | import requests 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointInfo(unittest.TestCase): 20 | def test_info(self): 21 | response = requests.get(f"{SERVER_URI}/info/") 22 | assert response.status_code == 200 23 | 24 | # check if following fields exist in the response 25 | res = response.json() 26 | for f in ["version", "name", "labels"]: 27 | assert res[f] 28 | 29 | 30 | if __name__ == "__main__": 31 | unittest.main() 32 | -------------------------------------------------------------------------------- /tests/integration/radiology/test_session.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | import os 12 | import unittest 13 | 14 | import requests 15 | 16 | from tests.integration import SERVER_URI 17 | 18 | 19 | class EndPointSession(unittest.TestCase): 20 | def test_session(self): 21 | studies = "tests/data/dataset/local/spleen" 22 | files = [("files", ("spleen_3.nii.gz", open(os.path.join(studies, "spleen_3.nii.gz"), "rb")))] 23 | 24 | response = requests.put(f"{SERVER_URI}/session/?expiry=600", files=files) 25 | assert response.status_code == 200 26 | 27 | r = response.json() 28 | session_id = r["session_id"] 29 | session_info = r["session_info"] 30 | 31 | assert session_id 32 | assert session_info 33 | 34 | response = requests.get(f"{SERVER_URI}/session/{session_id}") 35 | assert response.status_code == 200 36 | 37 | 38 | if __name__ == "__main__": 39 | unittest.main() 40 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | # pytest -v --no-summary test_infer.py --log-cli-level=INFO 13 | -------------------------------------------------------------------------------- /tests/unit/activelearning/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/client/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/datastore/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/deepedit/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/endpoints/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_activelearning.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | from .context import BasicEndpointTestSuite 15 | 16 | 17 | class EndPointActiveLearning(BasicEndpointTestSuite): 18 | def test_strategy_random(self): 19 | response = self.client.post("/activelearning/random") 20 | assert response.status_code == 200 21 | 22 | # check if following fields exist in the response 23 | res = response.json() 24 | for f in ["id", "name"]: 25 | assert res[f] 26 | 27 | def test_strategy_first(self): 28 | response = self.client.post("/activelearning/first") 29 | assert response.status_code == 200 30 | 31 | # check if following fields exist in the response 32 | res = response.json() 33 | for f in ["id", "name"]: 34 | assert res[f] 35 | 36 | 37 | if __name__ == "__main__": 38 | unittest.main() 39 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_batch_infer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | import torch 15 | 16 | from .context import BasicEndpointTestSuite 17 | 18 | 19 | class EndPointScoring(BasicEndpointTestSuite): 20 | def test_001_batch_infer(self): 21 | if not torch.cuda.is_available(): 22 | return 23 | 24 | model = "deepedit_seg" 25 | images = "labeled" 26 | response = self.client.post(f"/batch/infer/{model}?images={images}&run_sync=true") 27 | assert response.status_code == 200 28 | 29 | def test_002_status(self): 30 | self.client.get("/batch/infer/") 31 | 32 | def test_003_stop(self): 33 | self.client.delete("/batch/infer/") 34 | 35 | def test_004_batch_infer(self): 36 | if not torch.cuda.is_available(): 37 | return 38 | 39 | model = "deepedit_seg" 40 | images = "all" 41 | params = {"max_workers": 2} 42 | response = self.client.post(f"/batch/infer/{model}?images={images}&run_sync=true", json=params) 43 | assert response.status_code == 200 44 | 45 | 46 | if __name__ == "__main__": 47 | unittest.main() 48 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_info.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | from .context import BasicEndpointTestSuite 15 | 16 | 17 | class EndPointInfo(BasicEndpointTestSuite): 18 | def test_info(self): 19 | response = self.client.get("/info/") 20 | assert response.status_code == 200 21 | 22 | # check if following fields exist in the response 23 | res = response.json() 24 | for f in ["version", "name", "labels"]: 25 | assert res[f] 26 | 27 | 28 | if __name__ == "__main__": 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_logs.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | import torch 15 | 16 | from .context import BasicEndpointTestSuite 17 | 18 | 19 | class TestEndPointLogs(BasicEndpointTestSuite): 20 | def test_logs(self): 21 | response = self.client.get("/logs/") 22 | assert response.status_code == 200 23 | 24 | def test_logs_all(self): 25 | response = self.client.get("/logs/?lines=0") 26 | assert response.status_code == 200 27 | 28 | def test_logs_gpu(self): 29 | if not torch.cuda.is_available(): 30 | return 31 | 32 | response = self.client.get("/logs/gpu") 33 | assert response.status_code == 200 34 | 35 | 36 | if __name__ == "__main__": 37 | unittest.main() 38 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_model.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import time 13 | import unittest 14 | 15 | from .context import BasicEndpointTestSuite 16 | 17 | 18 | class EndPointModel(BasicEndpointTestSuite): 19 | def test_info(self): 20 | model = "deepedit" 21 | 22 | response = self.client.get(f"/model/info/{model}") 23 | assert response.status_code == 200 24 | 25 | def test_download(self): 26 | model = "deepedit" 27 | 28 | response = self.client.get(f"/model/{model}") 29 | assert response.status_code == 200 30 | time.sleep(1) 31 | 32 | 33 | if __name__ == "__main__": 34 | unittest.main() 35 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_ohif.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | from .context import BasicEndpointTestSuite 15 | 16 | 17 | class TestEndPointLogs(BasicEndpointTestSuite): 18 | def test_ohif(self): 19 | response = self.client.get("/ohif/") 20 | assert response.status_code == 404 21 | 22 | 23 | if __name__ == "__main__": 24 | unittest.main() 25 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_proxy.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | import unittest 12 | from types import SimpleNamespace 13 | from unittest.mock import patch 14 | 15 | from .context import BasicEndpointTestSuite 16 | 17 | 18 | class RawData: 19 | def read(self): 20 | return b"xyz" 21 | 22 | 23 | def mocked_requests_get(*args, **kwargs): 24 | return SimpleNamespace(content=b"xyz", raw=RawData(), status_code=400, headers={}) 25 | 26 | 27 | @patch("requests.get", side_effect=mocked_requests_get) 28 | class TestEndPointLogs(BasicEndpointTestSuite): 29 | def test_proxy(self, mock_get): 30 | self.client.get("/proxy/dicom/studies") 31 | 32 | 33 | if __name__ == "__main__": 34 | unittest.main() 35 | -------------------------------------------------------------------------------- /tests/unit/endpoints/test_scoring_v2.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import time 13 | import unittest 14 | 15 | import torch 16 | 17 | from .context import BasicBundleV2TestSuite 18 | 19 | 20 | class EndPointBundleScoring(BasicBundleV2TestSuite): 21 | # test epistemic_v2 22 | # TODO:: Enable the test 23 | def x_test_bundle_epistemic(self): 24 | if not torch.cuda.is_available(): 25 | return 26 | 27 | response = self.client.post("/scoring/spleen_ct_segmentation?run_sync=true") 28 | assert response.status_code == 200 29 | time.sleep(1) 30 | 31 | def test_status(self): 32 | self.client.get("/scoring/") 33 | time.sleep(1) 34 | 35 | def test_stop(self): 36 | self.client.delete("/scoring/") 37 | time.sleep(1) 38 | 39 | 40 | if __name__ == "__main__": 41 | unittest.main() 42 | -------------------------------------------------------------------------------- /tests/unit/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/interfaces/test_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import unittest 13 | 14 | import numpy as np 15 | from monai.transforms.utility.array import Identity 16 | from parameterized import parameterized 17 | 18 | from monailabel.interfaces.utils.transform import run_transforms, shape_info 19 | 20 | SHAPE_DATA = [ 21 | {"pred": np.array([[[1, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]]]).astype(np.float32)}, 22 | ["pred"], 23 | "pred: (1, 3, 4)(float32)", 24 | ] 25 | 26 | TRANSFORM_DATA = [{"pred": np.array([[[1, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]]]).astype(np.float32)}, [Identity()]] 27 | 28 | 29 | class TestTransformUtils(unittest.TestCase): 30 | @parameterized.expand([SHAPE_DATA]) 31 | def test_shape_info(self, data, keys, expected_output): 32 | res = shape_info(data, keys) 33 | self.assertEqual(res, expected_output) 34 | 35 | @parameterized.expand([TRANSFORM_DATA]) 36 | def test_run_transforms(self, data, callables): 37 | res = run_transforms(data, callables) 38 | np.testing.assert_equal(res, data) 39 | 40 | 41 | if __name__ == "__main__": 42 | unittest.main() 43 | -------------------------------------------------------------------------------- /tests/unit/scribbles/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/transform/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | -------------------------------------------------------------------------------- /tests/unit/utils/test_sessions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) MONAI Consortium 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # Unless required by applicable law or agreed to in writing, software 7 | # distributed under the License is distributed on an "AS IS" BASIS, 8 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9 | # See the License for the specific language governing permissions and 10 | # limitations under the License. 11 | 12 | import os 13 | import time 14 | import unittest 15 | 16 | from monailabel.utils.sessions import Sessions 17 | 18 | 19 | class MyTestCase(unittest.TestCase): 20 | base_dir = os.path.realpath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))) 21 | data_dir = os.path.join(base_dir, "tests", "data") 22 | download_dir = os.path.join(base_dir, "tests", "downloads") 23 | 24 | def test_auto_expiry(self): 25 | sessions = Sessions(os.path.join(self.data_dir, "sessions")) 26 | count = len(sessions) 27 | 28 | session = sessions.add_session(os.path.join(self.download_dir, "dataset.zip"), uncompress=True, expiry=1) 29 | assert session 30 | 31 | time.sleep(2) 32 | sessions.remove_expired() 33 | assert len(sessions) == count 34 | 35 | 36 | if __name__ == "__main__": 37 | unittest.main() 38 | --------------------------------------------------------------------------------