Class AlgorithmMeanShiftClustering

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmMeanShiftClustering
    extends AlgorithmBase
    The java code is ported from C++ code downloaded from http://coewww.rutgers.edu/riul/research/code.html. The relevant web page section says: Adaptive mean shift based clustering C++ code implementing an (approximate) mean shift procedure with variable bandwith (in high dimensions). The algorithm is described in Mean shift based clustering in high dimensions: A texture classification example. For comments, please contact Bogdan Georgescu or Ilan Shimshoni. The original paper was written by Bogdan Georgescu, Ilan Shimshoni, and P. Meer in the proceedings of ICCV 2003. The original files were fams.cpp and fams.h. This code was ported by William Gandler.
    • Field Detail

      • FAMS_FLOAT_SHIFT

        private static float FAMS_FLOAT_SHIFT
      • K

        private int K
      • L

        private int L
      • k_neigh

        private int k_neigh
      • data_file_name

        private java.lang.String data_file_name
      • input_directory

        private java.lang.String input_directory
      • choosePoints

        private int choosePoints
      • jump

        private int jump
      • percent

        private double percent
      • fixedWidth

        private boolean fixedWidth
      • width

        private float width
      • findOptimalKL

        private boolean findOptimalKL
      • epsilon

        private float epsilon
      • Kmin

        private int Kmin
      • Kjump

        private int Kjump
      • FAMS_DO_SPEEDUP

        private boolean FAMS_DO_SPEEDUP
      • nPoints

        private int nPoints
      • nDims

        private int nDims
      • pttemp

        private float[] pttemp
      • prunedModesImage

        private ModelImage prunedModesImage
      • noLSH

        private boolean noLSH
      • raFile

        private java.io.RandomAccessFile raFile
      • byteIntBuffer

        private final byte[] byteIntBuffer
        byte array for int *
      • byteFloatBuffer

        private final byte[] byteFloatBuffer
        byte array for float *
      • endianess

        private boolean endianess
      • array1

        private int[] array1
      • minVal

        private float minVal
      • maxVal

        private float maxVal
      • data

        private int[][] data
      • dataSize

        private int dataSize
      • rr

        double[] rr
      • psel

        private int[] psel
      • nsel

        private int nsel
      • modes

        private int[][] modes
      • hmodes

        private int[][] hmodes
      • npm

        private int npm
      • prunedmodes

        private int[][] prunedmodes
      • nprunedmodes

        private int[] nprunedmodes
      • M

        private int M
      • M2

        private int M2
      • hashCoeffs

        private int[] hashCoeffs
      • K_

        private int K_
      • L_

        private int L_
      • t_cut_res

        private int[][] t_cut_res
      • t_old_cut_res

        private int[][] t_old_cut_res
      • t_old_m

        private int[] t_old_m
      • t_m

        private int[] t_m
      • t_m2

        private int[] t_m2
      • t_hjump

        private int[] t_hjump
      • nnres1

        private int nnres1
      • nnres2

        private int nnres2
      • tt1

        private long tt1
      • srand

        private java.util.Random srand
    • Constructor Detail

      • AlgorithmMeanShiftClustering

        public AlgorithmMeanShiftClustering​(ModelImage image,
                                            int K,
                                            int L,
                                            int k_neigh,
                                            java.lang.String data_file_name,
                                            java.lang.String input_directory,
                                            int choosePoints,
                                            int jump,
                                            double percent,
                                            boolean fixedWidth,
                                            float width,
                                            boolean findOptimalKL,
                                            float epsilon,
                                            int Kmin,
                                            int Kjump,
                                            boolean FAMS_DO_SPEEDUP,
                                            int nPoints,
                                            int nDims,
                                            float[] pttemp,
                                            ModelImage modesImage,
                                            ModelImage prunedModesImage)
        File formats: Files are all ASCII files. The input file has a one line header with two number_of_points dimension Then the input points are given as lines including d numbers. The pilot process produces the neighborhood size for each point If the input file is for example d040_1S.txt and the number of neighbors is k the pilot file will be pilot_d040_1S_k.txt If the file exists the program will assume that it was created by a previous run and use the information in it and will not rerun the pilot creation procedure. This enables the users to provide their own neighborhood sizes. The output files are for example: The result of MS on the selected points is in out_data_file_name.txt The result of joined modes is in modes_data_file_name.txt Example: We are given a file d040_1S.txt fams 30 46 200 d040_1S ./ -f 0.05 10 2 Finds K,L and optionally runs mean shift on all points. To run mean shift on same data with K=24 and L=35 fams 24 35 200 d040_1S ./ NOTES: - Internally the program scales the data between 0 and 2^16-1, therefore the precision is limited by range_of_data/2^16 - Running mean shift on all the points is not necessary when only the modes are needed - In the file fams.h there are several constants that influence the speed and accuracy of the program. For example you can set the bandwidth on which two modes are joined or the number of trials on which the test is run when finding K and L. Permission to port granted by Ilan Shimshoni: No problem. Good luck with that. I'll be happy to put your code also on my website if you like. Ilan Sent from my Cyanogen phone On Nov 23, 2016 9:02 PM, "Gandler, William (NIH/CIT) [E]" wrote: Dear Ilan Shimshoni, I am a Java programmer for the MIPAV imaging package at NIH working on mean shift. Could I have permission to port your Adaptive mean shift based clustering C++ code to Java for use in MIPAV? You will receive full acknowledgement for all code ported. Sincerely, William Gandler