mrpro.utils.split_idx

mrpro.utils.split_idx(idx: Tensor, np_per_block: int, np_overlap: int = 0, cyclic: bool = False) Tensor[source]

Split a tensor of indices into different blocks.

Parameters:
  • idx – 1D indices to be split into different blocks.

  • np_per_block – Number of points per block.

  • np_overlap – Number of points overlapping between blocks, default of 0 means no overlap between blocks

  • cyclic – Last block is filled up with points from the first block, e.g. due to cyclic cardiac motion

Example: # idx = [1,2,3,4,5,6,7,8,9], np_per_block = 5, np_overlap = 3, cycle = True # # idx: 1 2 3 4 5 6 7 8 9 # block 0: 0 0 0 0 0 # block 1: 1 1 1 1 1 # block 2: 2 2 2 2 2 # block 3: 3 3 3 3 3

Return type:

2D indices to split data into different blocks in the shape [block, index].

Raises:
  • ValueError – If the provided idx is not 1D

  • ValueError – If the overlap is smaller than the number of points per block