Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyto tomoloading #22

Merged
merged 10 commits into from
Jul 24, 2023
Merged

Pyto tomoloading #22

merged 10 commits into from
Jul 24, 2023

Conversation

LorenzLamm
Copy link
Collaborator

@LorenzLamm LorenzLamm commented Jul 19, 2023

Adjust dataloading to keep the header information of the input tomogram even after segmentation with MemBrain-seg.

It is not based on Pyto (as I thought initially would be necessary), but only on the mrcfile package. Thanks Alister for helping fix this!

data -= np.mean(data)
data /= np.std(data)
if return_header:
return data, header
Copy link
Collaborator Author

@LorenzLamm LorenzLamm Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what I was doing in the previous version :D
The new version is even shorter

if header is not None:
attributes = header.dtype.names
for attr in attributes:
setattr(out_mrc.header, attr, getattr(header, attr))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the header could not be set directly with
out_mrc.header = header but separate setting of the attributes works nicely.

@LorenzLamm LorenzLamm marked this pull request as ready for review July 19, 2023 10:23
Copy link
Contributor

@alisterburt alisterburt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay here - just getting back to reality!

Main comment is I don't love that a flag dictates the return type in the load_tomogram function, I would rather return some simple model Tomogram with both the array data and the header in every case

non blocking though - can be followup/cleanup

@LorenzLamm LorenzLamm merged commit 0890128 into main Jul 24, 2023
@LorenzLamm LorenzLamm deleted the pyto_tomoloading branch July 24, 2023 07:52
@LorenzLamm LorenzLamm mentioned this pull request Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants