func ProcessDicom(dicomReader io.Reader) error {
	dcm, err := ioutil.ReadAll(dicomReader)
	if err != nil {
		return err
	}

	p, err := dicom.NewParserFromBytes(dcm, nil)
	if err != nil {
		return err
	}

	parsedData, err := bulkprocess.SafelyDicomParse(p, dicom.ParseOptions{
		DropPixelData: true,
	})
	if parsedData == nil || err != nil {
		return fmt.Errorf("Error reading dicom: %v", err)
	}

	for _, elem := range parsedData.Elements {
		tagName, _ := dicomtag.Find(elem.Tag)

		if tagName.Name == "" {
			tagName.Name = "____"
		}

		// We don't want to flood the screen with pixel data. Note that as long
		// as we have set DropPixelData: true above in dicom.ParseOptions, these
		// checks are redundant.

		if elem.Tag == dicomtag.PixelData {
			// Don't print the main image as text
			fmt.Println(elem.Tag, tagName.Name, "~~skipping pixel data~~")
			continue
		}

		if elem.Tag.Compare(dicomtag.Tag{Group: 0x6000, Element: 0x3000}) == 0 {
			// Don't print the overlay as text
			fmt.Println(elem.Tag, tagName.Name, "~~skipping overlay pixel data~~")
			continue
		}

		if elem.Tag.Compare(dicomtag.Tag{Group: 0x0029, Element: 0x1020}) == 0 {
			// Don't print the secondary Siemens data.
			fmt.Println(elem.Tag, tagName.Name, "~~skipping secondary Siemens data~~")
			continue
		}

		// Siemens header data requires special treatment
		if elem.Tag.Compare(dicomtag.Tag{Group: 0x0029, Element: 0x1010}) == 0 {
			for _, v := range elem.Value {
				sc, err := bulkprocess.ParseSiemensHeader(v)
				if err != nil {
					return err
				}
				fmt.Printf("%v %v %s NElements: %+v\n", elem.Tag, tagName.Name, "SiemensHeader", sc.NElements)
				for _, v := range sc.Slice() {
					fmt.Printf("%v %v %s %+v\n", elem.Tag, tagName.Name, "SiemensHeader", v)
				}
			}

			continue
		}

		fmt.Println(elem.Tag, tagName.Name, elem.Value)
	}

	return nil
}
// Takes in a dicom file (in bytes), emit meta-information
Takes in a dicom file (in bytes), emit meta-information
// Takes in a dicom file ( in bytes ) emit meta - information
func ProcessDicom(dicomReader io.Reader) error {
	dcm, err := ioutil.ReadAll(dicomReader)
	if err != nil {
		return err
	}
	p, err := dicom.NewParserFromBytes(dcm, nil)
	if err != nil {
		return err
	}
	parsedData, err := bulkprocess.SafelyDicomParse(p, dicom.ParseOptions{
		DropPixelData: true,
	})
	if parsedData == nil || err != nil {
		return fmt.Errorf("Error reading dicom: %v", err)
	}
	for _, elem := range parsedData.Elements {
		tagName, _ := dicomtag.Find(elem.Tag)
		if tagName.Name == "" {
			tagName.Name = "____"
		}
		if elem.Tag == dicomtag.PixelData {
			fmt.Println(elem.Tag, tagName.Name, "~~skipping pixel data~~")
			continue
		}
		if elem.Tag.Compare(dicomtag.Tag{Group: 0x6000, Element: 0x3000}) == 0 {
			fmt.Println(elem.Tag, tagName.Name, "~~skipping overlay pixel data~~")
			continue
		}
		if elem.Tag.Compare(dicomtag.Tag{Group: 0x0029, Element: 0x1020}) == 0 {
			fmt.Println(elem.Tag, tagName.Name, "~~skipping secondary Siemens data~~")
			continue
		}
		if elem.Tag.Compare(dicomtag.Tag{Group: 0x0029, Element: 0x1010}) == 0 {
			for _, v := range elem.Value {
				sc, err := bulkprocess.ParseSiemensHeader(v)
				if err != nil {
					return err
				}
				fmt.Printf("%v %v %s NElements: %+v\n", elem.Tag, tagName.Name, "SiemensHeader", sc.NElements)
				for _, v := range sc.Slice() {
					fmt.Printf("%v %v %s %+v\n", elem.Tag, tagName.Name, "SiemensHeader", v)
				}
			}
			continue
		}
		fmt.Println(elem.Tag, tagName.Name, elem.Value)
	}
	return nil
}
func ProcessDicom ( dicomReader io . Reader ) error { dcm , err := ioutil . ReadAll ( dicomReader ) if err != nil { return err } p , err := dicom . NewParserFromBytes ( dcm , nil ) if err != nil { return err } parsedData , err := bulkprocess . SafelyDicomParse ( p , dicom . ParseOptions { DropPixelData : true , } ) if parsedData == nil || err != nil { return fmt . Errorf ( " " , err ) } for _ , elem := range parsedData . Elements { tagName , _ := dicomtag . Find ( elem . Tag ) if tagName . Name == " " { tagName . Name = " " } if elem . Tag == dicomtag . PixelData { fmt . Println ( elem . Tag , tagName . Name , " " ) continue } if elem . Tag . Compare ( dicomtag . Tag { Group : 0x6000 , Element : 0x3000 } ) == 0 { fmt . Println ( elem . Tag , tagName . Name , " " ) continue } if elem . Tag . Compare ( dicomtag . Tag { Group : 0x0029 , Element : 0x1020 } ) == 0 { fmt . Println ( elem . Tag , tagName . Name , " " ) continue } if elem . Tag . Compare ( dicomtag . Tag { Group : 0x0029 , Element : 0x1010 } ) == 0 { for _ , v := range elem . Value { sc , err := bulkprocess . ParseSiemensHeader ( v ) if err != nil { return err } fmt . Printf ( " \n " , elem . Tag , tagName . Name , " " , sc . NElements ) for _ , v := range sc . Slice ( ) { fmt . Printf ( " \n " , elem . Tag , tagName . Name , " " , v ) } } continue } fmt . Println ( elem . Tag , tagName . Name , elem . Value ) } return nil }
Takes in a dicom file (in bytes), emit meta-information
Takes in a dicom file ( in bytes ) emit meta - information
// We don't want to flood the screen with pixel data. Note that as long // as we have set DropPixelData: true above in dicom.ParseOptions, these // checks are redundant. // Don't print the main image as text // Don't print the overlay as text // Don't print the secondary Siemens data. // Siemens header data requires special treatment