Closed badesar1 closed 2 years ago
Hi @badesar1,
I thought it should be possible to do this, but if you can't do it then maybe it isn't possible currently. You could make repeated calls to each index in turn and then concatenate along that dimension. A bit messy but it avoids reading the whole data in one block.
You could also try https://github.com/mrphysics-bonn/twixtools as an alternative reader. I haven't tried it out but it might offer the functionality you are looking for.
Closing for now. Please get back in touch if you want to discuss further.
Hi, is it possible to select a set of indices while reading data? i.e.
slice_index = np.array([0, 1, 2, 30, 31, 32])
out = twixObj.image[:,:,:,0,slice_index,0,0,:,:,0,:,0,0,0,0,0]
I am able to select and read a subset of data using array slicing syntax, but when I try to read a specific set of slice indices (as above), I get: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().
I am able to retrieve the indices I need after reading the full dataset:
out = twixObj.image['']
out = out[:,:,:,0,slice_index,0,0,:,:,0,:,0,0,0,0,0]
but would prefer to only read the relevant data as I need it.Thanks for your help