├── bacmman-core ├── README.md ├── .gitignore └── src │ ├── main │ ├── java │ │ └── bacmman │ │ │ ├── plugins │ │ │ ├── PostFilterFeature.java │ │ │ ├── SegmenterNoRelabel.java │ │ │ ├── TransformationApplyDirectly.java │ │ │ ├── TransformationNoInput.java │ │ │ ├── FeatureExtractorOneEntryPerInstance.java │ │ │ ├── plugins │ │ │ │ ├── DisableParallelExecution.java │ │ │ │ ├── processing_pipeline │ │ │ │ │ └── ProcessingPipelineWithSegmenter.java │ │ │ │ ├── measurements │ │ │ │ │ └── objectFeatures │ │ │ │ │ │ └── object_feature │ │ │ │ │ │ ├── ValutAtCenter.java │ │ │ │ │ │ ├── Quantile.java │ │ │ │ │ │ ├── Max.java │ │ │ │ │ │ ├── Min.java │ │ │ │ │ │ ├── Mean.java │ │ │ │ │ │ └── SimpleObjectFeature.java │ │ │ │ ├── post_filters │ │ │ │ │ ├── MergeTouchingRegions.java │ │ │ │ │ ├── SetParentBounds.java │ │ │ │ │ └── InvertMask.java │ │ │ │ ├── pre_filters │ │ │ │ │ └── ScaleHistogram.java │ │ │ │ ├── segmenters │ │ │ │ │ ├── Identity.java │ │ │ │ │ └── ImportROI.java │ │ │ │ └── thresholders │ │ │ │ │ ├── FactorOfMean.java │ │ │ │ │ └── Percentile.java │ │ │ ├── PersistentConfiguration.java │ │ │ ├── DockerComplient.java │ │ │ ├── FeatureExtractorTemporal.java │ │ │ ├── PluginWithLegacyInitialization.java │ │ │ ├── FeatureExtractorConfigurable.java │ │ │ ├── ParameterChangeCallback.java │ │ │ ├── TestableOperation.java │ │ │ ├── DockerDLTrainer.java │ │ │ ├── GeometricalFeature.java │ │ │ ├── MultiThreaded.java │ │ │ ├── HintSimple.java │ │ │ ├── DevPlugin.java │ │ │ ├── ops │ │ │ │ ├── OpWrapper.java │ │ │ │ ├── ParameterWithValue.java │ │ │ │ └── OpParameter.java │ │ │ ├── Filter.java │ │ │ ├── Autofocus.java │ │ │ ├── Transformation.java │ │ │ ├── SimpleThresholder.java │ │ │ ├── PreFilter.java │ │ │ ├── Thresholder.java │ │ │ ├── ImageProcessingPlugin.java │ │ │ ├── Cropper.java │ │ │ ├── Plugin.java │ │ │ ├── PostFilter.java │ │ │ ├── ProcessingPipelineWithTracking.java │ │ │ ├── Tracker.java │ │ │ ├── object_feature │ │ │ │ └── ObjectFeatureWithCore.java │ │ │ ├── ObjectSplitter.java │ │ │ ├── TrackPostFilter.java │ │ │ ├── Segmenter.java │ │ │ ├── ManualSegmenter.java │ │ │ ├── MultichannelTransformation.java │ │ │ ├── TrackPreFilter.java │ │ │ ├── ConfigurableTransformation.java │ │ │ ├── ObjectFeature.java │ │ │ ├── ThresholderHisto.java │ │ │ └── HistogramScaler.java │ │ │ ├── ui │ │ │ ├── CTB_IO_MODE.java │ │ │ ├── gui │ │ │ │ └── image_interaction │ │ │ │ │ └── OverlayDisplayer.java │ │ │ └── logger │ │ │ │ ├── ProgressLogger.java │ │ │ │ └── ConsoleProgressLogger.java │ │ │ ├── data_structure │ │ │ ├── GraphObject.java │ │ │ ├── dao │ │ │ │ ├── PersistentMasterDAO.java │ │ │ │ ├── DuplicateMasterDAO.java │ │ │ │ ├── DiskBackedImageManager.java │ │ │ │ └── ImageDAO.java │ │ │ └── region_container │ │ │ │ ├── roi │ │ │ │ ├── ObjectRoi.java │ │ │ │ └── TrackRoi.java │ │ │ │ ├── RegionContainerBlankMask.java │ │ │ │ ├── RegionContainerSpot.java │ │ │ │ └── RegionContainerEllipse2D.java │ │ │ ├── github │ │ │ └── gist │ │ │ │ ├── UserAuth.java │ │ │ │ ├── NoAuth.java │ │ │ │ ├── BasicAuth.java │ │ │ │ └── TokenAuth.java │ │ │ ├── processing │ │ │ ├── gaussian_fit │ │ │ │ ├── FitFunctionScalable.java │ │ │ │ ├── FitFunctionUntrainableParameters.java │ │ │ │ ├── FitFunctionCustom.java │ │ │ │ ├── ConstantEstimator.java │ │ │ │ ├── PlaneEstimator.java │ │ │ │ └── EstimatorPlusBackground.java │ │ │ ├── matching │ │ │ │ ├── trackmate │ │ │ │ │ ├── Dimension.java │ │ │ │ │ ├── tracking │ │ │ │ │ │ └── sparselap │ │ │ │ │ │ │ ├── costfunction │ │ │ │ │ │ │ ├── SquareDistCostFunction.java │ │ │ │ │ │ │ └── CostFunction.java │ │ │ │ │ │ │ └── costmatrix │ │ │ │ │ │ │ └── GraphSegmentSplitter.java │ │ │ │ │ └── features │ │ │ │ │ │ └── FeatureFilter.java │ │ │ │ └── CostThreshold.java │ │ │ ├── track_post_processing │ │ │ │ └── SplitAndMerge.java │ │ │ └── clustering │ │ │ │ ├── FusionCriterion.java │ │ │ │ ├── Interface.java │ │ │ │ ├── InterfaceRegion.java │ │ │ │ └── SimpleInterfaceVoxelSet.java │ │ │ ├── configuration │ │ │ ├── parameters │ │ │ │ ├── InvisibleNode.java │ │ │ │ ├── AbstractChoiceParameterFixedChoiceList.java │ │ │ │ ├── PositionParameter.java │ │ │ │ ├── PostLoadable.java │ │ │ │ ├── ListElementErasable.java │ │ │ │ ├── ParameterWithLegacyInitialization.java │ │ │ │ ├── ContainerParameter.java │ │ │ │ ├── ChoosableParameterMultiple.java │ │ │ │ ├── SimplePluginParameterList.java │ │ │ │ ├── Listenable.java │ │ │ │ ├── ChoosableParameter.java │ │ │ │ ├── NoteParameter.java │ │ │ │ ├── ActionableParameter.java │ │ │ │ ├── ListParameter.java │ │ │ │ ├── GroupParameter.java │ │ │ │ ├── ObjectClassParameter.java │ │ │ │ └── FloatParameter.java │ │ │ └── experiment │ │ │ │ └── ConfigIDAware.java │ │ │ ├── image │ │ │ ├── DiskBackedImage.java │ │ │ ├── io │ │ │ │ └── ImageReader.java │ │ │ ├── ImageFloatingPoint.java │ │ │ ├── BoundingBoxMask.java │ │ │ ├── wrappers │ │ │ │ ├── ImagescienceWrapper.java │ │ │ │ └── ImgLib1ImageWrapper.java │ │ │ ├── ImageProperties.java │ │ │ ├── SubtractedMask.java │ │ │ ├── ImageCoordinate.java │ │ │ ├── PrimitiveType.java │ │ │ └── Offset.java │ │ │ ├── utils │ │ │ ├── TriFunction.java │ │ │ ├── MathUtils.java │ │ │ ├── ReflexionUtils.java │ │ │ ├── JSONSerializable.java │ │ │ ├── EnumerationUtils.java │ │ │ └── geom │ │ │ │ └── GeomUtils.java │ │ │ ├── core │ │ │ ├── Context.java │ │ │ ├── TaskI.java │ │ │ └── OmeroGateway.java │ │ │ └── measurement │ │ │ ├── MeasurementKey.java │ │ │ └── MeasurementKeyObject.java │ └── resources │ │ ├── logback.xml │ │ └── copy-deps-IJ.sh │ └── test │ └── resources │ └── logback-test.xml ├── .gitignore ├── bacmman-dl ├── .gitignore ├── src │ └── main │ │ └── resources │ │ └── dockerfiles │ │ ├── predict_dnn--tf-2-14-0.dockerfile │ │ ├── pixmclass--tf-2-14-0.dockerfile │ │ ├── pixmclass--tf-2-7-1.dockerfile │ │ └── predict_dnn--tf-2-7-1.dockerfile └── pom.xml ├── bacmman-gui ├── .gitignore └── src │ └── main │ ├── resources │ ├── icons │ │ ├── url32.png │ │ ├── folder32.png │ │ ├── folder64.png │ │ ├── metadata32.png │ │ ├── configuration32.png │ │ ├── configuration64.png │ │ ├── neural_network32.png │ │ └── neural_network64.png │ ├── legacy_sample_dataset │ │ └── legacy.json │ ├── dockerfiles │ │ ├── data_analysis--amd_py-4-4-1.dockerfile │ │ ├── data_analysis--amd_py-4-4-9.dockerfile │ │ ├── data_analysis--arm_py-4-4-1.dockerfile │ │ └── data_analysis--arm_py-4-4-9.dockerfile │ └── sample_datasets │ │ └── defaults.json │ └── java │ └── bacmman │ ├── ui │ └── gui │ │ ├── objects │ │ ├── UIContainer.java │ │ ├── TrackNodeInterface.java │ │ ├── StructureObjectTreeModel.java │ │ └── TabMouseAdapter.java │ │ ├── selection │ │ └── SelectionRenderer.java │ │ └── ToolTipImage.java │ └── configuration │ └── parameters │ └── ui │ ├── ArmableUI.java │ ├── ParameterUI.java │ ├── ListParameterUI.java │ └── StayOpenCheckBoxMenuItemUI.java ├── bacmman-ij1_ ├── .gitignore └── src │ └── main │ └── resources │ └── plugins.config ├── bacmman-modules-mother-machine ├── .gitignore ├── pom.xml └── src │ └── main │ └── java │ └── bacmman │ └── processing │ └── bacteria_spine │ └── SpineOverlayDrawer.java ├── bacmman-omero ├── src │ └── main │ │ ├── resources │ │ └── icons │ │ │ ├── user16.png │ │ │ ├── dataset16.png │ │ │ ├── group16.png │ │ │ ├── picture16.png │ │ │ └── project16.png │ │ └── java │ │ └── bacmman │ │ └── omero │ │ └── TypeConverter.java └── pom.xml ├── bacmman-ctb ├── src │ └── main │ │ └── resources │ │ └── script.sh └── pom.xml ├── merge-dev.sh ├── bacmman-distnet2d ├── src │ └── main │ │ └── resources │ │ └── dockerfiles │ │ ├── distnet2d--tf-2-7-1.dockerfile │ │ ├── distnet2d--tf-2-14-0.dockerfile │ │ ├── distnet2d_seg--tf-2-14-0.dockerfile │ │ └── distnet2d_seg--tf-2-7-1.dockerfile └── pom.xml ├── bacmman-ilastik └── pom.xml ├── bacmman-docker ├── src │ └── main │ │ └── java │ │ └── bacmman │ │ └── docker │ │ ├── LogContainerResultCallback.java │ │ ├── ExecResultCallback.java │ │ ├── PullImageResultCallback.java │ │ └── ProgressParser.java └── pom.xml ├── bacmman-trackmate └── pom.xml ├── bacmman-test └── src │ └── test │ └── java │ └── bacmman │ ├── image │ └── TestImageView.java │ └── dummy_plugins │ └── DummyThresholder.java ├── bacmman-tango └── pom.xml ├── bacmman-mapdb └── pom.xml └── README.md /bacmman-core/README.md: -------------------------------------------------------------------------------- 1 | # bacmman-core -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | **/target/ 3 | **/.idea/ -------------------------------------------------------------------------------- /bacmman-dl/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml 3 | -------------------------------------------------------------------------------- /bacmman-gui/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml 3 | -------------------------------------------------------------------------------- /bacmman-ij1_/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml 3 | -------------------------------------------------------------------------------- /bacmman-modules-mother-machine/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml -------------------------------------------------------------------------------- /bacmman-core/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | *.iml 3 | /src/test/java/bacmman/github/gist/Test.java -------------------------------------------------------------------------------- /bacmman-ij1_/src/main/resources/plugins.config: -------------------------------------------------------------------------------- 1 | Plugins, "BACteria in Mother Machine ANalyzer", bacmman.binding.IJ1 -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/url32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/url32.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/folder32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/folder32.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/folder64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/folder64.png -------------------------------------------------------------------------------- /bacmman-omero/src/main/resources/icons/user16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-omero/src/main/resources/icons/user16.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/metadata32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/metadata32.png -------------------------------------------------------------------------------- /bacmman-omero/src/main/resources/icons/dataset16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-omero/src/main/resources/icons/dataset16.png -------------------------------------------------------------------------------- /bacmman-omero/src/main/resources/icons/group16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-omero/src/main/resources/icons/group16.png -------------------------------------------------------------------------------- /bacmman-omero/src/main/resources/icons/picture16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-omero/src/main/resources/icons/picture16.png -------------------------------------------------------------------------------- /bacmman-omero/src/main/resources/icons/project16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-omero/src/main/resources/icons/project16.png -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/PostFilterFeature.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface PostFilterFeature extends PostFilter { 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/SegmenterNoRelabel.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface SegmenterNoRelabel extends Segmenter{ 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/TransformationApplyDirectly.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface TransformationApplyDirectly { 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/configuration32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/configuration32.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/configuration64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/configuration64.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/neural_network32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/neural_network32.png -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/icons/neural_network64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeanollion/bacmman/HEAD/bacmman-gui/src/main/resources/icons/neural_network64.png -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/ui/CTB_IO_MODE.java: -------------------------------------------------------------------------------- 1 | package bacmman.ui; 2 | 3 | public enum CTB_IO_MODE {RESULTS, RESULTS_AND_RAW, GOLD_TRUTH, SILVER_TRUTH, RAW} 4 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/TransformationNoInput.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface TransformationNoInput extends Transformation { 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/GraphObject.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure; 2 | 3 | public interface GraphObject extends Comparable { 4 | int getFrame(); 5 | } 6 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/FeatureExtractorOneEntryPerInstance.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface FeatureExtractorOneEntryPerInstance extends FeatureExtractor { 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-ctb/src/main/resources/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Prerequisities: Java >=8, CUDA 11.0 to 11.2, CUDNN 8x 3 | CONFIG='' 4 | java -cp dependency/*:bacmman-ctb-3.4.1.jar bacmman.ui.Run "../Fluo-N2DH-SIM+/01" "$CONFIG" true -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/DisableParallelExecution.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins; 2 | // currently works for Segmenters in the scope SegmentOnly / SegmentThenTrack 3 | public interface DisableParallelExecution { 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/PersistentConfiguration.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface PersistentConfiguration { // when plugin is changed in pluginparameter, pre-configure the new plugin instance with the previously set plugin 4 | } 5 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/dao/PersistentMasterDAO.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.dao; 2 | 3 | public interface PersistentMasterDAO> extends MasterDAO { 4 | boolean containsDatabase(String outputPath); 5 | void compact(); 6 | } 7 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/github/gist/UserAuth.java: -------------------------------------------------------------------------------- 1 | package bacmman.github.gist; 2 | 3 | import java.io.IOException; 4 | import java.net.HttpURLConnection; 5 | 6 | public interface UserAuth { 7 | void authenticate(HttpURLConnection connection); 8 | String getAccount(); 9 | } 10 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/processing_pipeline/ProcessingPipelineWithSegmenter.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.processing_pipeline; 2 | 3 | import bacmman.plugins.Segmenter; 4 | 5 | public interface ProcessingPipelineWithSegmenter { 6 | Segmenter getSegmenter(); 7 | } 8 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/FitFunctionScalable.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | public interface FitFunctionScalable extends FitFunctionCustom { 4 | void scaleIntensity(double[] parameters, double center, double scale, boolean normalize); 5 | } 6 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/legacy_sample_dataset/legacy.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "name": "Human Cells 2D", "folder": "Cell Tracking", "gist_id": "b4d20fc2c9b405f6ec0a9ee66d4af4f8", "hint": "35 fr, 21Mb.
Subset of evaluation set Fluo-C2DH-HBEC used in DiSTNet2D
Credits: https://arxiv.org/abs/2310.19641" } 3 | ] -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/DockerComplient.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface DockerComplient { 4 | String getDockerImageName(); 5 | String getVersionPrefix(); 6 | default int[] minimalVersion() {return null;} 7 | default int[] maximalVersion() {return null;} 8 | } 9 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/InvisibleNode.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.parameters; 2 | 3 | import javax.swing.tree.TreeNode; 4 | 5 | public interface InvisibleNode { 6 | TreeNode getChildAt(int index, boolean filterIsActive); 7 | int getChildCount(boolean filterIsActive); 8 | } 9 | -------------------------------------------------------------------------------- /merge-dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | git checkout master 3 | git merge --no-commit dev 4 | git checkout master -- bacmman-dl/src/main/resources/dockerfiles/ bacmman-distnet2d/src/main/resources/dockerfiles/ bacmman-gui/src/main/resources/dockerfiles/ 5 | echo "Enter commit message" 6 | read -p "Enter commit message: " msg 7 | git commit -m "$msg" 8 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/FeatureExtractorTemporal.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.data_structure.SegmentedObject; 4 | 5 | import java.util.stream.Stream; 6 | 7 | public interface FeatureExtractorTemporal extends FeatureExtractor { 8 | void setSubsampling(int factor, int offset); 9 | } 10 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/PluginWithLegacyInitialization.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import org.json.simple.JSONArray; 5 | 6 | import java.util.List; 7 | 8 | public interface PluginWithLegacyInitialization { 9 | void legacyInit(JSONArray parameters); 10 | } 11 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/region_container/roi/ObjectRoi.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.region_container.roi; 2 | 3 | import java.awt.*; 4 | 5 | public interface ObjectRoi> { 6 | void setColor(Color color, boolean fill); 7 | void setStrokeWidth(double strokeWidth); 8 | O duplicate(); 9 | } 10 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/FitFunctionUntrainableParameters.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | import net.imglib2.algorithm.localization.FitFunction; 4 | 5 | public interface FitFunctionUntrainableParameters extends FitFunction { 6 | int[] getUntrainableIndices(int nDims, boolean fitCenter, boolean fitAxis); 7 | } 8 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/FeatureExtractorConfigurable.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.data_structure.SegmentedObject; 4 | 5 | import java.util.List; 6 | import java.util.stream.Stream; 7 | 8 | public interface FeatureExtractorConfigurable extends FeatureExtractor { 9 | void configure(Stream parentTrack, int objectClassIdx); 10 | } 11 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/DiskBackedImage.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | public interface DiskBackedImage> { 4 | void freeMemory(boolean storeIfModified); 5 | void detach(); 6 | boolean detached(); 7 | boolean isOpen(); 8 | boolean isWritable(); 9 | void setModified(boolean modified); 10 | I getImageType(); 11 | long heapMemory(); 12 | } 13 | -------------------------------------------------------------------------------- /bacmman-dl/src/main/resources/dockerfiles/predict_dnn--tf-2-14-0.dockerfile: -------------------------------------------------------------------------------- 1 | FROM tensorflow/tensorflow:2.14.0-gpu 2 | RUN apt-get -y clean && apt-get -y update 3 | RUN apt-get -y install wget 4 | RUN pip install --upgrade h5py==3.11.0 5 | 6 | RUN wget https://gist.githubusercontent.com/jeanollion/7b156bdbd7769f7a0a64b6774550ff4d/raw/predict.py -O predict.py 7 | RUN chmod a+r predict.py 8 | 9 | CMD ["python", "predict.py"] -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/region_container/roi/TrackRoi.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.region_container.roi; 2 | 3 | import bacmman.configuration.experiment.Structure; 4 | 5 | import java.awt.*; 6 | 7 | public interface TrackRoi { 8 | Structure.TRACK_DISPLAY getDisplayType(); 9 | void setColor(Color color, double edgeOpacity, double fillOpacity, double arrowOpacity); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ParameterChangeCallback.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | 5 | import java.util.function.Consumer; 6 | 7 | public interface ParameterChangeCallback { 8 | T addParameterChangeCallback(Consumer parameterChangeCallBack); 9 | boolean removeParameterChangeCallback(Consumer parameterChangeCallBack); 10 | } 11 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/trackmate/Dimension.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.matching.trackmate; 2 | 3 | public enum Dimension { 4 | NONE, 5 | QUALITY, 6 | INTENSITY, 7 | INTENSITY_SQUARED, 8 | POSITION, 9 | VELOCITY, 10 | LENGTH, // we separate length and position so that x,y,z are plotted on a different graph from spot sizes 11 | TIME, 12 | ANGLE, 13 | RATE, // count per frames 14 | STRING; // for non-numeric features 15 | } 16 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/io/ImageReader.java: -------------------------------------------------------------------------------- 1 | package bacmman.image.io; 2 | import bacmman.image.Image; 3 | import java.io.IOException; 4 | 5 | public interface ImageReader { 6 | ImageReader setInvertTZ(boolean invertTZ); 7 | void closeReader(); 8 | Image openImage(ImageIOCoordinates coords) throws IOException; 9 | double[] getScaleXYZ(double defaultValue); 10 | double getTimePoint(int c, int t, int z); 11 | boolean imageExists(); 12 | } 13 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/FitFunctionCustom.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | import net.imglib2.algorithm.localization.FitFunction; 4 | 5 | public interface FitFunctionCustom extends FitFunction { 6 | int getNParameters(int nDims); 7 | boolean isValid(double[] initialParameters, double[] parameters); 8 | FitFunctionCustom setPositionLimit(double[] centerRange); 9 | FitFunctionCustom setSizeLimit(double sizeLimit); 10 | } 11 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/track_post_processing/SplitAndMerge.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.track_post_processing; 2 | 3 | import bacmman.data_structure.Region; 4 | import bacmman.data_structure.SegmentedObject; 5 | import bacmman.utils.Triplet; 6 | 7 | import java.util.List; 8 | 9 | public interface SplitAndMerge { 10 | double computeMergeCost(List toMerge); 11 | Triplet computeSplitCost(SegmentedObject toSplit); 12 | } 13 | -------------------------------------------------------------------------------- /bacmman-core/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/TriFunction.java: -------------------------------------------------------------------------------- 1 | package bacmman.utils; 2 | 3 | import java.util.Objects; 4 | import java.util.function.Function; 5 | 6 | @FunctionalInterface 7 | public interface TriFunction { 8 | R apply(T var1, U var2, V var3); 9 | 10 | default TriFunction andThen(Function after) { 11 | Objects.requireNonNull(after); 12 | return (t, u, v) -> { 13 | return after.apply(this.apply(t, u, v)); 14 | }; 15 | } 16 | } -------------------------------------------------------------------------------- /bacmman-dl/src/main/resources/dockerfiles/pixmclass--tf-2-14-0.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.14.0 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install PixMClass 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/60ad55e49a69dbf08e337ce97b030ce5/raw/training_pixmclass.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-dl/src/main/resources/dockerfiles/pixmclass--tf-2-7-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.7.1 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install PixMClass 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/60ad55e49a69dbf08e337ce97b030ce5/raw/training_pixmclass.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-distnet2d/src/main/resources/dockerfiles/distnet2d--tf-2-7-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.7.1 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install DiSTNet2D 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/789b9dbbda92da548401c7250f1631ad/raw/training_distnet2d.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-distnet2d/src/main/resources/dockerfiles/distnet2d--tf-2-14-0.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.14.0 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install DiSTNet2D 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/789b9dbbda92da548401c7250f1631ad/raw/training_distnet2d.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-distnet2d/src/main/resources/dockerfiles/distnet2d_seg--tf-2-14-0.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.14.0 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install DiSTNet2D 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/8035170d925598817be05dafbea05e89/raw/training_distnet2d_seg.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-distnet2d/src/main/resources/dockerfiles/distnet2d_seg--tf-2-7-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM jeanollion/training_dnn:tf-2.7.1 2 | RUN pip install --upgrade h5py==3.11.0 3 | RUN pip install DiSTNet2D 4 | RUN wget https://gist.githubusercontent.com/jeanollion/4aea9bef9c4b98aa5f8084e1be5ed6ee/raw/training_core.py -O training_core.py 5 | RUN wget https://gist.githubusercontent.com/jeanollion/8035170d925598817be05dafbea05e89/raw/training_distnet2d_seg.py -O train.py 6 | RUN chmod a+r /training_core.py 7 | RUN chmod a+r /train.py 8 | ENV NUMBA_NUM_THREADS=1 9 | ENTRYPOINT ["/bin/bash"] -------------------------------------------------------------------------------- /bacmman-dl/src/main/resources/dockerfiles/predict_dnn--tf-2-7-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM tensorflow/tensorflow:2.7.1-gpu 2 | RUN apt-key del 7fa2af80 3 | RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub 4 | RUN apt-get -y clean 5 | RUN apt-get -y update 6 | RUN apt-get -y install wget 7 | RUN pip install --upgrade h5py==3.11.0 8 | 9 | RUN wget https://gist.githubusercontent.com/jeanollion/7b156bdbd7769f7a0a64b6774550ff4d/raw/predict.py -O predict.py 10 | RUN chmod a+r predict.py 11 | 12 | CMD ["python", "predict.py"] -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/github/gist/NoAuth.java: -------------------------------------------------------------------------------- 1 | package bacmman.github.gist; 2 | 3 | import java.net.HttpURLConnection; 4 | 5 | public class NoAuth implements UserAuth { 6 | final String account; 7 | 8 | public NoAuth() { 9 | this(null); 10 | } 11 | 12 | public NoAuth(String account) { 13 | this.account = account; 14 | } 15 | 16 | @Override 17 | public void authenticate(HttpURLConnection urlConnection) { 18 | } 19 | @Override 20 | public String getAccount() { 21 | return account; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/TestableOperation.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | public interface TestableOperation { 4 | enum TEST_MODE {NO_TEST(false, false), 5 | TEST_EXPERT(true, true), 6 | TEST_SIMPLE(true, false); 7 | private final boolean simple, expert; 8 | TEST_MODE(boolean simple, boolean expert) { 9 | this.simple=simple; 10 | this.expert=expert; 11 | } 12 | public boolean testSimple() {return simple;} 13 | public boolean testExpert() {return expert;} 14 | } 15 | void setTestMode(TEST_MODE testMode); 16 | } 17 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/measurements/objectFeatures/object_feature/ValutAtCenter.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 2 | 3 | import bacmman.data_structure.Region; 4 | import bacmman.plugins.object_feature.IntensityMeasurement; 5 | 6 | public class ValutAtCenter extends IntensityMeasurement { 7 | @Override 8 | public double performMeasurement(Region region) { 9 | return core.getIntensityMeasurements(region).getValueAtCenter(); 10 | } 11 | 12 | @Override 13 | public String getDefaultName() { 14 | return "ValueAtCenter"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bacmman-core/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/ui/gui/image_interaction/OverlayDisplayer.java: -------------------------------------------------------------------------------- 1 | package bacmman.ui.gui.image_interaction; 2 | 3 | import bacmman.data_structure.Region; 4 | import bacmman.utils.geom.Point; 5 | import bacmman.utils.geom.Vector; 6 | 7 | import java.awt.*; 8 | 9 | public interface OverlayDisplayer { 10 | void displayContours(Region r, int frame, double size, int smoothRadius, Color color, boolean dashed); 11 | void displayRegion(Region r, int frame, Color color); 12 | void displayArrow(Point start, Vector direction, int frameStat, int frameEnd, boolean arrowStart, boolean arrowEnd, double size, Color color); 13 | void updateDisplay(); 14 | void hideLabileObjects(); 15 | } 16 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/MathUtils.java: -------------------------------------------------------------------------------- 1 | package bacmman.utils; 2 | 3 | public class MathUtils { 4 | /** 5 | * Solves the equation {@param a} * X^2 + {@param b} * X + {@param c} = 0 6 | * @param a 7 | * @param b 8 | * @param c 9 | * @return array with roots or array of length 0 if no roots 10 | */ 11 | public static double[] solveQuadratic(double a, double b, double c) { 12 | if (a == 0) return new double[]{-c/b}; 13 | double d = b*b-4*a*c; 14 | if (d<0) return new double[0]; 15 | if (d==0) return new double[]{-b/(2*a)}; 16 | d = Math.sqrt(d); 17 | return new double[]{(-b+d)/(2*a), (-b-d)/(2*a)}; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/dockerfiles/data_analysis--amd_py-4-4-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/jupyter/scipy-notebook:lab-4.4.1 2 | #RUN pip install PyBacmman 3 | RUN pip install git+https://git@github.com/jeanollion/PyBacmman.git 4 | #RUN pip install bokeh, selenium # to export bokeh plots as images 5 | RUN pip install plotly kaleido 6 | # Override settings: dark theme 7 | RUN mkdir -p /opt/conda/share/jupyter/lab/settings 8 | RUN echo '{"@jupyterlab/apputils-extension:themes": {"theme": "JupyterLab Dark"}}' > /opt/conda/share/jupyter/lab/settings/overrides.json 9 | # create working dir 10 | USER root 11 | RUN mkdir -p /data 12 | RUN chmod 777 /data 13 | RUN chown -R $NB_UID:$NB_GID /data 14 | USER $NB_UID 15 | WORKDIR /data -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/dockerfiles/data_analysis--amd_py-4-4-9.dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/jupyter/scipy-notebook:lab-4.4.9 2 | #RUN pip install PyBacmman 3 | RUN pip install git+https://git@github.com/jeanollion/PyBacmman.git 4 | #RUN pip install bokeh, selenium # to export bokeh plots as images 5 | RUN pip install plotly kaleido 6 | # Override settings: dark theme 7 | RUN mkdir -p /opt/conda/share/jupyter/lab/settings 8 | RUN echo '{"@jupyterlab/apputils-extension:themes": {"theme": "JupyterLab Dark"}}' > /opt/conda/share/jupyter/lab/settings/overrides.json 9 | # create working dir 10 | USER root 11 | RUN mkdir -p /data 12 | RUN chmod 777 /data 13 | RUN chown -R $NB_UID:$NB_GID /data 14 | USER $NB_UID 15 | WORKDIR /data -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/ImageFloatingPoint.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | public abstract class ImageFloatingPoint> extends Image { 4 | protected ImageFloatingPoint(String name, int sizeX, int sizeY, int sizeZ, int offsetX, int offsetY, int offsetZ, double scaleXY, double scaleZ) { 5 | super(name, sizeX, sizeY, sizeZ, offsetX, offsetY, offsetZ, scaleXY, scaleZ); 6 | } 7 | 8 | protected ImageFloatingPoint(String name, int sizeX, int sizeY, int sizeZ) { 9 | super(name, sizeX, sizeY, sizeZ); 10 | } 11 | 12 | protected ImageFloatingPoint(String name, ImageProperties properties) { 13 | super(name, properties); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/dockerfiles/data_analysis--arm_py-4-4-1.dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/jupyter/scipy-notebook:aarch64-lab-4.4.1 2 | #RUN pip install PyBacmman 3 | RUN pip install git+https://git@github.com/jeanollion/PyBacmman.git 4 | #RUN pip install bokeh, selenium # to export bokeh plots as images 5 | RUN pip install plotly kaleido 6 | # Override settings: dark theme 7 | RUN mkdir -p /opt/conda/share/jupyter/lab/settings 8 | RUN echo '{"@jupyterlab/apputils-extension:themes": {"theme": "JupyterLab Dark"}}' > /opt/conda/share/jupyter/lab/settings/overrides.json 9 | # create working dir 10 | USER root 11 | RUN mkdir -p /data 12 | RUN chmod 777 /data 13 | RUN chown -R $NB_UID:$NB_GID /data 14 | USER $NB_UID 15 | WORKDIR /data -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/dockerfiles/data_analysis--arm_py-4-4-9.dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/jupyter/scipy-notebook:aarch64-lab-4.4.9 2 | #RUN pip install PyBacmman 3 | RUN pip install git+https://git@github.com/jeanollion/PyBacmman.git 4 | #RUN pip install bokeh, selenium # to export bokeh plots as images 5 | RUN pip install plotly kaleido 6 | # Override settings: dark theme 7 | RUN mkdir -p /opt/conda/share/jupyter/lab/settings 8 | RUN echo '{"@jupyterlab/apputils-extension:themes": {"theme": "JupyterLab Dark"}}' > /opt/conda/share/jupyter/lab/settings/overrides.json 9 | # create working dir 10 | USER root 11 | RUN mkdir -p /data 12 | RUN chmod 777 /data 13 | RUN chown -R $NB_UID:$NB_GID /data 14 | USER $NB_UID 15 | WORKDIR /data -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/post_filters/MergeTouchingRegions.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.post_filters; 2 | 3 | 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.data_structure.RegionPopulation; 6 | import bacmman.data_structure.SegmentedObject; 7 | import bacmman.plugins.PostFilter; 8 | 9 | public class MergeTouchingRegions implements PostFilter { 10 | @Override 11 | public Parameter[] getParameters() { 12 | return new Parameter[0]; 13 | } 14 | 15 | @Override 16 | public RegionPopulation runPostFilter(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation) { 17 | childPopulation.mergeAllConnected(); 18 | return childPopulation; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/trackmate/tracking/sparselap/costfunction/SquareDistCostFunction.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.matching.trackmate.tracking.sparselap.costfunction; 2 | 3 | import bacmman.processing.matching.trackmate.Spot; 4 | 5 | /** 6 | * SOURCE CODE TAKEN FROM TRACKMATE: https://github.com/fiji/TrackMate 7 | * A cost function that returns cost equal to the square distance. Suited to 8 | * Brownian motion. 9 | * 10 | * @author Jean-Yves Tinevez - 2014 11 | * 12 | */ 13 | public class SquareDistCostFunction implements CostFunction< S, S > 14 | { 15 | 16 | @Override 17 | public double linkingCost( final S source, final S target ) 18 | { 19 | final double d2 = source.squareDistanceTo( target ); 20 | return ( d2 == 0 ) ? Double.MIN_NORMAL : d2; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/github/gist/BasicAuth.java: -------------------------------------------------------------------------------- 1 | package bacmman.github.gist; 2 | 3 | import java.net.HttpURLConnection; 4 | import java.util.Base64; 5 | 6 | public class BasicAuth implements UserAuth { 7 | private final String username, password; 8 | public BasicAuth(String username, String password) { 9 | this.username=username; 10 | this.password=password; 11 | } 12 | public void authenticate(HttpURLConnection urlConnection) { 13 | String usernameColonPassword = String.format("%s:%s", username, password); 14 | String basicAuthPayload = "Basic " + Base64.getEncoder().encodeToString(usernameColonPassword.getBytes()); 15 | urlConnection.addRequestProperty("Authorization", basicAuthPayload); 16 | } 17 | public String getAccount() { 18 | return username; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bacmman-omero/src/main/java/bacmman/omero/TypeConverter.java: -------------------------------------------------------------------------------- 1 | package bacmman.omero; 2 | 3 | import omero.*; 4 | 5 | public class TypeConverter { 6 | public static Object convert(RType object) { 7 | if (object instanceof RString) { 8 | return ((RString)object).getValue(); 9 | } else if (object instanceof RLong) { 10 | return ((RLong)object).getValue(); 11 | } else if (object instanceof RInt) { 12 | return ((RInt)object).getValue(); 13 | } else if (object instanceof RDouble) { 14 | return ((RDouble)object).getValue(); 15 | } else if (object instanceof RFloat) { 16 | return ((RFloat)object).getValue(); 17 | } else if (object instanceof RBool) { 18 | return ((RBool)object).getValue(); 19 | } else { 20 | return null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/AbstractChoiceParameterFixedChoiceList.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.parameters; 2 | 3 | import java.util.function.Function; 4 | 5 | public abstract class AbstractChoiceParameterFixedChoiceList> extends AbstractChoiceParameter { 6 | protected String[] listChoice; 7 | public AbstractChoiceParameterFixedChoiceList(String name, String[] listChoice, String selectedItem, Function mapper, Function toString, boolean allowNoSelection) { 8 | super(name, null, mapper, toString, allowNoSelection); // set listChoice before call set selected Item 9 | this.listChoice=listChoice; 10 | if (selectedItem!=null) this.setSelectedItem(selectedItem); 11 | } 12 | @Override 13 | public String[] getChoiceList() {return listChoice;} 14 | } 15 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/DockerDLTrainer.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.configuration.parameters.TrainingConfigurationParameter; 5 | import bacmman.core.Task; 6 | import bacmman.data_structure.dao.MasterDAO; 7 | import bacmman.github.gist.DLModelMetadata; 8 | 9 | import java.util.List; 10 | 11 | public interface DockerDLTrainer extends Plugin { 12 | TrainingConfigurationParameter getConfiguration(); 13 | Parameter[] getDatasetExtractionParameters(); 14 | 15 | Task getDatasetExtractionTask(MasterDAO mDAO, String outputFile, List selectionContainer); 16 | 17 | DLModelMetadata getDLModelMetadata(String workingDirectory); 18 | 19 | String minimalScriptVersion(); 20 | 21 | enum SELECTION_MODE {NEW, EXISTING} 22 | 23 | interface ComputeMetrics {} 24 | interface TestPredict {} 25 | } 26 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/trackmate/tracking/sparselap/costfunction/CostFunction.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.matching.trackmate.tracking.sparselap.costfunction; 2 | 3 | /** 4 | * SOURCE CODE TAKEN FROM TRACKMATE: https://github.com/fiji/TrackMate 5 | * Interface representing a function that can calculate the cost to link a 6 | * source object to a target object. 7 | * 8 | * @author Jean-Yves Tinevez - 2014 9 | * 10 | * @param 11 | * the type of the sources. 12 | * @param 13 | * the type of the targets. 14 | */ 15 | public interface CostFunction< K, J > 16 | { 17 | 18 | /** 19 | * Returns the cost to link two objects. 20 | * 21 | * @param source 22 | * the source object. 23 | * @param target 24 | * the target object. 25 | * @return the cost as a double. 26 | */ 27 | public double linkingCost(K source, J target); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/dao/DuplicateMasterDAO.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.dao; 2 | 3 | import bacmman.data_structure.MasterDAOFactory; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Collection; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.function.Function; 10 | 11 | public class DuplicateMasterDAO extends MemoryMasterDAO> { 12 | public DuplicateMasterDAO(MasterDAO sourceMasterDAO, Function idGenerator, Collection excludeOC) { 13 | super(sourceMasterDAO.getAccess(), (mDAO, positionName) -> new DuplicateObjectDAO<>(mDAO, sourceMasterDAO.getDao(positionName), idGenerator, excludeOC)); 14 | this.xp=sourceMasterDAO.getExperiment().duplicate(); 15 | this.datasetDir = sourceMasterDAO.getDatasetDir(); 16 | MasterDAO.configureExperiment(this, xp); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/ConstantEstimator.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | import net.imglib2.Localizable; 4 | import net.imglib2.algorithm.localization.Observation; 5 | import net.imglib2.algorithm.localization.StartPointEstimator; 6 | 7 | import java.util.Arrays; 8 | 9 | public class ConstantEstimator implements StartPointEstimator { 10 | long[] span; 11 | public ConstantEstimator(long span, int nDims) { 12 | this.span = new long[nDims]; 13 | for (int i = 0; i { 7 | 8 | public PositionParameter(String name, boolean allowNoSelection, boolean allowMultipleSelection) { 9 | super(name, s->s, allowNoSelection, allowMultipleSelection); 10 | } 11 | 12 | @Override 13 | public String[] getChoiceList() { 14 | if (getXP()==null) return new String[0]; 15 | return getXP().getPositionsAsString(); 16 | } 17 | protected Experiment getXP() { 18 | return ParameterUtils.getExperiment(this); 19 | } 20 | public String[] getSelectedPosition(boolean returnAllIfNoneSelected) { 21 | if (returnAllIfNoneSelected && selectedItems.length == 0) return getChoiceList(); 22 | return getSelectedItems(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/pre_filters/ScaleHistogram.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.pre_filters; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.configuration.parameters.PluginParameter; 5 | import bacmman.image.Image; 6 | import bacmman.image.ImageMask; 7 | import bacmman.plugins.HistogramScaler; 8 | import bacmman.plugins.PreFilter; 9 | 10 | public class ScaleHistogram implements PreFilter { 11 | PluginParameter scaler = new PluginParameter<>("Scaler", HistogramScaler.class, false).setEmphasized(true).setHint("Scaling method applied to histogram"); 12 | 13 | @Override 14 | public Parameter[] getParameters() { 15 | return new Parameter[]{scaler}; 16 | } 17 | 18 | @Override 19 | public Image runPreFilter(Image input, ImageMask mask, boolean allowInplaceModification) { 20 | return scaler.instantiatePlugin().transformInputImage(allowInplaceModification).scale(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/GeometricalFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface GeometricalFeature extends ObjectFeature { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/PlaneEstimator.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | import net.imglib2.Localizable; 4 | import net.imglib2.algorithm.localization.Observation; 5 | import net.imglib2.algorithm.localization.StartPointEstimator; 6 | 7 | import java.util.Arrays; 8 | 9 | public class PlaneEstimator implements StartPointEstimator { 10 | long[] span; 11 | public PlaneEstimator(long span, int nDims) { 12 | this.span = new long[nDims]; 13 | for (int i = 0; i. 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface MultiThreaded { 26 | void setMultiThread(boolean parallel); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/HintSimple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * Hint for non-expert mode 23 | * @author Jean Ollion 24 | */ 25 | public interface HintSimple { 26 | String getSimpleHintText(); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/PostLoadable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface PostLoadable { 26 | public void postLoad(); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-dl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | 12 | bacmman-dl 13 | 14 | 15 | com.github.jeanollion.bacmman 16 | bacmman-core 17 | ${bacmman.version} 18 | 19 | 20 | cisd 21 | jhdf5 22 | 19.04.1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/DevPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * Plugins implementing this interface are not displayed in production 23 | * @author Jean Ollion 24 | */ 25 | public interface DevPlugin { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-ilastik/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | 12 | bacmman-ilastik 13 | 14 | 15 | com.github.jeanollion.bacmman 16 | bacmman-core 17 | ${bacmman.version} 18 | 19 | 20 | org.ilastik 21 | ilastik4ij 22 | 1.8.3 23 | 24 | 25 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ListElementErasable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ListElementErasable { 26 | public boolean eraseData(); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/objects/UIContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.gui.objects; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface UIContainer { 26 | public Object[] getDisplayComponent(boolean multipleSelection); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/ReflexionUtils.java: -------------------------------------------------------------------------------- 1 | package bacmman.utils; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import java.lang.reflect.Field; 7 | import java.lang.reflect.Modifier; 8 | 9 | public class ReflexionUtils { 10 | static Logger logger = LoggerFactory.getLogger(ReflexionUtils.class); 11 | public static void setvalueOnFinalField(Object object, String fieldName, Object newValue) { 12 | Field field = null; 13 | try { 14 | field = object.getClass().getDeclaredField( fieldName ); 15 | field.setAccessible(true); 16 | 17 | Field modifiersField = Field.class.getDeclaredField("modifiers"); 18 | modifiersField.setAccessible(true); 19 | modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); 20 | 21 | field.set(object, newValue); 22 | } catch (NoSuchFieldException|IllegalAccessException e) { 23 | logger.debug("cannot set value", e); 24 | } 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/configuration/parameters/ui/ArmableUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters.ui; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ArmableUI extends ParameterUI { 26 | public void refreshArming(); 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ops/OpWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.ops; 20 | 21 | import net.imagej.ops.OpService; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface OpWrapper { 28 | public void setOpService(OpService os); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | /** 26 | * Filters have same input channel as output channel 27 | * @author Jean Ollion 28 | */ 29 | public interface Filter extends Transformation { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ParameterWithLegacyInitialization.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.parameters; 2 | 3 | import java.util.function.BiConsumer; 4 | 5 | public interface ParameterWithLegacyInitialization { 6 | /** 7 | * This method is run when a parameter cannot be initialized, meaning that the parametrization of the module has changed. 8 | */ 9 | void legacyInit(); 10 | 11 | Parameter[] getLegacyParameters(); 12 | /** 13 | * When a parameter A of a module has been replaced by B, this methods allows to initialize B using the former value of A 14 | * @param p 15 | * @param setValue 16 | * @return 17 | */ 18 | P setLegacyParameter(BiConsumer setValue, Parameter... p); 19 | 20 | /** 21 | * When parameter cannot be initialized, this value is used as default. Useful when default value of a parameter has changed. 22 | * @param value default value 23 | * @return this parameter for convenience 24 | */ 25 | P setLegacyInitializationValue(V value); 26 | } 27 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/configuration/parameters/ui/ParameterUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters.ui; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ParameterUI { 26 | public Object[] getDisplayComponent(); 27 | //public void updateUIFromParameter(); 28 | } 29 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/clustering/FusionCriterion.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.clustering; 2 | 3 | import bacmman.measurement.BasicMeasurements; 4 | import bacmman.utils.ArrayUtil; 5 | import bacmman.utils.HashMapGetCreate; 6 | 7 | import java.util.function.Predicate; 8 | 9 | public interface FusionCriterion> { 10 | boolean checkFusion(T inter); 11 | void elementChanged(E e); 12 | 13 | class SimpleFusionCriterion> implements FusionCriterion { 14 | final Predicate forbidFusion; 15 | public SimpleFusionCriterion(Predicate forbidFusion) { 16 | this.forbidFusion = forbidFusion; 17 | } 18 | 19 | @Override 20 | public boolean checkFusion(T inter) { 21 | return !forbidFusion.test(inter); 22 | } 23 | 24 | @Override 25 | public void elementChanged(E e) { } 26 | } 27 | interface AcceptsFusionCriterion> { 28 | void addFusionCriterion(FusionCriterion crit); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Autofocus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.image.Image; 22 | import bacmman.image.ImageMask; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface Autofocus extends Plugin { 29 | public int getBestFocusPlane(Image image, ImageMask mask); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Transformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.image.Image; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface Transformation extends ImageProcessingPlugin { 28 | Image applyTransformation(int channelIdx, int timePoint, Image image); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/ui/logger/ProgressLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.logger; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ProgressLogger { 26 | void setProgress(int i); 27 | void setMessage(String message); 28 | void setRunning(boolean running); 29 | boolean isGUI(); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/segmenters/Identity.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.segmenters; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.data_structure.Region; 5 | import bacmman.data_structure.RegionPopulation; 6 | import bacmman.data_structure.SegmentedObject; 7 | import bacmman.image.BoundingBoxMask; 8 | import bacmman.image.Image; 9 | import bacmman.plugins.Hint; 10 | import bacmman.plugins.Segmenter; 11 | 12 | import java.util.Arrays; 13 | 14 | public class Identity implements Segmenter, Hint { 15 | @Override 16 | public String getHintText() { 17 | return "Returns a single rectangle object with same bounds as input image"; 18 | } 19 | 20 | @Override 21 | public RegionPopulation runSegmenter(Image input, int objectClassIdx, SegmentedObject parent) { 22 | return new RegionPopulation(Arrays.asList(new Region(new BoundingBoxMask(input, input.getBoundingBox()), 1, input.sizeZ()>1)), input); 23 | } 24 | 25 | @Override 26 | public Parameter[] getParameters() { 27 | return new Parameter[0]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ops/ParameterWithValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.ops; 20 | 21 | import bacmman.configuration.parameters.Parameter; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface ParameterWithValue

