MPI-Dortmund / tomotwin-cryoet

cryo-ET particle picking by representation and metric learning
Mozilla Public License 2.0
30 stars 6 forks source link

Label mask is not specificed #86

Closed DrJesseHansen closed 1 week ago

DrJesseHansen commented 9 months ago

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

thorstenwagner commented 9 months 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

DrJesseHansen commented 9 months ago

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

thorstenwagner commented 9 months ago

I remember you :-) Glad that you want to play around with TomoTwin.

I hope we can get everything working smoothly for you.

DrJesseHansen commented 9 months ago

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

thorstenwagner commented 9 months ago

Not sure what version of TomoTwin / napari-tomotwin you have installed.

But this should be the documentation with the "old" workflow:

https://tomotwin-cryoet--71.org.readthedocs.build/en/71/tutorials/tutorials_overview.html#load-data-for-clustering-in-napari

DrJesseHansen commented 9 months ago

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

image

`--------------------------------------------------------------------------- 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=, value=51) 137 def _value_changed(self, value): 138 """Slider changed to this new value. 139 140 We split this out as a separate function for perfmon. 141 """ --> 142 self.dims.set_current_step(self.axis, value) self.axis = 0 value = 51 self.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')) self = <napari._qt.widgets.qt_dims_slider.QtDimSliderWidget object at 0x7f2d202be9e0>

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=, *args=(), **kwargs={'value': (51, 359, 255)}) 765 self._block_counter.update([cb]) 766 continue --> 768 self._invoke_callback(cb, event if pass_event else None) event = self = <napari.utils.events.event.EventEmitter object at 0x7f2e0cb4b4c0> cb = <bound method ViewerModel._update_layers of 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..get_event at 0x7f2cde9e5fc0>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7f2e19272830>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})> pass_event = False 769 if event.blocked: 770 break

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=, cb=, event=None) 804 self.disconnect(cb) 805 return --> 806 _handle_exception( self = <napari.utils.events.event.EventEmitter object at 0x7f2e0cb4b4c0> event = None cb = <bound method ViewerModel._update_layers of 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..get_event at 0x7f2cde9e5fc0>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7f2e19272830>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})> (cb, event) = (<bound method ViewerModel._update_layers of 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..get_event at 0x7f2cde9e5fc0>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7f2e19272830>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})>, None) 807 self.ignore_callback_errors, 808 self.print_callback_errors, 809 self, 810 cb_event=(cb, event), 811 )

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=, cb=, event=None) 793 cb(event) 794 else: --> 795 cb() cb = <bound method ViewerModel._update_layers of 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..get_event at 0x7f2cde9e5fc0>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7f2e19272830>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={})> 796 except Exception as e: # noqa: BLE001 797 # dead Qt object with living python pointer. not importing Qt 798 # here... but this error is consistent across backends 799 if ( 800 isinstance(e, RuntimeError) 801 and 'C++' in str(e) 802 and str(e).endswith(('has been deleted', 'already deleted.')) 803 ):

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..get_event at 0x7f2cde9e5fc0>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[<function dims_scroll at 0x7f2e19272830>], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}) self.dims.ndisplay = 2 self.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')) 394 self.dims.point, self.dims.ndisplay, self.dims.order 395 ) 396 position = list(self.cursor.position) 397 for ind in self.dims.order[: -self.dims.ndisplay]:

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=) 854 """Load the image and maybe thumbnail source. 855 856 Parameters 857 ---------- 858 data : Slice 859 """ 860 if self._slice.load(data): 861 # The load was synchronous. --> 862 self._on_data_loaded(data, sync=True) data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f2e04c5df00> self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> 863 else: 864 # The load will be asynchronous. Signal that our self.loaded 865 # property is now false, since the load is in progress. 866 self.events.loaded()

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=, sync=True) 883 data.transpose(self._get_order()) 885 # Pass the loaded data to the slice. --> 886 if not self._slice.on_loaded(data): self = <Labels layer 'cluster_ids_in_space' at 0x7f2cfe74e860> data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f2e04c5df00> self._slice = <napari.layers.image._image_slice.ImageSlice object at 0x7f2e0741bbb0> 887 # Slice rejected it, was it for the wrong indices? 888 return 890 # Notify the world.

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=, data=) 141 return False # data was not used. 143 # Display the newly loaded data. --> 144 self._set_raw_images(data.image, data.thumbnail_source) data.image = <class 'numpy.ndarray'> (720, 512) uint64 data.thumbnail_source = None self = <napari.layers.image._image_slice.ImageSlice object at 0x7f2d20295150> data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f2e04c5df00> 145 self.loaded = True 146 return True # data was used.

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=, image=<class 'numpy.ndarray'> (720, 512) uint64, thumbnail_source=<class 'numpy.ndarray'> (720, 512) uint64) 100 image = np.clip(image, 0, 1) 101 thumbnail_source = np.clip(thumbnail_source, 0, 1) --> 102 self.image.raw = image image = <class 'numpy.ndarray'> (720, 512) uint64 self.image = <napari.layers.image._image_view.ImageView object at 0x7f2d20295e70> self = <napari.layers.image._image_slice.ImageSlice object at 0x7f2d20295150> 104 # save a computation of view image if thumbnail and image is equal 105 if thumbnail_source is image:

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=, raw_image=<class 'numpy.ndarray'> (720, 512) uint64) 75 self._raw = raw_image 77 # Update the view image based on this new raw image. ---> 78 self._view = self.image_converter(raw_image) raw_image = <class 'numpy.ndarray'> (720, 512) uint64 self._view = <class 'numpy.ndarray'> (1, 1) float64 self = <napari.layers.image._image_view.ImageView object at 0x7f2d20295e70> self.image_converter = <bound method _weakref_hide._raw_to_displayed of <napari.layers.image.image._weakref_hide object at 0x7f2e0727ff70>>

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=, *args=(<class 'numpy.ndarray'> (720, 512) uint64,), kwarg={}) 1119 def _raw_to_displayed(self, *args, *kwarg): -> 1120 return self.obj()._raw_to_displayed(args, kwarg) args = (<class 'numpy.ndarray'> (720, 512) uint64,) kwarg = {} self.obj = <weakref at 0x7f2cdea20090; to 'Labels' at 0x7f2cfe74e860> self = <napari.layers.image.image._weakref_hide object at 0x7f2e0727ff70>

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`

thorstenwagner commented 9 months ago

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

DrJesseHansen commented 9 months ago

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

thorstenwagner commented 9 months ago

/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.

DrJesseHansen commented 9 months ago

thanks Thorsten, I just passed along the message to our IT.

Jesse

DrJesseHansen commented 9 months ago

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.

thorstenwagner commented 1 week ago

I close this but I keep in mind that purely pip based installation is wished.