How to apply doughnut mask

Hi I’m using v2.15.1 and I’m trying to apply a doughnut mask that I created in another program to remove the center part of a VLP. What is the best way to do that. Using the volume tools or putting the mask into the refinement doesn’t seem to take. What step am I missing?

You may need to uncheck fill holes when using volume tools - otherwise the void in the middle of the VLP will be treated as a hole and filled in. Is that what is happening?

Cheers
Oli

thanks for the suggestion @olibclarke. I tried that, but go the same volume on output as I did for what I used as an input. Is there something special I need to do for the volume to apply a second mask on the refinement output?

Hi @hansenbry,

If you are just looking to multiply the mask with an input volume, then I don’t believe that the Volume Tools job has this functionality; the Volume Tools job is intended more for processing and creating masks, which can then be inputted into refinement jobs.

If you already have the mask that has the central region removed, and you want to launch a new refinement with this mask, you can input the mask into a refinement job along with the volume and particles. Note that the mask used in refinement is never applied to the output volume; it is only used when generating the volume that particles are aligned to. The output volume is always the filtered reconstruction directly from the particles.

Alternatively, if you just want to get a map that is the same as the refined structure with the mask multiplied into it, I don’t believe this can be done in a standalone job in cryoSPARC. You can, however, use the vop multiply command in UCSF Chimera. For example if you opened both the mask and the volume as model specifier 0 and 1 respectively then you can run vop multiply #0,#1 onGrid #1 and save the output map as an .mrc file.

Michael

2 Likes

@mmclean thanks for the tips. I’ll try the Chimera trick. I tried the refinement method and it kept crashing. Even though the pixel size and everything between the data and the mask is good I keep getting this error:

[CPU: 6.95 GB]   Traceback (most recent call last):
  File "cryosparc2_worker/cryosparc2_compute/run.py", line 85, in cryosparc2_compute.run.main
  File "cryosparc2_worker/cryosparc2_compute/jobs/refine/newrun.py", line 265, in cryosparc2_compute.jobs.refine.newrun.run_homo_refine
  File "cryosparc2_compute/newfourier.py", line 363, in resample_resize_real
    return ZT( ifft( ZT(fft(x, stack=stack), N_resample, stack=stack), stack=stack), M, stack=stack), psize_final
  File "cryosparc2_compute/newfourier.py", line 106, in fft
    return fftcenter3(x, fft_threads)
  File "cryosparc2_compute/newfourier.py", line 74, in fftcenter3
    alternatesign_rspace(tmp)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/dispatcher.py", line 330, in _compile_for_args
    raise e
TypingError: Caused By:
Traceback (most recent call last):
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/compiler.py", line 240, in run
    stage()
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/compiler.py", line 454, in stage_nopython_frontend
    self.locals)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/compiler.py", line 868, in type_inference_stage
    infer.propagate()
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 844, in propagate
    raise errors[0]
TypingError: Internal error at <numba.typeinfer.IntrinsicCallConstraint object at 0x7fe89f660410>:
--%<-----------------------------------------------------------------
Traceback (most recent call last):
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 137, in propagate
    constraint(typeinfer)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 501, in __call__
    self.resolve(typeinfer, typeinfer.typevars, fnty=self.func)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/errors.py", line 265, in new_error_context
    six.reraise(type(newerr), newerr, sys.exc_info()[2])
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/errors.py", line 259, in new_error_context
    yield
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 501, in __call__
    self.resolve(typeinfer, typeinfer.typevars, fnty=self.func)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 441, in resolve
    sig = typeinfer.resolve_call(fnty, pos_args, kw_args, literals=literals)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 1113, in resolve_call
    literals=literals)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/context.py", line 189, in resolve_function_type
    res = defn.apply(args, kws)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/templates.py", line 207, in apply
    sig = generic(args, kws)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/npydecl.py", line 235, in generic
    assert len(sig.args) == 3
InternalError: 'NoneType' object has no attribute 'args'
[1] During: typing of intrinsic-call at cryosparc2_compute/newfourier.py (29)
--%<-----------------------------------------------------------------

File "cryosparc2_compute/newfourier.py", line 29

Failed at nopython (nopython frontend)
Internal error at <numba.typeinfer.IntrinsicCallConstraint object at 0x7fe89f660410>:
--%<-----------------------------------------------------------------
Traceback (most recent call last):
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 137, in propagate
    constraint(typeinfer)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 501, in __call__
    self.resolve(typeinfer, typeinfer.typevars, fnty=self.func)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/errors.py", line 265, in new_error_context
    six.reraise(type(newerr), newerr, sys.exc_info()[2])
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/errors.py", line 259, in new_error_context
    yield
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 501, in __call__
    self.resolve(typeinfer, typeinfer.typevars, fnty=self.func)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 441, in resolve
    sig = typeinfer.resolve_call(fnty, pos_args, kw_args, literals=literals)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typeinfer.py", line 1113, in resolve_call
    literals=literals)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/context.py", line 189, in resolve_function_type
    res = defn.apply(args, kws)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/templates.py", line 207, in apply
    sig = generic(args, kws)
  File "/gs1/RTS/EM/Software/CryoSPARCv2/cryosparc2_worker/deps/anaconda/lib/python2.7/site-packages/numba/typing/npydecl.py", line 235, in generic
    assert len(sig.args) == 3
InternalError: 'NoneType' object has no attribute 'args'
[1] During: typing of intrinsic-call at cryosparc2_compute/newfourier.py (29)
--%<-----------------------------------------------------------------

File "cryosparc2_compute/newfourier.py", line 29