Skip to content

QMENTA/qmenta-sdk-tool-maker-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 

Repository files navigation

QMENTA SDK Tool maker Example

This is an example a tool that can be created with the new Qmenta tool maker. Clone this repository to adapt the Dockerfile and tool script and rapidly build QMENTA tools. It contains a simple example with all the required files to build and test the tool. If you want to know more about how to use the SDK and all its features, take a look at the documentation.

In order to add tools to the QMENTA platform you need to have developer privileges. If you are interested in this feature, please contact us at info@qmenta.com.

We recommend to use the latest QMENTA SDK Lib version, please check the QMENTA Python SDK Release history

Here you can find an example of:

  • Template tool: What is created by the Tool Maker automatically (we recommend to use the latest QMENTA SDK Lib version)
  • SDK Tool maker example: Example with report PDF.
  • Simple tool 1: Tool example with parameters.

Contents

Dockerfile

This file contains the sequence of instructions to build a new tool image. You can setup environment paths, run commands during the image building stage and copy files (see Dockerfile commands).

Tool script

The main script that is executed when a tool is launched on the QMENTA platform. This script typically performs the actions shown below using the QMENTA SDK functions where suitable:

  1. Download the input data to the container.
  2. Process it (call any third party tool).
  3. Upload the results.

The naive example shown in this repository computes the histogram for a range of intensities in a T1-weighted image. The range of intensities can be specified from outside the tool thanks to the tool settings specification.

Feel free to contact us if you have any doubt or request at sdk@qmenta.com! We are happy to hear from you and expand the capabilities of the platform to fit new useful requirements.

Report template

This tool code uses this HTML template to populate some fields with the patient data and the analysis results to generate a PDF report.

Local test folder

This folder includes the files to test the tool locally before creating the docker and adding it to the platform. For testing modify the /local/test/test_tool.py, add your data in the /local/test/sample_data.

To run the local testing, move to the repository main where the folder called local_tools/ is located.

For instance, if you have this path: /home/user/dev/qmenta-sdk-tool-maker-example/local_tools/tool_id run the following:

cd /home/user/dev/qmenta-sdk-tool-maker-example/
pytest /home/user/dev/qmenta-sdk-tool-maker-example/local_tools/tool_id/local/test/test_tool.py::TestTool::test_basic_call

More information about local testing can be found in the SDK Documentation

Running the test with Docker

You need an account and a repository in Docker to build a new image using the Dockerfile. Make sure the service is started and login to Docker:

sudo systemctl start docker
docker login

Then you can run the local test. The input and output folders of the local test are going to be reused because the tests have the same name (test_basic_call()). If you want to have a separated folder, create the folder structure and use a different method name. Run the test as previously:

pytest /home/user/dev/qmenta-sdk-tool-maker-example/local_tools/tool_id/local/test/test_tool.py::TestToolDocker::test_basic_call

If everything ran correctly, the docker image should be created. Check it by using the command docker images. Apply proper tagging to the docker image and push it to your repository:

docker tag tool_id:1.0 my_docker_user/tool_id:1.0
docker push my_docker_user/tool_id:1.0

More information about Docker local testing can be found in the SDK Documentation

Add the tool to the QMENTA platform

More information about adding a tool to the QMENTA Platform can be found in the SDK Documentation

About

QMENTA Tool created using SDK's Tool Maker and ready to be integrated and executed in the QMENTA system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors