# -*- coding: utf-8 -*-
"""Batch_Data_Generator.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1JruNkM8pWd4EnVlnMILNPy6zevdoTvMz
"""
# Created for batch size of 1 only
class DataGenerator(Sequence):
  def __init__(self,Id,datapath):
    self.Id = Id
    self.datapath = datapath
  def __getitem__(self, index):
    string_directive = self.Id[index]
    X1, X2 = self.mode(string_directive)
    return X1,X2
  def __len__(self):
    return len(self.Id)
  def mode(self,string_directive):
    data_object = h5py.File(self.datapath + string_directive, 'r')
    data = np.array(data_object['data'])
    mask = np.array(data_object['mask'])
    data,mask = direct_grid_distortion(data,mask)
    mask = np.swapaxes(mask,0,1)
    mask = np.expand_dims(mask,0)
    data = np.swapaxes(data,0,1)
    data_  = np.zeros(data.shape)
    for i in range(4):
      data_[:,:,:,i] = (data[:,:,:,i] - np.min(data[:,:,:,i]))/(np.max(data[:,:,:,i])-np.min(data[:,:,:,i]))
    data_ = np.expand_dims(data_,0)
    return data_,mask

4698664d3ca278455c2bf952c79ed64047055b8b
<mask token>


class DataGenerator(Sequence):
    <mask token>
    <mask token>
    <mask token>
    <mask token>

<mask token>


class DataGenerator(Sequence):

    def __init__(self, Id, datapath):
        self.Id = Id
        self.datapath = datapath

    def __getitem__(self, index):
        string_directive = self.Id[index]
        X1, X2 = self.mode(string_directive)
        return X1, X2
    <mask token>
    <mask token>

<mask token>


class DataGenerator(Sequence):

    def __init__(self, Id, datapath):
        self.Id = Id
        self.datapath = datapath

    def __getitem__(self, index):
        string_directive = self.Id[index]
        X1, X2 = self.mode(string_directive)
        return X1, X2

    def __len__(self):
        return len(self.Id)
    <mask token>

<mask token>


class DataGenerator(Sequence):

    def __init__(self, Id, datapath):
        self.Id = Id
        self.datapath = datapath

    def __getitem__(self, index):
        string_directive = self.Id[index]
        X1, X2 = self.mode(string_directive)
        return X1, X2

    def __len__(self):
        return len(self.Id)

    def mode(self, string_directive):
        data_object = h5py.File(self.datapath + string_directive, 'r')
        data = np.array(data_object['data'])
        mask = np.array(data_object['mask'])
        data, mask = direct_grid_distortion(data, mask)
        mask = np.swapaxes(mask, 0, 1)
        mask = np.expand_dims(mask, 0)
        data = np.swapaxes(data, 0, 1)
        data_ = np.zeros(data.shape)
        for i in range(4):
            data_[:, :, :, i] = (data[:, :, :, i] - np.min(data[:, :, :, i])
                ) / (np.max(data[:, :, :, i]) - np.min(data[:, :, :, i]))
        data_ = np.expand_dims(data_, 0)
        return data_, mask

# -*- coding: utf-8 -*-
"""Batch_Data_Generator.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1JruNkM8pWd4EnVlnMILNPy6zevdoTvMz
"""
# Created for batch size of 1 only
class DataGenerator(Sequence):
  def __init__(self,Id,datapath):
    self.Id = Id
    self.datapath = datapath
  def __getitem__(self, index):
    string_directive = self.Id[index]
    X1, X2 = self.mode(string_directive)
    return X1,X2
  def __len__(self):
    return len(self.Id)
  def mode(self,string_directive):
    data_object = h5py.File(self.datapath + string_directive, 'r')
    data = np.array(data_object['data'])
    mask = np.array(data_object['mask'])
    data,mask = direct_grid_distortion(data,mask)
    mask = np.swapaxes(mask,0,1)
    mask = np.expand_dims(mask,0)
    data = np.swapaxes(data,0,1)
    data_  = np.zeros(data.shape)
    for i in range(4):
      data_[:,:,:,i] = (data[:,:,:,i] - np.min(data[:,:,:,i]))/(np.max(data[:,:,:,i])-np.min(data[:,:,:,i]))
    data_ = np.expand_dims(data_,0)
    return data_,mask
