Image registration fails on remote server

I am using starfish to analyze RNAscope images that involve 3 rounds of imaging of DAPI+4 spot channels. I can get the pipeline to work on my local computer, but when I try running the exact same script on a Jupyter notebook hosted on a remote server, the image registration fails. Below is my code and the full output error that is categorized as “AttributeError: ‘DataArray’ object has no attribute ‘flags’.” Stack overflow has so far been unhelpful in diagnosing the problem so if anyone knows why this is happening I would be very appreciative. Thanks!

Loaded packages:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

from typing import Optional, Tuple
from IPython import get_ipython
from PIL import Image

import starfish
from starfish import Experiment
from starfish.types import Axes
from starfish.image import Filter
from starfish.image import ApplyTransform, LearnTransform
from starfish.spots import FindSpots, DecodeSpots
from starfish.types import Features, Axes
from starfish.image import Segment
from starfish.spots import AssignTargets
from starfish import ExpressionMatrix
from starfish import ImageStack
from starfish import FieldOfView, display

#%gui qt5 Napari doesn’t work on remote server.
%config Completer.use_jedi = False

Image registration code:
#Define empty vector to put registered primary images into
prim_proj_regis =

#Also make a vector of just R1 DAPI images
projected_z_stacks_nuc_R1 =

for key in range(0,len(list_of_keys)):
#Select FOV DAPI series
FOV_nuclei = projected_z_stacks_nuc[key]

#Choose R1 DAPI from that FOV
nuclei_zproj_ref = FOV_nuclei.sel({Axes.ROUND: 0, Axes.CH: 0}) 

#Define function to learn transformation of R1 to R2 and R3
learn_translation = LearnTransform.Translation(reference_stack = nuclei_zproj_ref, axes=Axes.ROUND, upsampling = 1) 
#Apply that transformation to the three z-projected DAPI images from each round of that FOV (input)
transforms_list = = FOV_nuclei)

#Then apply transformation to the primary data
warp = ApplyTransform.Warp()
FOV_prim = projected_z_stacks_prim[key]
FOV_prim_registered = = FOV_prim, transforms_list = transforms_list)

Error:Preformatted text
AttributeError Traceback (most recent call last)
24 learn_translation = LearnTransform.Translation(reference_stack = nuclei_zproj_ref, axes=Axes.ROUND, upsampling = 1)
25 #Apply that transformation to the three z-projected DAPI images from each round of that FOV (input)
—> 26 transforms_list = = FOV_nuclei)
28 #Then apply transformation to the primary data

~/.local/lib/python3.6/site-packages/starfish/core/pipeline/ in helper(*args, **kwargs)
21 @functools.wraps(func)
22 def helper(*args, **kwargs):
—> 23 result = func(*args, **kwargs)
24 if result is not None:
25 method_class_str = str(args[0].class)

~/.local/lib/python3.6/site-packages/starfish/core/image/_registration/LearnTransform/ in run(self, stack, verbose, *args)
67 shift, error, phasediff = register_translation(src_image=target_image,
68 target_image=reference_image,
—> 69 upsample_factor=self.upsampling)
70 if verbose:
71 print(f"For {self.axes}: {a}, Shift: {shift}, Error: {error}")

~/.local/lib/python3.6/site-packages/skimage/feature/ in register_translation(src_image, target_image, upsample_factor, space, return_error)
167 # real data needs to be fft’d.
168 elif space.lower() == ‘real’:
–> 169 src_freq = fft.fftn(src_image)
170 target_freq = fft.fftn(target_image)
171 else:

~/.local/lib/python3.6/site-packages/scipy/fft/ in ua_function(method, args, kwargs)
21 if fn is None:
22 return NotImplemented
—> 23 return fn(*args, **kwargs)

~/.local/lib/python3.6/site-packages/scipy/fft/_pocketfft/ in c2cn(forward, x, s, axes, norm, overwrite_x, workers)
144 Return multidimensional discrete Fourier transform.
145 “”"
–> 146 tmp = _asfarray(x)
148 shape, axes = _init_nd_shape_and_axes(tmp, s, axes)

~/.local/lib/python3.6/site-packages/scipy/fft/_pocketfft/ in _asfarray(x)
94 # Always align input
—> 95 return np.array(x, copy=not x.flags[‘ALIGNED’])
97 def _datacopied(arr, original):

~/.local/lib/python3.6/site-packages/xarray/core/ in getattr(self, name)
231 return source[name]
232 raise AttributeError(
–> 233 “{!r} object has no attribute {!r}”.format(type(self).name, name)
234 )

AttributeError: ‘DataArray’ object has no attribute ‘flags’

Most likely the issue is due to the scikit-image version. Make sure the version on your remote server is 0.15.0 (pip install scikit-image==0.15.0).

Reference to same issue:

Apologies for not seeing it had already been posted on github. That fixed the problem. Thanks so much.