func ExtractDicomFromZipReader(rc *zip.Reader, dicomName string, includeOverlay bool) (image.Image, error) {

	for _, v := range rc.File {
		// Iterate over all of the dicoms in the zip til we find the one with
		// the desired name. This is reasonably efficient since we don't need to
		// read all of the data to find the right name.
		if v.Name != dicomName {
			continue
		}

		dicomReader, err := v.Open()
		if err != nil {
			return nil, err
		}
		defer dicomReader.Close()

		img, err := ExtractDicomFromReader(dicomReader, int64(v.UncompressedSize64), includeOverlay)

		return img, err
	}

	return nil, fmt.Errorf("Did not find the requested Dicom %s", dicomName)
}
// ExtractDicomFromZipReader consumes a zip reader of the UK Biobank format,
// finds the dicom of the desired name, and returns that image, with or without
// the overlay (if any is present) based on includeOverlay.
ExtractDicomFromZipReader consumes a zip reader of the UK Biobank format,
finds the dicom of the desired name, and returns that image, with or without
the overlay (if any is present) based on includeOverlay.
// ExtractDicomFromZipReader consumes a zip reader of the UK Biobank format // finds the dicom of the desired name and returns that image with or without // the overlay ( if any is present ) based on includeOverlay .
func ExtractDicomFromZipReader(rc *zip.Reader, dicomName string, includeOverlay bool) (image.Image, error) {
	for _, v := range rc.File {
		if v.Name != dicomName {
			continue
		}
		dicomReader, err := v.Open()
		if err != nil {
			return nil, err
		}
		defer dicomReader.Close()
		img, err := ExtractDicomFromReader(dicomReader, int64(v.UncompressedSize64), includeOverlay)
		return img, err
	}
	return nil, fmt.Errorf("Did not find the requested Dicom %s", dicomName)
}
func ExtractDicomFromZipReader ( rc * zip . Reader , dicomName string , includeOverlay bool ) ( image . Image , error ) { for _ , v := range rc . File { if v . Name != dicomName { continue } dicomReader , err := v . Open ( ) if err != nil { return nil , err } defer dicomReader . Close ( ) img , err := ExtractDicomFromReader ( dicomReader , int64 ( v . UncompressedSize64 ) , includeOverlay ) return img , err } return nil , fmt . Errorf ( " " , dicomName ) }
ExtractDicomFromZipReader consumes a zip reader of the UK Biobank format,
finds the dicom of the desired name, and returns that image, with or without
the overlay (if any is present) based on includeOverlay.
ExtractDicomFromZipReader consumes a zip reader of the UK Biobank format finds the dicom of the desired name and returns that image with or without the overlay ( if any is present ) based on includeOverlay .
// Iterate over all of the dicoms in the zip til we find the one with // the desired name. This is reasonably efficient since we don't need to // read all of the data to find the right name.