Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Return file info from channel in struct #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions dicom.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

type DicomFile struct {
Elements []DicomElement
Path string
}

// Errors
Expand Down
19 changes: 18 additions & 1 deletion dicomPipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ func (di *DicomFile) Parse(buff []byte) <-chan DicomMessage {
panic(err)
}

_, c := parser.Parse(buff)
di, c := parser.Parse(buff)
if err != nil {
panic(err)
}

return c
}

Expand All @@ -40,6 +41,22 @@ func (di *DicomFile) Discard(in <-chan DicomMessage, done *sync.WaitGroup) {
go func() {
for dcmMsg := range in {
dcmMsg.wait <- true
di.Elements = append(di.Elements, *dcmMsg.msg)
}
done.Done()
}()

}

// Discard messages and not store pixel data
func (di *DicomFile) DiscardPixel(in <-chan DicomMessage, done *sync.WaitGroup) {
done.Add(1)
go func() {
for dcmMsg := range in {
dcmMsg.wait <- true
if dcmMsg.msg.Name != "PixelData" {
di.Elements = append(di.Elements, *dcmMsg.msg)
}
}
done.Done()
}()
Expand Down