e2b2e773215b5360e8398b3199806b2e98ae4dc6,niftynet/engine/windows_aggregator_grid.py,GridSamplesAggregator,decode_batch,#GridSamplesAggregator#Any#Any#,45

Before Change


                            self.csv_out[i] = self._initialise_empty_csv(
                                1 + location_init[0, :].shape[-1])
                        else:
                            window[i] = np.asarray(window[i])
                            try:
                                assert window[i].ndim <= 2
                            except (TypeError, AssertionError):
                                tf.logging.error(
                                    "The output you are trying to "
                                    "save as csv is more than "
                                    "bidimensional. Did you want "
                                    "to save an image instead? "
                                    "Put the keyword window "
                                    "in the output dictionary"
                                    " in your application file")
                            if window[i].ndim < 2:
                                window[i] = np.expand_dims(window[i], 0)
                            self.csv_out[i] = self._initialise_empty_csv(
                                n_channel=window[i][0].shape[-1] + location_init
                                [0, :].shape[-1])
            for i in window:
                if "window" in i:
                    self.image_out[i][
                        x_start:x_end, y_start:y_end, z_start:z_end, ...] = \
                        window[i][batch_id, ...]
                else:
                    if isinstance(window[i], (list, tuple, np.ndarray)):
                        window[i] = np.asarray(window[i])
                        try:
                            assert window[i].ndim <= 2
                        except (TypeError, AssertionError):
                            tf.logging.error(
                                "The output you are trying to "
                                "save as csv is more than "
                                "bidimensional. Did you want "
                                "to save an image instead? "
                                "Put the keyword window "
                                "in the output dictionary"
                                " in your application file")
                        if window[i].ndim < 2:
                            window[i] = np.expand_dims(window[i], 0)
                        window[i] = np.asarray(window[i])

                        window_loc = np.concatenate([
                            window[i], np.tile(
                                location_init[batch_id, ...],
                                [window[i].shape[0], 1])], 1)
                    else:
                        window_loc = np.concatenate([
                            np.reshape(window[i], [1, 1]), np.tile(
                                location_init[batch_id, ...], [1, 1])], 1)
                    self.csv_out[i] = np.concatenate([self.csv_out[i],
                                                      window_loc], 0)
        return True

After Change


                        window[i][batch_id, ...]
                else:
                    if isinstance(window[i], (list, tuple, np.ndarray)):
                        window_save = np.squeeze(np.asarray(window[i][batch_id,
                                                                   ...]))
                        try:
                            assert window_save.ndim <= 2
                        except (TypeError, AssertionError):
                            tf.logging.error(
                                "The output you are trying to "
                                "save as csv is more than "
                                "bidimensional. Did you want "
                                "to save an image instead? "
                                "Put the keyword window "
                                "in the output dictionary"
                                " in your application file")
                        while window_save.ndim < 2:
                            window_save = np.expand_dims(window_save, 0)
                        window_save = np.asarray(window_save)

                        window_loc = np.concatenate([
                            window_save, np.tile(
                                location_init[batch_id, ...],
                                [window_save.shape[0], 1])], 1)
                    else:
                        window_loc = np.concatenate([
                            np.reshape(window[i][batch_id, ...], [1, 1]), \
                                     np.tile(
                                location_init[batch_id, ...], [1, 1])], 1)
                    self.csv_out[i] = np.concatenate([self.csv_out[i],
                                                      window_loc], 0)
        return True
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 23

Instances


Project Name: NifTK/NiftyNet
Commit Name: e2b2e773215b5360e8398b3199806b2e98ae4dc6
Time: 2019-07-03
Author: carole.sudre@kcl.ac.uk
File Name: niftynet/engine/windows_aggregator_grid.py
Class Name: GridSamplesAggregator
Method Name: decode_batch


Project Name: NifTK/NiftyNet
Commit Name: e871df8da1390d0be46434ac606921ae9f85841f
Time: 2019-06-08
Author: carole.sudre@kcl.ac.uk
File Name: niftynet/engine/windows_aggregator_grid.py
Class Name: GridSamplesAggregator
Method Name: decode_batch


Project Name: NifTK/NiftyNet
Commit Name: e2b2e773215b5360e8398b3199806b2e98ae4dc6
Time: 2019-07-03
Author: carole.sudre@kcl.ac.uk
File Name: niftynet/engine/windows_aggregator_resize.py
Class Name: ResizeSamplesAggregator
Method Name: decode_batch


Project Name: NifTK/NiftyNet
Commit Name: e2b2e773215b5360e8398b3199806b2e98ae4dc6
Time: 2019-07-03
Author: carole.sudre@kcl.ac.uk
File Name: niftynet/engine/windows_aggregator_grid.py
Class Name: GridSamplesAggregator
Method Name: decode_batch


Project Name: NifTK/NiftyNet
Commit Name: e871df8da1390d0be46434ac606921ae9f85841f
Time: 2019-06-08
Author: carole.sudre@kcl.ac.uk
File Name: niftynet/engine/windows_aggregator_resize.py
Class Name: ResizeSamplesAggregator
Method Name: decode_batch