Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leica TCS: make sure XML file is on used files list #4252

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

melissalinkert
Copy link
Member

Fixes #4229 (cc @mabruce).

As indicated in the original issue, showinf curated/leica-tcs/brian/Series002.xml without this change will not include Series002.xml on the used file list. With this change, it should be included on the used file list.

Note Series002.xml will appear at the end of the list, which at first glance looks like it should cause test failures due to the changes in #4172. However, the use of initFile(...) on the first TIFF file found in line 263 means that the initialized file in the end is not Series002.xml.

Adding to 8.0.1 since this should be safe for a patch release, but this could easily be moved to a later milestone.

@melissalinkert melissalinkert added this to the 8.0.1 milestone Nov 6, 2024
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note Series002.xml will appear at the end of the list, which at first glance looks like it should cause test failures due to the changes in #4172. However, the use of initFile(...) on the first TIFF file found in line 263 means that the initialized file in the end is not Series002.xml.

From the reader logic, the XML file is treated an optional file with additional metadata so appending it to the end of the used files list rather makes sense.

With the current release of Bio-Formats using the sample dataset listed in the description, the XML file is not included in the the used files list after initialization when selecting either a TIFF file of the XML file. With this change, the XML is added to the used files:

sbesson@Sebastiens-MacBook-Pro-3 bioformats % ./tools/showinf -nopix ~/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002.xml         

Checking file format [Leica TCS TIFF]
Initializing reader
TCSReader initializing /Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002.xml
Reading IFDs
Populating metadata
Checking comment style
Populating OME metadata
unknown creation date format:    0:00:00 00:00:00
Initialization took 0.064s

Reading core metadata
filename = /Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif
Used files:
	/Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif
	/Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch01.tif
	/Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002.xml
Series count = 1
Series #0 :
	Image count = 2
	RGB = false (1) 
	Interleaved = false
	Indexed = true (false color, 8-bit LUT: 3 x 256)
	Width = 512
	Height = 512
	SizeZ = 1
	SizeT = 1
	SizeC = 2
	Tile size = 512 x 512
	Thumbnail size = 128 x 128
	Endianness = intel (little)
	Dimension order = XYCTZ (certain)
	Pixel type = uint8
	Valid bits per pixel = 8
	Metadata complete = false
	Thumbnail series = false
	-----
	Plane #0 <=> Z 0, C 0, T 0
	Plane #1 <=> Z 0, C 1, T 0


Reading global metadata
Number of image files: 2

Reading metadata

When selecting the TIFF file as an input, the XML file is not returned by getUsedFiles, should this be the case?

sbesson@Sebastiens-MacBook-Pro-3 bioformats % ./tools/showinf -nopix ~/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif        
Checking file format [Leica TCS TIFF]
Initializing reader
TCSReader initializing /Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif
Reading IFDs
Populating metadata
Checking comment style
Populating OME metadata
unknown creation date format:    0:00:00 00:00:00
Initialization took 0.065s

Reading core metadata
filename = /Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif
Used files:
	/Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch00.tif
	/Users/sbesson/bf-data-repo/automated-tests/curated/leica-tcs/brian/Series002_z00_ch01.tif
Series count = 1
Series #0 :
	Image count = 2
	RGB = false (1) 
	Interleaved = false
	Indexed = true (false color, 8-bit LUT: 3 x 256)
	Width = 512
	Height = 512
	SizeZ = 1
	SizeT = 1
	SizeC = 2
	Tile size = 512 x 512
	Thumbnail size = 128 x 128
	Endianness = intel (little)
	Dimension order = XYCTZ (certain)
	Pixel type = uint8
	Valid bits per pixel = 8
	Metadata complete = false
	Thumbnail series = false
	-----
	Plane #0 <=> Z 0, C 0, T 0
	Plane #1 <=> Z 0, C 1, T 0


Reading global metadata
Number of image files: 2

Reading metadata

One inline question about a possible redundant call.

@@ -247,6 +247,7 @@ protected void initFile(String id) throws FormatException, IOException {
Arrays.sort(list);

boolean isXML = checkSuffix(id, XML_SUFFIX);
if (isXML) xmlFile = l.getAbsolutePath();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this effectively redundant with the call after initFile(new Location(parent, file).getAbsolutePath()) below?

@melissalinkert melissalinkert modified the milestones: 8.0.1, 8.1.0 Nov 11, 2024
@melissalinkert
Copy link
Member Author

This ended up being quite a bit more involved than I originally anticipated.

Last 3 commits here should mean that the XML file ends up on the used files list no matter what. However, the XML file being missing from the list meant that it wasn't being parsed at all - so several fixes were needed to address a NullPointerException and invalid OME-XML. That also means that a configuration change is needed for leica-tcs/brian only (see forthcoming PR).

Given the larger scope, I would be more comfortable with this going into 8.1.0 than 8.0.1, so have updated the milestone accordingly.

@sbesson sbesson self-requested a review November 12, 2024 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leica TCS: incorrect used files list
2 participants