Skip to content

Commit

Permalink
Merge pull request #5 from notZaki/pr
Browse files Browse the repository at this point in the history
Create an invalid file during tests to check isdicom()
  • Loading branch information
Dale-Black authored Dec 13, 2021
2 parents ba46466 + 777dbae commit 4bca7d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
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

0 comments on commit 4bca7d7

Please sign in to comment.