Skip to content

Commit

Permalink
Merge branch 'develop' into quick-start-czi-reader
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault authored Nov 2, 2023
2 parents efb99c3 + e484e1f commit 0abad27
Show file tree
Hide file tree
Showing 35 changed files with 263 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
env:
maven_commands: install # default is install
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
Expand All @@ -33,7 +33,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Retrieve version
id: get_version
run: |
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Retrieve version
id: get_version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Release artifacts
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion components/bio-formats-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,15 @@ else if (store.getImageCount() > 1) {
store.setPixelsSizeC(new PositiveInteger(channels*imp.getNChannels()), 0);
store.setPixelsSizeT(new PositiveInteger(imp.getNFrames()), 0);

try {
// if a subset of the data was opened, the number of Channels
// in the OME-XML may not match the ImagePlus channel count
// channel count mismatches can cause problems when actually writing pixels
service.removeChannels(service.getOMEMetadata(store), 0, imp.getNChannels());
}
catch (ServiceException e) {
}

if (store.getImageID(0) == null) {
store.setImageID(MetadataTools.createLSID("Image", 0), 0);
}
Expand Down
2 changes: 1 addition & 1 deletion components/bio-formats-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
2 changes: 1 addition & 1 deletion components/bundles/bioformats_package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/forks/turbojpeg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/formats-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions components/formats-api/src/loci/formats/CoreMetadataList.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
6 changes: 3 additions & 3 deletions components/formats-api/src/loci/formats/MetadataList.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* #%L
* primary reader and writer APIs
* Top-level reader and writer APIs
* %%
* Copyright (C) 2018 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
Expand All @@ -9,13 +9,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
2 changes: 1 addition & 1 deletion components/formats-bsd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions components/formats-bsd/src/loci/formats/in/OBFReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Expand Down
3 changes: 3 additions & 0 deletions components/formats-bsd/src/loci/formats/in/OMETiffReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,9 @@ else if (t == 0) {
if (firstFile == null ||
(testFile != null && !info[s][0].reader.isThisType(testFile)))
{
if (info[s][0].id != null && failOnMissingTIFF()) {
throw new FormatException("Invalid file (may be corrupted): " + info[s][0].id);
}
LOGGER.warn("{} is not a valid OME-TIFF", info[s][0].id);
info[s][0].id = currentId;
info[s][0].exists = false;
Expand Down
35 changes: 21 additions & 14 deletions components/formats-bsd/src/loci/formats/in/SlideBook7Reader.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@

/*
* #%L
* OME Bio-Formats package for reading and converting biological file formats.
* BSD implementations of Bio-Formats readers and writers
* %%
* Copyright (C) 2005 - 2022 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
* - Glencoe Software, Inc.
* - University of Dundee
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/

Expand Down
14 changes: 11 additions & 3 deletions components/formats-bsd/src/loci/formats/out/DicomWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,28 @@ public void saveBytes(int no, byte[] buf, int x, int y, int w, int h)
{
checkParams(no, buf, x, y, w, h);

int resolutionIndex = getIndex(series, resolution);
int thisTileWidth = tileWidth[resolutionIndex];
int thisTileHeight = tileHeight[resolutionIndex];

MetadataRetrieve r = getMetadataRetrieve();
if ((!(r instanceof IPyramidStore) ||
((IPyramidStore) r).getResolutionCount(series) == 1) &&
!isFullPlane(x, y, w, h))
{
throw new FormatException("DicomWriter does not allow tiles for non-pyramid images");
}
else if (x % thisTileWidth != 0 || y % thisTileHeight != 0 ||
(w != thisTileWidth && x + w != getSizeX()) ||
(h != thisTileHeight && y + h != getSizeY()))
{
throw new FormatException("Tile too small, expected " + thisTileWidth + "x" + thisTileHeight +
". Setting the tile size to " + getSizeX() + "x" + getSizeY() + " or smaller may work.");
}
checkPixelCount(false);

boolean first = x == 0 && y == 0;
boolean last = x + w == getSizeX() && y + h == getSizeY();
int resolutionIndex = getIndex(series, resolution);

// the compression type isn't supplied to the writer until
// after setId is called, so metadata that indicates or
Expand Down Expand Up @@ -264,8 +274,6 @@ public void saveBytes(int no, byte[] buf, int x, int y, int w, int h)

byte[] paddedBuf = null;

int thisTileWidth = tileWidth[resolutionIndex];
int thisTileHeight = tileHeight[resolutionIndex];
int thisTilePixels = thisTileWidth * thisTileHeight;

// pad the last row and column of tiles to match specified tile size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ public JPEGTurboServiceImpl() {
logger = Logger.getLogger(NATIVE_LIB_CLASS);
logger.setLevel(Level.SEVERE);
if (!libraryLoaded) {
NativeLibraryUtil.loadNativeLibrary(TJ.class, "turbojpeg");
libraryLoaded = true;
libraryLoaded = NativeLibraryUtil.loadNativeLibrary(TJ.class, "turbojpeg");
if (!libraryLoaded) {
throw new RuntimeException("TurboJPEG could not be loaded");
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions components/formats-bsd/src/loci/formats/tiff/IFD.java
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ public int getPixelType() throws FormatException {
case 24:
return FormatTools.FLOAT;
case 64:
if (bitFormat != 3) {
throw new FormatException("64-bit int data not supported");
}
return FormatTools.DOUBLE;
case 32:
if (bitFormat == 3) return FormatTools.FLOAT;
Expand Down
3 changes: 3 additions & 0 deletions components/formats-bsd/src/loci/formats/tiff/TiffParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ public Object getIFDValue(TiffIFDEntry entry) throws IOException {
offset &= 0xffffffffL;
offset += 0x100000000L;
}
if (offset >= in.length()) {
return null;
}
in.seek(offset);
}

Expand Down
11 changes: 5 additions & 6 deletions components/formats-bsd/test/spec/AbstractTest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/*
* #%L
* Tests for OME-XML specification classes.
* BSD implementations of Bio-Formats readers and writers
* %%
* Copyright (C) 2010-2013 Glencoe Software, Inc.
* Copyright (C) 2005 - 2017 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
* - Glencoe Software, Inc.
* - University of Dundee
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand All @@ -24,10 +27,6 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of any organization.
* #L%
*/

Expand Down
4 changes: 2 additions & 2 deletions components/formats-gpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ome</groupId>
<artifactId>pom-bio-formats</artifactId>
<version>7.0.1-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>

Expand Down Expand Up @@ -153,7 +153,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230227</version>
<version>20231013</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
Expand Down
Loading

0 comments on commit 0abad27

Please sign in to comment.