JupyterHub DICOM file access issue

64 views
Skip to first unread message

Nadya Shusharina

unread,
Mar 6, 2023, 6:26:51 PM3/6/23
to xnat_discussion
Hi, 
I am trying to run example notebooks on my data in XNAT/JupyterHub.
When I open the terminal JupyterHub, the .dcm files are acceessible under
/data/projects/[PROJECTNAME]/experiments/[EXPERIMENTID]/SCANS/[SCANID]/DICOM/*.dcm
However, there is an error trying to retrieve the files from the Jupyter notebook XNATpy.ipynb: 

file_object = session.projects['NNN'].subjects['NNN'].experiments['NNN'].scans['NNN'].resources['DICOM'].files[0]   

There are no python errors in the notebook prior to this, connection to XNAT is ok.  Error message is below.

Thank you,
Nadya

File /opt/conda/lib/python3.10/site-packages/xnat/core.py:783, in XNATBaseListing.__getitem__(self, item) 781 def __getitem__(self, item): 782 if isinstance(item, (int, slice)): --> 783 return self.listing[item] 785 try: 786 return self.data[item] File /opt/conda/lib/python3.10/site-packages/xnat/core.py:767, in XNATBaseListing.listing(self) 762 @property 763 def listing(self): 764 """ 765 The listing view of the data 766 """ --> 767 return self.data_maps[3] File /opt/conda/lib/python3.10/site-packages/xnat/core.py:59, in caching.<locals>.wrapper(self) 53 def wrapper(self): 54 # We use self._cache here, in the decorator _cache will be a member of 55 # the objects, so nothing to worry about 56 # pylint: disable=protected-access 57 if not self.caching or name not in self._cache: 58 # Compute the value if not cached ---> 59 self._cache[name] = func(self) 61 return self._cache[name] File /opt/conda/lib/python3.10/site-packages/xnat/core.py:928, in XNATListing.data_maps(self) 926 if self.secondary_lookup_field is not None: 927 secondary_lookup_value = x.get(self.secondary_lookup_field) --> 928 new_object = self.xnat_session.create_object(x['URI'], 929 type_=xsi_type, 930 id_=x['ID'], 931 fieldname=x.get('fieldname'), 932 **{self.secondary_lookup_field: secondary_lookup_value}) 933 if secondary_lookup_value in key_map: 934 non_unique.add(secondary_lookup_value) File /opt/conda/lib/python3.10/site-packages/xnat/session.py:1021, in BaseXNATSession.create_object(self, uri, type_, fieldname, **kwargs) 1018 overwrites = None 1020 if cls.SECONDARY_LOOKUP_FIELD not in kwargs: -> 1021 kwargs[cls.SECONDARY_LOOKUP_FIELD] = datafields.get(cls.SECONDARY_LOOKUP_FIELD) 1023 obj = cls(uri, self, datafields=datafields, fieldname=fieldname, overwrites=overwrites, **kwargs) 1025 self._cache['__objects__'][uri, fieldname] = obj AttributeError: 'NoneType' object has no attribute 'get'


Andrew Lassiter

unread,
Mar 15, 2023, 11:14:13 AM3/15/23
to xnat_discussion
Hi Nadya,

I'm unable to reproduce this error. What version of XNATpy are you using? We collaborated with the XNATpy developers to add support for XNAT/Jupyterhub integration which was released with version 0.4.3 of XNATpy. 

Thanks,
Andy

Hakim Achterberg

unread,
Mar 16, 2023, 2:55:26 AM3/16/23
to xnat_discussion
Hi Nadya, Andy,

Sorry for the delay, bit of a crazy week for me. I just verified that this is actually a bug introduced in 0.5.0 from when we tried to fix something else. I am working on a fix, for now I am afraid you can either use 0.4.3 or wait for a bugfix release.

Kind regards,
Hakim

Nadya Shusharina

unread,
Jun 14, 2023, 3:04:52 PM6/14/23
to xnat_discussion
Hi Hakim,

I was wondering if the bugfix was released for 0.5.0 version.

Thank you,
Nadya

Reply all
Reply to author
Forward
0 new messages