├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── scopes │ └── scope_settings.xml ├── vcs.xml ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── encodings.xml ├── codeStyleSettings.xml ├── misc.xml ├── compiler.xml ├── inspectionProfiles │ └── Project_Default.xml ├── artifacts │ └── MIST_Fiji.xml └── jarRepositories.xml ├── plugins.config ├── lib ├── fftw │ ├── libfftw3.dll │ └── libfftw3f.dll └── jcuda │ ├── JCufft-0.9.0d-windows-x86_64.dll │ ├── JNvrtc-0.9.0d-windows-x86_64.dll │ ├── libJCufft-0.9.0d-linux-x86_64.so │ ├── libJNvrtc-0.9.0d-linux-x86_64.so │ ├── JCudaDriver-0.9.0d-windows-x86_64.dll │ ├── JCudaRuntime-0.9.0d-windows-x86_64.dll │ ├── libJCudaDriver-0.9.0d-linux-x86_64.so │ └── libJCudaRuntime-0.9.0d-linux-x86_64.so ├── src ├── main │ ├── resources │ │ ├── META-INF │ │ │ └── MANIFEST.MF │ │ └── figs │ │ │ ├── Subgrid.png │ │ │ ├── NIST-Logo_5.png │ │ │ ├── RowCol_LowerLeft.png │ │ │ ├── RowCol_UpperLeft.png │ │ │ ├── stitching_icon.png │ │ │ ├── RowCol_LowerRight.png │ │ │ ├── RowCol_UpperRight.png │ │ │ ├── LowerLeft_VerticalCombing.png │ │ │ ├── LowerRight_VerticalCombing.png │ │ │ ├── UpperLeft_VerticalCombing.png │ │ │ ├── UpperRight_VerticalCombing.png │ │ │ ├── LowerLeft_HorizontalCombing.png │ │ │ ├── LowerLeft_VerticalContinuous.png │ │ │ ├── LowerRight_HorizontalCombing.png │ │ │ ├── UpperLeft_HorizontalCombing.png │ │ │ ├── UpperLeft_VerticalContinuous.png │ │ │ ├── UpperRight_HorizontalCombing.png │ │ │ ├── LowerLeft_HorizontalContinuous.png │ │ │ ├── LowerRight_HorizontalContinuous.png │ │ │ ├── LowerRight_VerticalContinuous.png │ │ │ ├── UpperLeft_HorizontalContinuous.png │ │ │ ├── UpperRight_HorizontalContinuous.png │ │ │ └── UpperRight_VerticalContinuous.png │ └── java │ │ └── gov │ │ └── nist │ │ └── isg │ │ └── mist │ │ ├── lib │ │ ├── export │ │ │ ├── MicroscopyUnits.java │ │ │ ├── CompressionMode.java │ │ │ ├── BlendingMode.java │ │ │ └── tileblender │ │ │ │ └── TileOverlayBlend.java │ │ ├── exceptions │ │ │ ├── EmptyGridException.java │ │ │ ├── GlobalOptimizationException.java │ │ │ └── StitchingException.java │ │ ├── memorypool │ │ │ ├── ImageAllocator.java │ │ │ ├── Allocator.java │ │ │ ├── JavaAllocator.java │ │ │ ├── CudaAllocator.java │ │ │ └── PointerAllocator.java │ │ ├── imagetile │ │ │ ├── BioFormatsReader.java │ │ │ ├── fftw │ │ │ │ └── FftwPlanType.java │ │ │ └── utilfns │ │ │ │ └── IndexValuePair.java │ │ ├── common │ │ │ ├── MinMaxElement.java │ │ │ └── DoublePointerComparator.java │ │ ├── tilegrid │ │ │ └── traverser │ │ │ │ ├── TileGridTraverser.java │ │ │ │ └── TileGridTraverserFactory.java │ │ └── parallel │ │ │ └── gpu │ │ │ ├── MonitoredPriorityBlockingQueue.java │ │ │ └── TileProducer.java │ │ ├── lib32 │ │ └── memorypool │ │ │ └── PointerAllocator32.java │ │ ├── gui │ │ ├── components │ │ │ └── textfield │ │ │ │ └── textFieldModel │ │ │ │ ├── RegexModel.java │ │ │ │ ├── RegexResetImageSizeModel.java │ │ │ │ ├── TimeslicesModel.java │ │ │ │ ├── FilenameModel.java │ │ │ │ ├── UpdateSubGridModel.java │ │ │ │ ├── DualRegexResetImageSizeModel.java │ │ │ │ ├── DualRegexModel.java │ │ │ │ ├── CheckSubGridModel.java │ │ │ │ ├── TextFieldModel.java │ │ │ │ ├── CheckSubGridOneBasedModel.java │ │ │ │ ├── InvalidTextModel.java │ │ │ │ └── CheckSubGridAndFileSizeModel.java │ │ └── params │ │ │ ├── interfaces │ │ │ ├── GUIParamFunctions.java │ │ │ └── StitchingAppParamFunctions.java │ │ │ └── utils │ │ │ └── StitchingParamUtils.java │ │ └── optimization │ │ ├── workflow │ │ ├── data │ │ │ └── OptimizationData.java │ │ └── tasks │ │ │ └── TileProducer.java │ │ └── model │ │ └── overlap │ │ ├── ParallelMlePoint.java │ │ ├── MLEPoint.java │ │ ├── MleLikelihoodCache.java │ │ └── MleWorker.java └── test │ └── java │ └── gov │ └── nist │ └── isg │ └── mist │ ├── utilfns │ ├── TestBioFormats.java │ └── TestUtilFnsNative.java │ ├── timing │ └── TimeUtil.java │ ├── basic │ ├── TestShortConversion.java │ └── TestReadingImage.java │ ├── grid │ └── TestCreateGrid.java │ ├── fftw │ ├── TestFFTWComputeFFT32.java │ └── TestFFTWComputeFFT.java │ ├── java │ └── TestJavaComputeFFT.java │ └── jcuda │ ├── TestJCUDACUFFT.java │ └── TestJCUDACUFFT32.java ├── java_libs └── org │ └── jcuda │ ├── jcuda │ ├── 5.0 │ │ ├── jcuda-5.0.jar │ │ └── jcuda-5.0.pom │ └── 6.5 │ │ ├── jcuda-6.5.jar │ │ └── jcuda-6.5.pom │ └── jcufft │ ├── 5.0 │ ├── jcufft-5.0.jar │ └── jcufft-5.0.pom │ └── 6.5 │ ├── jcufft-6.5.jar │ └── jcufft-6.5.pom ├── .gitignore ├── Dockerfile ├── LICENSE.txt ├── docker_example.sh ├── push-docker.sh └── assemble_stitched_image.py /.idea/.name: -------------------------------------------------------------------------------- 1 | MIST -------------------------------------------------------------------------------- /plugins.config: -------------------------------------------------------------------------------- 1 | Plugins>Stitching, "MIST", gov.nist.isg.mist.MISTMain -------------------------------------------------------------------------------- /lib/fftw/libfftw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/fftw/libfftw3.dll -------------------------------------------------------------------------------- /lib/fftw/libfftw3f.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/fftw/libfftw3f.dll -------------------------------------------------------------------------------- /src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: gov.nist.isg.mist.MISTMain 3 | 4 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/main/resources/figs/Subgrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/Subgrid.png -------------------------------------------------------------------------------- /src/main/resources/figs/NIST-Logo_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/NIST-Logo_5.png -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcuda/5.0/jcuda-5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/java_libs/org/jcuda/jcuda/5.0/jcuda-5.0.jar -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcuda/6.5/jcuda-6.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/java_libs/org/jcuda/jcuda/6.5/jcuda-6.5.jar -------------------------------------------------------------------------------- /lib/jcuda/JCufft-0.9.0d-windows-x86_64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/JCufft-0.9.0d-windows-x86_64.dll -------------------------------------------------------------------------------- /lib/jcuda/JNvrtc-0.9.0d-windows-x86_64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/JNvrtc-0.9.0d-windows-x86_64.dll -------------------------------------------------------------------------------- /lib/jcuda/libJCufft-0.9.0d-linux-x86_64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/libJCufft-0.9.0d-linux-x86_64.so -------------------------------------------------------------------------------- /lib/jcuda/libJNvrtc-0.9.0d-linux-x86_64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/libJNvrtc-0.9.0d-linux-x86_64.so -------------------------------------------------------------------------------- /src/main/resources/figs/RowCol_LowerLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/RowCol_LowerLeft.png -------------------------------------------------------------------------------- /src/main/resources/figs/RowCol_UpperLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/RowCol_UpperLeft.png -------------------------------------------------------------------------------- /src/main/resources/figs/stitching_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/stitching_icon.png -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcufft/5.0/jcufft-5.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/java_libs/org/jcuda/jcufft/5.0/jcufft-5.0.jar -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcufft/6.5/jcufft-6.5.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/java_libs/org/jcuda/jcufft/6.5/jcufft-6.5.jar -------------------------------------------------------------------------------- /src/main/resources/figs/RowCol_LowerRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/RowCol_LowerRight.png -------------------------------------------------------------------------------- /src/main/resources/figs/RowCol_UpperRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/RowCol_UpperRight.png -------------------------------------------------------------------------------- /lib/jcuda/JCudaDriver-0.9.0d-windows-x86_64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/JCudaDriver-0.9.0d-windows-x86_64.dll -------------------------------------------------------------------------------- /lib/jcuda/JCudaRuntime-0.9.0d-windows-x86_64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/JCudaRuntime-0.9.0d-windows-x86_64.dll -------------------------------------------------------------------------------- /lib/jcuda/libJCudaDriver-0.9.0d-linux-x86_64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/libJCudaDriver-0.9.0d-linux-x86_64.so -------------------------------------------------------------------------------- /lib/jcuda/libJCudaRuntime-0.9.0d-linux-x86_64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/lib/jcuda/libJCudaRuntime-0.9.0d-linux-x86_64.so -------------------------------------------------------------------------------- /src/main/resources/figs/LowerLeft_VerticalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerLeft_VerticalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerRight_VerticalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerRight_VerticalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperLeft_VerticalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperLeft_VerticalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperRight_VerticalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperRight_VerticalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerLeft_HorizontalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerLeft_HorizontalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerLeft_VerticalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerLeft_VerticalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerRight_HorizontalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerRight_HorizontalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperLeft_HorizontalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperLeft_HorizontalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperLeft_VerticalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperLeft_VerticalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperRight_HorizontalCombing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperRight_HorizontalCombing.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerLeft_HorizontalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerLeft_HorizontalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerRight_HorizontalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerRight_HorizontalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/LowerRight_VerticalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/LowerRight_VerticalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperLeft_HorizontalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperLeft_HorizontalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperRight_HorizontalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperRight_HorizontalContinuous.png -------------------------------------------------------------------------------- /src/main/resources/figs/UpperRight_VerticalContinuous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usnistgov/MIST/HEAD/src/main/resources/figs/UpperRight_VerticalContinuous.png -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dat 2 | *.class 3 | 4 | # jekyll files 5 | _site/ 6 | 7 | # LaTex generated files 8 | doc/*.aux 9 | doc/*.bbl 10 | doc/*.blg 11 | doc/*.log 12 | doc/*.out 13 | doc/*.pdf 14 | doc/*.synctex.gz 15 | doc/*.toc 16 | 17 | # Intellij Folders 18 | out 19 | target 20 | 21 | # User-specific IntlliJ workspace: 22 | .idea/workspace.xml 23 | 24 | # Eclipse files 25 | .settings/ 26 | .project 27 | .classpath 28 | 29 | # macOS files 30 | **/.DS_Store 31 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/export/MicroscopyUnits.java: -------------------------------------------------------------------------------- 1 | package gov.nist.isg.mist.lib.export; 2 | 3 | import ome.units.UNITS; 4 | import ome.units.quantity.Length; 5 | import ome.units.unit.Unit; 6 | 7 | public enum MicroscopyUnits { 8 | KILOMETER(UNITS.KILOMETER), 9 | HECTOMETER(UNITS.HECTOMETER), 10 | DECAMETER(UNITS.DECAMETER), 11 | METER(UNITS.METER), 12 | DECIMETER(UNITS.DECIMETER), 13 | CENTIMETER(UNITS.CENTIMETER), 14 | MILLIMETER(UNITS.MILLIMETER), 15 | MICROMETER(UNITS.MICROMETER), 16 | NANOMETER(UNITS.NANOMETER), 17 | PICOMETER(UNITS.PICOMETER), 18 | ; 19 | MicroscopyUnits(Unit unit) { 20 | this.unit = unit; 21 | } 22 | 23 | private Unit unit; 24 | 25 | public Unit getUnit() { 26 | return unit; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return this.name(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nvidia/cuda:9.0-runtime-ubuntu16.04 2 | MAINTAINER National Institute of Standards and Technology 3 | 4 | ARG EXEC_DIR="/opt/executables" 5 | ARG DATA_DIR="/data" 6 | 7 | # Create folders 8 | RUN mkdir -p ${EXEC_DIR} \ 9 | && mkdir -p ${EXEC_DIR}/lib/jcuda \ 10 | && mkdir -p ${DATA_DIR}/inputs \ 11 | && mkdir ${DATA_DIR}/outputs 12 | 13 | # Install fftw and java 8 jdk 14 | RUN apt-get update \ 15 | && apt-get install -y libfftw3-dev \ 16 | && apt-get install -y openjdk-8-jdk \ 17 | && update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 18 | 19 | # Copy MIST CUDA lib 20 | COPY lib/jcuda/*.ptx ${EXEC_DIR}/lib/jcuda/ 21 | 22 | # Copy MIST JAR 23 | COPY target/MIST_*-jar-with-dependencies.jar ${EXEC_DIR}/MIST.jar 24 | 25 | # Set working directory 26 | WORKDIR ${EXEC_DIR} 27 | 28 | # Default command. Additional arguments are provided through the command line 29 | ENTRYPOINT ["/usr/bin/java", "-jar", "MIST.jar"] -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/export/CompressionMode.java: -------------------------------------------------------------------------------- 1 | package gov.nist.isg.mist.lib.export; 2 | 3 | import loci.formats.out.OMETiffWriter; 4 | 5 | public enum CompressionMode { 6 | UNCOMPRESSED(OMETiffWriter.COMPRESSION_UNCOMPRESSED), 7 | LZW(OMETiffWriter.COMPRESSION_LZW), 8 | JPEG_2000_LOSSY(OMETiffWriter.COMPRESSION_J2K_LOSSY), 9 | JPEG(OMETiffWriter.COMPRESSION_JPEG), 10 | ZLIB(OMETiffWriter.COMPRESSION_ZLIB) 11 | ; 12 | private CompressionMode(String compressionName) { 13 | this.compressionName = compressionName; 14 | } 15 | 16 | public String getCompressionName() { 17 | return this.compressionName; 18 | } 19 | 20 | /** 21 | * Gets the tooltip text 22 | * 23 | * @return the tooltip text 24 | */ 25 | public String getToolTipText() { 26 | return this.toolTipText; 27 | } 28 | 29 | private String compressionName; 30 | private String toolTipText; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/export/BlendingMode.java: -------------------------------------------------------------------------------- 1 | package gov.nist.isg.mist.lib.export; 2 | 3 | 4 | /** 5 | * Enum representing the different types of blending modes 6 | * 7 | * @author Tim Blattner 8 | * @version 1.0 9 | */ 10 | public enum BlendingMode { 11 | /** 12 | * Overlay blending mode 13 | */ 14 | OVERLAY("Overlay", "Choose only one pixel from overlapping pixels based on highest correlation", false), 15 | 16 | /** 17 | * Average blending mode 18 | */ 19 | AVERAGE("Average", "Computes the the average intensity for each image", false), 20 | 21 | /** 22 | * Linear blending mode 23 | */ 24 | LINEAR("Linear", "Smoothly alters the intensity of the overlapping area between images", true); 25 | 26 | private String name; 27 | private String toolTipText; 28 | private boolean requiresAlpha; 29 | 30 | private BlendingMode(String name, String toolTipText, boolean requiresAlpha) { 31 | this.name = name; 32 | this.toolTipText = toolTipText; 33 | this.requiresAlpha = requiresAlpha; 34 | } 35 | 36 | /** 37 | * Returns if alpha is required or not 38 | * 39 | * @return true if alpha is required, otherwise false 40 | */ 41 | public boolean isRequiresAlpha() { 42 | return this.requiresAlpha; 43 | } 44 | 45 | /** 46 | * Gets the tooltip text 47 | * 48 | * @return the tooltip text 49 | */ 50 | public String getToolTipText() { 51 | return this.toolTipText; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return this.name; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcuda/5.0/jcuda-5.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.jcuda 6 | jcuda 7 | 5.0 8 | 9 | 10 | JCuda - Java bindings for NVIDIA CUDA 11 | Copyright (c) 2008-2011 Marco Hutter - http://www.jcuda.org 12 | Permission is hereby granted, free of charge, to any person 13 | obtaining a copy of this software and associated documentation 14 | files (the "Software"), to deal in the Software without 15 | restriction, including without limitation the rights to use, 16 | copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following 19 | conditions: 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcuda/6.5/jcuda-6.5.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.jcuda 6 | jcuda 7 | 6.5 8 | 9 | 10 | JCuda - Java bindings for NVIDIA CUDA 11 | Copyright (c) 2008-2011 Marco Hutter - http://www.jcuda.org 12 | Permission is hereby granted, free of charge, to any person 13 | obtaining a copy of this software and associated documentation 14 | files (the "Software"), to deal in the Software without 15 | restriction, including without limitation the rights to use, 16 | copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following 19 | conditions: 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcufft/5.0/jcufft-5.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.jcuda 6 | jcufft 7 | 5.0 8 | 9 | 10 | JCuda - Java bindings for NVIDIA CUDA 11 | Copyright (c) 2008-2011 Marco Hutter - http://www.jcuda.org 12 | Permission is hereby granted, free of charge, to any person 13 | obtaining a copy of this software and associated documentation 14 | files (the "Software"), to deal in the Software without 15 | restriction, including without limitation the rights to use, 16 | copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following 19 | conditions: 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /java_libs/org/jcuda/jcufft/6.5/jcufft-6.5.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.jcuda 6 | jcufft 7 | 6.5 8 | 9 | 10 | JCuda - Java bindings for NVIDIA CUDA 11 | Copyright (c) 2008-2011 Marco Hutter - http://www.jcuda.org 12 | Permission is hereby granted, free of charge, to any person 13 | obtaining a copy of this software and associated documentation 14 | files (the "Software"), to deal in the Software without 15 | restriction, including without limitation the rights to use, 16 | copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following 19 | conditions: 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | -------------------------------------------------------------------------------- /docker_example.sh: -------------------------------------------------------------------------------- 1 | docker run -v /path/to/data/on/your/machine:/data wipp/mist:2.0.7 --imageDir=/data/inputs --filenamePatternType=ROWCOL --filenamePattern="img_r{rrr}_c{ccc}.ome.tif" --gridOrigin=UL --gridWidth=5 --gridHeight=5 --startTileRow=1 --startTileCol=1 --startRow=0 --startCol=0 --extentWidth=5 --extentHeight=5 --isTimeSlices=false --assembleNoOverlap=false --stageRepeatability=0 --overlapUncertainty=5 --programType=java --outputPath=/data/outputs 2 | 3 | 4 | 5 | 6 | container: 7 | args: 8 | - '--imageDir' 9 | - '{{inputs.parameters.imageDir}}' 10 | - '--filenamePatternType' 11 | - '{{inputs.parameters.filenamePatternType}}' 12 | - '--filenamePattern' 13 | - '{{inputs.parameters.filenamePattern}}' 14 | - '--gridOrigin' 15 | - '{{inputs.parameters.gridOrigin}}' 16 | - '--gridWidth' 17 | - '{{inputs.parameters.gridWidth}}' 18 | - '--gridHeight' 19 | - '{{inputs.parameters.gridHeight}}' 20 | - '--startTileRow' 21 | - '{{inputs.parameters.startTileRow}}' 22 | - '--startTileCol' 23 | - '{{inputs.parameters.startTileCol}}' 24 | - '--startRow' 25 | - '{{inputs.parameters.startRow}}' 26 | - '--startCol' 27 | - '{{inputs.parameters.startCol}}' 28 | - '--extentWidth' 29 | - '{{inputs.parameters.extentWidth}}' 30 | - '--extentHeight' 31 | - '{{inputs.parameters.extentHeight}}' 32 | - '--isTimeSlices' 33 | - '{{inputs.parameters.isTimeSlices}}' 34 | - '--assembleNoOverlap' 35 | - '{{inputs.parameters.assembleNoOverlap}}' 36 | - '--stageRepeatability' 37 | - '{{inputs.parameters.stageRepeatability}}' 38 | - '--overlapUncertainty' 39 | - '{{inputs.parameters.overlapUncertainty}}' 40 | - '--programType' 41 | - '{{inputs.parameters.programType}}' 42 | - '--outputPath' 43 | - '{{inputs.parameters.outputPath}}' 44 | image: 'wipp/mist:2.0.7' 45 | -------------------------------------------------------------------------------- /push-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 3 | # NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | # You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 5 | 6 | version=2.0.7 7 | docker push wipp/mist:latest 8 | docker push wipp/mist:${version} 9 | -------------------------------------------------------------------------------- /.idea/artifacts/MIST_Fiji.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/MIST_Fiji 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/exceptions/EmptyGridException.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.lib.exceptions; 9 | 10 | public class EmptyGridException extends Exception { 11 | 12 | 13 | /** 14 | * 15 | */ 16 | private static final long serialVersionUID = 1L; 17 | 18 | public EmptyGridException() { 19 | super(); 20 | } 21 | 22 | public EmptyGridException(String message) { 23 | super(message); 24 | } 25 | 26 | public EmptyGridException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | 44 | 45 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/exceptions/GlobalOptimizationException.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:58:49 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | package gov.nist.isg.mist.lib.exceptions; 19 | 20 | public class GlobalOptimizationException extends Exception { 21 | 22 | /** 23 | * 24 | */ 25 | private static final long serialVersionUID = 1L; 26 | 27 | public GlobalOptimizationException() { 28 | super(); 29 | } 30 | 31 | public GlobalOptimizationException(String message) { 32 | super(message); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/exceptions/StitchingException.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:58:49 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | package gov.nist.isg.mist.lib.exceptions; 19 | 20 | public class StitchingException extends Exception { 21 | 22 | /** 23 | * 24 | */ 25 | private static final long serialVersionUID = 1L; 26 | 27 | public StitchingException() { 28 | super(); 29 | } 30 | 31 | public StitchingException(String message) { 32 | super(message); 33 | } 34 | 35 | public StitchingException(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/utilfns/TestBioFormats.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | package gov.nist.isg.mist.utilfns; 10 | 11 | import java.io.File; 12 | 13 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 14 | import gov.nist.isg.mist.lib.imagetile.Stitching; 15 | import gov.nist.isg.mist.lib.imagetile.java.JavaImageTile; 16 | 17 | /** 18 | * Test class for BioFormats image reader. 19 | * 20 | * @author Michael Majurski 21 | */ 22 | public class TestBioFormats { 23 | 24 | public static void main(String args[]) { 25 | 26 | // File file = new File("C:\\majurski\\image-data\\BioFormats_Examples\\leica_stack\\leica_stack_Series014_z000_ch00.tif"); 27 | File file = new File("C:\\majurski\\image-data\\BioFormats_Examples\\2chZT\\2chZT.lsm"); 28 | 29 | Stitching.USE_BIOFORMATS = true; 30 | ImageTile tile = new JavaImageTile(file); 31 | tile.readTile(); 32 | 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/memorypool/ImageAllocator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: May 16, 2014 3:53:06 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib.memorypool; 19 | 20 | /** 21 | * Represents an allocator for allocating Java memory in the form float[][] 22 | * 23 | * @author Tim Blattner 24 | * @version 1.0 25 | */ 26 | public class ImageAllocator implements Allocator { 27 | 28 | @Override 29 | public short[] allocate(int... n) { 30 | int size = 1; 31 | 32 | for (int s : n) 33 | size *= s; 34 | 35 | return new short[size]; 36 | } 37 | 38 | @Override 39 | public short[] deallocate(short[] memory) { 40 | memory = null; 41 | return null; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/memorypool/Allocator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 11:05:10 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib.memorypool; 19 | 20 | import jcuda.CudaException; 21 | 22 | /** 23 | * Interface to create different types of memory allocators. 24 | * 25 | * @param the underlying memory type. 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public interface Allocator { 30 | /** 31 | * Allocates memory 32 | * 33 | * @param n an array of dimensions 34 | * @return the memory reference 35 | */ 36 | public T allocate(int... n) throws OutOfMemoryError, CudaException; 37 | 38 | /** 39 | * Deallocates memory 40 | * 41 | * @param memory the memory reference 42 | * @return the reference after deallocation (normally null) 43 | */ 44 | public T deallocate(T memory); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/memorypool/JavaAllocator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: May 16, 2014 3:53:06 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib.memorypool; 19 | 20 | /** 21 | * Represents an allocator for allocating Java memory in the form float[][] 22 | * 23 | * @author Tim Blattner 24 | * @version 1.0 25 | */ 26 | public class JavaAllocator implements Allocator { 27 | 28 | @Override 29 | public float[][] allocate(int... n) { 30 | int n1 = 0; 31 | int n2 = 0; 32 | 33 | if (n.length == 2) { 34 | n1 = n[0]; 35 | n2 = n[1]; 36 | } else { 37 | throw new IllegalArgumentException("Java Allocator requires 2-dimensions"); 38 | } 39 | 40 | return new float[n1][n2]; 41 | } 42 | 43 | @Override 44 | public float[][] deallocate(float[][] memory) { 45 | memory = null; 46 | return null; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/memorypool/CudaAllocator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 11:04:56 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib.memorypool; 19 | 20 | import jcuda.driver.CUdeviceptr; 21 | import jcuda.driver.JCudaDriver; 22 | 23 | /** 24 | * Allocator type that allocates GPU memory (JCUDA) 25 | * 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public class CudaAllocator implements Allocator { 30 | 31 | @Override 32 | public CUdeviceptr allocate(int... n) { 33 | int size = 1; 34 | for (int val : n) { 35 | size *= val; 36 | } 37 | 38 | CUdeviceptr ptr = new CUdeviceptr(); 39 | JCudaDriver.cuMemAlloc(ptr, size); 40 | 41 | return ptr; 42 | } 43 | 44 | @Override 45 | public CUdeviceptr deallocate(CUdeviceptr memory) { 46 | JCudaDriver.cuMemFree(memory); 47 | return memory; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/imagetile/BioFormatsReader.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.lib.imagetile; 9 | 10 | import java.io.File; 11 | 12 | import gov.nist.isg.mist.lib.log.Log; 13 | import ij.ImagePlus; 14 | import loci.plugins.BF; 15 | import loci.plugins.in.ImporterOptions; 16 | 17 | /** 18 | * Class to hold static methods for reading images with BioFormats library 19 | * 20 | * @author Michael Majurski 21 | */ 22 | public class BioFormatsReader { 23 | 24 | public static ImagePlus readImage(String filepath) { 25 | ImagePlus imp; 26 | 27 | File file = new File(filepath); 28 | Log.msg(Log.LogType.INFO, "Loading " + file.getName() + " using BioFormats"); 29 | 30 | try { 31 | ImporterOptions options = new ImporterOptions(); 32 | options.setId(file.getAbsolutePath()); 33 | options.setSplitChannels(false); 34 | options.setSplitTimepoints(false); 35 | options.setSplitFocalPlanes(false); 36 | options.setAutoscale(false); 37 | options.setVirtual(false); 38 | 39 | ImagePlus[] tmp = BF.openImagePlus(options); 40 | imp = tmp[0]; 41 | 42 | 43 | } catch (Exception e) { 44 | Log.msg(Log.LogType.MANDATORY, "Cannot open image using BioFormats"); 45 | return null; 46 | } 47 | 48 | 49 | return imp; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/memorypool/PointerAllocator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 11:04:44 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib.memorypool; 19 | 20 | import org.bridj.Pointer; 21 | 22 | import gov.nist.isg.mist.lib.imagetile.fftw.FFTW3Library; 23 | 24 | /** 25 | * Allocator type that allocates Pointer memory for use with FFTW 26 | * 27 | * The memory that is allocated is double complex, so size = size*sizeof(double)*2 28 | * 29 | * element i*2 = real element i*2+1 = imaginary 30 | * 31 | * @author Tim Blattner 32 | * @version 1.0 33 | */ 34 | public class PointerAllocator implements Allocator> { 35 | 36 | @Override 37 | public Pointer allocate(int... n) { 38 | long size = 1; 39 | for (int val : n) { 40 | size *= val; 41 | } 42 | 43 | // Allocate complex numbers 44 | return FFTW3Library.fftw_alloc_real(size * 2); 45 | } 46 | 47 | @Override 48 | public Pointer deallocate(Pointer memory) { 49 | FFTW3Library.fftw_free(memory); 50 | return memory; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/common/MinMaxElement.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 11:08:33 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.common; 20 | 21 | /** 22 | * Class for storing the min and max into a single object. 23 | * 24 | * @author Tim Blattner 25 | * @version 1.0 26 | */ 27 | public class MinMaxElement { 28 | 29 | private int min; 30 | private int max; 31 | 32 | /** 33 | * Creates a min-max element 34 | * 35 | * @param min the min value 36 | * @param max the max value 37 | */ 38 | public MinMaxElement(int min, int max) { 39 | this.min = min; 40 | this.max = max; 41 | } 42 | 43 | /** 44 | * @return the min 45 | */ 46 | public int getMin() { 47 | return this.min; 48 | } 49 | 50 | /** 51 | * @param min the min to set 52 | */ 53 | public void setMin(int min) { 54 | this.min = min; 55 | } 56 | 57 | /** 58 | * @return the max 59 | */ 60 | public int getMax() { 61 | return this.max; 62 | } 63 | 64 | /** 65 | * @param max the max to set 66 | */ 67 | public void setMax(int max) { 68 | this.max = max; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib32/memorypool/PointerAllocator32.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 11:04:44 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | 18 | package gov.nist.isg.mist.lib32.memorypool; 19 | 20 | import org.bridj.Pointer; 21 | 22 | import gov.nist.isg.mist.lib.memorypool.Allocator; 23 | import gov.nist.isg.mist.lib32.imagetile.fftw.FFTW3Library32; 24 | 25 | /** 26 | * Allocator type that allocates Pointer memory for use with FFTW 27 | * 28 | * The memory that is allocated is double complex, so size = size*sizeof(double)*2 29 | * 30 | * element i*2 = real element i*2+1 = imaginary 31 | * 32 | * @author Tim Blattner 33 | * @version 1.0 34 | */ 35 | public class PointerAllocator32 implements Allocator> { 36 | 37 | @Override 38 | public Pointer allocate(int... n) { 39 | long size = 1; 40 | for (int val : n) { 41 | size *= val; 42 | } 43 | 44 | // Allocate complex numbers 45 | return FFTW3Library32.fftwf_alloc_real(size * 2); 46 | } 47 | 48 | @Override 49 | public Pointer deallocate(Pointer memory) { 50 | FFTW3Library32.fftwf_free(memory); 51 | return memory; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/RegexModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:37:30 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import java.util.regex.Matcher; 22 | import java.util.regex.Pattern; 23 | 24 | /** 25 | * Validator that checks values based on a regex 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class RegexModel extends InvalidTextModel { 31 | 32 | private Pattern pattern; 33 | 34 | /** 35 | * Creates a regex validator based on a given regex 36 | * 37 | * @param regex the regex to check 38 | * @param errorText the error text associated with this validator 39 | */ 40 | public RegexModel(String regex, String errorText, String... invalidStrings) { 41 | super(errorText, invalidStrings); 42 | this.pattern = Pattern.compile(regex); 43 | } 44 | 45 | @Override 46 | public boolean validateText(String val) { 47 | if (!super.validateText(val)) 48 | return false; 49 | 50 | Matcher matcher = this.pattern.matcher(val); 51 | if (!matcher.find() || matcher.groupCount() != 3) { 52 | return false; 53 | } 54 | return true; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/imagetile/fftw/FftwPlanType.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: May 10, 2013 2:58:58 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.imagetile.fftw; 20 | 21 | /** 22 | * Type of FFTW plan 23 | * 24 | * @author Tim Blattner 25 | * @version 1.0 26 | */ 27 | public enum FftwPlanType { 28 | 29 | // /** 30 | // * Selects Estimate FFTW planning mode 31 | // */ 32 | // ESTIMATE("Estimate", FFTW3Library.FFTW_ESTIMATE), 33 | 34 | /** 35 | * Selects measure FFTW planning mode 36 | */ 37 | MEASURE("Measure", FFTW3Library.FFTW_MEASURE), 38 | 39 | /** 40 | * Selects patient FFTW planning mode 41 | */ 42 | PATIENT("Patient", FFTW3Library.FFTW_PATIENT), 43 | 44 | /** 45 | * Selects exhaustive FFTW planning mode 46 | */ 47 | EXHAUSTIVE("Exhaustive", FFTW3Library.FFTW_EXHAUSTIVE); 48 | 49 | 50 | private FftwPlanType(final String text, int val) { 51 | this.text = text; 52 | this.val = val; 53 | } 54 | 55 | private final String text; 56 | private final int val; 57 | 58 | @Override 59 | public String toString() { 60 | return this.text; 61 | } 62 | 63 | /** 64 | * Gets the FFTW planning mode value 65 | * 66 | * @return the FFTW planning mode value 67 | */ 68 | public int getVal() { 69 | return this.val; 70 | } 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/workflow/data/OptimizationData.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:59:00 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.optimization.workflow.data; 20 | 21 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 22 | 23 | /** 24 | * Created by tjb3 on 4/1/2015. 25 | */ 26 | public class OptimizationData { 27 | 28 | 29 | public enum TaskType { 30 | READ, 31 | BK_CHECK_NEIGHBORS, 32 | BK_CHECK_MEMORY, 33 | OPTIMIZE_NORTH, 34 | OPTIMIZE_WEST, 35 | BK_DONE, 36 | CANCELLED 37 | 38 | } 39 | 40 | 41 | private ImageTile tile; 42 | private ImageTile neighbor; 43 | 44 | private TaskType type; 45 | 46 | public OptimizationData(ImageTile tile, TaskType type) { 47 | this.tile = tile; 48 | this.type = type; 49 | } 50 | 51 | 52 | public OptimizationData(ImageTile tile, ImageTile neighbor, TaskType type) { 53 | this.tile = tile; 54 | this.neighbor = neighbor; 55 | 56 | this.type = type; 57 | } 58 | 59 | public ImageTile getTile() { 60 | return tile; 61 | } 62 | 63 | public ImageTile getNeighbor() { 64 | return neighbor; 65 | } 66 | 67 | public TaskType getType() { 68 | return type; 69 | } 70 | 71 | public void setType(TaskType type) { 72 | this.type = type; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/RegexResetImageSizeModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:37:30 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.outputTab.OutputPanel; 22 | 23 | /** 24 | * Validator that checks values based on a regex 25 | * 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public class RegexResetImageSizeModel extends RegexModel { 30 | 31 | private OutputPanel outputPanel; 32 | 33 | /** 34 | * Creates a regex validator based on a given regex 35 | * 36 | * @param regex the regex to check 37 | * @param errorText the error text associated with this validator 38 | * @param outputPanel the output panel to reset image size 39 | * @param invalidStrings the invalid strings for this validator 40 | */ 41 | public RegexResetImageSizeModel(String regex, String errorText, OutputPanel outputPanel, String... invalidStrings) { 42 | super(regex, errorText, invalidStrings); 43 | this.outputPanel = outputPanel; 44 | } 45 | 46 | @Override 47 | public boolean validateText(String val) { 48 | if (super.validateText(val)) { 49 | this.outputPanel.resetImageDimensions(); 50 | return true; 51 | } 52 | return false; 53 | 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/tilegrid/traverser/TileGridTraverser.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:41:17 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.tilegrid.traverser; 20 | 21 | /** 22 | * Traversal interface, describing a traverser 23 | * 24 | * @author Tim Blattner 25 | * @version 1.0 26 | */ 27 | public interface TileGridTraverser extends Iterable { 28 | 29 | /** 30 | * Different types of traversers 31 | */ 32 | public static enum Traversals { 33 | /** 34 | * Row traversal (combed) 35 | */ 36 | ROW, 37 | 38 | /** 39 | * Row chained traversal 40 | */ 41 | ROW_CHAINED, 42 | 43 | /** 44 | * Column traversal (combed) 45 | */ 46 | COLUMN, 47 | 48 | /** 49 | * Column chained traversal 50 | */ 51 | COLUMN_CHAINED, 52 | 53 | /** 54 | * Diagonal traversal 55 | */ 56 | DIAGONAL, 57 | 58 | /** 59 | * Diagonal chained traversal 60 | */ 61 | DIAGONAL_CHAINED 62 | } 63 | 64 | /** 65 | * Gets the current row of the traverser 66 | * 67 | * @return the current row of the traverser 68 | */ 69 | public int getCurrentRow(); 70 | 71 | /** 72 | * Gets the current column of the traverser 73 | * 74 | * @return the current column of hte traverser 75 | */ 76 | public int getCurrentColumn(); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/imagetile/utilfns/IndexValuePair.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: May 10, 2013 2:58:58 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.imagetile.utilfns; 20 | 21 | public class IndexValuePair implements Comparable { 22 | 23 | private int index; 24 | private double value; 25 | 26 | 27 | /** 28 | * @param index 29 | * @param value 30 | */ 31 | public IndexValuePair(int index, double value) { 32 | super(); 33 | this.index = index; 34 | this.value = value; 35 | } 36 | 37 | /** 38 | * @return the index 39 | */ 40 | public int getIndex() { 41 | return this.index; 42 | } 43 | 44 | /** 45 | * @param index the index to set 46 | */ 47 | public void setIndex(int index) { 48 | this.index = index; 49 | } 50 | 51 | /** 52 | * @return the value 53 | */ 54 | public double getValue() { 55 | return this.value; 56 | } 57 | 58 | /** 59 | * @param value the value to set 60 | */ 61 | public void setValue(double value) { 62 | this.value = value; 63 | } 64 | 65 | @Override 66 | public int compareTo(IndexValuePair arg0) { 67 | int val = Double.compare(arg0.getValue(), this.getValue()); 68 | 69 | if (val == 0) { 70 | return new Integer(this.getIndex()).compareTo(arg0.getIndex()); 71 | } 72 | return val; 73 | 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/timing/TimeUtil.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: Aug 1, 2013 4:05:38 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.timing; 21 | 22 | /** 23 | * Timing utlity functions for obtaining timing information in milliseconds. 24 | * 25 | *
26 |  * 
27 |  * TimeUtil.tick();
28 |  * Run.Computation();
29 |  * System.out.println("The compute time is: " + TimeUtil.tock() + " ms");
30 |  * 
31 |  * 
32 | * 33 | * @author Tim Blattner 34 | * @version 1.0 35 | */ 36 | public class TimeUtil { 37 | 38 | private static long tickTime = 0L; 39 | 40 | /** 41 | * Utility function to start a timer (must not call tock before calling tick) 42 | */ 43 | public static void tick() { 44 | if (tickTime == 0L) { 45 | tickTime = System.currentTimeMillis(); 46 | } else { 47 | System.err.println("Must call tock before tick"); 48 | System.exit(1); 49 | } 50 | } 51 | 52 | /** 53 | * Utility function to get the time from calling tick. Must call tick before calling tock. 54 | * 55 | * @return the difference between calling tick and tock 56 | */ 57 | public static long tock() { 58 | if (tickTime == 0L) { 59 | System.err.println("Must call tick before tock"); 60 | System.exit(1); 61 | } 62 | 63 | long ret = System.currentTimeMillis() - tickTime; 64 | tickTime = 0L; 65 | return ret; 66 | 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/TimeslicesModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Jul 2, 2014 11:22:21 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 19 | 20 | import java.util.List; 21 | 22 | import gov.nist.isg.mist.gui.params.objects.RangeParam; 23 | 24 | /** 25 | * Validator that checks timeslice format 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class TimeslicesModel implements TextFieldModel> { 31 | 32 | @Override 33 | public boolean validateText(String val) { 34 | if (val.equals("")) 35 | return true; 36 | 37 | String[] valSplit = val.split(","); 38 | 39 | for (String v : valSplit) { 40 | RangeParam param = RangeParam.parseParam(v); 41 | if (param == null) 42 | return false; 43 | } 44 | return true; 45 | } 46 | 47 | @Override 48 | public String getErrorMessage() { 49 | return "Enter time slices specifying range: e.g. 1-5,8,11-13" 50 | + "
To specify all time slices leave field blank"; 51 | } 52 | 53 | @Override 54 | public List getModelValue(String val) { 55 | return RangeParam.parseTimeSlices(val); 56 | } 57 | 58 | @Override 59 | public String setModelValue(String val) { 60 | return val; 61 | } 62 | 63 | @Override 64 | public void updateTextFields() { 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/FilenameModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Jul 2, 2014 11:20:29 AM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import java.io.File; 22 | import java.io.IOException; 23 | 24 | /** 25 | * Validator that checks for valid file name 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class FilenameModel implements TextFieldModel { 31 | 32 | private String errorText; 33 | 34 | /** 35 | * Constructs the file name validator 36 | * 37 | * @param errorText the errtext associated with this validator 38 | */ 39 | public FilenameModel(String errorText) { 40 | this.errorText = errorText; 41 | 42 | } 43 | 44 | @Override 45 | public boolean validateText(String val) { 46 | File testFile = new File(val); 47 | try { 48 | testFile.getCanonicalPath(); 49 | testFile = null; 50 | } catch (IOException e) { 51 | return false; 52 | } 53 | 54 | return true; 55 | } 56 | 57 | @Override 58 | public String getErrorMessage() { 59 | return this.errorText; 60 | } 61 | 62 | @Override 63 | public String getModelValue(String val) { 64 | return val; 65 | } 66 | 67 | @Override 68 | public String setModelValue(String val) { 69 | return val; 70 | } 71 | 72 | @Override 73 | public void updateTextFields() { 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/parallel/gpu/MonitoredPriorityBlockingQueue.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 11, 2014 12:12:37 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.parallel.gpu; 20 | 21 | import java.util.concurrent.PriorityBlockingQueue; 22 | 23 | /** 24 | * Class that adds a monitor on the size of the priority blocking queue. The class monitors the 25 | * maximum size that the queue achieves. 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class MonitoredPriorityBlockingQueue extends PriorityBlockingQueue { 31 | 32 | /** 33 | * 34 | */ 35 | private static final long serialVersionUID = 1L; 36 | 37 | private int monitorSize; 38 | 39 | /** 40 | * Creates a monitor implementation of a blocking queue. This queue monitors the maximum size of 41 | * the queue 42 | * 43 | * @param size the size of the queue 44 | */ 45 | public MonitoredPriorityBlockingQueue(int size) { 46 | super(size); 47 | this.monitorSize = 0; 48 | } 49 | 50 | @Override 51 | public E take() throws InterruptedException { 52 | 53 | if (this.monitorSize < super.size()) { 54 | this.monitorSize = super.size(); 55 | } 56 | 57 | E ret = super.take(); 58 | 59 | return ret; 60 | } 61 | 62 | /** 63 | * Gets the monitored size of the queue 64 | * 65 | * @return the maximum size the queue achieved. 66 | */ 67 | public int getMonitorSize() { 68 | return this.monitorSize; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/basic/TestShortConversion.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: May 10, 2013 2:58:58 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | 21 | package gov.nist.isg.mist.basic; 22 | 23 | import gov.nist.isg.mist.lib.log.Log; 24 | import gov.nist.isg.mist.lib.log.Log.LogType; 25 | 26 | /** 27 | * Tests converting a short value to an int value so we do not have negative short values. 28 | * 29 | * @author Tim Blattner 30 | * @version 1.0 31 | */ 32 | public class TestShortConversion { 33 | 34 | /** 35 | * Main test case 36 | */ 37 | public static void main(String[] args) { 38 | Log.msg(LogType.MANDATORY, "Running test short conversion"); 39 | boolean passed = true; 40 | int count = 0; 41 | 42 | for (short test = Short.MIN_VALUE; test < Short.MAX_VALUE; test++) { 43 | String binaryTest = Integer.toBinaryString(0x10000 | (test & 0xFFFF)).substring(1); 44 | 45 | boolean isNeg = test < 0; 46 | 47 | int temp = test & 0x7fff; 48 | 49 | if (isNeg) 50 | temp |= 0x8000; 51 | 52 | String binaryTemp = Integer.toBinaryString(0x10000 | temp).substring(1); 53 | 54 | if (!binaryTemp.equals(binaryTest)) { 55 | passed = false; 56 | Log.msg(LogType.MANDATORY, "test: " + test + " FAILED"); 57 | } 58 | count++; 59 | 60 | } 61 | 62 | if (passed) 63 | Log.msg(LogType.MANDATORY, count + " values were correctly converted"); 64 | else 65 | Log.msg(LogType.MANDATORY, "Test failed!"); 66 | 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/UpdateSubGridModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:38:18 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.subgrid.SubgridPanel; 22 | 23 | /** 24 | * Validator that checks integers and if valid updates a referenced sub-grid 25 | * 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public class UpdateSubGridModel extends IntModel { 30 | 31 | private SubgridPanel subgridPanel; 32 | 33 | /** 34 | * Creates a validator that updates the sub-grid when the check passes 35 | * 36 | * @param advPanel the panel where the sub-grid exists 37 | */ 38 | public UpdateSubGridModel(SubgridPanel advPanel) { 39 | this.subgridPanel = advPanel; 40 | } 41 | 42 | /** 43 | * Creates a validator that updates the sub-grid when the check passes 44 | * 45 | * @param min the minimum value that is valid (inclusive) 46 | * @param max the maximum value that is valid (inclusive) 47 | * @param advPanel the panel where the subgrid exists 48 | */ 49 | public UpdateSubGridModel(int min, int max, SubgridPanel advPanel) { 50 | super(min, max); 51 | this.subgridPanel = advPanel; 52 | } 53 | 54 | @Override 55 | public boolean validateText(String val) { 56 | if (super.validateText(val)) { 57 | this.subgridPanel.updateSubGrid(); 58 | return true; 59 | } 60 | return false; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/tilegrid/traverser/TileGridTraverserFactory.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:47:52 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.tilegrid.traverser; 20 | 21 | 22 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 23 | import gov.nist.isg.mist.lib.tilegrid.TileGrid; 24 | 25 | /** 26 | * Traversal utility function for creating a traversal based on a type bound to a grid of tiles. 27 | * 28 | * @author Tim Blattner 29 | * @version 1.0 30 | */ 31 | public class TileGridTraverserFactory { 32 | 33 | /** 34 | * Generates a traversal surrounding a tile grid 35 | * 36 | * @param type the type of traversal 37 | * @param grid the subgrid to traverse 38 | * @return the traverser 39 | */ 40 | public static > TileGridTraverser makeTraverser( 41 | TileGridTraverser.Traversals type, TileGrid grid) { 42 | switch (type) { 43 | case ROW: 44 | return new TileGridRowTraverser(grid); 45 | case COLUMN: 46 | return new TileGridColumnTraverser(grid); 47 | case COLUMN_CHAINED: 48 | return new TileGridColumnChainedTraverser(grid); 49 | case DIAGONAL: 50 | return new TileGridDiagonalTraverser(grid); 51 | case DIAGONAL_CHAINED: 52 | return new TileGridDiagonalChainedTraverser(grid); 53 | case ROW_CHAINED: 54 | return new TileGridRowChainedTraverser(grid); 55 | default: 56 | return new TileGridRowTraverser(grid); 57 | 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/DualRegexResetImageSizeModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:37:30 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.outputTab.OutputPanel; 22 | 23 | /** 24 | * Validator that checks values based on two regex and resets image size 25 | * 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public class DualRegexResetImageSizeModel extends DualRegexModel { 30 | 31 | 32 | private OutputPanel outputPanel; 33 | 34 | 35 | /** 36 | * Creates a regex validator based on a given regex 37 | * 38 | * @param regex1 the first regex to check 39 | * @param regex2 the second regex to check 40 | * @param errorText the error text associated with this validator 41 | * @param outputPanel the output panel to reference to reset image size 42 | * @param invalidStrings the invalid strings for this validator 43 | */ 44 | public DualRegexResetImageSizeModel(String regex1, String regex2, String errorText, 45 | OutputPanel outputPanel, String... invalidStrings) { 46 | super(regex1, regex2, errorText, invalidStrings); 47 | 48 | this.outputPanel = outputPanel; 49 | } 50 | 51 | @Override 52 | public boolean validateText(String val) { 53 | if (super.validateText(val)) { 54 | this.outputPanel.resetImageDimensions(); 55 | return true; 56 | } 57 | return false; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/DualRegexModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:37:30 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import java.util.regex.Matcher; 22 | import java.util.regex.Pattern; 23 | 24 | /** 25 | * Validator that checks values based on a two regex 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class DualRegexModel extends InvalidTextModel { 31 | 32 | private Pattern pattern1; 33 | private Pattern pattern2; 34 | 35 | /** 36 | * Creates a regex validator based on a given regex 37 | * 38 | * @param regex1 the first regex to check 39 | * @param regex2 the second regex to check 40 | * @param errorText the error text associated with this validator 41 | * @param invalidStrings the invalid strings for this validator 42 | */ 43 | public DualRegexModel(String regex1, String regex2, String errorText, String... invalidStrings) { 44 | super(errorText, invalidStrings); 45 | this.pattern1 = Pattern.compile(regex1); 46 | this.pattern2 = Pattern.compile(regex2); 47 | } 48 | 49 | @Override 50 | public boolean validateText(String val) { 51 | if (!super.validateText(val)) 52 | return false; 53 | 54 | Matcher matcher1 = this.pattern1.matcher(val); 55 | Matcher matcher2 = this.pattern2.matcher(val); 56 | if (!matcher1.find() || matcher1.groupCount() != 3 || !matcher2.find() 57 | || matcher2.groupCount() != 3) { 58 | return false; 59 | } 60 | return true; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/CheckSubGridModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:31:32 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.subgrid.SubgridPanel; 22 | 23 | /** 24 | * Validator that checks if the subgrid parameters are correct based on the width and height of a 25 | * plate. 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class CheckSubGridModel extends IntModel { 31 | 32 | private SubgridPanel subgridPanel; 33 | 34 | /** 35 | * Creates a sub grid validator. 36 | * 37 | * @param advPanel the panel where the subgrid exists 38 | */ 39 | public CheckSubGridModel(SubgridPanel advPanel) { 40 | this.subgridPanel = advPanel; 41 | } 42 | 43 | /** 44 | * Checks a sub grid validator, also keeping the value in bounds by min (inclusive) and max 45 | * (inclusive) 46 | * 47 | * @param min the minimum value that is valid (inclusive) 48 | * @param max the maximum value that is valid (inclusive) 49 | * @param advPanel the panel where the subgrid exists 50 | */ 51 | public CheckSubGridModel(int min, int max, SubgridPanel advPanel) { 52 | super(min, max); 53 | this.subgridPanel = advPanel; 54 | } 55 | 56 | @Override 57 | public boolean validateText(String val) { 58 | if (super.validateText(val)) { 59 | if (this.subgridPanel.isValidSubGrid()) { 60 | // this.subgridPanel.checkUseFullGrid(); 61 | return true; 62 | } 63 | } 64 | return false; 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/grid/TestCreateGrid.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: Aug 1, 2013 4:18:17 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.grid; 21 | 22 | import gov.nist.isg.mist.lib.log.Log; 23 | import gov.nist.isg.mist.lib.log.Log.LogType; 24 | import gov.nist.isg.mist.lib.tilegrid.loader.SequentialTileGridLoader; 25 | import gov.nist.isg.mist.lib.tilegrid.loader.TileGridLoader.GridDirection; 26 | import gov.nist.isg.mist.lib.tilegrid.loader.TileGridLoader.GridOrigin; 27 | 28 | /** 29 | * Test case for generating different image acquisition strategies. 30 | * 31 | * @author Tim Blattner 32 | * @version 1.0 33 | */ 34 | public class TestCreateGrid { 35 | 36 | /** 37 | * Tests creating every possible type of grid and numbering scheme 38 | */ 39 | public static void runTestCreateGrid() { 40 | Log.setLogLevel(LogType.HELPFUL); 41 | Log.msg(LogType.MANDATORY, "Running Test Create Grid"); 42 | for (GridOrigin origin : GridOrigin.values()) { 43 | for (GridDirection dir : GridDirection.values()) { 44 | System.out.println("Origin: " + origin + " Direction: " + dir); 45 | SequentialTileGridLoader loader = 46 | new SequentialTileGridLoader(4, 4, 1, 0,0,"F_{ppp}.tif", origin, dir); 47 | loader.printNumberGrid(); 48 | System.out.println(); 49 | } 50 | System.out.println(); 51 | } 52 | 53 | 54 | Log.msg(LogType.MANDATORY, "Test Complete"); 55 | } 56 | 57 | /** 58 | * Executes the test case 59 | * 60 | * @param args not used 61 | */ 62 | public static void main(String args[]) { 63 | TestCreateGrid.runTestCreateGrid(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/model/overlap/ParallelMlePoint.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.optimization.model.overlap; 9 | 10 | /** 11 | * Class to hold thread safe best point to enable the stopping condition of the MLE search. 12 | * 13 | * @author Michael Majurski 14 | */ 15 | public class ParallelMlePoint { 16 | 17 | private MLEPoint point; 18 | private int numStableIterations; 19 | 20 | public ParallelMlePoint() { 21 | numStableIterations = 0; 22 | point = new MLEPoint(0, 0, 0, Double.NEGATIVE_INFINITY); 23 | } 24 | 25 | 26 | /** 27 | * Set this local MLEPoint if the new likelihood is better than the current on. 28 | * 29 | * @param p the new point to check against the one held by this class. 30 | */ 31 | public synchronized void setIfBetter(MLEPoint p) { 32 | if (p.getLikelihood() > point.getLikelihood()) { 33 | numStableIterations = 0; 34 | point.setLikelihood(p.getLikelihood()); 35 | point.setMu(p.getMu()); 36 | point.setSigma(p.getSigma()); 37 | point.setPIuni(p.getPIuni()); 38 | } else { 39 | numStableIterations++; 40 | } 41 | } 42 | 43 | /** 44 | * get a deep copy of the MLEPoint held within this class. 45 | * 46 | * @return deep copy of the local MLEPoint1 47 | */ 48 | public synchronized MLEPoint getPoint() { 49 | // return a new deep copy of this point 50 | return point.clone(); 51 | } 52 | 53 | 54 | /** 55 | * Get the number of times setIfBetter has been called since the last time the new point was 56 | * accepted. 57 | * 58 | * @return the number of times setIfBetter has been called without accepting the new point. Aka 59 | * the new likelihood was worse than the likelihood of the point held in the class. 60 | */ 61 | public synchronized int getNumStableIterations() { 62 | return this.numStableIterations; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/export/tileblender/TileOverlayBlend.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 25, 2014 4:27:16 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.export.tileblender; 20 | 21 | import gov.nist.isg.mist.lib.common.Array2DView; 22 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 23 | import ij.IJ; 24 | import ij.ImagePlus; 25 | import ij.process.*; 26 | import loci.formats.FormatException; 27 | import loci.formats.out.OMETiffWriter; 28 | import ome.xml.model.enums.PixelType; 29 | 30 | import java.io.IOException; 31 | import java.nio.*; 32 | import java.util.Arrays; 33 | 34 | /** 35 | * Creates an overlay blending function 36 | * 37 | * @author Tim Blattner 38 | * @version 1.0 39 | */ 40 | 41 | public class TileOverlayBlend extends TileBlender { 42 | 43 | 44 | public TileOverlayBlend(int bytesPerPixel, int imageType) { 45 | super(bytesPerPixel, imageType); 46 | } 47 | 48 | @Override 49 | public void initBlender(int tileSizeX, int tileSizeY) { } 50 | 51 | @Override 52 | public void blend(int x, int y, Array2DView pixels, ImageTile tile) { 53 | ImageProcessor ip = tile.getImageProcessor(); 54 | int tileY = 0; 55 | for (int row = pixels.getStartRow(); row < pixels.getStartRow() + pixels.getViewHeight(); row++) { 56 | int tileX = 0; 57 | for (int col = pixels.getStartCol(); col < pixels.getStartCol() + pixels.getViewWidth(); col++) { 58 | 59 | int pixel = ip.getPixel(col, row); 60 | this.setPixelValue(tileX + x, tileY + y, pixel); 61 | 62 | tileX++; 63 | } 64 | tileY++; 65 | } 66 | } 67 | 68 | @Override 69 | public void finalizeBlend(){ } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/common/DoublePointerComparator.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 1:12:06 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.common; 20 | 21 | import org.bridj.Pointer; 22 | 23 | import java.util.Comparator; 24 | 25 | /** 26 | * A comparator used for sorting a one-dimensional array of double pointers in ascending order. Used 27 | * to obtain the index of the larger elements. 28 | * 29 | *
30 |  * 
31 |  * Pointer ptr;
32 |  * Integer [] indices = new Integer[size];
33 |  * for (i = 0; i < size; i++)
34 |  * 	indices[i] = i;
35 |  *
36 |  * DoublePointerComparator cmp = new DoublePointerComparator(ptr);
37 |  *
38 |  * Arrays.sort(indices, cmp);
39 |  * 
40 |  * 
41 | * 42 | * @author Tim Blattner 43 | * @version 1.0 44 | */ 45 | public class DoublePointerComparator implements Comparator { 46 | 47 | private Pointer pointer; 48 | 49 | /** 50 | * Creates a double pointer comparator that is bound to a pointer 51 | * 52 | * @param pointer the pointer that the object is bound to 53 | */ 54 | public DoublePointerComparator(Pointer pointer) { 55 | this.pointer = pointer; 56 | } 57 | 58 | /** 59 | * Compares two values at indices i1 and i2 inside of the pointer that was initialized with the 60 | * DoublePointerComparator constructor 61 | * 62 | * @param o1 the first index inside of the pointer to compare 63 | * @param o2 the second index inside of the pointer to compare 64 | */ 65 | @Override 66 | public int compare(Integer o1, Integer o2) { 67 | return Double.compare(this.pointer.getDoubleAtIndex(o2), this.pointer.getDoubleAtIndex(o1)); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/TextFieldModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:28:13 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | /** 22 | * Validator is an interface that handles text validation for text fields. Functions for testing the 23 | * text, getting the values, and getting the error text associated with the validation are 24 | * provided. 25 | * 26 | * @param the type of Object for validation 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public interface TextFieldModel { 31 | /** 32 | * Tests the text using a specific validator 33 | * 34 | * @param val the text you wish to test 35 | * @return true if the the text is valid 36 | */ 37 | public boolean validateText(String val); 38 | 39 | /** 40 | * Gets the error message associated with this validator 41 | * 42 | * @return the error message 43 | */ 44 | public String getErrorMessage(); 45 | 46 | /** 47 | * Gets the value of the text based on the validation type 48 | * 49 | * @param val the value you wish to parse 50 | * @return the value parsed by the validator 51 | */ 52 | public T getModelValue(String val); 53 | 54 | /** 55 | * Gets the value of the text based on the validation type. The value that is returned represents 56 | * the value that is to be used in the text 57 | * 58 | * @param val the value you wish to parse 59 | * @return the value that is to be placed inside the text field 60 | */ 61 | public String setModelValue(String val); 62 | 63 | /** 64 | * Updates the view based on the model 65 | */ 66 | public void updateTextFields(); 67 | } 68 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/fftw/TestFFTWComputeFFT32.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | package gov.nist.isg.mist.fftw; 11 | 12 | import java.io.File; 13 | import java.io.FileNotFoundException; 14 | 15 | import gov.nist.isg.mist.lib.log.Log; 16 | import gov.nist.isg.mist.lib.log.Log.LogType; 17 | import gov.nist.isg.mist.lib32.imagetile.fftw.FFTW3Library32; 18 | import gov.nist.isg.mist.lib32.imagetile.fftw.FftwImageTile32; 19 | import gov.nist.isg.mist.timing.TimeUtil; 20 | 21 | 22 | public class TestFFTWComputeFFT32 { 23 | 24 | /** 25 | * Computes the FFT for an image using FFTW 26 | */ 27 | public static void runTestFFTImage() throws FileNotFoundException { 28 | Log.setLogLevel(LogType.INFO); 29 | Log.msg(LogType.MANDATORY, "Running Test Compute FFT Image using FFTW"); 30 | 31 | File file = new File("C:\\majurski\\image-data\\1h_Wet_10Perc\\KB_2012_04_13_1hWet_10Perc_IR_00001.tif"); 32 | 33 | FftwImageTile32.initLibrary("C:\\majurski\\NISTGithub\\MISTMain\\lib\\fftw", "", "libfftw3f"); 34 | 35 | 36 | FftwImageTile32 tile = new FftwImageTile32(file); 37 | 38 | Log.msg(LogType.INFO, "Loading FFTW plan"); 39 | 40 | FftwImageTile32.initPlans(tile.getWidth(), tile.getHeight(), FFTW3Library32.FFTW_MEASURE, true, "test.dat"); 41 | FftwImageTile32.savePlan("test.dat"); 42 | Log.msg(LogType.INFO, "Computing FFT"); 43 | TimeUtil.tick(); 44 | tile.computeFft(); 45 | Log.msg(LogType.HELPFUL, "Finished Computing FFT in " + TimeUtil.tock() + " ms"); 46 | 47 | tile.releaseFftMemory(); 48 | 49 | FftwImageTile32.destroyPlans(); 50 | 51 | // } 52 | 53 | Log.msg(LogType.MANDATORY, "Test Completed."); 54 | } 55 | 56 | /** 57 | * Executes the test case 58 | * 59 | * @param args not used 60 | */ 61 | public static void main(String[] args) { 62 | try { 63 | TestFFTWComputeFFT32.runTestFFTImage(); 64 | } catch (FileNotFoundException e) { 65 | Log.msg(LogType.MANDATORY, "Unable to find file: " + e.getMessage()); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/utilfns/TestUtilFnsNative.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: Aug 1, 2013 4:20:49 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.utilfns; 21 | 22 | import org.bridj.BridJ; 23 | import org.bridj.Pointer; 24 | 25 | import java.io.File; 26 | 27 | import gov.nist.isg.mist.lib.imagetile.utilfns.UtilFnsLibrary; 28 | import gov.nist.isg.mist.lib.log.Log; 29 | import gov.nist.isg.mist.lib.log.Log.LogType; 30 | 31 | /** 32 | * Test case for loading the util functions native library and running an example. 33 | * 34 | * @author Tim Blattner 35 | * @version 1.0 36 | */ 37 | public class TestUtilFnsNative { 38 | 39 | /** 40 | * Tests loading UtilFns native library 41 | */ 42 | public static void runTestUtilFnsNative() { 43 | try { 44 | Log.msg(LogType.MANDATORY, "Running testing loading util functions natively"); 45 | BridJ.setNativeLibraryActualName("utilfns", "util-fns-windows"); 46 | BridJ.addLibraryPath(System.getProperty("user.dir") + File.separator + "util-fns"); 47 | 48 | Pointer test = Pointer.allocateDoubles(1000); 49 | UtilFnsLibrary.reduce_max_abs(test, 1000); 50 | 51 | Log.msg(LogType.MANDATORY, "Util FNS library loaded successfully"); 52 | } catch (UnsatisfiedLinkError ex) { 53 | Log.msg(LogType.MANDATORY, "Unabled to load UtilFns library: " + ex.toString()); 54 | Log.msg(LogType.MANDATORY, ex.getMessage()); 55 | } catch (Exception e) { 56 | Log.msg(LogType.MANDATORY, "Unabled to load UtilFns library: " + e.toString()); 57 | Log.msg(LogType.MANDATORY, e.getMessage()); 58 | } 59 | 60 | } 61 | 62 | /** 63 | * Executes the test case 64 | * 65 | * @param args not used 66 | */ 67 | public static void main(String[] args) { 68 | TestUtilFnsNative.runTestUtilFnsNative(); 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/basic/TestReadingImage.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: May 10, 2013 2:59:20 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.basic; 21 | 22 | import java.io.File; 23 | 24 | import javax.swing.*; 25 | 26 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 27 | import gov.nist.isg.mist.lib.imagetile.fftw.FftwImageTile; 28 | import gov.nist.isg.mist.lib.log.Log; 29 | import gov.nist.isg.mist.lib.log.Log.LogType; 30 | import gov.nist.isg.mist.timing.TimeUtil; 31 | 32 | /** 33 | * Test case for reading an image. 34 | * 35 | * @author Tim Blattner 36 | * @version 1.0 37 | */ 38 | public class TestReadingImage { 39 | 40 | /** 41 | * Tests reading an image 42 | */ 43 | public static void testReadingImage() { 44 | JFrame frame = new JFrame(); 45 | 46 | Log.msg(LogType.MANDATORY, "Running Test Reading Image"); 47 | 48 | JFileChooser chooser = 49 | new JFileChooser("F:\\StitchingData\\StitchingTestSlowFileLoad\\SSEA4_5x(1)"); 50 | chooser.setDialogTitle("Select File to test reading image."); 51 | 52 | int result = chooser.showOpenDialog(frame); 53 | 54 | // File file = new 55 | // File("C:\\Users\\tjb3\\Desktop\\input_images\\F_0001.tif"); 56 | 57 | if (result == JFileChooser.APPROVE_OPTION) { 58 | File file = chooser.getSelectedFile(); 59 | 60 | TimeUtil.tick(); 61 | ImageTile tile = new FftwImageTile(file); 62 | Log.msg(LogType.INFO, "Read Complete: " + tile.toString()); 63 | } else { 64 | Log.msg(LogType.MANDATORY, "Canceled selecting image."); 65 | } 66 | 67 | Log.msg(LogType.MANDATORY, "Test Completed in " + TimeUtil.tock() + "ms"); 68 | } 69 | 70 | /** 71 | * Executes the test case 72 | * 73 | * @param args not used 74 | */ 75 | public static void main(String[] args) { 76 | TestReadingImage.testReadingImage(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/params/interfaces/GUIParamFunctions.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 1:05:00 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.params.interfaces; 20 | 21 | import gov.nist.isg.mist.gui.params.StitchingAppParams; 22 | 23 | /** 24 | * An interface that represents parameter functions 25 | * 26 | * @author Tim Blattner 27 | * @version 1.0 28 | */ 29 | public interface GUIParamFunctions { 30 | 31 | /** 32 | * Loads parameters into the GUI 33 | * 34 | * @param params the params to load 35 | */ 36 | public void loadParamsIntoGUI(StitchingAppParams params); 37 | 38 | /** 39 | * Checks and parses the arguments in the GUI, setting the StitchingAppParams 40 | * 41 | * @param params the parameters that the GUI should set 42 | * @return true if the parameters were set 43 | */ 44 | public boolean checkAndParseGUI(StitchingAppParams params); 45 | 46 | /** 47 | * Checks the GUI arguments 48 | * 49 | * @return true if the arguments passed 50 | */ 51 | public boolean checkGUIArgs(); 52 | 53 | /** 54 | * Enables flag to indicate that we are loading parameters 55 | */ 56 | public void enableLoadingParams(); 57 | 58 | /** 59 | * Disables flag to indicate that we are loading parameters 60 | */ 61 | public void disableLoadingParams(); 62 | 63 | /** 64 | * Checks if we are loading parameters 65 | * 66 | * @return true if we are laoding parameters 67 | */ 68 | public boolean isLoadingParams(); 69 | 70 | /** 71 | * Loads parameters from GUI into parameter object that is used to save the parameters to a file 72 | * 73 | * @param params the params that are to be loaded from the GUI and saved 74 | * @param isClosing true if the application is being closed, otherwise false 75 | */ 76 | public void saveParamsFromGUI(StitchingAppParams params, boolean isClosing); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/CheckSubGridOneBasedModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:31:32 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.subgrid.SubgridPanel; 22 | 23 | /** 24 | * Validator that checks if the subgrid parameters are correct based on the width and height of a 25 | * plate. Also converts the values to enforce 1-based indexing. When getting the value, it will 26 | * convert the value from 1-based to 0-based, and when setting the value it converts from 0-based to 27 | * 1-based. 28 | * 29 | * @author Tim Blattner 30 | * @version 1.0 31 | */ 32 | public class CheckSubGridOneBasedModel extends CheckSubGridModel { 33 | 34 | /** 35 | * Creates a sub grid validator. 36 | * 37 | * @param advPanel the panel where the subgrid exists 38 | */ 39 | public CheckSubGridOneBasedModel(SubgridPanel advPanel) { 40 | super(advPanel); 41 | } 42 | 43 | /** 44 | * Checks a sub grid validator, also keeping the value in bounds by min (inclusive) and max 45 | * (inclusive) 46 | * 47 | * @param min the minimum value that is valid (inclusive) 48 | * @param max the maximum value that is valid (inclusive) 49 | * @param advPanel the panel where the subgrid exists 50 | */ 51 | public CheckSubGridOneBasedModel(int min, int max, SubgridPanel advPanel) { 52 | super(min, max, advPanel); 53 | } 54 | 55 | @Override 56 | public Integer getModelValue(String val) { 57 | int value = super.getModelValue(val); 58 | 59 | return value - 1; 60 | 61 | } 62 | 63 | 64 | @Override 65 | public String setModelValue(String val) { 66 | String valueStr = super.setModelValue(val); 67 | 68 | int zeroBasedVal = Integer.parseInt(valueStr); 69 | 70 | return Integer.toString(zeroBasedVal + 1); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/InvalidTextModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:37:30 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | /** 25 | * Validator that checks values based on a two regex 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class InvalidTextModel implements TextFieldModel { 31 | 32 | private List invalidText; 33 | private String errorText; 34 | 35 | /** 36 | * Creates a regex validator based on a given regex 37 | * 38 | * @param invalidStrings the array of invalid strings 39 | * @param errorText the error text associated with this validator 40 | */ 41 | public InvalidTextModel(String errorText, String... invalidStrings) { 42 | this.invalidText = Arrays.asList(invalidStrings); 43 | this.errorText = errorText; 44 | 45 | // update the error text to reflect that the invalid strings are invalid 46 | String extraErrorText = "

Invalid Character Sequences:"; 47 | for (String str : invalidStrings) 48 | extraErrorText = extraErrorText + "
" + "\"" + str + "\""; 49 | 50 | extraErrorText = extraErrorText + ""; 51 | this.errorText = this.errorText.replace("", extraErrorText); 52 | } 53 | 54 | @Override 55 | public boolean validateText(String val) { 56 | for (String s : this.invalidText) 57 | if (val.contains(s)) 58 | return false; 59 | 60 | return true; 61 | } 62 | 63 | @Override 64 | public String getErrorMessage() { 65 | return this.errorText; 66 | } 67 | 68 | @Override 69 | public String getModelValue(String val) { 70 | return val; 71 | } 72 | 73 | @Override 74 | public String setModelValue(String val) { 75 | return val; 76 | } 77 | 78 | @Override 79 | public void updateTextFields() { 80 | } 81 | 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/model/overlap/MLEPoint.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.optimization.model.overlap; 9 | 10 | import java.util.Random; 11 | 12 | /** 13 | * Class to hold MLE model. 14 | * 15 | * @author Michael Majurski 16 | */ 17 | public class MLEPoint implements Cloneable { 18 | 19 | private int PIuni; 20 | private int mu; 21 | private int sigma; 22 | private double likelihood; 23 | 24 | public static Random randMaker = new Random(System.currentTimeMillis()); 25 | 26 | /** 27 | * Create a new MLE model from the model parameters. 28 | * 29 | * @param PIuni (PIuniform) the probability of translation belonging in the uniform distribution. 30 | * @param mu the mean of the models normal distribution 31 | * @param sigma the standard deviation of the models normal distributions. 32 | * @param l the likelihood of the current model given some set of translations. 33 | */ 34 | public MLEPoint(int PIuni, int mu, int sigma, double l) { 35 | this.PIuni = PIuni; 36 | this.mu = mu; 37 | this.sigma = sigma; 38 | this.likelihood = l; 39 | } 40 | 41 | /** 42 | * Get a new random MLEPoint. 43 | * 44 | * @return MLEPoint with random PIuni, mu, sigma, and Double.NaN likelihood. 45 | */ 46 | public static synchronized MLEPoint getRandomPoint() { 47 | int p = (int) Math.round(100 * randMaker.nextDouble()); 48 | int m = (int) Math.round(100 * randMaker.nextDouble()); 49 | int s = (int) Math.round(100 * randMaker.nextDouble()); 50 | return new MLEPoint(p, m, s, Double.NaN); 51 | } 52 | 53 | public int getPIuni() { return this.PIuni; } 54 | public void setPIuni(int val) { this.PIuni = val; } 55 | 56 | public int getMu() { return this.mu; } 57 | public void setMu(int val) { this.mu = val; } 58 | 59 | public int getSigma() { return this.sigma; } 60 | public void setSigma(int val) { this.sigma = val; } 61 | 62 | public double getLikelihood() { return this.likelihood; } 63 | public void setLikelihood(double val) { this.likelihood = val; } 64 | 65 | 66 | /** 67 | * Create a new deep copy of the given MLE model 68 | */ 69 | @Override 70 | public MLEPoint clone() { 71 | return new MLEPoint(PIuni, mu, sigma, likelihood); 72 | } 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/params/utils/StitchingParamUtils.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Oct 1, 2014 1:54:40 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | package gov.nist.isg.mist.gui.params.utils; 18 | 19 | import gov.nist.isg.mist.lib.log.Log; 20 | import gov.nist.isg.mist.lib.log.Log.LogType; 21 | 22 | /** 23 | * StitchingParamUtils are utility functions for stitching parameters 24 | * 25 | * @author Tim Blattner 26 | */ 27 | public class StitchingParamUtils { 28 | 29 | /** 30 | * Loads a double value from a string 31 | * 32 | * @param val the double value in string format 33 | * @param def the default value 34 | * @return the double value 35 | */ 36 | public static double loadDouble(String val, double def) { 37 | try { 38 | return Double.parseDouble(val.trim()); 39 | } catch (NumberFormatException e) { 40 | Log.msg(LogType.MANDATORY, "Error in loading double value: " + val + " using default: " + def); 41 | return def; 42 | } 43 | } 44 | 45 | /** 46 | * Loads a integer value from a string 47 | * 48 | * @param val the integer value in string format 49 | * @param def the default value 50 | * @return the integer value 51 | */ 52 | public static int loadInteger(String val, int def) { 53 | try { 54 | return Integer.parseInt(val.trim()); 55 | } catch (NumberFormatException e) { 56 | Log.msg(LogType.MANDATORY, "Error in loading integer value: " + val + " using default: " 57 | + def); 58 | return def; 59 | } 60 | } 61 | 62 | /** 63 | * Loads a boolean value from a string 64 | * 65 | * @param val the boolean value in string format 66 | * @param def the default value 67 | * @return the boolean value 68 | */ 69 | public static boolean loadBoolean(String val, boolean def) { 70 | try { 71 | return Boolean.parseBoolean(val.trim()); 72 | } catch (NumberFormatException e) { 73 | Log.msg(LogType.MANDATORY, "Error in loading boolean value: " + val + " using default: " 74 | + def); 75 | return def; 76 | } 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/params/interfaces/StitchingAppParamFunctions.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Oct 1, 2014 1:46:11 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // ================================================================ 17 | package gov.nist.isg.mist.gui.params.interfaces; 18 | 19 | import java.io.File; 20 | import java.io.FileWriter; 21 | import java.util.prefs.Preferences; 22 | 23 | import gov.nist.isg.mist.lib.log.Log.LogType; 24 | 25 | /** 26 | * StitchingAppParamFunctions describes the stitching app param functions 27 | * 28 | * @author Tim Blattner 29 | */ 30 | public interface StitchingAppParamFunctions { 31 | 32 | /** 33 | * Checks parameters 34 | * 35 | * @return true if parameters check is successful, otherwise false 36 | */ 37 | public boolean checkParams(); 38 | 39 | /** 40 | * Loads parameters from a fileReader 41 | * 42 | * @param file the file to load params from 43 | * @return true if loading was successful, otherwise false 44 | */ 45 | public boolean loadParams(File file); 46 | 47 | /** 48 | * Loads parameters from preferences 49 | * 50 | * @param preferences the preferences you wish to load 51 | * @return true if loading was successful, otherwise false 52 | */ 53 | public boolean loadParams(Preferences preferences); 54 | 55 | /** 56 | * Prints parameters specifying a log level 57 | * 58 | * @param logLevel the log level to use for printing parameters 59 | */ 60 | public void printParams(LogType logLevel); 61 | 62 | /** 63 | * Loads parameters from macro 64 | * 65 | * @param macroOptions the macro options to load 66 | */ 67 | public void loadMacro(String macroOptions); 68 | 69 | /** 70 | * Records parameters into macro 71 | */ 72 | public void recordMacro(); 73 | 74 | /** 75 | * Saves parameters into preferences 76 | * 77 | * @param preferences the preferences to save 78 | */ 79 | public void saveParams(Preferences preferences); 80 | 81 | /** 82 | * Saves parameters into file 83 | * 84 | * @param writer the file writer to save 85 | * @return true if the save was successful, otherwise false 86 | */ 87 | public boolean saveParams(FileWriter writer); 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/fftw/TestFFTWComputeFFT.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: May 10, 2013 2:59:10 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.fftw; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | 25 | import gov.nist.isg.mist.lib.imagetile.fftw.FFTW3Library; 26 | import gov.nist.isg.mist.lib.imagetile.fftw.FftwImageTile; 27 | import gov.nist.isg.mist.lib.log.Log; 28 | import gov.nist.isg.mist.lib.log.Log.LogType; 29 | import gov.nist.isg.mist.timing.TimeUtil; 30 | 31 | /** 32 | * Test case for computing the FFT of an image using FFTW 33 | * 34 | * @author Tim Blattner 35 | * @version 1.0 36 | */ 37 | public class TestFFTWComputeFFT { 38 | 39 | /** 40 | * Computes the FFT for an image using FFTW 41 | */ 42 | public static void runTestFFTImage() throws FileNotFoundException { 43 | Log.setLogLevel(LogType.INFO); 44 | 45 | Log.msg(LogType.MANDATORY, "Running Test Compute FFT Image using FFTW"); 46 | 47 | 48 | File file = new File("C:\\majurski\\image-data\\1h_Wet_10Perc\\KB_2012_04_13_1hWet_10Perc_IR_00001.tif"); 49 | FftwImageTile.initLibrary("C:\\majurski\\NISTGithub\\MISTMain\\lib\\fftw", "", "libfftw3"); 50 | 51 | FftwImageTile tile = new FftwImageTile(file); 52 | 53 | Log.msg(LogType.INFO, "Loading FFTW plan"); 54 | 55 | FftwImageTile.initPlans(tile.getWidth(), tile.getHeight(), FFTW3Library.FFTW_MEASURE, true, "test.dat"); 56 | FftwImageTile.savePlan("test.dat"); 57 | Log.msg(LogType.INFO, "Computing FFT"); 58 | TimeUtil.tick(); 59 | tile.computeFft(); 60 | Log.msg(LogType.HELPFUL, "Finished Computing FFT in " + TimeUtil.tock() + " ms"); 61 | 62 | tile.releaseFftMemory(); 63 | 64 | FftwImageTile.destroyPlans(); 65 | 66 | Log.msg(LogType.MANDATORY, "Test Completed."); 67 | } 68 | 69 | /** 70 | * Executes the test case 71 | * 72 | * @param args not used 73 | */ 74 | public static void main(String[] args) { 75 | try { 76 | TestFFTWComputeFFT.runTestFFTImage(); 77 | } catch (FileNotFoundException e) { 78 | Log.msg(LogType.MANDATORY, "Unable to find file: " + e.getMessage()); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/lib/parallel/gpu/TileProducer.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:59:00 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.lib.parallel.gpu; 20 | 21 | import java.util.concurrent.PriorityBlockingQueue; 22 | 23 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 24 | import gov.nist.isg.mist.lib.imagetile.ImageTile.State; 25 | import gov.nist.isg.mist.lib.memorypool.DynamicMemoryPool; 26 | import gov.nist.isg.mist.lib.parallel.common.StitchingTask; 27 | import gov.nist.isg.mist.lib.parallel.common.StitchingTask.TaskType; 28 | import gov.nist.isg.mist.lib.tilegrid.traverser.TileGridTraverser; 29 | 30 | /** 31 | * A thread dedicated to reading and allocating memory for image tiles. 32 | * 33 | * @author Tim Blattner 34 | * @version 1.0 35 | */ 36 | public class TileProducer implements Runnable { 37 | 38 | private TileGridTraverser> traverser; 39 | private PriorityBlockingQueue> workQueue; 40 | private DynamicMemoryPool pool; 41 | 42 | private volatile boolean isCancelled; 43 | 44 | /** 45 | * Initializes a producer thread 46 | * 47 | * @param traverser the traverser 48 | * @param workQueue the work queu 49 | * @param pool the pool of memory 50 | */ 51 | public TileProducer(TileGridTraverser> traverser, 52 | PriorityBlockingQueue> workQueue, DynamicMemoryPool pool) { 53 | this.traverser = traverser; 54 | this.workQueue = workQueue; 55 | this.pool = pool; 56 | this.isCancelled = false; 57 | } 58 | 59 | @Override 60 | public void run() { 61 | for (ImageTile tile : this.traverser) { 62 | if (this.isCancelled) 63 | break; 64 | 65 | tile.readTile(); 66 | 67 | tile.setFftState(State.IN_FLIGHT); 68 | tile.allocateFftMemory(this.pool); 69 | this.workQueue.put(new StitchingTask(tile, null, TaskType.FFT)); 70 | } 71 | 72 | this.workQueue.put(new StitchingTask(null, null, StitchingTask.TaskType.READ_DONE)); 73 | } 74 | 75 | /** 76 | * Cancels the task 77 | */ 78 | public void cancel() { 79 | this.isCancelled = true; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/model/overlap/MleLikelihoodCache.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.optimization.model.overlap; 9 | 10 | /** 11 | * Class to hold thread safe cache of Maximum Likelihood values to prevent recomputing between 12 | * threads. 13 | * 14 | * @author Michael Majurski 15 | */ 16 | public class MleLikelihoodCache { 17 | 18 | double likelihood[][][]; 19 | 20 | /** 21 | * Allocates the MLE likelihood cache and initializes each element to Double.NaN 22 | */ 23 | public MleLikelihoodCache() { 24 | likelihood = new double[100][100][100]; 25 | 26 | // init all values to Double.Nan 27 | for (int p = 0; p < 100; p++) 28 | for (int m = 0; m < 100; m++) 29 | for (int s = 0; s < 100; s++) 30 | likelihood[p][m][s] = Double.NaN; 31 | 32 | 33 | } 34 | 35 | 36 | /** 37 | * Thread safe method to get a cached MLE likelihood value. 38 | * 39 | * Per the Java documentation, synchronized is per instance. Therefore, since this cache 40 | * instance is shared among the workers, there is no potential conflicts. 41 | * 42 | * @param p the PIuniform query percent value. Valid range: [0,100) 43 | * @param m the mu query percent value. Valid range: [0,100) 44 | * @param s the sigma query percent value. Valid range: [0,100) 45 | * @return the cached likelihood value, or Double.NaN if not yet computed. 46 | */ 47 | public synchronized double getLikelihood(int p, int m, int s) { 48 | double val = Double.NEGATIVE_INFINITY; 49 | if (p >= 0 && p < 100 && m >= 0 && m < 100 && s >= 0 && s < 100) 50 | val = likelihood[p][m][s]; 51 | 52 | return val; 53 | } 54 | 55 | /** 56 | * Thread safe method to set a cached MLE likelihood value. 57 | * 58 | * Per the Java documentation, synchronized is per instance. Therefore, since this cache 59 | * instance is shared among the workers, there is no potential conflicts. 60 | * 61 | * @param p the PIuniform query percent value. Valid range: [0,100) 62 | * @param m the mu query percent value. Valid range: [0,100) 63 | * @param s the sigma query percent value. Valid range: [0,100) 64 | * @param l the likelihood value. 65 | */ 66 | public synchronized void setLikelihood(int p, int m, int s, double l) { 67 | if (p >= 0 && p < 100 && m >= 0 && m < 100 && s >= 0 && s < 100) 68 | likelihood[p][m][s] = l; 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/workflow/tasks/TileProducer.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Aug 1, 2013 3:59:00 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.optimization.workflow.tasks; 20 | 21 | import java.util.concurrent.BlockingQueue; 22 | import java.util.concurrent.Semaphore; 23 | 24 | import gov.nist.isg.mist.lib.imagetile.ImageTile; 25 | import gov.nist.isg.mist.lib.log.Log; 26 | import gov.nist.isg.mist.lib.tilegrid.traverser.TileGridTraverser; 27 | import gov.nist.isg.mist.optimization.workflow.data.OptimizationData; 28 | 29 | /** 30 | * A thread dedicated to reading and allocating memory for image tiles. 31 | * 32 | * @author Tim Blattner 33 | * @version 1.0 34 | */ 35 | public class TileProducer implements Runnable { 36 | 37 | private TileGridTraverser> traverser; 38 | private BlockingQueue> workQueue; 39 | private Semaphore sem; 40 | 41 | private volatile boolean isCancelled; 42 | 43 | /** 44 | * Initializes a producer thread 45 | * 46 | * @param traverser the traverser 47 | * @param workQueue the work queue 48 | */ 49 | public TileProducer(TileGridTraverser> traverser, 50 | BlockingQueue> workQueue, Semaphore sem) { 51 | this.traverser = traverser; 52 | this.workQueue = workQueue; 53 | this.sem = sem; 54 | this.isCancelled = false; 55 | } 56 | 57 | @Override 58 | public void run() { 59 | for (ImageTile tile : this.traverser) { 60 | if (this.isCancelled) 61 | break; 62 | 63 | try { 64 | if (sem != null) { 65 | sem.acquire(); 66 | } 67 | 68 | tile.readTile(); 69 | 70 | } catch (InterruptedException e) { 71 | Log.msg(Log.LogType.MANDATORY, "Tile producer Interrupted"); 72 | return; 73 | } 74 | 75 | this.workQueue.add(new OptimizationData(tile, OptimizationData.TaskType.BK_CHECK_NEIGHBORS)); 76 | 77 | } 78 | 79 | } 80 | 81 | /** 82 | * Cancels the task 83 | */ 84 | public void cancel() { 85 | this.isCancelled = true; 86 | if (this.sem != null) 87 | this.sem.release(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/gui/components/textfield/textFieldModel/CheckSubGridAndFileSizeModel.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | // ================================================================ 10 | // 11 | // Author: tjb3 12 | // Date: Apr 18, 2014 12:38:18 PM EST 13 | // 14 | // Time-stamp: 15 | // 16 | // 17 | // ================================================================ 18 | 19 | package gov.nist.isg.mist.gui.components.textfield.textFieldModel; 20 | 21 | import gov.nist.isg.mist.gui.panels.outputTab.OutputPanel; 22 | import gov.nist.isg.mist.gui.panels.subgrid.SubgridPanel; 23 | 24 | /** 25 | * Validator that checks integers and if valid updates a referenced sub-grid 26 | * 27 | * @author Tim Blattner 28 | * @version 1.0 29 | */ 30 | public class CheckSubGridAndFileSizeModel extends CheckSubGridModel { 31 | 32 | private OutputPanel outputPanel; 33 | private SubgridPanel subgridPanel; 34 | 35 | /** 36 | * Creates a validator that updates the sub-grid when the check passes 37 | * 38 | * @param subgridPanel the panel where the sub-grid exists 39 | * @param outputPanel the output panel to reference the file size 40 | */ 41 | public CheckSubGridAndFileSizeModel(SubgridPanel subgridPanel, OutputPanel outputPanel) { 42 | super(subgridPanel); 43 | this.outputPanel = outputPanel; 44 | this.subgridPanel = subgridPanel; 45 | } 46 | 47 | /** 48 | * Creates a validator that updates the sub-grid when the check passes 49 | * 50 | * @param min the minimum value that is valid (inclusive) 51 | * @param max the maximum value that is valid (inclusive) 52 | * @param subgridPanel the panel where the subgrid exists 53 | * @param outputPanel the output panel to reference the file size 54 | */ 55 | public CheckSubGridAndFileSizeModel(int min, int max, SubgridPanel subgridPanel, 56 | OutputPanel outputPanel) { 57 | super(min, max, subgridPanel); 58 | this.outputPanel = outputPanel; 59 | this.subgridPanel = subgridPanel; 60 | 61 | } 62 | 63 | @Override 64 | public boolean validateText(String val) { 65 | if (super.validateText(val)) { 66 | this.outputPanel.updateFileSize(this.subgridPanel.getExtentHeight() * this.subgridPanel.getExtentWidth()); 67 | return true; 68 | } 69 | this.outputPanel.updateFileSize(0); 70 | return false; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/java/TestJavaComputeFFT.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: May 10, 2013 2:59:10 PM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.java; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | 25 | import javax.swing.*; 26 | 27 | import gov.nist.isg.mist.lib.imagetile.java.JavaImageTile; 28 | import gov.nist.isg.mist.lib.log.Log; 29 | import gov.nist.isg.mist.lib.log.Log.LogType; 30 | import gov.nist.isg.mist.timing.TimeUtil; 31 | 32 | /** 33 | * Test case for computing the FFT of an image using Java. 34 | * 35 | * @author Tim Blattner 36 | * @version 1.0 37 | */ 38 | public class TestJavaComputeFFT { 39 | 40 | /** 41 | * Tests computing the FFT of an image using java. 42 | */ 43 | public static void runTestFFTImage() throws FileNotFoundException { 44 | JFrame frame = new JFrame(); 45 | 46 | Log.setLogLevel(LogType.INFO); 47 | Log.msg(LogType.MANDATORY, "Running Test Compute FFT Image Java"); 48 | 49 | JFileChooser chooser = new JFileChooser("F:\\StitchingData\\joe_bad_data"); 50 | chooser.setDialogTitle("Select File to test computing FFT."); 51 | 52 | int result = chooser.showOpenDialog(frame); 53 | 54 | if (result == JFileChooser.APPROVE_OPTION) { 55 | File file = chooser.getSelectedFile(); 56 | 57 | JavaImageTile tile = new JavaImageTile(file); 58 | JavaImageTile.initJavaPlan(tile); 59 | Log.msg(LogType.INFO, "Read complete: " + tile.toString()); 60 | 61 | TimeUtil.tick(); 62 | tile.computeFft(); 63 | 64 | 65 | Log.msg(LogType.MANDATORY, "FFT complete for: " + tile.getFileName() + " computed in " 66 | + TimeUtil.tock() + "ms"); 67 | 68 | 69 | } else { 70 | Log.msg(LogType.MANDATORY, "Canceled selecting image."); 71 | } 72 | 73 | Log.msg(LogType.MANDATORY, "Test Completed."); 74 | } 75 | 76 | /** 77 | * Executes the test case 78 | * 79 | * @param args not used 80 | */ 81 | public static void main(String[] args) { 82 | try { 83 | TestJavaComputeFFT.runTestFFTImage(); 84 | } catch (FileNotFoundException e) { 85 | Log.msg(LogType.MANDATORY, "Unable to find file: " + e.getMessage()); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/jcuda/TestJCUDACUFFT.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: Jul 2, 2014 11:54:02 AM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.jcuda; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | 25 | import gov.nist.isg.mist.lib.imagetile.jcuda.CudaImageTile; 26 | import gov.nist.isg.mist.lib.imagetile.jcuda.CudaUtils; 27 | import gov.nist.isg.mist.lib.libraryloader.LibraryUtils; 28 | import gov.nist.isg.mist.lib.log.Log; 29 | import gov.nist.isg.mist.lib.log.Log.LogType; 30 | import gov.nist.isg.mist.timing.TimeUtil; 31 | import jcuda.LogLevel; 32 | import jcuda.driver.JCudaDriver; 33 | import jcuda.runtime.JCuda; 34 | 35 | /** 36 | * Test case for computing the FFT using CUDA cuFFT 37 | * 38 | * @author Tim Blattner 39 | * @version 1.0 40 | */ 41 | public class TestJCUDACUFFT { 42 | 43 | private static void runTestJCUDACUFFT() throws FileNotFoundException { 44 | LibraryUtils.initalize(); 45 | JCudaDriver.setExceptionsEnabled(true); 46 | JCudaDriver.setLogLevel(LogLevel.LOG_DEBUG); 47 | Log.setLogLevel(LogType.VERBOSE); 48 | Log.msg(LogType.MANDATORY, "Running JCUDA CUFFT test"); 49 | 50 | File file = new File("C:\\majurski\\image-data\\1h_Wet_10Perc\\KB_2012_04_13_1hWet_10Perc_IR_00001.tif"); 51 | 52 | // BridJ.addLibraryPath(System.getProperty("user.dir") + File.separator 53 | // + "libs" + File.separator + "jcuda"); 54 | 55 | CudaImageTile tile = new CudaImageTile(file); 56 | 57 | boolean enableCudaExceptions = true; 58 | CudaUtils.initJCUDA(1, new int[]{0}, tile, enableCudaExceptions); 59 | 60 | TimeUtil.tick(); 61 | tile.setDev(0); 62 | tile.computeFft(); 63 | 64 | JCuda.cudaDeviceSynchronize(); 65 | 66 | Log.msg(LogType.MANDATORY, "Completed FFT in : " + TimeUtil.tock() + "ms"); 67 | 68 | Log.msg(LogType.MANDATORY, "Test Completed."); 69 | } 70 | 71 | /** 72 | * Executes the test case 73 | * 74 | * @param args not used 75 | */ 76 | public static void main(String[] args) { 77 | try { 78 | TestJCUDACUFFT.runTestJCUDACUFFT(); 79 | } catch (FileNotFoundException e) { 80 | Log.msg(LogType.MANDATORY, "File not found: " + e.getMessage()); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/test/java/gov/nist/isg/mist/jcuda/TestJCUDACUFFT32.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | 9 | 10 | // ================================================================ 11 | // 12 | // Author: tjb3 13 | // Date: Jul 2, 2014 11:54:02 AM EST 14 | // 15 | // Time-stamp: 16 | // 17 | // 18 | // ================================================================ 19 | 20 | package gov.nist.isg.mist.jcuda; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | 25 | import gov.nist.isg.mist.lib.imagetile.jcuda.CudaUtils; 26 | import gov.nist.isg.mist.lib.libraryloader.LibraryUtils; 27 | import gov.nist.isg.mist.lib.log.Log; 28 | import gov.nist.isg.mist.lib.log.Log.LogType; 29 | import gov.nist.isg.mist.lib32.imagetile.jcuda.CudaImageTile32; 30 | import gov.nist.isg.mist.timing.TimeUtil; 31 | import jcuda.LogLevel; 32 | import jcuda.driver.JCudaDriver; 33 | import jcuda.runtime.JCuda; 34 | 35 | /** 36 | * Test case for computing the FFT using CUDA cuFFT 37 | * 38 | * @author Tim Blattner 39 | * @version 1.0 40 | */ 41 | public class TestJCUDACUFFT32 { 42 | 43 | private static void runTestJCUDACUFFT() throws FileNotFoundException { 44 | LibraryUtils.initalize(); 45 | JCudaDriver.setExceptionsEnabled(true); 46 | JCudaDriver.setLogLevel(LogLevel.LOG_DEBUG); 47 | Log.setLogLevel(LogType.VERBOSE); 48 | Log.msg(LogType.MANDATORY, "Running JCUDA CUFFT test"); 49 | 50 | File file = new File("C:\\majurski\\image-data\\1h_Wet_10Perc\\KB_2012_04_13_1hWet_10Perc_IR_00001.tif"); 51 | 52 | // BridJ.addLibraryPath(System.getProperty("user.dir") + File.separator 53 | // + "libs" + File.separator + "jcuda"); 54 | 55 | CudaImageTile32 tile = new CudaImageTile32(file); 56 | 57 | boolean enableCudaExceptions = true; 58 | CudaUtils.initJCUDA(1, new int[]{0}, tile, enableCudaExceptions); 59 | 60 | TimeUtil.tick(); 61 | tile.setDev(0); 62 | tile.computeFft(); 63 | 64 | JCuda.cudaDeviceSynchronize(); 65 | 66 | Log.msg(LogType.MANDATORY, "Completed FFT in : " + TimeUtil.tock() + "ms"); 67 | 68 | Log.msg(LogType.MANDATORY, "Test Completed."); 69 | } 70 | 71 | /** 72 | * Executes the test case 73 | * 74 | * @param args not used 75 | */ 76 | public static void main(String[] args) { 77 | try { 78 | TestJCUDACUFFT32.runTestJCUDACUFFT(); 79 | } catch (FileNotFoundException e) { 80 | Log.msg(LogType.MANDATORY, "File not found: " + e.getMessage()); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /assemble_stitched_image.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | import skimage.io 4 | 5 | 6 | def assemble_image(global_positions_filepath, images_dirpath, output_filepath): 7 | 8 | parent, fn = os.path.split(output_filepath) 9 | if not os.path.exists(parent): 10 | os.makedirs(parent) 11 | 12 | if not os.path.exists(global_positions_filepath): 13 | raise RuntimeError('Missing global positions file: {}'.format(global_positions_filepath)) 14 | 15 | # load the global positions for each image 16 | img_names = list() 17 | pixel_x_position = list() 18 | pixel_y_position = list() 19 | with open(global_positions_filepath, 'r') as fh: 20 | for line in fh: 21 | line = line.strip() 22 | toks = line.split(';') 23 | 24 | # handle file name loading 25 | fn_tok = toks[0] 26 | fn = fn_tok.split(':')[1].strip() 27 | img_names.append(fn) 28 | 29 | # handle the position loading 30 | pos_tok = toks[2] 31 | pos_pair = pos_tok.split(':')[1].strip() 32 | pos_pair = pos_pair.replace(')', '') 33 | pos_pair = pos_pair.replace('(', '') 34 | pos_pairs = pos_pair.split(',') 35 | x = int(pos_pairs[0].strip()) 36 | y = int(pos_pairs[1].strip()) 37 | pixel_x_position.append(x) 38 | pixel_y_position.append(y) 39 | 40 | # verify that all images exist 41 | if not os.path.exists(images_dirpath): 42 | raise RuntimeError('Images directory does not exist: {}'.format(images_dirpath)) 43 | 44 | for fn in img_names: 45 | if not os.path.exists(os.path.join(images_dirpath, fn)): 46 | raise RuntimeError('Image {} expected based on global positions file, but its missing from the image directory.'.format(fn)) 47 | 48 | # compute how large of an output image will be required. 49 | first_tile = skimage.io.imread(os.path.join(images_dirpath, img_names[0])) 50 | tile_shape = first_tile.shape 51 | n_channels = 1 52 | if len(tile_shape) == 3: 53 | n_channels = tile_shape[2] 54 | tile_h = tile_shape[0] 55 | tile_w = tile_shape[1] 56 | 57 | stitched_img_h = tile_h + np.max(pixel_y_position) 58 | stitched_img_w = tile_w + np.max(pixel_x_position) 59 | 60 | # creating blank image 61 | print('Creating blank stitched image of size: ({}, {}, {})'.format(stitched_img_h, stitched_img_w, n_channels)) 62 | stitched_img = np.zeros((stitched_img_h, stitched_img_w, n_channels), dtype=first_tile.dtype) 63 | 64 | for i in range(0, len(img_names)): 65 | fn = img_names[i] 66 | x = pixel_x_position[i] 67 | y = pixel_y_position[i] 68 | print('Img {}/{}. Placing {} at ({}, {})'.format(i, len(img_names), fn, x, y)) 69 | tile = skimage.io.imread(os.path.join(images_dirpath, fn)) 70 | if tile.shape != tile_shape: 71 | raise RuntimeError('All images must be the same shape. Image {} is {}, expected {}'.format(fn, tile.shape, tile_shape)) 72 | if tile.dtype != first_tile.dtype: 73 | raise RuntimeError('Img {} has type: {}, expected {}.'.format(fn, tile.dtype, first_tile.dtype)) 74 | 75 | stitched_img[y:y+tile_h, x:x+tile_w, :] = tile 76 | 77 | print('Saving stitched image to disk') 78 | skimage.io.imsave(output_filepath, stitched_img, plugin=None, tile=(1024, 1024), check_contrast=False) 79 | 80 | 81 | if __name__ == "__main__": 82 | import argparse 83 | 84 | parser = argparse.ArgumentParser(description='Script to assemble MIST stitched image') 85 | parser.add_argument('--global-positions-filepath', type=str, required=True, help='Filepath to the global positions file generated by MIST.') 86 | parser.add_argument('--images-dirpath', type=str, required=True, help='Dirpath (directory) where the source images exists.') 87 | parser.add_argument('--output-filepath', type=str, required=True, help='Filepath where to save the resulting stitched image.') 88 | 89 | args = parser.parse_args() 90 | global_positions_filepath = args.global_positions_filepath 91 | images_dirpath = args.images_dirpath 92 | output_filepath = args.output_filepath 93 | 94 | assemble_image(global_positions_filepath, images_dirpath, output_filepath) 95 | -------------------------------------------------------------------------------- /src/main/java/gov/nist/isg/mist/optimization/model/overlap/MleWorker.java: -------------------------------------------------------------------------------- 1 | // NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software. 2 | 3 | // NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. 4 | 5 | // You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States. 6 | 7 | 8 | package gov.nist.isg.mist.optimization.model.overlap; 9 | 10 | import java.util.concurrent.ConcurrentLinkedQueue; 11 | 12 | /** 13 | * Maximum likelihood estimation worker. 14 | * 15 | * @author Michael Majurski 16 | */ 17 | public class MleWorker implements Runnable { 18 | 19 | 20 | private volatile boolean isCancelled; 21 | 22 | private double[] T; 23 | 24 | private ParallelMlePoint bestPoint; 25 | private ConcurrentLinkedQueue resultsQueue; 26 | private MleLikelihoodCache mleCache; 27 | 28 | /** 29 | * Worker to perform maximum likelihood estimation via hill climbing given a starting point (in 30 | * percent) within the valid range. 31 | * 32 | * @param bestPoint The thread safe MLEPoint denoting the current best among all the workers 33 | * @param resultsQueue The output results queue to hold the location of hte local maxima found 34 | * @param translations The translations to be used in performing MLE estimation. Must be within 35 | * [0,100]. 36 | */ 37 | public MleWorker(ParallelMlePoint bestPoint, ConcurrentLinkedQueue resultsQueue, 38 | double[] translations, MleLikelihoodCache mleCache) { 39 | 40 | this.bestPoint = bestPoint; 41 | this.resultsQueue = resultsQueue; 42 | this.T = translations; 43 | this.mleCache = mleCache; 44 | this.isCancelled = false; 45 | } 46 | 47 | 48 | /** 49 | * Run the MleWorker task 50 | */ 51 | @Override 52 | public void run() { 53 | 54 | boolean workerDone = false; 55 | MLEPoint point; 56 | while (!workerDone && !this.isCancelled) { 57 | 58 | // get a new random point 59 | point = MLEPoint.getRandomPoint(); 60 | 61 | // Perform hill climbing at percent of range resolution 62 | point = MleUtils.hillClimbSearch(point, mleCache, T); 63 | 64 | // add the found point to the output queue 65 | resultsQueue.add(point); 66 | 67 | // add the point to the best point if its better than the global best 68 | bestPoint.setIfBetter(point); 69 | 70 | // if the best point has been stable for the required number of iterations, stop 71 | if (bestPoint.getNumStableIterations() > MleUtils.NUMBER_STABLE_MLE_ITERATIONS) 72 | workerDone = true; 73 | } 74 | } 75 | 76 | /** 77 | * Cancels this task 78 | */ 79 | public void cancel() { 80 | this.isCancelled = true; 81 | } 82 | 83 | 84 | } 85 | --------------------------------------------------------------------------------