Skip to content

Migrate tables from imagej-common #2

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

Merged
merged 42 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
08d5df9
Temporarily add imagej-common dependency for migration
imagejan Jul 17, 2018
9dd4a24
Add initial code, migrated from ij-core & ij-data
ctrueden Apr 18, 2014
0fe628f
Organize imports
ctrueden Apr 22, 2014
f966754
DefaultTableDisplay: handle double array as table
ctrueden Aug 4, 2014
64ddcf7
POM: update to the ImgLib2 2.0.1 release
ctrueden Oct 22, 2014
86b4cfa
Eliminate deprecated net.imglib2.meta usages
ctrueden Dec 23, 2014
ddad54e
Happy New Year 2015!
ctrueden Jan 16, 2015
46e2f31
Use the diamond syntax
ctrueden Jun 23, 2016
027eda4
Happy belated New Year 2016
ctrueden Jun 23, 2016
ef82fbf
Add column implementations for primitive types
awalter17 Feb 3, 2016
1301ddd
Add getType method to different columns
awalter17 Feb 3, 2016
88e4406
Add fill methods to columns
awalter17 Mar 16, 2016
49a3b24
Add table implementations for primitive types
awalter17 Mar 18, 2016
9e35d9a
Add tests for primitive table types and update ResultsTable test
awalter17 Jun 15, 2016
cdca805
Initialize appended/inserted Column backing arrays
awalter17 Jun 6, 2016
459436c
Modify removeRows to use zero indexing
awalter17 Jun 15, 2016
3e7f248
Add tests for remove/append a row/column to tables
awalter17 Jun 15, 2016
08f1fa5
Fix insert rows/columns operations
awalter17 Jun 10, 2016
9bde616
Add tests for inserting a row/column to ResultsTable
awalter17 Jun 15, 2016
b2bfdee
Fix removeColumns to allow removal of columns starting zero
awalter17 Jun 15, 2016
3a0fed8
Fix removeRows to start at specified row
awalter17 Jun 15, 2016
6280b4e
Add tests for removing/adding rows/columns to ResultsTable
awalter17 Jun 15, 2016
447c4ef
Clean up table test
awalter17 Jun 15, 2016
6af44ca
Create and implement PrimitiveColumn, and update tests
awalter17 Jun 15, 2016
ae714af
Add insert row/column test for remaining primitive tables
awalter17 Jun 17, 2016
7f2cb1e
Add tests for modifying multiple rows/columns
awalter17 Jun 17, 2016
21ce0f7
Make table methods more generic
awalter17 Jun 17, 2016
fc34d4f
Modify table API to allow GenericTable to store multiple column types
awalter17 Jun 22, 2016
5f3b823
Fix fill methods to update the size of the column
awalter17 Jun 27, 2016
c902d40
Override list add methods to update rowCount
awalter17 Jun 27, 2016
0227303
Add test for GenericTable
awalter17 Jun 27, 2016
809133c
Happy New Year 2016
ctrueden Sep 2, 2016
15980d2
Aggregate display of simple outputs into a table
ctrueden Sep 2, 2016
c74cb07
ResultsPostprocessor: handle Object outputs better
ctrueden Sep 2, 2016
1d39079
ResultsPostprocessor: do not require UIService
ctrueden Dec 21, 2016
8938075
Happy New Year 2017
ctrueden Jan 17, 2017
28ebe30
Update to imglib2 5.0.0
ctrueden Apr 24, 2018
8e3bf8f
Add TableService
awalter17 Apr 24, 2018
c127cd5
Add default table service
awalter17 Apr 27, 2018
f9a70f6
Remove ImageJ-specific table classes
imagejan Jul 17, 2018
48cd88d
Rename package net.imagej.table to org.scijava.table
imagejan Jul 17, 2018
0f80ce4
Replace usage of deprecated ClassUtils methods
imagejan Jul 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
559 changes: 559 additions & 0 deletions src/main/java/org/scijava/table/AbstractTable.java

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions src/main/java/org/scijava/table/BoolColumn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2009 - 2017 Board of Regents of the University of
* Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
* Institute of Molecular Cell Biology and Genetics.
* %%
* 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%
*/

package org.scijava.table;

import org.scijava.util.BoolArray;

