// Write will write the input DICOM dataset to the provided io.Writer as a complete DICOM (including any header
// information if available).
Write will write the input DICOM dataset to the provided io.Writer as a complete DICOM (including any header
information if available).
// Write will write the input DICOM dataset to the provided io . Writer as a complete DICOM ( including any header // information if available ) .
func Write(out io.Writer, ds Dataset, opts ...WriteOption) error {
	optSet := toOptSet(opts...)
	w := dicomio.NewWriter(out, nil, false)
	var metaElems []*Element
	for _, elem := range ds.Elements {
		if elem.Tag.Group == tag.MetadataGroup {
			metaElems = append(metaElems, elem)
		}
	}
	err := writeFileHeader(w, &ds, metaElems, *optSet)
	if err != nil {
		return err
	}
	endian, implicit, err := ds.transferSyntax()
	if (err != nil && err != ErrorElementNotFound) || (err == ErrorElementNotFound && !optSet.defaultMissingTransferSyntax) {
		return err
	}
	if err == ErrorElementNotFound && optSet.defaultMissingTransferSyntax {
		w.SetTransferSyntax(binary.LittleEndian, true)
	} else {
		w.SetTransferSyntax(endian, implicit)
	}
	for _, elem := range ds.Elements {
		if elem.Tag.Group != tag.MetadataGroup {
			err = writeElement(w, elem, *optSet)
			if err != nil {
				return err
			}
		}
	}
	return nil
}
func Write ( out io . Writer , ds Dataset , opts ... WriteOption ) error { optSet := toOptSet ( opts ... ) w := dicomio . NewWriter ( out , nil , false ) var metaElems [ ] * Element for _ , elem := range ds . Elements { if elem . Tag . Group == tag . MetadataGroup { metaElems = append ( metaElems , elem ) } } err := writeFileHeader ( w , & ds , metaElems , * optSet ) if err != nil { return err } endian , implicit , err := ds . transferSyntax ( ) if ( err != nil && err != ErrorElementNotFound ) || ( err == ErrorElementNotFound && ! optSet . defaultMissingTransferSyntax ) { return err } if err == ErrorElementNotFound && optSet . defaultMissingTransferSyntax { w . SetTransferSyntax ( binary . LittleEndian , true ) } else { w . SetTransferSyntax ( endian , implicit ) } for _ , elem := range ds . Elements { if elem . Tag . Group != tag . MetadataGroup { err = writeElement ( w , elem , * optSet ) if err != nil { return err } } } return nil }
Write will write the input DICOM dataset to the provided io.Writer as a complete DICOM (including any header
information if available).
Write will write the input DICOM dataset to the provided io . Writer as a complete DICOM ( including any header information if available ) .