CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
550 stars 182 forks source link

Nikon Data loader patch #360

Closed rjkoch closed 2 years ago

rjkoch commented 2 years ago

Fixed issues with Nikon data loader. number of pixels and voxels should be integers, not float. Index, for loading images, should start at 0, not 1. Used enumerate rather than iterating the index in the loop.

rjkoch commented 2 years ago

I'll get back into this today after my day job. But yes, I'll make another PR

On Thu, Mar 17, 2022, 6:14 AM Biguri @.***> wrote:

@.**** commented on this pull request.

In Python/tigre/utilities/io/NikonDataLoader.py https://github.com/CERN/TIGRE/pull/360#discussion_r828958520:

@@ -157,9 +158,11 @@ def loadNikonProjections(folder, geometry, angles, **kwargs): image = numpy.asarray(image).astype(numpy.float32) projections = numpy.zeros([len(indices), image.shape[0], image.shape[1]], dtype=numpy.single) projections[0, :, :] = -numpy.log(image / float(geometry.whitelevel))

  • index = 1
  • Python uses zero-based indexing

Did it? Weird, I thought I had this well tested. Sure the change you suggest make sense. Mind making a commit? then I'll merge the PR.

— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/pull/360#discussion_r828958520, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSFZJHOXTPXOA4JHI2S6R3VAMAXXANCNFSM5Q5OTS5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

AnderBiguri commented 2 years ago

@rjkoch Thanks! No need to make another PR, just make a commit to rjkoch:master, it should appear in this PR too.

rjkoch commented 2 years ago

Got it, sorry. New to git stuff. I made these changes to my local version, it was the only way I could get it to run on a test dataset.

I'll see if I can pull a test data set for use here.

On Thu, Mar 17, 2022, 6:46 AM Biguri @.***> wrote:

@rjkoch https://github.com/rjkoch Thanks! No need to make another PR, just make a commit to rjkoch:master, it should appear in this PR too.

— Reply to this email directly, view it on GitHub https://github.com/CERN/TIGRE/pull/360#issuecomment-1070779450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSFZJFPGA2ERLFJVFL4PDDVAMERJANCNFSM5Q5OTS5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

AnderBiguri commented 2 years ago

@rjkoch No worries! All this git stuff is not trivial, particularly when you are starting :) I have some Nikon datasets myself, so once you make the change we discussed I'll also test it on my side, make sure all runs well

rjkoch commented 2 years ago

made the suggested changes.

rjkoch commented 2 years ago

Just checked the unchanged loader on a dataset. With: proj, geo, angles = tigreio.NikonDataLoader(rel_dir.__str__(),sampling='equidistant',num_angles=150)

I get: IndexError: index 154 is out of bounds for axis 0 with size 154

This is because projections has shape (n,I,J) where n is the number of projections to load. but index, used to slice projections, ends up at n and we can't slice an array of size n using n but rather at most n-1