Skip to content

Commit

Permalink
fix: Refactor DICOM tag conversion functions and add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Mar 29, 2024
1 parent 49af730 commit d6094bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/nbiatoolkit/dicomtags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,3 @@ def getReferencedSeriesUIDS(series_tags_df: pd.DataFrame) -> List[str]:
UIDS: list[str] = value["data"].to_list()

return UIDS


if __name__ == "__main__":
from nbiatoolkit import NBIAClient

test = convert_element_to_int("(0028,0010)")

print(test)

print(convert_int_to_element(test))
8 changes: 8 additions & 0 deletions tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def test_convert_int_to_element():
result = convert_int_to_element(65535)
assert result == "(0000,FFFF)", f"Expected (0000,FFFF), but got {result}"

with pytest.raises(ValueError) as e:
convert_element_to_int("(1,1,1)")

print("All test cases passed!")


Expand Down Expand Up @@ -146,3 +149,8 @@ def test_getSeriesModality(RTSTRUCT_Tags):

with pytest.raises(IndexError) as e:
getSeriesModality(RTSTRUCT_Tags)


def test_failsubsetSeriesTags(RTSTRUCT_Series):
with pytest.raises(KeyError) as e:
subsetSeriesTags(RTSTRUCT_Series, "(0008,0060)")

0 comments on commit d6094bb

Please sign in to comment.