> extends Parameter

{ 28 | public Object getValue(); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/objects/TrackNodeInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.gui.objects; 20 | 21 | import java.util.List; 22 | import javax.swing.tree.MutableTreeNode; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface TrackNodeInterface extends MutableTreeNode { 29 | public List getChildren(); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/SimpleThresholder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.image.Image; 22 | import bacmman.image.ImageMask; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface SimpleThresholder extends Thresholder { 29 | public double runSimpleThresholder(Image image, ImageMask mask); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ContainerParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface ContainerParameter> extends Parameter

{ 28 | List getChildren(); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/PreFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.image.Image; 22 | import bacmman.image.ImageMask; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface PreFilter extends ImageProcessingPlugin { 29 | Image runPreFilter(Image input, ImageMask mask, boolean allowInplaceModification); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Thresholder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.SegmentedObject; 22 | import bacmman.image.Image; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface Thresholder extends Plugin { 29 | public double runThresholder(Image input, SegmentedObject structureObject); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-docker/src/main/java/bacmman/docker/LogContainerResultCallback.java: -------------------------------------------------------------------------------- 1 | package bacmman.docker; 2 | 3 | import com.github.dockerjava.api.async.ResultCallback; 4 | import com.github.dockerjava.api.model.Frame; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.concurrent.CountDownLatch; 9 | import java.util.function.BiPredicate; 10 | 11 | public class LogContainerResultCallback extends ResultCallback.Adapter { 12 | public final CountDownLatch latch = new CountDownLatch(1); 13 | List logs = new ArrayList<>(); 14 | BiPredicate, String> stopLog; 15 | public LogContainerResultCallback(BiPredicate, String> stopLog) { 16 | this.stopLog = stopLog; 17 | } 18 | public List getLogs() { 19 | return logs; 20 | } 21 | @Override 22 | public void onNext(Frame object) { 23 | String logLine = new String(object.getPayload()); 24 | logs.add(logLine); 25 | if (stopLog != null && stopLog.test(logs, logLine)) { 26 | latch.countDown(); 27 | } 28 | super.onNext(object); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/configuration/parameters/ui/ListParameterUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters.ui; 20 | 21 | import bacmman.configuration.parameters.Parameter; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface ListParameterUI extends ParameterUI { 28 | public Object[] getChildDisplayComponent(Parameter child); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ImageProcessingPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ImageProcessingPlugin extends Plugin { 26 | interface ImageProcessingPluginTemporalNeighborhood extends ImageProcessingPlugin { 27 | default int getMinimalTemporalNeighborhood() {return 0;} 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Cropper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.input_image.InputImages; 22 | import bacmman.image.MutableBoundingBox; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface Cropper extends Plugin { 29 | public MutableBoundingBox getCropBoundginBox(int channelIdx, InputImages inputImages); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ops/OpParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.ops; 20 | 21 | import org.scijava.module.ModuleItem; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface OpParameter

> extends ParameterWithValue

{ 28 | public void setModuleItem(ModuleItem param); 29 | public ModuleItem getModuleItem(); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/core/Context.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.core; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public class Context { 26 | static int threadSub = Runtime.getRuntime().availableProcessors(); 27 | static int threads = 1; 28 | public static int getThreadNumber(boolean subOperations) { 29 | return subOperations ? threadSub : threads; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/measurement/MeasurementKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.measurement; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public abstract class MeasurementKey { 26 | String key; 27 | protected MeasurementKey(String key) { 28 | this.key=key; 29 | } 30 | public String getKey() {return key;} 31 | public abstract int getStoreStructureIdx(); 32 | } 33 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/trackmate/features/FeatureFilter.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.matching.trackmate.features; 2 | 3 | /** 4 | * SOURCE CODE TAKEN FROM TRACKMATE: https://github.com/fiji/TrackMate 5 | * A helper class to store a feature filter. It is just made of 3 public fields. 6 | * 7 | * @author Jean-Yves Tinevez <jeanyves.tinevez@gmail.com> Sep 23, 2010 8 | * 9 | */ 10 | public class FeatureFilter 11 | { 12 | public final String feature; 13 | 14 | public final Double value; 15 | 16 | public final boolean isAbove; 17 | 18 | public FeatureFilter(final String feature, final Double value, final boolean isAbove ) 19 | { 20 | this.feature = feature; 21 | this.value = value; 22 | this.isAbove = isAbove; 23 | } 24 | 25 | public FeatureFilter(final String feature, final double value, final boolean isAbove ) 26 | { 27 | this( feature, Double.valueOf( value ), isAbove ); 28 | } 29 | 30 | @Override 31 | public String toString() 32 | { 33 | String str = feature.toString(); 34 | if ( isAbove ) 35 | str += " > "; 36 | else 37 | str += " < "; 38 | str += value.toString(); 39 | return str; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Plugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.configuration.parameters.Parameter; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public interface Plugin { 30 | public final static Logger logger = LoggerFactory.getLogger(Plugin.class); 31 | public Parameter[] getParameters(); 32 | } 33 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ChoosableParameterMultiple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ChoosableParameterMultiple

> extends Parameter

, Listenable

{ 26 | void setSelectedIndices(int[] selectedItems); 27 | int[] getSelectedIndices(); 28 | String[] getChoiceList(); 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/measurements/objectFeatures/object_feature/Quantile.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 2 | 3 | import bacmman.configuration.parameters.BoundedNumberParameter; 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.data_structure.Region; 6 | import bacmman.measurement.BasicMeasurements; 7 | import bacmman.plugins.object_feature.IntensityMeasurement; 8 | 9 | public class Quantile extends IntensityMeasurement { 10 | BoundedNumberParameter quantile = new BoundedNumberParameter("Quantile", 3, 0.5, 0, 1); 11 | @Override 12 | public double performMeasurement(Region region) { 13 | double quantile = this.quantile.getValue().doubleValue(); 14 | if (quantile == 0.5) return core.getIntensityMeasurements(region).getMedian(); 15 | return BasicMeasurements.getQuantileValue(region, core.getIntensityMap(true), quantile)[0]; 16 | } 17 | 18 | @Override 19 | public String getDefaultName() { 20 | return "Median"; 21 | } 22 | @Override 23 | public Parameter[] getParameters() { 24 | return new Parameter[]{channel, quantile}; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/post_filters/SetParentBounds.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.post_filters; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.data_structure.RegionPopulation; 5 | import bacmman.data_structure.SegmentedObject; 6 | import bacmman.image.BoundingBox; 7 | import bacmman.image.SimpleBoundingBox; 8 | import bacmman.plugins.Hint; 9 | import bacmman.plugins.PostFilter; 10 | 11 | public class SetParentBounds implements PostFilter, Hint { 12 | @Override 13 | public String getHintText() { 14 | return "This module simply set the parent bounds as bound of all the segmented objects."; 15 | } 16 | 17 | @Override 18 | public Parameter[] getParameters() { 19 | return new Parameter[0]; 20 | } 21 | 22 | @Override 23 | public RegionPopulation runPostFilter(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation) { 24 | BoundingBox b = new SimpleBoundingBox(parent.getBounds()); 25 | if (!childPopulation.isAbsoluteLandmark()) b.resetOffset(); 26 | childPopulation.getRegions().forEach(r -> r.setBounds(b)); 27 | return childPopulation; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/PostFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.RegionPopulation; 22 | import bacmman.data_structure.SegmentedObject; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface PostFilter extends ImageProcessingPlugin { 29 | RegionPopulation runPostFilter(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/objects/StructureObjectTreeModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.gui.objects; 20 | 21 | import javax.swing.tree.DefaultTreeModel; 22 | import javax.swing.tree.TreeNode; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public class StructureObjectTreeModel extends DefaultTreeModel { 29 | 30 | public StructureObjectTreeModel(TreeNode root) { 31 | super(root); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ProcessingPipelineWithTracking.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.configuration.parameters.TrackPostFilterSequence; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | * @param 27 | */ 28 | public interface ProcessingPipelineWithTracking extends ProcessingPipeline { 29 | U getTracker(); 30 | TrackPostFilterSequence getTrackPostFilters(); 31 | } 32 | -------------------------------------------------------------------------------- /bacmman-trackmate/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | bacmman-trackmate 12 | 13 | 14 | com.github.jeanollion.bacmman 15 | bacmman-core 16 | ${bacmman.version} 17 | 18 | 19 | com.github.jeanollion.bacmman 20 | bacmman-gui 21 | ${bacmman.version} 22 | 23 | 24 | sc.fiji 25 | TrackMate 26 | 7.11.1 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /bacmman-test/src/test/java/bacmman/image/TestImageView.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | public class TestImageView { 8 | @Test 9 | public void TestImageView() { 10 | ImageByte im = new ImageByte("", 4, 5, 6); 11 | im.setPixel(2, 3, 4, 1); 12 | im.setPixel(3, 3, 4, 2); 13 | im.setPixel(2, 2, 4, 3); 14 | im.setPixel(3, 2, 3, 4); 15 | im.setPixel(2, 2, 3, 5); 16 | 17 | SimpleBoundingBox bds = new SimpleBoundingBox(2, 3, 3, 4, 0, 5); 18 | Image dup = im.crop(bds); 19 | ImageView view = new ImageView(im, bds); 20 | compareImages(dup, view); 21 | } 22 | public static void compareImages(Image expected, Image actual) { 23 | BoundingBox.loop(expected, (x, y, z) -> { 24 | assertEquals("getPixelWithOffset differ at "+x+";"+y+"z", expected.getPixelWithOffset(x, y, z), actual.getPixelWithOffset(x, y, z), 1e-6); 25 | }); 26 | BoundingBox.loop(new SimpleBoundingBox(expected).resetOffset(), (x, y, z) -> { 27 | assertEquals("getPixelWithOffset differ at "+x+";"+y+"z", expected.getPixel(x, y, z), actual.getPixel(x, y, z), 1e-6); 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/JSONSerializable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.utils; 20 | 21 | import java.util.Map; 22 | import org.json.simple.JSONAware; 23 | import org.json.simple.JSONObject; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public interface JSONSerializable { 30 | Object toJSONEntry(); 31 | void initFromJSONEntry(Object jsonEntry); 32 | interface PartialInit { 33 | void initFromJSONEntry(Object jsonEntry, boolean partialInit); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Tracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.SegmentedObject; 22 | import bacmman.data_structure.TrackLinkEditor; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public interface Tracker extends ImageProcessingPlugin { 31 | ProcessingPipeline.PARENT_TRACK_MODE parentTrackMode(); 32 | void track(int structureIdx, List parentTrack, TrackLinkEditor editor); 33 | } 34 | -------------------------------------------------------------------------------- /bacmman-ctb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.jeanollion.bacmman 8 | bacmman 9 | 3.8.7 10 | 11 | 12 | bacmman-ctb 13 | 14 | 15 | com.github.jeanollion.bacmman 16 | bacmman-core 17 | ${bacmman.version} 18 | 19 | 20 | com.github.jeanollion.bacmman 21 | bacmman-dl 22 | ${bacmman.version} 23 | 24 | 25 | com.github.jeanollion.bacmman 26 | bacmman-tf2 27 | ${bacmman.version} 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/SimplePluginParameterList.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.parameters; 2 | 3 | import bacmman.plugins.Plugin; 4 | 5 | public class SimplePluginParameterList extends PluginParameterList> { 6 | boolean allowNoSelection; 7 | public SimplePluginParameterList(String name) {this(name, "plugin", (Class)Plugin.class, false);} 8 | public SimplePluginParameterList(String name, String childLabel, Class childClass, boolean allowNoSelection) { 9 | super(name, childLabel, childClass, allowNoSelection); 10 | this.allowNoSelection=allowNoSelection; 11 | } 12 | public SimplePluginParameterList(String name, String childLabel, Class childClass, T childInstance, boolean allowNoSelection) { 13 | super(name, childLabel, childClass, childInstance, allowNoSelection); 14 | this.allowNoSelection=allowNoSelection; 15 | } 16 | 17 | @Override 18 | public SimplePluginParameterList duplicate() { 19 | SimplePluginParameterList res = new SimplePluginParameterList(name, childLabel, childClass, allowNoSelection); 20 | res.setContentFrom(this); 21 | transferStateArguments(this, res); 22 | return res; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/measurement/MeasurementKeyObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.measurement; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | 26 | public class MeasurementKeyObject extends MeasurementKey { 27 | int structureIdx; 28 | public MeasurementKeyObject(String key, int structureIdx) { 29 | super(key); 30 | this.structureIdx = structureIdx; 31 | } 32 | 33 | @Override 34 | public int getStoreStructureIdx() { 35 | return structureIdx; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /bacmman-distnet2d/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.jeanollion.bacmman 8 | bacmman 9 | 3.8.7 10 | 11 | 12 | bacmman-distnet2d 13 | 14 | 15 | 16 | com.github.jeanollion.bacmman 17 | bacmman-core 18 | ${bacmman.version} 19 | 20 | 21 | com.github.jeanollion.bacmman 22 | bacmman-dl 23 | ${bacmman.version} 24 | 25 | 26 | com.github.jeanollion.bacmman 27 | bacmman-docker 28 | ${bacmman.version} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/object_feature/ObjectFeatureWithCore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.object_feature; 20 | 21 | import bacmman.image.Image; 22 | import bacmman.image.ImageMask; 23 | 24 | import java.util.Map; 25 | import java.util.function.BiFunction; 26 | 27 | /** 28 | * 29 | * @author Jean Ollion 30 | */ 31 | public interface ObjectFeatureWithCore { 32 | void setUpOrAddCore(Map availableCores, BiFunction preFilters); 33 | int getIntensityChannel(); 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/dao/DiskBackedImageManager.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.dao; 2 | 3 | import bacmman.image.DiskBackedImage; 4 | import bacmman.image.Image; 5 | import bacmman.image.SimpleDiskBackedImage; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | 10 | public interface DiskBackedImageManager { 11 | boolean startDaemon(double memoryFraction, long timeInterval); 12 | boolean stopDaemon(); 13 | boolean isFreeingMemory(); 14 | > I openImageContent(SimpleDiskBackedImage fmi) throws IOException; 15 | > void storeSimpleDiskBackedImage(SimpleDiskBackedImage fmi) throws IOException; 16 | > SimpleDiskBackedImage createSimpleDiskBackedImage(I image, boolean writable, boolean freeMemory); 17 | boolean detach(DiskBackedImage image, boolean freeMemory); 18 | void clear(boolean freeMemory); 19 | static void clearDiskBackedImageFiles(String directory) { // only valid when stored in temp directory 20 | if (directory == null) return; 21 | File tempDir = new File(directory); 22 | File[] images = tempDir.listFiles((f, fn) -> fn.endsWith(".bmimage")); 23 | if (images!=null) { 24 | for (File f : images) f.delete(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bacmman-tango/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | bacmman-tango 12 | jar 13 | 14 | 15 | 16 | GNU General Public License v3+ 17 | https://www.gnu.org/licenses/gpl.html 18 | repo 19 | 20 | 21 | 22 | 23 | 24 | com.github.jeanollion.bacmman 25 | bacmman-core 26 | ${bacmman.version} 27 | 28 | 29 | 30 | 31 | jitpack.io 32 | https://jitpack.io 33 | 34 | 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/CostThreshold.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.processing.matching; 20 | 21 | /** 22 | * Interface representing a function that can calculate the cost threshold to link a 23 | * source object to a target object. 24 | * 25 | * @author Jean Ollion 26 | * 27 | * @param 28 | * the type of the sources. 29 | * @param 30 | * the type of the targets. 31 | */ 32 | public interface CostThreshold { 33 | public double linkingCostThreshold( final K source, final J target ); 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/BoundingBoxMask.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | public class BoundingBoxMask extends BlankMask { 4 | final BoundingBox bounds; 5 | public BoundingBoxMask(ImageProperties properties, BoundingBox boundingBox) { 6 | super(properties); 7 | this.bounds=new SimpleBoundingBox(boundingBox); 8 | } 9 | 10 | @Override 11 | public boolean insideMask(int x, int y, int z) { 12 | return (x >= bounds.xMin() && x <= bounds.xMax() && y >= bounds.yMin() && y <= bounds.yMax() && z >= bounds.zMin() && z <= bounds.zMax()); 13 | } 14 | 15 | @Override 16 | public boolean insideMask(int xy, int z) { 17 | return insideMask(xy%sizeX, xy/sizeX, z); 18 | } 19 | 20 | @Override public int count() { 21 | return bounds.sizeX() * bounds.sizeY() * bounds.sizeZ(); 22 | } 23 | 24 | @Override 25 | public boolean insideMaskWithOffset(int x, int y, int z) { 26 | return insideMask(x-xMin, y-yMin, z-zMin); 27 | } 28 | 29 | @Override 30 | public BoundingBoxMask duplicateMask() { 31 | return new BoundingBoxMask(this, bounds); 32 | } 33 | 34 | @Override public BoundingBoxMask translate(Offset offset) { 35 | super.translate(offset); 36 | bounds.translate(offset); 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/Listenable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | import java.util.function.Consumer; 22 | 23 | /** 24 | * Uses consumer (and not runnable) in order to be able to transfer a listener to a duplicated object 25 | * the listener should be relative to the source parameter 26 | * @author Jean Ollion 27 | */ 28 | public interface Listenable

{ 29 | public P addListener(Consumer

listener); 30 | public void removeListener(Consumer

listener); 31 | public void fireListeners(); 32 | } 33 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ChoosableParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface ChoosableParameter

> extends Parameter

{ 26 | /** 27 | * Set {@param item} as selected 28 | * Should also fire listeners 29 | * @param item 30 | */ 31 | void setSelectedItem(String item); 32 | String[] getChoiceList(); 33 | int getSelectedIndex(); 34 | boolean isAllowNoSelection(); 35 | String getNoSelectionString(); 36 | } 37 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/post_filters/InvertMask.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.post_filters; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.data_structure.Region; 5 | import bacmman.data_structure.RegionPopulation; 6 | import bacmman.data_structure.SegmentedObject; 7 | import bacmman.processing.ImageLabeller; 8 | import bacmman.image.ImageMask; 9 | import bacmman.image.PredicateMask; 10 | import bacmman.plugins.Hint; 11 | import bacmman.plugins.PostFilter; 12 | 13 | import java.util.List; 14 | 15 | public class InvertMask implements PostFilter, Hint { 16 | @Override 17 | public Parameter[] getParameters() { 18 | return new Parameter[0]; 19 | } 20 | 21 | @Override 22 | public RegionPopulation runPostFilter(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation) { 23 | ImageMask result = PredicateMask.andNot(parent.getMask(), childPopulation.getLabelMap()); 24 | List regions = ImageLabeller.labelImageList(result); 25 | regions.forEach(Region::clearVoxels); // save memory 26 | return new RegionPopulation(regions, parent.getMask()); 27 | } 28 | 29 | @Override 30 | public String getHintText() { 31 | return "Inverts the mask within the parent mask: foreground is (parent mask) ∩ !mask"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ObjectSplitter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.data_structure.RegionPopulation; 23 | import bacmman.data_structure.SegmentedObject; 24 | import bacmman.image.Image; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public interface ObjectSplitter extends ImageProcessingPlugin.ImageProcessingPluginTemporalNeighborhood { 31 | RegionPopulation splitObject(Image input, SegmentedObject parent, int objectClassIdx, Region object); 32 | void setSplitVerboseMode(boolean verbose); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/TrackPostFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.SegmentedObjectFactory; 22 | import bacmman.data_structure.SegmentedObject; 23 | import bacmman.data_structure.TrackLinkEditor; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | * 29 | * @author Jean Ollion 30 | */ 31 | public interface TrackPostFilter extends ImageProcessingPlugin { 32 | ProcessingPipeline.PARENT_TRACK_MODE parentTrackMode(); 33 | void filter(int structureIdx, List parentTrack, SegmentedObjectFactory factory, TrackLinkEditor editor); 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/thresholders/FactorOfMean.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.thresholders; 2 | 3 | import bacmman.configuration.parameters.BoundedNumberParameter; 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.data_structure.SegmentedObject; 6 | import bacmman.image.Image; 7 | import bacmman.plugins.Hint; 8 | import bacmman.plugins.Thresholder; 9 | import bacmman.processing.ImageOperations; 10 | 11 | public class FactorOfMean implements Thresholder, Hint { 12 | BoundedNumberParameter thldFactor = new BoundedNumberParameter("Intensity Threshold Factor", 5, 10, 0, null).setEmphasized(true).setHint("Final threshold on intensity is mean(I) * this value"); 13 | 14 | @Override 15 | public Parameter[] getParameters() { 16 | return new Parameter[]{thldFactor}; 17 | } 18 | 19 | public FactorOfMean setFactor(double factor) { 20 | this.thldFactor.setValue(factor); 21 | return this; 22 | } 23 | 24 | @Override 25 | public double runThresholder(Image input, SegmentedObject structureObject) { 26 | double mean = ImageOperations.getMeanAndSigma(input, structureObject.getMask(), null)[0]; 27 | return this.thldFactor.getDoubleValue() * mean; 28 | } 29 | 30 | @Override 31 | public String getHintText() { 32 | return "Mean of the image multiplied by a constant factor"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-core/src/main/resources/copy-deps-IJ.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | fromDir=$1 4 | toDir=$2 5 | 6 | avoidList=( "3D_Viewer" "bio-formats" "formats" "fiji" "Fiji" "ij" "Image_5D" "imagej" "imagescience" "imageware" "imglib" "j3dcore" "j3dutils" "junit" "ome" "sciijava" "TrackMate" "Stitching" "vecmath" "loci" "JWIs" "VIB-lib" "batik" "commons-logging" "eventbus" "gentyref" "gluegen" "guava" "itextpdf" "jai_imageio" "jama" "javassist" "jcommon" "jdom2" "jfreechart" "jgoodies" "jgraph" "jhdf5" "joda-time" "jogl" "kryo" "legacy-imglib1" "mdbtools" "metadata-extractor" "metakit" "mines-jtk" "minlog" "mpicbg" "native-lib-loader" "netcdf" ) 7 | 8 | includeList=( "cglib" "commons-math" "json-simple" "mongo-java-driver" "morphium" ) 9 | 10 | echo "files from $fromDir will be inspected and copied into $toDir" 11 | 12 | for fullfile in "$fromDir"/*; do 13 | copy=false 14 | filename="${fullfile##*/}" 15 | for include in "${includeList[@]}"; do 16 | if [[ $filename == $include* ]]; then 17 | #echo "file: $filename starts with: $include and thus will be included" 18 | copy=true 19 | break 20 | fi 21 | done 22 | #echo "copy file: $filename? $copy" 23 | if $copy ; then 24 | echo "file: $filename will be copied to dir: $toDir" 25 | cp $fullfile $toDir 26 | fi 27 | done 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | for name in "${list[@]}" 37 | do 38 | echo "name =" $name 39 | done 40 | 41 | -------------------------------------------------------------------------------- /bacmman-docker/src/main/java/bacmman/docker/ExecResultCallback.java: -------------------------------------------------------------------------------- 1 | package bacmman.docker; 2 | 3 | import bacmman.utils.Utils; 4 | import com.github.dockerjava.api.async.ResultCallback; 5 | import com.github.dockerjava.api.model.Frame; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import java.util.function.Consumer; 10 | 11 | public class ExecResultCallback extends ResultCallback.Adapter { 12 | private static final Logger logger = LoggerFactory.getLogger(ExecResultCallback.class); 13 | private Consumer stdOut, stdErr; 14 | 15 | public ExecResultCallback(Consumer stdout, Consumer stderr) { 16 | this.stdOut = stdout; 17 | this.stdErr = stderr; 18 | } 19 | 20 | @Override 21 | public void onNext(Frame frame) { 22 | if (frame != null) { 23 | String message = new String(Utils.replaceInvalidUTF8(frame.getPayload())); 24 | switch (frame.getStreamType()) { 25 | case STDOUT: 26 | case RAW: 27 | if (stdOut != null) stdOut.accept(message); 28 | break; 29 | case STDERR: 30 | if (stdErr != null) stdErr.accept(message); 31 | break; 32 | default: 33 | logger.error("unknown stream type:" + frame.getStreamType()); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/wrappers/ImagescienceWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.image.wrappers; 20 | 21 | import bacmman.image.Image; 22 | import ij.ImagePlus; 23 | 24 | 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public class ImagescienceWrapper { 31 | public static imagescience.image.Image getImagescience(Image image) { 32 | ImagePlus ip = IJImageWrapper.getImagePlus(image); 33 | return imagescience.image.Image.wrap(ip); 34 | } 35 | 36 | public static > Image wrap(imagescience.image.Image image) { 37 | return IJImageWrapper.wrap(image.imageplus()); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/NoteParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | 22 | /** 23 | * 24 | * @author Jean Ollion 25 | */ 26 | public class NoteParameter extends TextParameter { 27 | 28 | public NoteParameter(String name) { 29 | this(name, ""); 30 | } 31 | 32 | public NoteParameter(String name, String defaultText) { 33 | super(name, defaultText, true, true); 34 | } 35 | 36 | @Override public String toString() {return name;} // do not show the note in the configuration tree 37 | 38 | @Override public String getHintText() { 39 | return value; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/Segmenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.RegionPopulation; 22 | import bacmman.data_structure.SegmentedObject; 23 | import bacmman.image.Image; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public interface Segmenter extends ImageProcessingPlugin { 30 | /** 31 | * 32 | * @param input 33 | * @param objectClassIdx index of the object class that will be segmented 34 | * @param parent parent object of the objects to be segmented 35 | * @return 36 | */ 37 | RegionPopulation runSegmenter(Image input, int objectClassIdx, SegmentedObject parent); 38 | } 39 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/ui/logger/ConsoleProgressLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.logger; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public class ConsoleProgressLogger implements ProgressLogger { 26 | 27 | @Override 28 | public void setProgress(int i) { 29 | setMessage("Progress: "+i+"%"); 30 | } 31 | 32 | @Override 33 | public void setMessage(String message) { 34 | System.out.println(">"+message); 35 | } 36 | 37 | @Override 38 | public void setRunning(boolean running) { 39 | 40 | } 41 | 42 | @Override 43 | public boolean isGUI() { 44 | return false; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /bacmman-omero/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | 12 | bacmman-omero 13 | 14 | 15 | 16 | com.github.jeanollion.bacmman 17 | bacmman-core 18 | ${bacmman.version} 19 | 20 | 21 | org.openmicroscopy 22 | omero-gateway 23 | 5.10.2 24 | 25 | 26 | com.intellij 27 | forms_rt 28 | 7.0.3 29 | 30 | 31 | 32 | 33 | ome.maven 34 | https://artifacts.openmicroscopy.org/artifactory/maven/ 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/objects/TabMouseAdapter.java: -------------------------------------------------------------------------------- 1 | package bacmman.ui.gui.objects; 2 | 3 | import javax.swing.*; 4 | import java.awt.*; 5 | import java.awt.event.MouseEvent; 6 | import java.awt.event.MouseListener; 7 | 8 | public class TabMouseAdapter implements MouseListener { 9 | @Override 10 | public void mouseClicked(MouseEvent e) { 11 | redispatch(e); 12 | } 13 | 14 | @Override 15 | public void mousePressed(MouseEvent e) { 16 | redispatch(e); 17 | } 18 | 19 | @Override 20 | public void mouseReleased(MouseEvent e) { 21 | redispatch(e); 22 | } 23 | 24 | @Override 25 | public void mouseEntered(MouseEvent e) { 26 | redispatch(e); 27 | } 28 | 29 | @Override 30 | public void mouseExited(MouseEvent e) { 31 | redispatch(e); 32 | } 33 | 34 | public void redispatch(MouseEvent e) { 35 | Component source = e.getComponent(); 36 | Component target = source.getParent(); 37 | while (true) { 38 | if (target == null) { 39 | break; 40 | } 41 | if (target instanceof JTabbedPane) { 42 | break; 43 | } 44 | target = target.getParent(); 45 | } 46 | if (target != null) { 47 | MouseEvent targetEvent = SwingUtilities.convertMouseEvent(source, e, target); 48 | target.dispatchEvent(targetEvent); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/experiment/ConfigIDAware.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.experiment; 2 | 3 | import bacmman.configuration.parameters.BooleanParameter; 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.github.gist.GistConfiguration; 6 | import bacmman.utils.JSONSerializable; 7 | 8 | public interface ConfigIDAware

> extends Parameter

, JSONSerializable.PartialInit { 9 | String getConfigID(); 10 | P setConfigID(String configID); 11 | GistConfiguration.TYPE getType(); 12 | default void setConfigItemIdx(int configItemIdx) {} 13 | default int getConfigItemIdx() {return -1;}; 14 | BooleanParameter getAutoUpdate(); 15 | String key = "config_id"; 16 | String idxKey = "config_item_idx"; 17 | String autoUpdateKey = "config_auto_update"; 18 | static void setAutoUpdate(ConfigIDAware source, ConfigIDAware target) { 19 | BooleanParameter sourceAU = source.getAutoUpdate(); 20 | if (sourceAU == null) return; 21 | BooleanParameter targetAU = target.getAutoUpdate(); 22 | if (targetAU == null) return; 23 | targetAU.setContentFrom(sourceAU); 24 | } 25 | static BooleanParameter getAutoUpdateParameter() { 26 | return new BooleanParameter("Auto Update Config", true) 27 | .setHint("If true, this configuration block will be automatically updated each time it is downloaded from configuration library"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/ImageProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.image; 20 | 21 | public interface ImageProperties> extends BoundingBox { 22 | public String getName(); 23 | public int sizeXY(); 24 | public int sizeXYZ(); 25 | public int getOffsetXY(); 26 | public double getScaleXY(); 27 | public double getScaleZ(); 28 | public T setCalibration(ImageProperties properties); 29 | public T setCalibration(double scaleXY, double scaleZ); 30 | public boolean sameDimensions(BoundingBox image); 31 | public static ImageProperties duplicateProperties(ImageProperties properties) { 32 | return new BlankMask(properties); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/configuration/parameters/ui/StayOpenCheckBoxMenuItemUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters.ui; 20 | 21 | import javax.swing.JComponent; 22 | import javax.swing.MenuSelectionManager; 23 | import javax.swing.plaf.ComponentUI; 24 | import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public class StayOpenCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI { 31 | @Override 32 | protected void doClick(MenuSelectionManager msm) { 33 | menuItem.doClick(0); 34 | } 35 | 36 | public static ComponentUI createUI(JComponent c) { 37 | return new StayOpenCheckBoxMenuItemUI(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ManualSegmenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.RegionPopulation; 22 | import bacmman.data_structure.SegmentedObject; 23 | import bacmman.image.Image; 24 | import bacmman.image.ImageMask; 25 | import bacmman.utils.geom.Point; 26 | 27 | import java.util.List; 28 | 29 | /** 30 | * 31 | * @author Jean Ollion 32 | */ 33 | public interface ManualSegmenter extends ImageProcessingPlugin.ImageProcessingPluginTemporalNeighborhood { 34 | void setManualSegmentationVerboseMode(boolean verbose); 35 | RegionPopulation manualSegment(Image input, SegmentedObject parent, ImageMask segmentationMask, int objectClassIdx, List seedsXYZ); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/resources/sample_datasets/defaults.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "name": "Phase Contrast", "folder": "Mother Machine", "gist_id": "01a255d5a11f71d6b7cd6a8f81b41caa", "hint": "50 frames, 53Mb" }, 3 | { "name": "Fluoresence", "folder": "Mother Machine", "gist_id": "adb4e7b76c1bd261fa477f70a2768e8a", 4 | "hint": "50 fr, 2 Channels, 57Mb" 5 | }, 6 | { "name": "Neutrophils", "folder": "Segmentation", "gist_id": "917bd79628670b95ec9b571f824201e3", 7 | "hint": "Fluorescence imaged neutrophils.
Credit: Ludvikova et al. Near-infrared co-illumination of fluorescent proteins reduces photobleaching and phototoxicity Nature Biotechnology 2023.
3 images, 4.72Mb" 8 | }, 9 | { "name": "Bacteria 2D", "folder": "Cell Tracking", "gist_id": "5104ca0deda85ba7057c1b618ec5cff6", "hint": "100 frames, 10Mb.
Subset of evaluation set PhC-C2DH-PA14 used in DiSTNet2D
Credits: https://arxiv.org/abs/2310.19641" }, 10 | { "name": "Human Cells 2D", "folder": "Cell Tracking", "gist_id": "cfd622af0ca25a4ba332d5c3458e1ce3", "hint": "99 frames, 44Mb.
Subset of evaluation set Fluo-C2DH-HBEC used in DiSTNet2D
Credits: https://arxiv.org/abs/2310.19641" }, 11 | { "name": "TL Bacteria 2D + SMF Spots", "folder": "Segmentation", "gist_id": "60d387067f645851c9be4a0dbfb94606", 12 | "hint": "Bacteria imaged with transmitted light stack and single-molecule fluorescence spots.
Credit: Daniel Thédié El Karoui Lab, The University of Edinburgh
6Mb" 13 | } 14 | ] 15 | 16 | -------------------------------------------------------------------------------- /bacmman-modules-mother-machine/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bacmman 7 | com.github.jeanollion.bacmman 8 | 3.8.7 9 | 10 | 4.0.0 11 | bacmman-modules-mother-machine 12 | jar 13 | 14 | 15 | 16 | GNU General Public License v3+ 17 | https://www.gnu.org/licenses/gpl.html 18 | repo 19 | 20 | 21 | 22 | 23 | 24 | sc.fiji 25 | Skeletonize3D_ 26 | 2.1.1 27 | 28 | 29 | com.github.jeanollion.bacmman 30 | bacmman-core 31 | ${bacmman.version} 32 | 33 | 34 | 35 | 36 | jitpack.io 37 | https://jitpack.io 38 | 39 | 40 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/clustering/Interface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.processing.clustering; 20 | 21 | import java.util.Comparator; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | * @param type of elements 27 | * @param type of interface 28 | */ 29 | public interface Interface> extends Comparable { 30 | E getE1(); 31 | E getE2(); 32 | boolean isInterfaceOf(E e1, E e2); 33 | boolean isInterfaceOf(E e1); 34 | E getOther(E e); 35 | 36 | void swichElements(E newE, E oldE, Comparator elementComparator); 37 | void performFusion(); 38 | boolean checkFusion(); 39 | void fusionInterface(T otherInterface, Comparator elementComparator); 40 | void updateInterface(); 41 | } 42 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/MultichannelTransformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public interface MultichannelTransformation extends Transformation { 26 | enum OUTPUT_SELECTION_MODE{SAME, SINGLE, MULTIPLE, MULTIPLE_DEFAULT_ALL, ALL}; 27 | /** 28 | * Selection mode for channels on which transformation will be applied 29 | * SINGLE: only one channel that can be configured 30 | * MULTIPLE : several channels that can be configured 31 | * ALL: all channels 32 | * SAME: same channel as input channels. Transformation must be configurable for this mode, otherwise error will be thrown 33 | * @return 34 | */ 35 | public OUTPUT_SELECTION_MODE getOutputChannelSelectionMode(); 36 | } 37 | -------------------------------------------------------------------------------- /bacmman-docker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.jeanollion.bacmman 8 | bacmman 9 | 3.8.7 10 | 11 | 12 | bacmman-docker 13 | jar 14 | 15 | 16 | 17 | GNU General Public License v3+ 18 | https://www.gnu.org/licenses/gpl.html 19 | repo 20 | 21 | 22 | 23 | 24 | com.github.jeanollion.bacmman 25 | bacmman-core 26 | ${bacmman.version} 27 | 28 | 29 | com.github.docker-java 30 | docker-java-core 31 | 3.4.1 32 | 33 | 34 | com.github.docker-java 35 | docker-java-transport-zerodep 36 | 3.4.1 37 | 38 | 39 | -------------------------------------------------------------------------------- /bacmman-test/src/test/java/bacmman/dummy_plugins/DummyThresholder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.dummy_plugins; 20 | 21 | import bacmman.configuration.parameters.NumberParameter; 22 | import bacmman.configuration.parameters.Parameter; 23 | import bacmman.data_structure.SegmentedObject; 24 | import bacmman.image.Image; 25 | import bacmman.plugins.Thresholder; 26 | 27 | /** 28 | * 29 | * @author Jean Ollion 30 | */ 31 | public class DummyThresholder implements Thresholder { 32 | 33 | public Parameter[] getParameters() { 34 | return new Parameter[]{new NumberParameter("number", 2, 2.22)}; 35 | } 36 | 37 | public boolean does3D() { 38 | return true; 39 | } 40 | public double runThresholder(Image input, SegmentedObject structureObject) { 41 | return 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/SubtractedMask.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | public class SubtractedMask extends SimpleImageProperties implements ImageMask { 4 | ImageMask refMask, maskToSubtract; 5 | public SubtractedMask(ImageMask refMask, ImageMask maskToSubtract) { 6 | super(refMask); 7 | this.refMask=refMask; 8 | if (!BoundingBox.isIncluded(maskToSubtract, refMask)) throw new IllegalArgumentException("mask to subtract should be included in reference mask"); 9 | this.maskToSubtract=maskToSubtract; 10 | } 11 | 12 | @Override 13 | public boolean insideMask(int x, int y, int z) { 14 | return refMask.insideMask(x, y, z) && !maskToSubtract.insideMask(x, y, z); 15 | } 16 | 17 | @Override 18 | public boolean insideMask(int xy, int z) { 19 | return refMask.insideMask(xy, z) && !maskToSubtract.insideMask(xy, z); 20 | } 21 | 22 | @Override 23 | public boolean insideMaskWithOffset(int x, int y, int z) { 24 | return refMask.insideMaskWithOffset(x, y, z) && !maskToSubtract.insideMaskWithOffset(x, y, z); 25 | } 26 | 27 | @Override 28 | public int count() { 29 | int count = 0; 30 | for (int z = 0; z< sizeZ(); ++z) { 31 | for (int xy=0; xy. 18 | */ 19 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.plugins.Hint; 23 | import bacmman.plugins.object_feature.IntensityMeasurement; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public class Max extends IntensityMeasurement implements Hint { 30 | 31 | @Override public double performMeasurement(Region object) { 32 | return core.getIntensityMeasurements(object).max; 33 | } 34 | 35 | @Override public String getDefaultName() { 36 | return "Max"; 37 | } 38 | @Override 39 | public String getHintText() { 40 | return "Maximal intensity value within object"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/measurements/objectFeatures/object_feature/Min.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.plugins.Hint; 23 | import bacmman.plugins.object_feature.IntensityMeasurement; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public class Min extends IntensityMeasurement implements Hint { 30 | 31 | @Override public double performMeasurement(Region object) { 32 | return core.getIntensityMeasurements(object).min; 33 | } 34 | 35 | @Override public String getDefaultName() { 36 | return "Min"; 37 | } 38 | 39 | @Override 40 | public String getHintText() { 41 | return "Minimal intensity value within object"; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/clustering/InterfaceRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.processing.clustering; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.data_structure.Voxel; 23 | 24 | /** 25 | * 26 | * @author Jean Ollion 27 | */ 28 | public interface InterfaceRegion> extends Interface { 29 | /** 30 | * Adds the pair of voxels to the interface 31 | * {@param v1} and {@param v2} correspond respectively to regions returned by {@link InterfaceRegion#getE1() } & {@link InterfaceRegion#getE2() } 32 | * If {@link RegionCluster} has a foreground mask, ie allows fusion to the backgorund object, {@param v1} can be out-of-bounds so a bound check should be performed 33 | * @param v1 34 | * @param v2 35 | */ 36 | void addPair(Voxel v1, Voxel v2); 37 | } 38 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/EnumerationUtils.java: -------------------------------------------------------------------------------- 1 | package bacmman.utils; 2 | 3 | import java.util.Enumeration; 4 | import java.util.Spliterator; 5 | import java.util.Spliterators; 6 | import java.util.function.Consumer; 7 | import java.util.stream.Stream; 8 | import java.util.stream.StreamSupport; 9 | 10 | public class EnumerationUtils { 11 | public static Stream toStream(Enumeration enumeration) { 12 | if (enumeration==null) return null; 13 | EnumerationSpliterator spliterator = new EnumerationSpliterator(Long.MAX_VALUE, Spliterator.ORDERED, enumeration); 14 | return StreamSupport.stream(spliterator, false); 15 | } 16 | 17 | public static class EnumerationSpliterator extends Spliterators.AbstractSpliterator { 18 | 19 | private final Enumeration enumeration; 20 | 21 | public EnumerationSpliterator(long est, int additionalCharacteristics, Enumeration enumeration) { 22 | super(est, additionalCharacteristics); 23 | this.enumeration = enumeration; 24 | } 25 | 26 | @Override 27 | public boolean tryAdvance(Consumer action) { 28 | if (enumeration.hasMoreElements()) { 29 | action.accept(enumeration.nextElement()); 30 | return true; 31 | } 32 | return false; 33 | } 34 | 35 | @Override 36 | public void forEachRemaining(Consumer action) { 37 | while (enumeration.hasMoreElements()) 38 | action.accept(enumeration.nextElement()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/TrackPreFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.SegmentedObject; 22 | import bacmman.data_structure.SegmentedObjectImageMap; 23 | import bacmman.image.Image; 24 | import bacmman.image.ImageMask; 25 | 26 | import java.util.Map; 27 | import java.util.TreeMap; 28 | import java.util.stream.Collectors; 29 | 30 | /** 31 | * 32 | * @author Jean Ollion 33 | */ 34 | public interface TrackPreFilter extends ImageProcessingPlugin { 35 | ProcessingPipeline.PARENT_TRACK_MODE parentTrackMode(); 36 | void filter(int structureIdx, SegmentedObjectImageMap preFilteredImages); 37 | static Map getMaskMap(Map map) { 38 | return map.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, e->e.getKey().getMask())); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ActionableParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * An actionable parameter is used by a conditional parameter: when its content is modified, it should also call the setObjectValue method of the conditional parameter, and its UI object should call the ConfigurationModel.nodeStructureChanged method to update the tree 23 | * @author Jean Ollion 24 | */ 25 | public interface ActionableParameter> extends Parameter

, ChoosableParameter

, Listenable

{ 26 | V getValue(); 27 | void setValue(V value); 28 | void setConditionalParameter(ConditionalParameterAbstract> cond); 29 | ConditionalParameterAbstract> getConditionalParameter(); 30 | } 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/region_container/RegionContainerBlankMask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.data_structure.region_container; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.data_structure.SegmentedObject; 23 | import bacmman.image.BlankMask; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | 30 | public class RegionContainerBlankMask extends RegionContainer { 31 | 32 | public RegionContainerBlankMask(SegmentedObject structureObject) { 33 | super(structureObject); 34 | } 35 | 36 | public BlankMask getImage() { 37 | return new BlankMask(bounds, getScaleXY(), getScaleZ()); 38 | } 39 | 40 | @Override 41 | public Region getRegion() { 42 | return new Region(getImage(), segmentedObject.getIdx()+1, is2D); 43 | } 44 | 45 | protected RegionContainerBlankMask() {} 46 | } 47 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/thresholders/Percentile.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.thresholders; 2 | 3 | import bacmman.configuration.parameters.BoundedNumberParameter; 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.data_structure.SegmentedObject; 6 | import bacmman.image.*; 7 | import bacmman.plugins.SimpleThresholder; 8 | import bacmman.plugins.ThresholderHisto; 9 | 10 | public class Percentile implements SimpleThresholder, ThresholderHisto { 11 | BoundedNumberParameter percentile = new BoundedNumberParameter("Percentile", 5, 95, 0, 100).setEmphasized(true).setHint("Returns a percentile of the intensity distribution.
For instance 95 corresponds to the value of the 5% brightest pixels"); 12 | 13 | public Percentile setPercentile(double value) { 14 | assert value>=0 && value <=100 : "percentile should be in range [0, 100]"; 15 | percentile.setValue(value); 16 | return this; 17 | } 18 | 19 | @Override 20 | public Parameter[] getParameters() { 21 | return new Parameter[]{percentile}; 22 | } 23 | 24 | @Override 25 | public double runThresholderHisto(Histogram histogram) { 26 | double prop = percentile.getValue().doubleValue()/100d; 27 | return histogram.getQuantiles(prop)[0]; 28 | } 29 | 30 | @Override 31 | public double runSimpleThresholder(Image input, ImageMask mask) { 32 | Histogram histo = HistogramFactory.getHistogram(()->mask==null ? input.stream(): input.stream(mask, true), 256); 33 | histo.removeSaturatingValue(4, true); 34 | return runThresholderHisto(histo); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ConfigurableTransformation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.input_image.InputImages; 22 | import bacmman.image.Image; 23 | 24 | import java.io.IOException; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public interface ConfigurableTransformation extends Transformation { 31 | /** 32 | * This method compute configuration data necessary for {@link Transformation#applyTransformation(int, int, Image)} method; in this method the objects should not be modified but created de novo. 33 | * @param channelIdx 34 | * @param inputImages 35 | */ 36 | void computeConfigurationData(int channelIdx, InputImages inputImages) throws IOException; 37 | boolean isConfigured(int totalChannelNumber, int totalTimePointNumber); 38 | boolean highMemory(); 39 | default void clear() {} 40 | } 41 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/region_container/RegionContainerSpot.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.region_container; 2 | 3 | import bacmman.data_structure.Region; 4 | import bacmman.data_structure.SegmentedObject; 5 | import bacmman.data_structure.Spot; 6 | import bacmman.utils.JSONUtils; 7 | import bacmman.utils.geom.Point; 8 | import org.json.simple.JSONObject; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | 12 | import java.util.List; 13 | 14 | public class RegionContainerSpot extends RegionContainer { 15 | public final static Logger logger = LoggerFactory.getLogger(RegionContainerSpot.class); 16 | public RegionContainerSpot() { 17 | super(); 18 | } 19 | 20 | public RegionContainerSpot(SegmentedObject object) { 21 | super(object); 22 | } 23 | 24 | @Override 25 | public Region getRegion() { 26 | return new Spot((Point)segmentedObject.getAttribute("Center"), 27 | ((Number) segmentedObject.getAttribute("Radius", Double.valueOf(1d))).doubleValue(), 28 | ((Number) segmentedObject.getAttribute("AspectRatioZ", Double.valueOf(1d))).doubleValue(), 29 | ((Number) segmentedObject.getAttribute("Intensity", Double.valueOf(0d))).doubleValue(), 30 | segmentedObject.getIdx() + 1, is2D, segmentedObject.getScaleXY(), segmentedObject.getScaleZ()); 31 | } 32 | 33 | @Override 34 | public JSONObject toJSON() { 35 | JSONObject res = super.toJSON(); 36 | res.put("Type", ANALYTICAL_TYPES.SPHERE.name()); // center, radius and intensity are stored in the attribute parameter 37 | return res; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/ImageCoordinate.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | import java.util.Objects; 4 | 5 | public class ImageCoordinate { 6 | int frame, channel, z; 7 | 8 | public ImageCoordinate duplicate() { 9 | return new ImageCoordinate(frame, channel, z); 10 | } 11 | 12 | public ImageCoordinate(int... fcz) { 13 | if (fcz.length>0) frame = fcz[0]; 14 | if (fcz.length>1) channel = fcz[1]; 15 | if (fcz.length>2) z = fcz[2]; 16 | } 17 | public void setFrame(int frame) { 18 | this.frame = frame; 19 | } 20 | 21 | public void setChannel(int channel) { 22 | this.channel = channel; 23 | } 24 | 25 | public void setZ(int z) { 26 | this.z = z; 27 | } 28 | 29 | public int getFrame() { 30 | return frame; 31 | } 32 | 33 | public int getChannel() { 34 | return channel; 35 | } 36 | 37 | public int getZ() { 38 | return z; 39 | } 40 | 41 | @Override 42 | public boolean equals(Object o) { 43 | if (this == o) return true; 44 | if (!(o instanceof ImageCoordinate)) return false; 45 | ImageCoordinate that = (ImageCoordinate) o; 46 | return frame == that.frame && channel == that.channel && z == that.z; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | return Objects.hash(frame, channel, z); 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "ImageCoordinate{" + 57 | "frame=" + frame + 58 | ", channel=" + channel + 59 | ", z=" + z + 60 | '}'; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/matching/trackmate/tracking/sparselap/costmatrix/GraphSegmentSplitter.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.matching.trackmate.tracking.sparselap.costmatrix; 2 | 3 | import bacmman.processing.matching.trackmate.Spot; 4 | import org.jgrapht.Graph; 5 | import org.jgrapht.alg.connectivity.ConnectivityInspector; 6 | import org.jgrapht.graph.DefaultWeightedEdge; 7 | 8 | import java.util.*; 9 | import java.util.stream.Collectors; 10 | 11 | /** 12 | * SOURCE CODE TAKEN FROM TRACKMATE: https://github.com/fiji/TrackMate 13 | */ 14 | public class GraphSegmentSplitter 15 | { 16 | private final Graph< S, DefaultWeightedEdge > graph; 17 | 18 | public GraphSegmentSplitter( final Graph< S, DefaultWeightedEdge > graph, final boolean findMiddlePoints ) 19 | { 20 | this.graph = graph; 21 | 22 | } 23 | 24 | public List< S > getSegmentEnds() { 25 | return graph.vertexSet().stream().filter(this::isSegmentEnd).sorted(Spot.frameComparator()).collect(Collectors.toList()); 26 | } 27 | 28 | public List< S > getSegmentMiddles() { 29 | return graph.vertexSet().stream().sorted(Spot.frameComparator()).collect(Collectors.toList()); 30 | } 31 | 32 | public List< S > getSegmentStarts() 33 | { 34 | return graph.vertexSet().stream().filter(this::isSegmentStart).sorted(Spot.frameComparator()).collect(Collectors.toList()); 35 | } 36 | public boolean isSegmentStart(S s) { 37 | return graph.edgesOf(s).stream().map(graph::getEdgeSource).allMatch(e->e.equals(s)); // true if no edges 38 | } 39 | public boolean isSegmentEnd(S s) { 40 | return graph.edgesOf(s).stream().map(graph::getEdgeTarget).allMatch(e->e.equals(s)); // true if no edges 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/core/TaskI.java: -------------------------------------------------------------------------------- 1 | package bacmman.core; 2 | 3 | import bacmman.ui.logger.ProgressLogger; 4 | import bacmman.utils.JSONSerializable; 5 | import org.json.simple.JSONObject; 6 | 7 | import java.lang.reflect.InvocationTargetException; 8 | import java.util.stream.Stream; 9 | 10 | public interface TaskI> { 11 | boolean isValid(); 12 | void printErrorsTo(ProgressLogger ui); 13 | void setUI(ProgressLogger ui); 14 | int countSubtasks(); 15 | void setTaskCounter(int[] counter); 16 | void initDB(); 17 | String getDir(); 18 | default void setPreprocessingMemoryThreshold(double preProcessingMemoryThreshold) {} 19 | void runTask(); 20 | default void done() {} 21 | void publishErrors(); 22 | JSONObject toJSONEntry(); 23 | void initFromJSONEntry(JSONObject data); 24 | T duplicate(); 25 | static TaskI createFromJSONEntry(JSONObject data) { 26 | if (data.containsKey("class")) { 27 | String className = (String)data.get("class"); 28 | try { 29 | Class clazz = Class.forName(className); 30 | TaskI res = (TaskI) clazz.getDeclaredConstructor().newInstance(); 31 | res.initFromJSONEntry(data); 32 | return res; 33 | } catch (InstantiationException | IllegalAccessException | InvocationTargetException | 34 | NoSuchMethodException | ClassNotFoundException e) { 35 | throw new RuntimeException(e); 36 | } 37 | } else { // most common task type 38 | Task res = new Task(); 39 | res.initFromJSONEntry(data); 40 | return res; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ObjectFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.configuration.parameters.Parameter; 22 | import bacmman.data_structure.Region; 23 | import bacmman.data_structure.RegionPopulation; 24 | import bacmman.data_structure.SegmentedObject; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public interface ObjectFeature extends Plugin { 31 | @Override public Parameter[] getParameters(); 32 | public ObjectFeature setUp(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation); 33 | /** 34 | * Performs a scalar measurement on a region 35 | * Region's landmark will be used, so if it is in relative landmark, the images used should be of the same dimension as the parent mask 36 | * @param region 37 | * @return performed measurement. 38 | */ 39 | public double performMeasurement(Region region); 40 | public String getDefaultName(); 41 | } 42 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/ThresholderHisto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins; 20 | 21 | import bacmman.data_structure.SegmentedObject; 22 | import bacmman.image.*; 23 | import bacmman.utils.Utils; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public interface ThresholderHisto extends SimpleThresholder { 30 | double runThresholderHisto(Histogram histogram); 31 | 32 | default double runThresholder(Image input, SegmentedObject structureObject) { 33 | ImageMask mask = structureObject!=null?structureObject.getMask():new BlankMask(input); 34 | return runSimpleThresholder(input, mask); 35 | } 36 | 37 | default double runSimpleThresholder(Image image, ImageMask mask) { 38 | Histogram histo = HistogramFactory.getHistogram(()-> image.stream(mask, true), HistogramFactory.BIN_SIZE_METHOD.AUTO_WITH_LIMITS); 39 | histo.removeSaturatingValue(4, true); 40 | return runThresholderHisto(histo); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ListParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public interface ListParameter> extends ContainerParameter { // 28 | T createChildInstance(); 29 | List getChildren(); 30 | /** 31 | * 32 | * @return the same instance of ListParameter 33 | */ 34 | Class getChildClass(); 35 | void insert(T... child); 36 | void removeAllElements(); 37 | int getUnMutableIndex(); 38 | int getMaxChildCount(); 39 | boolean isDeactivatable(); 40 | void setActivatedAll(boolean activated); 41 | boolean allowDeactivate(); 42 | List getActivatedChildren(); 43 | T getChildByName(String name); 44 | boolean allowMoveChildren(); 45 | boolean allowModifications(); 46 | boolean isEmpty(); 47 | } 48 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/selection/SelectionRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.ui.gui.selection; 20 | 21 | import bacmman.data_structure.Selection; 22 | 23 | import java.awt.Component; 24 | import javax.swing.JLabel; 25 | import javax.swing.JList; 26 | import javax.swing.ListCellRenderer; 27 | 28 | /** 29 | * 30 | * @author Jean Ollion 31 | */ 32 | public class SelectionRenderer extends JLabel implements ListCellRenderer { 33 | 34 | @Override 35 | public Component getListCellRendererComponent(JList list, Selection selection, int index, 36 | boolean isSelected, boolean cellHasFocus) { 37 | setText(selection.toString()); 38 | setForeground(isSelected ? list.getSelectionForeground() : selection.getColor(false)); 39 | setBackground(isSelected ? selection.getColor(false) : list.getBackground()); 40 | this.setOpaque(isSelected); 41 | //57/105/138 42 | return this; 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/measurements/objectFeatures/object_feature/Mean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 20 | 21 | import bacmman.data_structure.Region; 22 | import bacmman.measurement.BasicMeasurements; 23 | import bacmman.measurement.GeometricalMeasurements; 24 | import bacmman.plugins.Hint; 25 | import bacmman.plugins.object_feature.IntensityMeasurement; 26 | import bacmman.processing.ImageOperations; 27 | 28 | /** 29 | * 30 | * @author Jean Ollion 31 | */ 32 | public class Mean extends IntensityMeasurement implements Hint { 33 | @Override 34 | public double performMeasurement(Region object) { 35 | return core.getIntensityMeasurements(object).mean; 36 | } 37 | @Override 38 | public String getDefaultName() { 39 | return "MeanIntensity"; 40 | } 41 | @Override 42 | public String getHintText() { 43 | return "Average intensity value within object"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/measurements/objectFeatures/object_feature/SimpleObjectFeature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.plugins.plugins.measurements.objectFeatures.object_feature; 20 | 21 | import bacmman.configuration.parameters.Parameter; 22 | import bacmman.data_structure.RegionPopulation; 23 | import bacmman.data_structure.SegmentedObject; 24 | import bacmman.plugins.ObjectFeature; 25 | 26 | /** 27 | * 28 | * @author Jean Ollion 29 | */ 30 | public abstract class SimpleObjectFeature implements ObjectFeature { 31 | protected SegmentedObject parent; 32 | protected int childStructureIdx; 33 | 34 | @Override public Parameter[] getParameters() { 35 | return new Parameter[0]; 36 | } 37 | 38 | @Override public SimpleObjectFeature setUp(SegmentedObject parent, int childStructureIdx, RegionPopulation childPopulation) { 39 | this.parent=parent; 40 | this.childStructureIdx=childStructureIdx; 41 | return this; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/dao/ImageDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.data_structure.dao; 20 | 21 | import bacmman.image.BlankMask; 22 | import bacmman.image.BoundingBox; 23 | import bacmman.image.Image; 24 | 25 | import java.io.IOException; 26 | 27 | /** 28 | * 29 | * @author Jean Ollion 30 | */ 31 | public interface ImageDAO { 32 | void freeMemory(); 33 | void eraseAll(); 34 | String getImageExtension(); 35 | Image openPreProcessedImage(int channelImageIdx, int timePoint) throws IOException; 36 | Image openPreProcessedImage(int channelImageIdx, int timePoint, BoundingBox bounds) throws IOException; 37 | Image openPreProcessedImagePlane(int z, int channelImageIdx, int timePoint) throws IOException; 38 | BlankMask getPreProcessedImageProperties(int channelImageIdx) throws IOException; 39 | void writePreProcessedImage(Image image, int channelImageIdx, int timePoint); 40 | void deletePreProcessedImage(int channelImageIdx, int timePoint); 41 | 42 | boolean isEmpty(); 43 | } 44 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/github/gist/TokenAuth.java: -------------------------------------------------------------------------------- 1 | package bacmman.github.gist; 2 | 3 | import bacmman.utils.PasswordUtils; 4 | import bacmman.ui.PropertyUtils; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import java.net.HttpURLConnection; 8 | import java.security.GeneralSecurityException; 9 | import java.security.KeyException; 10 | 11 | public class TokenAuth implements UserAuth { 12 | private static final Logger logger = LoggerFactory.getLogger(TokenAuth.class); 13 | private final String token; 14 | private final String account; 15 | public TokenAuth(String username, char[] passphrase) throws GeneralSecurityException, KeyException { 16 | String encryptedToken = PropertyUtils.get(username+"_g_t_e"); 17 | String salt = PropertyUtils.get(username+"_g_t_s"); 18 | if (salt==null || encryptedToken==null) throw new KeyException("No token stored"); 19 | this.token = PasswordUtils.decryptFromPassphrase(passphrase, encryptedToken, salt); 20 | this.account=username; 21 | } 22 | 23 | public TokenAuth(String token) { 24 | this.token=token; 25 | this.account = null; 26 | } 27 | public static void encryptAndStore(String username, char[] passphrase, String token) throws GeneralSecurityException { 28 | String[] encryptedTokenAndSalt = PasswordUtils.encryptFromPassphrase(token, passphrase); 29 | PropertyUtils.set(username+"_g_t_e", encryptedTokenAndSalt[0]); 30 | PropertyUtils.set(username+"_g_t_s", encryptedTokenAndSalt[1]); 31 | } 32 | public void authenticate(HttpURLConnection urlConnection) { 33 | urlConnection.addRequestProperty("Authorization", "token "+token); 34 | } 35 | public String getAccount() { 36 | return account; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/utils/geom/GeomUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.utils.geom; 20 | 21 | import net.imglib2.RealLocalizable; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public class GeomUtils { 28 | public static double distSqXY(RealLocalizable p1, RealLocalizable p2) { 29 | double res= 0; 30 | for (int i = 0; i<2; ++i) res+=Math.pow(p1.getDoublePosition(i)-p2.getDoublePosition(i), 2); 31 | return res; 32 | } 33 | public static double distXY(RealLocalizable p1, RealLocalizable p2) { 34 | return Math.sqrt(distSqXY(p1, p2)); 35 | } 36 | public static double distSq(RealLocalizable p1, RealLocalizable p2) { 37 | double res= 0; 38 | for (int i = 0; i 2 | 5 | 4.0.0 6 | 7 | com.github.jeanollion.bacmman 8 | bacmman 9 | 3.8.7 10 | 11 | 12 | bacmman-mapdb 13 | 14 | 15 | 16 | com.github.jeanollion.bacmman 17 | bacmman-core 18 | ${bacmman.version} 19 | 20 | 21 | 36 | 37 | org.mapdb 38 | mapdb 39 | 3.0.10 40 | 41 | 42 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/PrimitiveType.java: -------------------------------------------------------------------------------- 1 | package bacmman.image; 2 | 3 | import java.util.Comparator; 4 | 5 | public interface PrimitiveType { 6 | Object[] getPixelArray(); 7 | int byteCount(); 8 | boolean floatingPoint(); 9 | default boolean typeEquals(PrimitiveType other) { 10 | return byteCount() == other.byteCount() && floatingPoint() == other.floatingPoint(); 11 | } 12 | interface ByteType extends PrimitiveType { 13 | byte[][] getPixelArray(); 14 | default int byteCount() {return 1;} 15 | default boolean floatingPoint() {return false;} 16 | } 17 | interface ShortType extends PrimitiveType { 18 | short[][] getPixelArray(); 19 | default int byteCount() {return 2;} 20 | default boolean floatingPoint() {return false;} 21 | } 22 | interface FloatType extends PrimitiveType { 23 | float[][] getPixelArray(); 24 | default int byteCount() {return 4;} 25 | default boolean floatingPoint() {return true;} 26 | } 27 | interface IntType extends PrimitiveType { 28 | int[][] getPixelArray(); 29 | default int byteCount() {return 4;} 30 | default boolean floatingPoint() {return false;} 31 | } 32 | interface DoubleType extends PrimitiveType { 33 | double[][] getPixelArray(); 34 | default int byteCount() {return 8;} 35 | default boolean floatingPoint() {return true;} 36 | } 37 | 38 | static Comparator typeComparator() { // floating point last, 39 | return (i1, i2) -> { 40 | int c = Boolean.compare(i1.floatingPoint(), i2.floatingPoint()); 41 | if (c == 0) { 42 | return Integer.compare(i1.byteCount(), i2.byteCount()); 43 | } else return c; 44 | }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bacmman-docker/src/main/java/bacmman/docker/PullImageResultCallback.java: -------------------------------------------------------------------------------- 1 | package bacmman.docker; 2 | 3 | import com.github.dockerjava.api.async.ResultCallback; 4 | import com.github.dockerjava.api.model.PullResponseItem; 5 | import com.github.dockerjava.api.model.ResponseItem; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | import java.util.HashMap; 10 | import java.util.Objects; 11 | import java.util.function.BiConsumer; 12 | import java.util.function.Consumer; 13 | 14 | public class PullImageResultCallback extends ResultCallback.Adapter { 15 | private static final Logger logger = LoggerFactory.getLogger(PullImageResultCallback.class); 16 | PullResponseItem error; 17 | final private Consumer stdout, stderr; 18 | ProgressParser stepProgress; 19 | public PullImageResultCallback(Consumer stdout, Consumer stderr, BiConsumer stepProgress) { 20 | this.stdout = stdout; 21 | this.stderr = stderr; 22 | this.stepProgress = new ProgressParser(stepProgress); 23 | } 24 | @Override 25 | public void onNext(PullResponseItem item) { 26 | if (item.isPullSuccessIndicated()) { 27 | if (stdout!=null) stdout.accept(messageFromPullResult(item)); 28 | } else { 29 | if (stderr!=null) stderr.accept(messageFromPullResult(item)); 30 | error = item; 31 | } 32 | stepProgress.accept(item); 33 | //logger.debug("{}", item); 34 | } 35 | 36 | public boolean success() { 37 | return error == null; 38 | } 39 | private String messageFromPullResult(PullResponseItem pullResponseItem) { 40 | return (pullResponseItem.getErrorDetail() != null) ? pullResponseItem.getErrorDetail().getMessage() : pullResponseItem.getStatus(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/gaussian_fit/EstimatorPlusBackground.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.gaussian_fit; 2 | 3 | import bacmman.image.MutableBoundingBox; 4 | import bacmman.utils.geom.Point; 5 | import net.imglib2.Localizable; 6 | import net.imglib2.algorithm.localization.Observation; 7 | import net.imglib2.algorithm.localization.StartPointEstimator; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class EstimatorPlusBackground implements StartPointEstimator { 15 | public static final Logger logger = LoggerFactory.getLogger(EstimatorPlusBackground.class); 16 | final protected StartPointEstimator pointEstimator; 17 | final protected StartPointEstimator backgroundEstimator; 18 | 19 | public EstimatorPlusBackground(StartPointEstimator pointEstimator, StartPointEstimator backgroundEstimator) { 20 | this.pointEstimator = pointEstimator; 21 | this.backgroundEstimator=backgroundEstimator; 22 | } 23 | 24 | @Override 25 | public long[] getDomainSpan() { 26 | return pointEstimator.getDomainSpan(); 27 | } 28 | 29 | @Override 30 | public double[] initializeFit(Localizable localizable, Observation observation) { 31 | double[] funParams = pointEstimator.initializeFit(localizable, observation); 32 | if (backgroundEstimator!=null) { 33 | double[] bckParams = backgroundEstimator.initializeFit(localizable, observation); 34 | double[] allParams = Arrays.copyOf(funParams, funParams.length + bckParams.length); 35 | //logger.debug("init param + bck : {}", allParams); 36 | System.arraycopy(bckParams, 0, allParams, funParams.length, bckParams.length); 37 | return allParams; 38 | } else return funParams; 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Release](https://jitpack.io/v/jeanollion/bacmman.svg)](https://jitpack.io/jeanollion/bacmman) 3 | 4 | BACteria in Mother Maching Analyzer (BACMMAN) is a software allowing fast and reliable automated image analysis of high-throughput 2D/3D time-series images from mother machine. Mother machine is a very popular microfluidic device allowing investigating biological processes in bacteria at the single-cell level. 5 | 6 | # Application 7 | 8 | BACMMAN can process this kind of data: 9 | 10 | | Fluorescence Images | Phase-contrast Images | 11 | | :---: | :---: | 12 | | | | 13 | 14 | See the [wiki](https://github.com/jeanollion/bacmman/wiki) for detailed information 15 | 16 | # Publications 17 | - Example datasets are taken from: [Robert et al. Mutation dynamics and fitness effects followed in single cells, Science 2018](http://science.sciencemag.org/content/359/6381/1283) 18 | - When using this work please cite [J. Ollion, L. Robert, and M. Elez, “High-throughput detection and tracking of cells and intracellular spots in mother machine experiments” Nature Protocols, 2019.](https://rdcu.be/bRSze) 19 | 20 | # Licence 21 | 22 | BACMMAN is a free/libre open source software under GNU General Public License v3.0 ([see license](https://github.com/jeanollion/bacmman/blob/master/LICENSE.txt)) 23 | 24 | # Structure of repository 25 | BACMMAN is composed of several modules: 26 | - The core module on which depend all other modules 27 | - The graphical user interface 28 | - Mother machine modules: image processing modules specifically designed for analysis of mother machine experiments 29 | - IJ1 binding integration in FIJI environment 30 | - Headless for run in command line mode 31 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/data_structure/region_container/RegionContainerEllipse2D.java: -------------------------------------------------------------------------------- 1 | package bacmman.data_structure.region_container; 2 | 3 | import bacmman.data_structure.Ellipse2D; 4 | import bacmman.data_structure.Region; 5 | import bacmman.data_structure.SegmentedObject; 6 | import bacmman.data_structure.Spot; 7 | import bacmman.utils.JSONUtils; 8 | import bacmman.utils.geom.Point; 9 | import org.json.simple.JSONObject; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | 13 | import java.util.List; 14 | 15 | public class RegionContainerEllipse2D extends RegionContainer { 16 | public final static Logger logger = LoggerFactory.getLogger(RegionContainerEllipse2D.class); 17 | public RegionContainerEllipse2D() { 18 | super(); 19 | } 20 | 21 | public RegionContainerEllipse2D(SegmentedObject object) { 22 | super(object); 23 | } 24 | 25 | @Override 26 | public Region getRegion() { 27 | return new Ellipse2D((Point) segmentedObject.getAttribute("Center"), 28 | ((Number) segmentedObject.getAttribute("MajorAxis", Double.valueOf(1d))).doubleValue(), 29 | ((Number) segmentedObject.getAttribute("MinorAxis", Double.valueOf(1d))).doubleValue(), 30 | ((Number) segmentedObject.getAttribute("Theta", Double.valueOf(1d))).doubleValue(), 31 | ((Number) segmentedObject.getAttribute("Intensity", Double.valueOf(0d))).doubleValue(), 32 | segmentedObject.getIdx() + 1, is2D, segmentedObject.getScaleXY(), segmentedObject.getScaleZ()); 33 | } 34 | 35 | @Override 36 | public JSONObject toJSON() { 37 | JSONObject res = super.toJSON(); 38 | res.put("Type", ANALYTICAL_TYPES.ELLIPSE2D.name()); // center, MajorAxis, MinorAxis, Theta and Intensity are stored in the attribute parameter 39 | return res; 40 | } 41 | } -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/processing/clustering/SimpleInterfaceVoxelSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.processing.clustering; 20 | 21 | import bacmman.data_structure.Region; 22 | 23 | /** 24 | * 25 | * @author Jean Ollion 26 | */ 27 | public class SimpleInterfaceVoxelSet extends InterfaceVoxelSet { 28 | 29 | public SimpleInterfaceVoxelSet(Region e1, Region e2) { 30 | super(e1, e2); 31 | } 32 | 33 | @Override 34 | public boolean checkFusion() { 35 | return false; 36 | } 37 | 38 | @Override 39 | public void updateInterface() { 40 | 41 | } 42 | 43 | @Override 44 | public int compareTo(SimpleInterfaceVoxelSet o) { 45 | return -Integer.compare(voxels.size(), o.voxels.size()); // biggest interface first 46 | } 47 | 48 | public static ClusterCollection.InterfaceFactory interfaceFactory() { 49 | return SimpleInterfaceVoxelSet::new; 50 | } 51 | 52 | @Override 53 | public double getValue() { 54 | return voxels.size(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/GroupParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Arrays; 23 | import java.util.Collection; 24 | import java.util.List; 25 | import org.json.simple.JSONArray; 26 | import bacmman.utils.JSONUtils; 27 | 28 | /** 29 | * 30 | * @author Jean Ollion 31 | */ 32 | public class GroupParameter extends GroupParameterAbstract { 33 | 34 | public GroupParameter(String name, Parameter... parameters) { 35 | super(name, parameters); 36 | } 37 | 38 | public GroupParameter(String name, Collection parameters) { 39 | super(name, parameters); 40 | } 41 | 42 | protected GroupParameter(String name) { 43 | super(name); 44 | } 45 | 46 | @Override 47 | public GroupParameter duplicate() { 48 | List dup = ParameterUtils.duplicateList(children); 49 | GroupParameter res = new GroupParameter(name, dup); 50 | transferStateArguments(this, res); 51 | return res; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/plugins/segmenters/ImportROI.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins.plugins.segmenters; 2 | 3 | import bacmman.configuration.parameters.FileChooser; 4 | import bacmman.configuration.parameters.Parameter; 5 | import bacmman.data_structure.Region; 6 | import bacmman.data_structure.RegionPopulation; 7 | import bacmman.data_structure.SegmentedObject; 8 | import bacmman.data_structure.region_container.roi.IJRoi3D; 9 | import bacmman.image.Image; 10 | import bacmman.plugins.Segmenter; 11 | import ij.gui.Roi; 12 | import ij.io.RoiDecoder; 13 | 14 | import java.io.File; 15 | import java.io.IOException; 16 | import java.util.ArrayList; 17 | 18 | public class ImportROI implements Segmenter { 19 | FileChooser roiFile = new FileChooser("ROI File", FileChooser.FileChooserOption.FILE_ONLY, false).setEmphasized(true).setHint("Choose file containing exported ROI"); 20 | 21 | @Override 22 | public Parameter[] getParameters() { 23 | return new Parameter[]{roiFile}; 24 | } 25 | 26 | @Override 27 | public RegionPopulation runSegmenter(Image input, int objectClassIdx, SegmentedObject parent) { 28 | String path = roiFile.getFirstSelectedFilePath(); 29 | File f = new File(path); 30 | if (!f.exists()) throw new RuntimeException("File do not exist"); 31 | Roi r = RoiDecoder.open(path); 32 | RoiDecoder rd = new RoiDecoder(path); 33 | try { 34 | Roi ijRoi = rd.getRoi(); 35 | IJRoi3D roi = new IJRoi3D(1); 36 | roi.setIs2D(true); 37 | roi.put(0, ijRoi); 38 | Region region = new Region(roi, 1, roi.getBounds(), parent.getScaleXY(), parent.getScaleZ()); 39 | return new RegionPopulation(new ArrayList(){{add(region);}}, input); 40 | } catch (IOException e) { 41 | throw new RuntimeException(e); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/core/OmeroGateway.java: -------------------------------------------------------------------------------- 1 | package bacmman.core; 2 | 3 | import bacmman.configuration.experiment.Experiment; 4 | import bacmman.data_structure.image_container.MultipleImageContainer; 5 | import bacmman.image.io.ImageReader; 6 | import bacmman.ui.PropertyUtils; 7 | import bacmman.ui.logger.ProgressLogger; 8 | import bacmman.utils.PasswordUtils; 9 | import java.io.IOException; 10 | import java.security.GeneralSecurityException; 11 | import java.util.List; 12 | import java.util.function.Consumer; 13 | 14 | public interface OmeroGateway { 15 | void setLogger(ProgressLogger logger); 16 | OmeroGateway setCredentials(String hostname, String userName, String password); 17 | boolean isConnected(); 18 | boolean connect(); 19 | boolean close(); 20 | ImageReader createReader(long fileID) throws IOException; 21 | void importFiles(Experiment xp, Consumer> importCallback, ProgressCallback pcb); 22 | 23 | static String decryptPassword(String server, String username, char[] password) throws GeneralSecurityException { 24 | String encryptedToken = PropertyUtils.get(server+"_"+username+"_o_e"); 25 | String salt = PropertyUtils.get(server+"_"+username+"_o_s"); 26 | if (salt==null || encryptedToken==null) return null; 27 | return PasswordUtils.decryptFromPassphrase(password, encryptedToken, salt); 28 | } 29 | static void encryptPassword(String server, String username, char[] localPassword, char[] remotePassword) throws GeneralSecurityException { 30 | String remotePW = String.copyValueOf(remotePassword); 31 | String[] encryptedPWAndSalt = PasswordUtils.encryptFromPassphrase(remotePW, localPassword); 32 | PropertyUtils.set(server+"_"+username+"_o_e", encryptedPWAndSalt[0]); 33 | PropertyUtils.set(server+"_"+username+"_o_s", encryptedPWAndSalt[1]); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/Offset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.image; 20 | 21 | 22 | /** 23 | * 24 | * @author Jean Ollion 25 | * @param 26 | */ 27 | public interface Offset> { 28 | int xMin(); 29 | int yMin(); 30 | int zMin(); 31 | int getIntPosition(int dim); 32 | Offset resetOffset(); 33 | Offset reverseOffset(); 34 | Offset translate(Offset other); 35 | default Offset translateReverse(Offset other) { 36 | return translate(-other.xMin(), -other.yMin(), -other.zMin()); 37 | } 38 | Offset translate(int dX, int dY, int dZ); 39 | static boolean offsetNull(Offset offset) { 40 | return offset.xMin()==0 && offset.yMin() == 0 && offset.zMin()==0; 41 | } 42 | static boolean offsetEquals(Offset off1, Offset off2) { 43 | return off1.xMin() == off2.xMin() && off1.yMin() == off2.yMin() && off1.zMin() == off2.zMin(); 44 | } 45 | static boolean offsetEquals2D(Offset off1, Offset off2) { 46 | return off1.xMin() == off2.xMin() && off1.yMin() == off2.yMin(); 47 | } 48 | Offset duplicate(); 49 | } 50 | -------------------------------------------------------------------------------- /bacmman-gui/src/main/java/bacmman/ui/gui/ToolTipImage.java: -------------------------------------------------------------------------------- 1 | package bacmman.ui.gui; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | import javax.swing.*; 7 | import javax.swing.border.BevelBorder; 8 | import java.awt.*; 9 | 10 | public class ToolTipImage extends JToolTip { 11 | private static final Logger logger = LoggerFactory.getLogger(ToolTipImage.class); 12 | private Icon image; 13 | JLabel text; 14 | JPanel ttPanel; 15 | public ToolTipImage(Image image) { 16 | this(image==null ? null : new ImageIcon(image)); 17 | } 18 | public ToolTipImage(Icon image) { 19 | super(); 20 | this.image = image; 21 | setLayout(new BorderLayout()); 22 | setBorder(new BevelBorder(0)); 23 | text = new JLabel(""); 24 | text.setBackground(null); 25 | if (image!=null) { 26 | ttPanel = new JPanel(new FlowLayout(1, 0, 5)); 27 | ttPanel.add(text); 28 | ttPanel.add(new JLabel(image)); 29 | add(ttPanel); 30 | } else { 31 | ttPanel = new JPanel(); 32 | ttPanel.add(text); 33 | add(ttPanel); 34 | } 35 | } 36 | 37 | public void stopAnimation() { 38 | if (image instanceof AnimatedIcon) { 39 | ((AnimatedIcon)image).stop(); 40 | } 41 | } 42 | 43 | @Override 44 | public Dimension getPreferredSize() { 45 | if (image==null) { 46 | Dimension dim = text.getPreferredSize(); 47 | return new Dimension(dim.width+10, dim.height+15); 48 | } else return new Dimension(image.getIconWidth(), text.getPreferredSize().height+5+image.getIconHeight()); 49 | } 50 | 51 | @Override 52 | public void setTipText(String tipText) { 53 | if (text!=null) text.setText(tipText); 54 | super.setTipText(tipText); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /bacmman-docker/src/main/java/bacmman/docker/ProgressParser.java: -------------------------------------------------------------------------------- 1 | package bacmman.docker; 2 | 3 | import bacmman.plugins.Plugin; 4 | import com.github.dockerjava.api.model.ResponseItem; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import java.util.HashMap; 9 | import java.util.Objects; 10 | import java.util.function.BiConsumer; 11 | 12 | public class ProgressParser { 13 | public final static Logger logger = LoggerFactory.getLogger(ProgressParser.class); 14 | final private HashMap progress = new HashMap<>(); 15 | //String currentStatus = null; 16 | final BiConsumer stepProgress; 17 | public ProgressParser(BiConsumer stepProgress) { 18 | this.stepProgress=stepProgress; 19 | } 20 | public void accept(ResponseItem item) { 21 | if (item.getStatus() == null) return; 22 | /*if (!Objects.equals(item.getStatus(), currentStatus)) { 23 | logger.debug("Switching to status: {} (previous: {})", item.getStatus(), currentStatus); 24 | progress.clear(); 25 | currentStatus = item.getStatus(); 26 | }*/ 27 | if (item.getId() != null && item.getProgressDetail() != null && item.getProgressDetail().getCurrent() !=null && item.getProgressDetail().getTotal()!=null) { 28 | progress.put(item.getId()+item.getStatus(), item.getProgressDetail()); 29 | long currentProgress=progress.values().stream().mapToLong(pd -> pd==null || pd.getCurrent()==null ? 0 : pd.getCurrent()/1024).sum()/1024; 30 | long totalProgress=progress.values().stream().mapToLong(pd -> pd == null || pd.getTotal()==null ? 0 : pd.getTotal()/(1024*1024)).sum(); 31 | if (stepProgress !=null) { 32 | stepProgress.accept((int)currentProgress, (int)totalProgress); 33 | } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /bacmman-modules-mother-machine/src/main/java/bacmman/processing/bacteria_spine/SpineOverlayDrawer.java: -------------------------------------------------------------------------------- 1 | package bacmman.processing.bacteria_spine; 2 | 3 | import bacmman.core.Core; 4 | import bacmman.image.Image; 5 | import bacmman.image.ImageMask; 6 | import bacmman.image.Offset; 7 | import bacmman.utils.geom.Point; 8 | import bacmman.utils.geom.Vector; 9 | 10 | import java.lang.reflect.InvocationTargetException; 11 | import java.util.List; 12 | 13 | public interface SpineOverlayDrawer { 14 | 15 | Object drawLine(Point start, Vector dir, String color, double width); 16 | 17 | Object drawArrow(Point start, Vector dir, String color, double width); 18 | Object drawPoint(Point point, String color, double width, int size, int type); 19 | Object getSpineOverlay(BacteriaSpineFactory.SpineResult s, Offset offset, String color, String contourColor, double width); 20 | void display(String title, ImageMask image, Object overlay); 21 | void display(String title, Image image, Object overlay); 22 | BacteriaSpineFactory.SpineResult trimSpine(BacteriaSpineFactory.SpineResult spine, double keepProp); 23 | 24 | void drawArrow(Object overlay, Offset offset, Point p1, Point p2, String color, double width); 25 | 26 | void drawPoint(Object overlay, Offset offset, Point p, String color, double width); 27 | 28 | 29 | static SpineOverlayDrawer get() { 30 | List> imp = Core.findImplementation("bacmman.processing.bacteria_spine", SpineOverlayDrawer.class); 31 | if (!imp.isEmpty()) { 32 | Class clazz = imp.get(0); 33 | try { 34 | return clazz.getDeclaredConstructor().newInstance(); 35 | } catch (NoClassDefFoundError | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { 36 | } 37 | } 38 | return null; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/plugins/HistogramScaler.java: -------------------------------------------------------------------------------- 1 | package bacmman.plugins; 2 | 3 | import bacmman.configuration.parameters.Parameter; 4 | import bacmman.data_structure.SegmentedObject; 5 | import bacmman.data_structure.SegmentedObjectUtils; 6 | import bacmman.data_structure.dao.ObjectDAO; 7 | import bacmman.image.Histogram; 8 | import bacmman.image.HistogramFactory; 9 | import bacmman.image.Image; 10 | import bacmman.plugins.Plugin; 11 | 12 | import java.util.List; 13 | import java.util.function.Consumer; 14 | import java.util.stream.Collectors; 15 | import java.util.stream.Stream; 16 | 17 | public interface HistogramScaler extends Plugin { 18 | void setHistogram(Histogram histogram); 19 | Image scale(Image image); 20 | Image reverseScale(Image image); 21 | boolean isConfigured(); 22 | void setScaleLogger(Consumer logger); 23 | HistogramScaler transformInputImage(boolean transformInputImage); 24 | static HistogramScaler noScaling() {return new HistogramScaler.NoScaling();} 25 | class NoScaling implements HistogramScaler { 26 | 27 | @Override 28 | public void setHistogram(Histogram histogram) { } 29 | 30 | @Override 31 | public void setScaleLogger(Consumer logger) {} 32 | 33 | @Override 34 | public Image scale(Image image) { 35 | return image; 36 | } 37 | 38 | @Override 39 | public Image reverseScale(Image image) { 40 | return image; 41 | } 42 | 43 | @Override 44 | public boolean isConfigured() { 45 | return true; 46 | } 47 | 48 | @Override 49 | public HistogramScaler transformInputImage(boolean transformInputImage) { 50 | return this; 51 | } 52 | 53 | @Override 54 | public Parameter[] getParameters() { 55 | return new Parameter[0]; 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/ObjectClassParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.configuration.parameters; 20 | 21 | /** 22 | * 23 | * @author Jean Ollion 24 | */ 25 | public class ObjectClassParameter extends ObjectClassParameterAbstract { 26 | 27 | public ObjectClassParameter(String name) { 28 | super(name); 29 | } 30 | public ObjectClassParameter(String name, int selectedStructure, boolean allowNoSelection, boolean multipleSelection) { 31 | super(name, selectedStructure, allowNoSelection, multipleSelection); 32 | } 33 | 34 | public ObjectClassParameter(String name, int[] selectedStructures, boolean allowNoSelection) { 35 | super(name, selectedStructures, allowNoSelection); 36 | } 37 | @Override 38 | public String[] getChoiceList() { 39 | String[] choices; 40 | if (getXP()!=null) { 41 | choices=getXP().experimentStructure.getObjectClassesAsString(); 42 | } else { 43 | choices = new String[]{"error, no experiment in the configuration"}; 44 | } 45 | return choices; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/configuration/parameters/FloatParameter.java: -------------------------------------------------------------------------------- 1 | package bacmman.configuration.parameters; 2 | 3 | public class FloatParameter extends NumberParameter{ 4 | Double lowerBound, upperBound; 5 | public FloatParameter(String name) { 6 | this(name, 0); 7 | } 8 | public FloatParameter(String name, double defaultValue) { 9 | super(name, 5, defaultValue); 10 | } 11 | public FloatParameter setLowerBound(double lowerBound) { 12 | this.lowerBound = lowerBound; 13 | return this; 14 | } 15 | public FloatParameter setUpperBound(double upperBound) { 16 | this.upperBound = upperBound; 17 | return this; 18 | } 19 | 20 | @Override 21 | public void setValue(Number value) { 22 | double doubleValue = value.doubleValue(); 23 | if (lowerBound!=null && doubleValueupperBound) value=upperBound.doubleValue(); 25 | super.setValue(value); 26 | } 27 | 28 | @Override 29 | public boolean isValid() { 30 | if (!super.isValid()) return false; 31 | return super.isValid() && (lowerBound==null || value.doubleValue()>=lowerBound.doubleValue()) && (upperBound==null || value.doubleValue()<=upperBound.doubleValue()); 32 | } 33 | 34 | @Override 35 | public FloatParameter duplicate() { 36 | FloatParameter res = new FloatParameter(name); 37 | res.setValue(this.getValue()); 38 | if (lowerBound!=null) res.setLowerBound(lowerBound); 39 | if (upperBound!=null) res.setUpperBound(upperBound); 40 | res.setListeners(listeners); 41 | res.addValidationFunction(additionalValidation); 42 | res.setHint(toolTipText); 43 | res.setSimpleHint(toolTipTextSimple); 44 | res.setEmphasized(isEmphasized); 45 | return res; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /bacmman-core/src/main/java/bacmman/image/wrappers/ImgLib1ImageWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Jean Ollion 3 | * 4 | * This File is part of BACMMAN 5 | * 6 | * BACMMAN is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BACMMAN is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with BACMMAN. If not, see . 18 | */ 19 | package bacmman.image.wrappers; 20 | 21 | import static bacmman.image.wrappers.IJImageWrapper.getImagePlus; 22 | //import mpicbg.imglib.image.display.imagej.ImageJFunctions; 23 | //import mpicbg.imglib.type.numeric.RealType; 24 | 25 | /** 26 | * 27 | * @author Jean Ollion 28 | */ 29 | public class ImgLib1ImageWrapper { 30 | /* 31 | public static < T extends RealType< T >> Image wrap(mpicbg.imglib.image.Image image) { 32 | ImagePlus ip = ImageJFunctions.copyToImagePlus(image); 33 | return IJImageWrapper.wrap(ip); 34 | } 35 | 36 | public static mpicbg.imglib.image.Image getImage(Image image) { //> 37 | image = TypeConverter.toCommonImageType(image); 38 | ImagePlus ip = IJImageWrapper.getImagePlus(image); 39 | if (image instanceof ImageFloat) return ImageJFunctions.wrapFloat(ip); 40 | else if (image instanceof ImageShort) return ImageJFunctions.wrapShort(ip); 41 | else if (image instanceof ImageByte) return ImageJFunctions.wrapByte(ip); 42 | else return null; 43 | } 44 | */ 45 | } 46 | --------------------------------------------------------------------------------