aicsimageio icon indicating copy to clipboard operation
aicsimageio copied to clipboard

Doc fix: update advice regarding scene iteration

Open GabeMedrash opened this issue 4 years ago • 0 comments

System and Software

Not important for this report.

Description

The docs specifically advise to iterate scenes via for id in image.scenes versus for i in range(len(image.scenes)). If there was previously an implementation detail that necessitated this advice, it seems that no longer exists. In fact, the scene naming heuristics used internally by the package may produce duplicate scene identifiers, making the given advice the exact opposite of how scenes should be safely iterated.

From @JacksonMaxfield:

I would generally use the for i in range(len(image.scenes)) because there can be duplicate scene id names i.e. scene 0 id is A and scene 1 id is A if you [call] set_scene with A it will choose the first one, where as if you call set_scene with 0 it will choose the 0th scene and if you call set_scene with 1 it will choose the 1st scene

Expected Behavior

N/A

Reproduction

N/A

Environment

Any additional information about your environment

GabeMedrash avatar Aug 23 '21 20:08 GabeMedrash