Пример #1
0
    def __init__(self, n_ch=2, nf=64, ks=3, nc=5, nd=5):
        """
        :param n_ch: number of channels
        :param nf: number of filters
        :param ks: kernel size
        :param nc: number of iterations
        :param nd: number of CRNN/BCRNN/CNN layers in each iteration
        """
        super(CRNN_MRI, self).__init__()
        self.nc = nc
        self.nd = nd
        self.nf = nf
        self.ks = ks

        self.bcrnn = BCRNNlayer(n_ch, nf, ks)
        self.conv1_x = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv1_h = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv2_x = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv2_h = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv3_x = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv3_h = nn.Conv2d(nf, nf, ks, padding=ks // 2)
        self.conv4_x = nn.Conv2d(nf, n_ch, ks, padding=ks // 2)
        self.relu = nn.ReLU(inplace=True)

        dcs = []
        for i in range(nc):
            dcs.append(cl.DataConsistencyInKspace(norm='ortho'))
        self.dcs = dcs
Пример #2
0
    def __init__(self, n_channels=2, nc=5, nd=5, **kwargs):
        super(DnCn3DShared, self).__init__()
        self.nc = nc
        self.nd = nd
        print('Creating D{}C{}-S (3D)'.format(nd, nc))

        self.conv_block = conv_block(n_channels, nd, **kwargs)
        self.dc = cl.DataConsistencyInKspace(norm='ortho')
Пример #3
0
    def __init__(self, n_channels=2, nc=5, nd=5, **kwargs):
        super(DnCn, self).__init__()
        self.nc = nc
        self.nd = nd
        print('Creating D{}C{}'.format(nd, nc))
        conv_blocks = []
        dcs = []

        conv_layer = conv_block

        for i in range(nc):
            conv_blocks.append(conv_layer(n_channels, nd, **kwargs))
            dcs.append(cl.DataConsistencyInKspace(norm='ortho'))

        self.conv_blocks = nn.ModuleList(conv_blocks)
        self.dcs = dcs
Пример #4
0
    def __init__(self,
                 n_channels=2,
                 nc=5,
                 nd=5,
                 fr_d=None,
                 clipped=False,
                 mode='pytorch',
                 **kwargs):
        """

        Parameters
        ----------

        fr_d: frame distance for data sharing layer. e.g. [1, 3, 5]

        """
        super(DnCn3DDS, self).__init__()
        self.nc = nc
        self.nd = nd
        self.mode = mode
        print('Creating D{}C{}-DS (3D)'.format(nd, nc))
        if self.mode == 'theano':
            print('Initialised with theano mode (backward-compatibility)')
        conv_blocks = []
        dcs = []
        kavgs = []

        if not fr_d:
            fr_d = list(range(10))
        self.fr_d = fr_d

        conv_layer = conv_block

        # update input-output channels for data sharing
        n_channels = 2 * len(fr_d)
        n_out = 2
        kwargs.update({'n_out': 2})

        for i in range(nc):
            kavgs.append(
                cl.AveragingInKspace(fr_d, i > 0, clipped, norm='ortho'))
            conv_blocks.append(conv_layer(n_channels, nd, **kwargs))
            dcs.append(cl.DataConsistencyInKspace(norm='ortho'))

        self.conv_blocks = nn.ModuleList(conv_blocks)
        self.dcs = nn.ModuleList(dcs)
        self.kavgs = nn.ModuleList(kavgs)