/**
* Efficient implementation of {@link Column} for {@code boolean} primitives.
*
* @author Alison Walter
*/
public class BoolColumn extends BoolArray implements
PrimitiveColumn<boolean[], Boolean>
{

/** The column header. */
private String header;

public BoolColumn() {}

public BoolColumn(final String header) {
this.header = header;
}

// -- Column methods --

@Override
public String getHeader() {
return header;
}

@Override
public void setHeader(final String header) {
this.header = header;
}

@Override
public Class<Boolean> getType() {
return Boolean.class;
}

// -- PrimitiveColumn methods --

@Override
public void fill(final boolean[] values) {
setArray(values.clone());
setSize(values.length);
}

@Override
public void fill(final boolean[] values, final int offset) {
// Check if array has been initialized
if (getArray() == null) setArray(values.clone());
else {
System.arraycopy(values, 0, getArray(), offset, values.length);
}
setSize(values.length);
}

}
51 changes: 51 additions & 0 deletions src/main/java/org/scijava/table/BoolTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2009 - 2017 Board of Regents of the University of
* Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
* Institute of Molecular Cell Biology and Genetics.
* %%
* 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%
*/

package org.scijava.table;

/**
* A table of {@code boolean} values.
*
* @author Alison Walter
*/
public interface BoolTable extends Table<BoolColumn, Boolean> {

/** Gets the value of the given table cell. */
default boolean getValue(final int col, final int row) {
return get(col).getValue(row);
}

/** Sets the value of the given table cell. */
default void setValue(final int col, final int row, final boolean value) {
get(col).setValue(row, value);
}

}
89 changes: 89 additions & 0 deletions src/main/java/org/scijava/table/ByteColumn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2009 - 2017 Board of Regents of the University of
* Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
* Institute of Molecular Cell Biology and Genetics.
* %%
* 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%
*/

package org.scijava.table;

import org.scijava.util.ByteArray;

/**
* Efficient implementation of {@link Column} for {@code byte} primitives.
*
* @author Alison Walter
*/
public class ByteColumn extends ByteArray implements
PrimitiveColumn<byte[], Byte>
{

/** The column header. */
private String header;

public ByteColumn() {}

public ByteColumn(final String header) {
this.header = header;
}

// -- Column methods --

@Override
public String getHeader() {
return header;
}

@Override
public void setHeader(final String header) {
this.header = header;
}

@Override
public Class<Byte> getType() {
return Byte.class;
}

// -- PrimitiveColumn methods --

@Override
public void fill(final byte[] values) {
setArray(values.clone());
setSize(values.length);
}

@Override
public void fill(final byte[] values, final int offset) {
// Check if array has been initialized
if (getArray() == null) setArray(values.clone());
else {
System.arraycopy(values, 0, getArray(), offset, values.length);
}
setSize(values.length);
}

}
51 changes: 51 additions & 0 deletions src/main/java/org/scijava/table/ByteTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2009 - 2017 Board of Regents of the University of
* Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
* Institute of Molecular Cell Biology and Genetics.
* %%
* 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%
*/

package org.scijava.table;

/**
* A table of byte-precision integer values.
*
* @author Alison Walter
*/
public interface ByteTable extends Table<ByteColumn, Byte> {

/** Gets the value of the given table cell. */
default byte getValue(int col, int row) {
return get(col).getValue(row);
}

/** Sets the value of the given table cell. */
default void setValue(int col, int row, byte value) {
get(col).setValue(row, value);
}

}
89 changes: 89 additions & 0 deletions src/main/java/org/scijava/table/CharColumn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2009 - 2017 Board of Regents of the University of
* Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck
* Institute of Molecular Cell Biology and Genetics.
* %%
* 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%
*/

package org.scijava.table;

import org.scijava.util.CharArray;

/**
* Efficient implementation of {@link Column} for {@code char} primitives.
*
* @author Alison Walter
*/
public class CharColumn extends CharArray implements
PrimitiveColumn<char[], Character>
{

/** The column header. */
private String header;

public CharColumn() {}

public CharColumn(final String header) {
this.header = header;
}

// -- Column methods --

@Override
public String getHeader() {
return header;
}

@Override
public void setHeader(final String header) {
this.header = header;
}

@Override
public Class<Character> getType() {
return Character.class;
}

// -- PrimitiveColumn methods --

@Override
public void fill(final char[] values) {
setArray(values.clone());
setSize(values.length);
}

@Override
public void fill(final char[] values, final int offset) {
// Check if array has been initialized
if (getArray() == null) setArray(values.clone());
else {
System.arraycopy(values, 0, getArray(), offset, values.length);
}
setSize(values.length);
}

}
Loading