Problem with WholeSlideDataConfiguration ¶
By: antoniosantos on March 30, 2022, 12:51 a.m.
Good night dear. How is everything?
I have a problem to create the batch_iterator of the wholeslidedata library
Error \/
RegistrantNotRegisteredError Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 with createbatchiterator(mode=mode, userconfig=userconfig, cpus=cpus) as trainingbatchiterator:
2 pprint(trainingbatchiterator.dataset.annotationsperlabelperkey)
File D:\anaconda3\lib\site-packages\wholeslidedata\iterators.py:60, in createbatchiterator(userconfig, mode, batches, update, presets, cpus, context, determinstic, iteratorclass)
45 def createbatchiterator(
46 userconfig,
47 mode,
(...)
54 iteratorclass=BatchIterator,
55 ):
56 configbuilder = WholeSlideDataConfiguration.build(
57 userconfig=userconfig, modes=(mode,), buildinstances=False, presets=presets
58 )
---> 60 builds = WholeSlideDataConfiguration.build(
61 userconfig=userconfig, modes=(mode,), presets=presets
62 )
64 updatequeue = Queue() if update else None
66 batchcommander = BatchCommander(
67 configbuilder=configbuilder,
68 mode=mode,
69 resetindex=batches,
70 updatequeue=update_queue,
71 )
File D:\anaconda3\lib\site-packages\creationism\configuration\config.py:294, in Configuration.build(cls, userconfig, modes, buildinstances, buildkey, presets, externalconfigurations, searchpaths, *args, kwargs)
292 resolvenone(configuration)
293 if buildinstances:
--> 294 return configuration.buildinstances(externalconfigurations=externalconfigurations, buildkey=buildkey)
295 return configuration**
File D:\anaconda3\lib\site-packages\creationism\configuration\config.py:320, in Configuration.buildinstances(self, externalconfigurations, buildkey)
317 buildkeys = buildkeys[:index]
319 for key in buildkeys:
--> 320 build[mode][key] = build[mode][key].build(configurations)
322 build = build.cast()
323 if build_key:
File D:\anaconda3\lib\site-packages\creationism\configuration\config.py:242, in ConfigDict.build(self, configuration)
231 return ConfigObject(
232 buildregistrantobject(
233 self,
(...)
238 )
239 )
241 if module is not None and attribute is not None:
--> 242 return ConfigObject(build_object(self, module, attribute))
244 return self
File D:\anaconda3\lib\site-packages\creationism\configuration\config.py:348, in buildobject(builds, module, attribute)
346 for attr in attributes:
347 attribute = getattr(attribute, attr)
--> 348 return attribute(builds.cast())
File D:\anaconda3\lib\site-packages\wholeslidedata\dataset.py:132, in WholeSlideDataSet.init(self, mode, associations, labels, renamedlabels, loadimages, copypath)
130 self.loadimages = loadimages
131 self.copypath = copypath
--> 132 super().init(mode, associations, labels, renamedlabels)
File D:\anaconda3\lib\site-packages\wholeslidedata\dataset.py:40, in DataSet.init(self, mode, associations, labels, renamedlabels)
37 self.labels = labels
38 self.renamedlabels = renamedlabels
---> 40 self.data = self.open(self.associations)
41 self.samplereferences, self.allsamplereferences = self.initsamples(self.data)
42 self.alllabels = Labels.create(list(self.allsample_references.keys()))
File D:\anaconda3\lib\site-packages\wholeslidedata\dataset.py:144, in WholeSlideDataSet.open(self, associations)
137 data[filekey] = {
138 WholeSlideDataSet.IMAGESIDENTIFIER: dict(),
139 WholeSlideDataSet.ANNOTATIONSIDENTIFIER: dict(),
140 }
141 for wsiindex, wsifile in enumerate(associatedfiles[WholeSlideImageFile]):
142 data[filekey][WholeSlideDataSet.IMAGESIDENTIFIER][
143 wsiindex
--> 144 ] = self.openimage(wsifile)
145 for wsaindex, wsafile in enumerate(
146 associatedfiles[WholeSlideAnnotationFile]
147 ):
148 data[filekey][WholeSlideDataSet.ANNOTATIONSIDENTIFIER][
149 wsaindex
150 ] = self.openannotation(wsafile)
File D:\anaconda3\lib\site-packages\wholeslidedata\dataset.py:157, in WholeSlideDataSet.openimage(self, wsifile)
155 wsifile.copy(self.copypath)
156 if self.loadimages:
--> 157 return wsifile.open()
158 return wsifile.path
File D:\anaconda3\lib\site-packages\wholeslidedata\source\files.py:86, in WholeSlideImageFile.open(self)
85 def open(self):
---> 86 return WholeSlideImage(self.path, self.imagebackend)
File D:\anaconda3\lib\site-packages\wholeslidedata\image\wholeslideimage.py:19, in WholeSlideImage.init(self, path, backend)
15 def init(
16 self, path: str, backend: WholeSlideImageBackend = 'openslide',
17 ) -> None:
18 self.path = Path(path)
---> 19 self.backend = WholeSlideImageBackend.create(backend, path=self.path)
20 self.extension = self.path.suffix
22 self.shapes = self.backend.init_shapes()
File D:\anaconda3\lib\site-packages\creationism\registration\factory.py:64, in RegistrantFactory.create(cls, registrantname, returntype, args, kwargs)
55 @classmethod
56 def create(
57 cls,
(...)
61 kwargs
62 ):
63 if cls._REGISTER is None:
---> 64 raise RegistrantNotRegisteredError(
65 cls=cls,
66 registrant_name=registrant_name,
67 register=cls._REGISTER,
68 )
70 if issubclass(type(registrant_name), cls):
71 return registrant_name*
RegistrantNotRegisteredError:
Registrant 'openslide' is not found in the register of class 'WholeSlideImageBackend' with an empty register.
Can anybody help me? I've already installed openslide and I'm using ubuntu as the operating system and put the file path correctly but the error still persists