tbepler/topaz

Topaz DeNoise3D and array size

schmitbp opened this issue · 10 comments

Hello,
I've been trying to use Topaz's DeNoise3D program for a set of tomograms I'm working on. After running the command I get from the Topaz GUI, I get an error message that says: "ValueError: cannot reshape array of size 261888 into shape (194,362,454)"
I've tried changing patch sizes, but the error seems to persist. For reference: I'm using Topaz/0.2.5 and I've added screenshots of what I'm inputting into the Topaz GUI as well as the error I receive in the terminal.

#2

#1

Thank you,
Ben

This error is happening when topaz tries to parse your tomogram MRCs, because the tomogram size encoded in the header doesn't match with the actual number of bytes in the file. Based on the sizes encoded in your header, topaz expects there to be 31883512 (194362454) entries.

Could your file have been truncated or incorrectly encoded somehow?

Interesting, okay. I'm not sure where I could have truncated the files (unless perhaps when the stack is binned during reconstruction). I would have no idea if the file was incorrectly encoded, perhaps you have a suggestion to check this? Thank you for your quick response.

Unfortunately I'm not really sure how this could happen. If you can share one of your tomograms that produces this error, I can take a look at it.

@alexjnoble have you ever run into an error like this before with tomograms?

Hi Ben,

the picture of your command line input shows --patch-size 32 --patch padding 48. This may be the problem: --patch-size must be larger than --patch-padding. Ideally, --patch-size is twice the size of --patch-padding.

Best,
-Alex

@alexjnoble the error happens when topaz parses the tomogram, so I don't think it's related to the patch size and patch padding. Do you know why the tomogram size encoded in the MRC header would disagree with the actual size of the tomogram data in the MRC file?

Screen Shot 2021-09-20 at 11 11 31 AM
Hi Alex, I think this was my mistake (sorry) I added the wrong screenshot. I've also tried using Patch size of 96 and padding of 48. Here's another screenshot of when I try using these parameters.
Ben

Oh. Can you check the tomogram dimensions and x,y origin using IMOD's header script? Do this: header tomogram.mrc

-Alex

Screen Shot 2021-09-20 at 11 24 35 AM
I think this is what you're asking for, but if not please let me know.
Ben

Hi Ben,

The dimensions of your tomogram confuse me because they don't match up with the dimensions in the error, or multiples of the dimensions in your error. But I do notice one potential issue: The y-dimension is odd; 1351. This is only divisible by 7. I suggest trimming off one pixel in the y-dimension. You can use IMOD's trimvol to do this: https://bio3d.colorado.edu/imod/doc/man/trimvol.html

Then try denoising.

Best,
-Alex

Ah Ha! This was my issue. The volume was denoised and looks beautiful, thank you, Alex and Tristan, very excited to see the improved data!