Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an invalid file during tests to check isdicom() #5

Merged
merged 3 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DICOM"
uuid = "a26e6606-dd52-5f6a-a97f-4f611373d757"
version = "0.10.0"
version = "0.10.1"

[compat]
julia = "0.7, 1"
Expand Down
22 changes: 12 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,23 @@ end
@testset "Parse entire folder" begin
# Following files have missing preamble and won't be parsed
# ["OT_Implicit_Little_Headless.dcm", "CT_Implicit_Little_Headless_Retired.dcm"]
# and brain.bpm is not a DICOM file
# along with an invalid notdicom.dcm file which we will first create
notdicomfile = joinpath(data_folder, "notdicom.dcm")
open(notdicomfile, "w") do io
print(io, "!")
end

# First, test the isdicom() function
fileDX = download_dicom("DX_Implicit_Little_Interleaved.dcm")
@test DICOM.isdicom(fileDX) == true
@test DICOM.isdicom(notdicomfile) == false

# Second, test if all valid dicom file can be parsed
dcms = dcmdir_parse(data_folder)
@test issorted([dcm[tag"Instance Number"] for dcm in dcms])
@test length(dcms) == length(readdir(data_folder)) - 3 # -3 because of note above
end

@testset "isdicom" begin
answer = DICOM.isdicom("test/testdata/brain.bmp")
@test answer === false

fileDX = download_dicom("DX_Implicit_Little_Interleaved.dcm")
answer2 = DICOM.isdicom(fileDX)
@test answer2 == true
end

@testset "Test tag macro" begin
@test tag"Modality" === (0x0008, 0x0060) === DICOM.fieldname_dict[:Modality]
@test tag"Shutter Overlay Group" ===
Expand Down