Skip to content

Commit 7048e16

Browse files
Add test file for bioformats metadata retrieval
1 parent e79d452 commit 7048e16

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Following is a testing script for the retrieval of metadata methods in imcflibs.imagej.bioformats.
2+
3+
Copy the following code to a Fiji that has the release `python-imcflibs-1.5.0.jar` in the /jars directory.
4+
5+
Add the source folder and the names of the files under the corresponding lines, and run the script. If the metadata is printed in Fiji output, the methods are working as intended
6+
7+
```
8+
import os
9+
from imcflibs.imagej import bioformats
10+
from ij import IJ
11+
12+
# Testing for the metadata retrieval through Bioformats
13+
14+
# Add directory path here that contains the files you wish to test for
15+
path = r"U:\\VAMP\\rohang0000\\stage_test"
16+
file_path_1 = os.path.join(path, "DON_25922_20250201_25922_2_01.vsi")
17+
file_path_2 = os.path.join(path, "DON_25922_20250201_25922_2_02.vsi")
18+
file_path_3 = os.path.join(path, "DON_25922_20250201_25922_2_03.vsi")
19+
20+
metadata = bioformats.get_metadata_from_file(file_path_1)
21+
print(metadata.unit_width)
22+
print(metadata.unit)
23+
print(metadata.channel_count)
24+
25+
# Stage metadata and coordinates test for a list of vsi files
26+
fnames = [file_path_1, file_path_2, file_path_3]
27+
28+
metadata_stage = bioformats.get_stage_coords(fnames)
29+
30+
print(metadata_stage.image_calibration)
31+
print(metadata_stage.stage_coordinates_x)
32+
print(metadata_stage.stage_coordinates_y)
33+
print(metadata_stage.stage_coordinates_z)
34+
```

0 commit comments

Comments
 (0)