imgnet CLI#
imgnet#
IMGNET CLI - toolkit for facilitating access to standardized medical imaging datasets for cancer research and clinical AI applications.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--quiet, -q |
boolean | Suppress all logging except errors, overrides verbosity options. | False |
--verbose, -v |
integer range (0 and above) |
Increase verbosity of logging, overrides environment variable. (0-3: ERROR, WARNING, INFO, DEBUG). | 0 |
--version |
boolean | Show the version and exit. | False |
-h, --help |
boolean | Show this message and exit. | False |
Subcommands
- collections: Explore datasets available in the ImgNet index.
- download: Download medical imaging data from an ImgNet query manifest.
- query: Query medical imaging datasets and save matching DICOM series metadata.
- update-index: Download and update the local ImgNet dataset index.
collections#
Explore datasets available in the ImgNet index.
Collections are indexed medical imaging datasets that can be searched, inspected, and downloaded using ImgNet commands.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
Subcommands
- info: Display detailed information about an indexed collection.
- overview: Display a visual overview of the ImgNet dataset index.
- summary: Display a summary of all indexed collections.
info#
Display detailed information about an indexed collection.
Shows metadata such as the data source, file format, image count, modalities, body regions, and collection description.
Use --tags to display the metadata fields available for filtering when building ImgNet queries.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
--tags, -t |
boolean | Show metadata fields available for querying, grouped by modality. | False |
--json |
boolean | Output collection metadata as JSON instead of a formatted table. | False |
overview#
Display a visual overview of the ImgNet dataset index.
Shows aggregate statistics across all collections, including: number of collections, total images, storage size, data sources, file formats, modality distributions, and largest collections.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
--update, -u |
boolean | Rebuild the collections summary before generating the overview. | False |
summary#
Display a summary of all indexed collections.
Shows basic information including collection size, image count, modalities, file formats, and data sources.
Use --update to rebuild the summary from the collection metadata.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
--update, -u |
boolean | Rebuild the collections summary before generating the overview. | False |
download#
Download medical imaging data from an ImgNet query manifest.
The manifest should be generated using imgnet query and contains
a list of imaging series to download from indexed datasets.
By default, downloaded files are stored in the srcdata directory
inside the output directory. Use --process to convert downloaded
DICOM files into NIfTI format using med-imagetools. Processed files
are stored in the procdata directory.
MANIFEST:
Path to a CSV manifest generated by imgnet query.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
--output-dir, -o |
directory | Directory where downloaded data will be stored. If not provided, a timestamped directory will be created in the current working directory. | None |
--process, -p |
boolean | Convert downloaded DICOM files to NIfTI format using med-imagetools. | False |
--delete-srcdata |
boolean | Delete downloaded DICOM source files after successful processing. This frees disk space but cannot be undone. | False |
query#
Query medical imaging datasets and save matching DICOM series metadata.
Searches across indexed imaging collections to find series that match your
criteria. Results are saved as a CSV file that can be piped into
imgnet download to retrieve the actual image files.
Output files in
QUERY LOGIC: All specified filters are combined with AND logic. For example, using --collection 4D-Lung --modality CT --rules "CT(PatientAge>50)" will only match CT series from the 4D-Lung collection where patient age > 50.
Rules provide the most powerful filtering and support: - Operators: ==, !=, <=, >=, <, > - Logical: AND, OR, and parentheses for grouping - Values: strings (quoted), numbers, or unquoted words
EXAMPLES: # Query all CT scans from the 4D-Lung collection imgnet query -c 4D-Lung -m CT
# Query multiple collections for MR and CT, save to custom directory imgnet query -o ./my_query -c 4D-Lung -c Adrenal-ACC-Ki67-Seg -m MR -m CT
# Find female patients over 50 with CT chest scans imgnet query -r 'CT(PatientSex=="F" AND PatientAge>50 AND StudyDescription=="CHEST")'
# Find either CT or MR studies for patients under 30 imgnet query -r 'CT(PatientAge<30) OR MR(PatientAge<30)'
# Re-run a previous query imgnet query -i ./previous_query/valid_query.json
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--help, -h |
boolean | Show this message and exit. | False |
--output-dir, -o |
directory | Directory to save query results (default: ./query_results). | None |
--input-path, -i |
file | Re-run a previous query by loading a saved valid_query.json file. | None |
--collection, -c |
text | Include only files from this dataset collection. Can be specified multiple times. Use 'all' to query every collection. | None |
--modality, -m |
text | Include only files of this imaging modality (e.g., CT, MR, RTSTRUCT, SEG). Can be specified multiple times. | None |
--file-type, -ft |
choice (dicom | nifti) |
Include only files in this format: 'dicom' or 'nifti' (default: both). | None |
--rules, -r |
text | Filter series by metadata using boolean expressions. Format: modality(condition AND/OR condition). Example: -r 'CT(PatientAge>50 AND StudyDescription!="CHEST")' Example: -r 'MR(SeriesDescription=="T2_AXIAL")' Example: -r 'CT(PatientSex=="F" OR PatientAge<30)' | None |
update-index#
Download and update the local ImgNet dataset index.
The index contains metadata describing available imaging collections, including information required for searching and downloading datasets.
By default, the index is stored in the ImgNet user data directory. Use --path to store or update the index in a custom location.
Usage:
Options:
| Name | Type | Description | Default |
|---|---|---|---|
--path, -p |
path | Path where the ImgNet indexed datasets will be stored. Defaults to $IMGNET_INDEX_DIR/indexed_datasets or the platform user data directory if the environment variable is not set. | None |
--help |
boolean | Show this message and exit. | False |