Skip to content

Instantly share code, notes, and snippets.

@gillesdemey
Last active March 20, 2023 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gillesdemey/8c1e95c64accbbf030ff73548a8888d2 to your computer and use it in GitHub Desktop.
Save gillesdemey/8c1e95c64accbbf030ff73548a8888d2 to your computer and use it in GitHub Desktop.
Dicom writer
module github.com/gillesdemey/dicom-test
go 1.20
require (
github.com/suyashkumar/dicom v1.0.6 // indirect
golang.org/x/text v0.3.8 // indirect
)
package main
import (
"encoding/binary"
"os"
"github.com/suyashkumar/dicom"
"github.com/suyashkumar/dicom/pkg/tag"
)
func main() {
file, _ := os.Create("dicom.dcm")
defer file.Close()
writer := dicom.NewWriter(file)
writer.SetTransferSyntax(binary.BigEndian, true)
patient, _ := dicom.NewElement(tag.PatientName, []string{"Bob", "Jones"})
writer.WriteElement(patient)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment