TomographicImaging / CIL-ASTRA

Apache License 2.0
2 stars 5 forks source link

FBP reconstruction 4D multichannel data #91

Open epapoutsellis opened 3 years ago

epapoutsellis commented 3 years ago

I am trying to do FBP for 3D+channel data and get this error

     70         if sinogram_geometry.channels > 1:
---> 71             raise NotImplementedError("Cannot process multi-channel data")
     72             #processor_full = ChannelwiseProcessor(processor, self.sinogram_geometry.channels, dimension='prepend')
     73             #self.processor = operator_full

NotImplementedError: Cannot process multi-channel data

See here.

gfardell commented 3 years ago

I think we need a multichannel processor rather than implementing these versions by hand.

paskino commented 3 years ago

Currently this is not implemented as it may not be clear what it is expected to be done on the multichannel dataset. If channel wise repetition is what is required, we can have 2 options:

  1. create a ChannelwiseProcessor similarly to the ChannelwiseOperator to operate on the single channels in the data and return a multichannel dataset
  2. write your own for loop on the channels as option 2 below

ig3d = ig4d.get_slice(channel=1)
ag3d = ag4d.get_slice(channel=1)

fbp = FBP(ig3d, ag3d)
fbp.set_input(data)
recon3d = fbp.get_output()

# this fails
# fbp4d = FBP(ig4d, ag4d) 

### Option 1
ig3d = ig4d.get_slice(channel=1)
ag3d = ag4d.get_slice(channel=1)
fbp = FBP(ig3d, ag3d)

fbp4d = ChannelwiseProcessor(fbp, num_channels=ag4d.channels)
fbp4d.set_input(data4d)
recon4d = fbp4d.get_output()
# or 
recon4d = ChannelwiseProcessor(fbp, num_channels=ag4d.channels)(data4d)

### Option 2: do nothing
ig3d = ig4d.get_slice(channel=0)
ag3d = ag4d.get_slice(channel=0)
fbp = FBP(ig3d, ag3d)

recon4d = ig4d.allocate(None)
for ch in range(ag4d.channels):
    fbp.set_input(data4d.get_slice(channel=ch))
    recon4d.fill(fbp.get_output(), channel=ch)

### Option 3: not an option
fbp4d = FBP(ig4d, ag4d, isMultichannel=True)
recon4d = fbp4d(data4d)
jakobsj commented 3 years ago

I like the ChannelwiseProcessor. So that would work in the same way for other processors like RingRemover, Masker and CentreOfRotationCorrector?

On Fri, 7 May 2021, 13:19 Edoardo Pasca, @.***> wrote:

Currently this is not implemented as it may not be clear what it is expected to be done on the multichannel dataset. If channel wise repetition is what is required, we can have 2 options:

  1. create a ChannelwiseProcessor similarly to the ChannelwiseOperator to operate on the single channels in the data and return a multichannel dataset
  2. write your own for loop on the channels as option 2 below

ig3d = ig4d.get_slice(channel=1)ag3d = ag4d.get_slice(channel=1) fbp = FBP(ig3d, ag3d)fbp.set_input(data)recon3d = fbp.get_output()

this fails# fbp4d = FBP(ig4d, ag4d)

Option 1ig3d = ig4d.get_slice(channel=1)ag3d = ag4d.get_slice(channel=1)fbp = FBP(ig3d, ag3d)

fbp4d = ChannelwiseProcessor(fbp, num_channels=ag4d.channels)fbp4d.set_input(data4d)recon4d = fbp4d.get_output()# or recon4d = ChannelwiseProcessor(fbp, num_channels=ag4d.channels)(data4d)

Option 2: do nothingig3d = ig4d.get_slice(channel=0)ag3d = ag4d.get_slice(channel=0)fbp = FBP(ig3d, ag3d)

recon4d = ig4d.allocate(None)for ch in range(ag4d.channels): fbp.set_input(data4d.get_slice(channel=ch)) recon4d.fill(fbp.get_output(), channel=ch)

Option 3: not an optionfbp4d = FBP(ig4d, ag4d, isMultichannel=True)recon4d = fbp4d(data4d)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vais-ral/CCPi-astra/issues/91#issuecomment-834281770, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACMDSCBNXLM7ETTWQRK4DG3TMPEFBANCNFSM44FXWXCA .

gfardell commented 3 years ago

Yes, but I think RingRemover and Masker already handle 4D data. Centre of rotation is an interesting one, I don't think we can have different geometries in different channels, and it works by updating the geometry rather than changing the data, I'm not sure what we'd want to do here.