Modality Methods
The getModalityValues()
method can provide insight to the available modality types in the NBIA database.
The method has the following signature:
- NBIAClient.getModalityValues(Collection: str = '', BodyPartExamined: str = '', Counts: bool = False, return_type: ReturnType | str | None = None) List[dict[Any, Any]] | DataFrame [source]
Retrieves possible modality values from the NBIA database.
- Parameters:
Collection (str, optional) – Collection name to filter by. Defaults to “”.
BodyPartExamined (str, optional) – BodyPart name to filter by. Defaults to “”.
Counts (bool, optional) – Flag to indicate whether to return patient counts. Defaults to False.
return_type (Optional[Union[ReturnType, str]], optional) – Return type of the response. Defaults to None which uses the default return type.
- Returns:
List of modality values or DataFrame containing the modality values.
- Return type:
List[dict[Any, Any]] | pd.DataFrame
Passing no parameters to the method will return a list of all modality types available in the NBIA database.
Filtering by Collection
and BodyPartExamined
is also possible.
The Counts
parameter can be set to True
to return the number of patients for each modality type.
with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues()
print(modalities)
Modality
0 CR
1 CT
2 DX
3 FUSION
4 KO
5 MG
6 MR
7 NM
8 OT
9 PR
10 PT
11 REG
12 RF
13 RTDOSE
14 RTPLAN
15 RTSTRUCT
16 RWV
17 SC
18 SEG
19 SR
20 US
21 XA
with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues(
Collection = "TCGA-BLCA",
)
print(modalities)
Modality
0 CR
1 CT
2 DX
3 MR
4 PT
with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues(
Collection = "TCGA-BLCA",
Counts = True
)
print(modalities)
Modality PatientCount
0 CR 7
1 CT 107
2 DX 7
3 MR 20
4 PT 7