Closed DrJesseHansen closed 1 week ago
Hi Jesse!
I updated the clustering workflow 5 days ago (TomoTwin 0.8). The tutorial you follow is written for that version. However, you probably still use TomoTwin 0.7.x, right?
Could you please update (TomoTwin + napari)? You also need to recalculate the umap once you updated (See release notes: https://github.com/MPI-Dortmund/tomotwin-cryoet/releases/tag/v0.8.0)
Best, Thorsten
ah okay, thanks Thorsten!
Our IT did install the latest ver of tomotwin but apparently only alongside python 3.11. (my colleague is concurrently posting on your github with issues we are having). Looks like our IT is working on it.
thanks for the reply, and thanks for the cool program! Have been a user of crYOLO for many years (specifically filament tracing).
Jesse
I remember you :-) Glad that you want to play around with TomoTwin.
I hope we can get everything working smoothly for you.
hi Thorsten,
We can't get it running yet with the new tomotwin, but I'd like to try to continue with the old version for now. However the tutorial is for the new version. Could you please tell me what I should have done (with the old version) in order to not get this error about the label mask not specified? I'm guessing there is either an extra step to generate that label mask, or an extra flag during the UMAP manifold step.
thanks!
Jesse
Not sure what version of TomoTwin / napari-tomotwin you have installed.
But this should be the documentation with the "old" workflow:
Hey again,
I don't want to bother you too much with this because it may just be an issue with the old version that is now fixed. So please feel free to tell me to wait for the new ver and stop fiddling with the old ver problems.
First I should say that I (once again) am using this on filaments. I'm using a WARP tomogram (CTF corrected, so I guess that's why the contrast isn't great. Should I instead use isonet tomo, or AREtomo output?).
Your old workflow did indeed work, however there are some new issues. In the image below, I can see things as expected. When I click on the actin filament it gives me the red circle for where actin is. I then make a lasso there to select the actin but it ends up selecting a ton of stuff that ISN'T actin.
Nonetheless, when I try to then use the slider to go through the tomo slices to look at things then I get this numpy error (bottom right). I have pasted the output from the traceback below.
thanks again!
J
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/_qt/widgets/qt_dims_slider.py:142, in QtDimSliderWidget._value_changed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/components/dims.py:290, in Dims.set_current_step(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....5), order=(0, 1, 2), axis_labels=('0', '1', '2')), axis=0, value=51) 288 full_current_step = list(self.current_step) 289 full_current_step[axis] = step --> 290 self.current_step = full_current_step full_current_step = [51, 359, 255] self.current_step = (50, 359, 255) self = Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 124.0, 1.0), (0.0, 720.0, 1.0), (0.0, 512.0, 1.0)), current_step=(50, 359, 255), order=(0, 1, 2), axis_labels=('0', '1', '2')) 291 else: 292 full_current_step = list(self.current_step)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/evented_model.py:326, in EventedModel.setattr(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....5), order=(0, 1, 2), axis_labels=('0', '1', '2')), name='current_step', value=[51, 359, 255]) 323 if areequal(after, before): 324 # no change 325 return --> 326 emitter(value=after) # emit event emitter = <napari.utils.events.event.EventEmitter object at 0x7f2e0cb4b4c0> after = (51, 359, 255) 328 # emit events for any dependent computed properties as well 329 for dep, value in before_deps.items():
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:768, in EventEmitter.call(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:806, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:795, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/components/viewer_model.py:393, in ViewerModel._update_layers(self=Viewer(camera=Camera(center=(0.0, 328.4855323332...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}), layers=[<Image layer 'hybrid_TS_02_ts_001' at 0x7f2d205... layer 'cluster_ids_in_space' at 0x7f2cfe74e860>])
391 layers = layers or self.layers
392 for layer in layers:
--> 393 layer._slice_dims(
layer = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860>
self.dims.order = (0, 1, 2)
self = Viewer(camera=Camera(center=(0.0, 328.4855323332283, 356.38443931697844), zoom=0.71846005090166, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(50.0, 944.3862098122253, 731.4923087478355), scaled=True, size=10, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 124.0, 1.0), (0.0, 720.0, 1.0), (0.0, 512.0, 1.0)), current_step=(50, 359, 255), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'hybrid_TS_02_ts_001' at 0x7f2d20580bb0>, <Labels layer '...001_embeddings_label_mask.mrci' at 0x7f2d20178850>, <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860>], help='use <1> for activate the label eraser, use <2> for activate the paint brush, use <3> for activate the fill bucket, use <4> for pick mode', status={'layer_base': 'hybrid_TS_02_ts_001_embeddings_label_mask.mrci', 'source_type': 'plugin', 'plugin': 'Box Manager', 'coordinates': ' [50 944 731]'}, tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[<function load_umap.
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1076, in Layer._slice_dims(self=<Labels layer 'cluster_ids_in_space'>, point=(51.0, 359.0, 255.0), ndisplay=2, order=(0, 1, 2)) 1073 self._slice_input = slice_input 1075 # Update the point values -> 1076 self.refresh() self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> 1077 self._reset_editable()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1264, in Layer.refresh(self=<Labels layer 'cluster_ids_in_space'>, event=None) 1262 """Refresh all layer data based on current view slice.""" 1263 if self.visible: -> 1264 self.set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> 1265 self.events.set_data() 1266 self._update_thumbnail()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1029, in Layer.set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 1027 def set_view_slice(self): 1028 with self.dask_optimized_slicing(): -> 1029 self._set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860>
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:834, in _ImageBase._set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 830 # Load our images, might be sync or async. 831 data = self._SliceDataClass( 832 self, image_indices, image, thumbnail_source 833 ) --> 834 self._load_slice(data) data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f2e04c5df00> self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> 835 if self._should_calc_clims: 836 self.reset_contrast_limits_range()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:862, in _ImageBase._load_slice(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:886, in _ImageBase._on_data_loaded(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:144, in ImageSlice.on_loaded(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:102, in ImageSlice._set_raw_images(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_view.py:78, in ImageView.raw(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:1120, in _weakref_hide._raw_to_displayed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:999, in Labels._raw_to_displayed(self=<Labels layer 'cluster_ids_in_space'>, raw=<class 'numpy.ndarray'> (720, 512) uint64, data_slice=(slice(0, 720, None), slice(0, 512, None))) 996 if labels_to_map.size == 0: 997 return self._cached_mapped_labels[data_slice] --> 999 mapped_labels = self._map_labels_to_colors(labels_to_map) labels_to_map = <class 'numpy.ndarray'> (117380,) uint64 self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> 1001 if update_mask is not None: 1002 self._cached_mapped_labels[data_slice][update_mask] = mapped_labels
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:1036, in Labels._map_labels_to_colors(self=<Labels layer 'cluster_ids_in_space'>, labels_to_map=<class 'numpy.ndarray'> (117380,) uint64) 1030 none_color_index = self._label_color_index[None] 1032 if upper_bound_n_unique_labels < 65536: 1033 mapping = np.array( 1034 [ 1035 self._label_color_index.get(label_id, none_color_index) -> 1036 for label_id in range(min_label_id, max_label_id + 1) np = <module 'numpy' from '/mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/numpy/init.py'> none_color_index = 0.5 self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> self._label_color_index = {0: 0.16666667, 2: 0.8333334, None: 0.5} min_label_id = 0 max_label_id = 7 1037 ] 1038 ) 1039 mapped_labels = mapping[labels_to_map - min_label_id] 1040 else:
TypeError: 'numpy.float64' object cannot be interpreted as an integer`
Hi Jesse,
can you quickly upload this tomo and share it with me and I will give it a try?
A few comments:
Regarding the exception: Lets see if I can reproduce it with the latest version.
Ragarding the tomo: Warp is fine for now. We have better experiences with imod reconstructed tomograms. However, people even used it successfully on denoised tomos from cryocare.
Best, Thorsten
hi,
here's the tomogram https://seafile.ist.ac.at/f/1480f049fff94c408df4/
thanks for the feedback. Actually I'm hoping to find little blobby things bound to the filaments, so even if it doesn't find filaments I'd be alright here.
I'll test it out with tomos generated from WARP, isonet, and AREtomo and see which works best.
thanks again!
Jesse
/mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/l
I just realize that something with your setup seems to be odd. When you follow my instructions, you should end-up with napari 0.4.17. On purpose because the latest 0.4.18 has breaking changes that gonna be fixed with the next napari release. It looks like you don't use conda at all. Can you tell your cluster adminstrators that they should setup a conda environment as described in the documentation? We do that on all our clusters (local) and the super computers of the MPG.
thanks Thorsten, I just passed along the message to our IT.
Jesse
hi,
I received a response from our IT regarding the Conda. Also I will test the new installation and report back here what happens.
From IT:
conda is not our first choice when installing python packages, because I have seen several issues of conda on Debian/Ubuntu, usually some incompatibilities with system libraries (libssl, libncurses libreadline, libtinfo, qt, etc, ...). Often old/outdated/incompatible versions are used. This is usually less of a problem with pip, because the native libraries are used.
Anyway, I managed to install tomotwin, by using conda. You can test it with module load tomotwin tomotwin_tools.py -h and python import cuml
seems to work fine on GTX1080 (it fails on older GPU's GTX980, K40)
I see now also some issues when installing napari through conda, e.g. it has gui issues when using through x2go. These gui issues do not occur when using napari installed with pip only (w/o conda).
I suspect that also this issue is related to the way how conda is packaging qt/opengl/mesa https://github.com/MPI-Dortmund/tomotwin-cryoet/issues/75
So if you are in contact with the developers, you might want to tell them that we would prefer a pip-based installation of (napari-)tomotwin.
I close this but I keep in mind that purely pip based installation is wished.
Dear Devs,
I am using tomotwin as part of napari 0.4.18. I am running in clustering mode. The pixel size of my tomogram is 11.06, note that I did try to use e2proc3d with fourier shrink as written in the tutorial. It appeared to execute the command, but when I use Imod's "header" Tool to examine the output I see that the pixel size is unchanged.
Nevertheless, I continued with the tomo at 11.06. It appeared to run through on the embedding without issue. Then it runs through the second part (Estimate UMAP manifold and Generate Embedding Mask) without issue either.
output: Read data Prepare data Fit umap on 400000 samples Transform complete dataset in 8 chunks with a chunksize of ~447678 Transform: Write embeedings to disk Write umap model to disk Calculate label mask and write it to disk Create embedding mask Done
I then open napari 0.4.18 along with the tomogram. As per the instructions I use the plugin to open and point to the UMAP path. "...embeddings.tumap". I click LOAD. I then get the error "label mask is not specified".
I can see tomotwin label mask in the upper right. It is a dropdown but it is greyed out so I cannot select anything. The field is currently empty.
In the output folder (TOMOTWIN/tomograms/out/clustering) I have the following files: ts_001_embeddings.tumap ts_001_embeddings_umap_model.pkl ts_001_embeddings_label_mask.mrci
thanks in advance!
Jesse