code: def test_dicom_image_concurrency():
      """test_decode_dicom_image_currency"""
  
      @tf.function
      def preprocess(dcm_content):
          tags = tfio.image.decode_dicom_data(
              dcm_content, tags=[tfio.image.dicom_tags.PatientsName]
          )
          tf.print(tags)
          image = tfio.image.decode_dicom_image(
              dcm_content, dtype=tf.float32
          )
          return image
  
      dcm_path = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_dicom",
          "TOSHIBA_J2K_OpenJPEGv2Regression.dcm",
      )
  
      dataset = (
          tf.data.Dataset.from_tensor_slices([dcm_path])
          .repeat()
          .map(tf.io.read_file)
          .map(preprocess, num_parallel_calls=8)
          .take(200)
      )
      for i, item in enumerate(dataset):
          print(tf.shape(item), i)
          assert np.array_equal(tf.shape(item), [1, 512, 512, 1])
  
      dcm_path = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_dicom",
          "US-PAL-8-10x-echo.dcm",
      )
  
      dataset = (
          tf.data.Dataset.from_tensor_slices([dcm_path])
          .repeat()
          .map(tf.io.read_file)
          .map(preprocess, num_parallel_calls=8)
          .take(200)
      )
      for i, item in enumerate(dataset):
          print(tf.shape(item), i)
          assert np.array_equal(tf.shape(item), [10, 430, 600, 3])
  
file_path: io/tests/test_dicom.py
imports: import os
  import numpy
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 5 for calling a global function with example usage: test_dicom_image_concurrency() and returns: image