List of usage examples for java.lang Float MAX_VALUE
float MAX_VALUE
To view the source code for java.lang Float MAX_VALUE.
Click Source Link
From source file:SIFT_Volume_Stitching.java
/** Compute the matching key points between two image processors @param image processor 1 (front stack) @param image processor 1 (back stack)/*w ww . ja va2 s .c om*/ @param sift object @param boolen (information shown or not) @return the matching key points */ public Vector<PointMatch> searchBestInliers(ImageProcessor ip1, ImageProcessor ip2, SIFT ijSIFT, boolean showInfoBoolean) { fsb.clear(); ijSIFT.extractFeatures(ip2, fsb); System.out.print("identifying correspondences using brute force ..."); Vector<PointMatch> candidates = FloatArray2DSIFT.createMatches(fsb, fsf, 1.5f, null, Float.MAX_VALUE, p.rod); Vector<PointMatch> inliers = new Vector<PointMatch>(); AbstractAffineModel2D<?> BestModel; switch (p.modelIndex) { case 0: BestModel = new TranslationModel2D(); break; case 1: BestModel = new RigidModel2D(); break; case 2: BestModel = new SimilarityModel2D(); break; case 3: BestModel = new AffineModel2D(); break; default: BestModel = new RigidModel2D(); } try { modelFound = BestModel.filterRansac(candidates, inliers, 1000, p.maxEpsilon, p.minInlierRatio); } catch (Exception e) { modelFound = false; System.err.println(e.getMessage()); } if (modelFound) { if (showInfoBoolean) { double[][] data = new double[2][3]; BestModel.toMatrix(data); displayFeatures(ip1, ip2, candidates, inliers, modelFound); } } return inliers; }
From source file:org.bangbang.support.v4.widget.VerticalViewPager.java
private void calculatePageOffsets(ItemInfo curItem, int curIndex, ItemInfo oldCurInfo) { final int N = mAdapter.getCount(); final int height = getHeight(); final float marginOffset = height > 0 ? (float) mPageMargin / height : 0; // Fix up offsets for later layout. if (oldCurInfo != null) { final int oldCurPosition = oldCurInfo.position; // Base offsets off of oldCurInfo. if (oldCurPosition < curItem.position) { int itemIndex = 0; ItemInfo ii = null;/* w w w .j a v a 2 s .c om*/ float offset = oldCurInfo.offset + oldCurInfo.widthFactor + marginOffset; for (int pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < mItems.size(); pos++) { ii = mItems.get(itemIndex); while (pos > ii.position && itemIndex < mItems.size() - 1) { itemIndex++; ii = mItems.get(itemIndex); } while (pos < ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset += mAdapter.getPageWidth(pos) + marginOffset; pos++; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } } else if (oldCurPosition > curItem.position) { int itemIndex = mItems.size() - 1; ItemInfo ii = null; float offset = oldCurInfo.offset; for (int pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) { ii = mItems.get(itemIndex); while (pos < ii.position && itemIndex > 0) { itemIndex--; ii = mItems.get(itemIndex); } while (pos > ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset -= mAdapter.getPageWidth(pos) + marginOffset; pos--; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; } } } // Base all offsets off of curItem. final int itemCount = mItems.size(); float offset = curItem.offset; int pos = curItem.position - 1; mFirstOffset = curItem.position == 0 ? curItem.offset : -Float.MAX_VALUE; mLastOffset = curItem.position == N - 1 ? curItem.offset + curItem.widthFactor - 1 : Float.MAX_VALUE; // Previous pages for (int i = curIndex - 1; i >= 0; i--, pos--) { final ItemInfo ii = mItems.get(i); while (pos > ii.position) { offset -= mAdapter.getPageWidth(pos--) + marginOffset; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; if (ii.position == 0) mFirstOffset = offset; } offset = curItem.offset + curItem.widthFactor + marginOffset; pos = curItem.position + 1; // Next pages for (int i = curIndex + 1; i < itemCount; i++, pos++) { final ItemInfo ii = mItems.get(i); while (pos < ii.position) { offset += mAdapter.getPageWidth(pos++) + marginOffset; } if (ii.position == N - 1) { mLastOffset = offset + ii.widthFactor - 1; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } mNeedCalculatePageOffsets = false; }
From source file:lenscorrection.Distortion_Correction.java
static protected void extractSIFTPointsThreaded(final int index, final List<Feature>[] siftFeatures, final List<PointMatch>[] inliers, final AbstractAffineModel2D<?>[] models) { // save all matching candidates final List<PointMatch>[] candidates = new List[siftFeatures.length - 1]; final Thread[] threads = MultiThreading.newThreads(); final AtomicInteger ai = new AtomicInteger(0); // start at second // slice//from w ww . j av a2 s. c om for (int ithread = 0; ithread < threads.length; ++ithread) { threads[ithread] = new Thread() { @Override public void run() { setPriority(Thread.NORM_PRIORITY); for (int j = ai.getAndIncrement(); j < candidates.length; j = ai.getAndIncrement()) { final int i = (j < index ? j : j + 1); candidates[j] = FloatArray2DSIFT.createMatches(siftFeatures[index], siftFeatures[i], 1.5f, null, Float.MAX_VALUE, 0.5f); } } }; } MultiThreading.startAndJoin(threads); // get rid of the outliers and save the rigid transformations to match // the inliers final AtomicInteger ai2 = new AtomicInteger(0); for (int ithread = 0; ithread < threads.length; ++ithread) { threads[ithread] = new Thread() { @Override public void run() { setPriority(Thread.NORM_PRIORITY); for (int i = ai2.getAndIncrement(); i < candidates.length; i = ai2.getAndIncrement()) { final List<PointMatch> tmpInliers = new ArrayList<PointMatch>(); // RigidModel2D m = // RigidModel2D.estimateBestModel(candidates.get(i), // tmpInliers, sp.min_epsilon, sp.max_epsilon, // sp.min_inlier_ratio); final AbstractAffineModel2D<?> m; switch (sp.expectedModelIndex) { case 0: m = new TranslationModel2D(); break; case 1: m = new RigidModel2D(); break; case 2: m = new SimilarityModel2D(); break; case 3: m = new AffineModel2D(); break; default: return; } boolean modelFound = false; try { modelFound = m.filterRansac(candidates[i], tmpInliers, 1000, sp.maxEpsilon, sp.minInlierRatio, 10); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) IJ.log("Model found:\n " + candidates[i].size() + " candidates\n " + tmpInliers.size() + " inliers\n " + String.format("%.2f", m.getCost()) + "px average displacement"); else IJ.log("No Model found."); inliers[index * (sp.numberOfImages - 1) + i] = tmpInliers; models[index * (sp.numberOfImages - 1) + i] = m; // System.out.println("**** MODEL ADDED: " + // (index*(sp.numberOfImages-1)+i)); } } }; } MultiThreading.startAndJoin(threads); }
From source file:org.bangbang.support.v4.widget.ViewPager.java
private void calculatePageOffsets(ItemInfo curItem, int curIndex, ItemInfo oldCurInfo) { final int N = mAdapter.getCount(); final int width = getWidth(); final float marginOffset = width > 0 ? (float) mPageMargin / width : 0; // Fix up offsets for later layout. if (oldCurInfo != null) { final int oldCurPosition = oldCurInfo.position; // Base offsets off of oldCurInfo. if (oldCurPosition < curItem.position) { int itemIndex = 0; ItemInfo ii = null;//from w ww. jav a2 s.c om float offset = oldCurInfo.offset + oldCurInfo.widthFactor + marginOffset; for (int pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < mItems.size(); pos++) { ii = mItems.get(itemIndex); while (pos > ii.position && itemIndex < mItems.size() - 1) { itemIndex++; ii = mItems.get(itemIndex); } while (pos < ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset += mAdapter.getPageWidth(pos) + marginOffset; pos++; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } } else if (oldCurPosition > curItem.position) { int itemIndex = mItems.size() - 1; ItemInfo ii = null; float offset = oldCurInfo.offset; for (int pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) { ii = mItems.get(itemIndex); while (pos < ii.position && itemIndex > 0) { itemIndex--; ii = mItems.get(itemIndex); } while (pos > ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset -= mAdapter.getPageWidth(pos) + marginOffset; pos--; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; } } } // Base all offsets off of curItem. final int itemCount = mItems.size(); float offset = curItem.offset; // offset += (1.0 - curItem.widthFactor) / 2.0; // curItem.offset = offset; int pos = curItem.position - 1; mFirstOffset = curItem.position == 0 ? curItem.offset //bangbang.S - (1f - curItem.widthFactor) / 2.f : -Float.MAX_VALUE; mLastOffset = curItem.position == N - 1 ? curItem.offset + curItem.widthFactor - 1 // bangbang.S + (1f - curItem.widthFactor) / 2.f : Float.MAX_VALUE; // Previous pages for (int i = curIndex - 1; i >= 0; i--, pos--) { final ItemInfo ii = mItems.get(i); while (pos > ii.position) { offset -= mAdapter.getPageWidth(pos--) + marginOffset; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; if (ii.position == 0) mFirstOffset = offset - (1f - curItem.widthFactor) / 2.f; } offset = curItem.offset + curItem.widthFactor + marginOffset; pos = curItem.position + 1; // Next pages for (int i = curIndex + 1; i < itemCount; i++, pos++) { final ItemInfo ii = mItems.get(i); while (pos < ii.position) { offset += mAdapter.getPageWidth(pos++) + marginOffset; } if (ii.position == N - 1) { mLastOffset = offset + ii.widthFactor - 1 //bangbang.S + (1f - curItem.widthFactor) / 2.f; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } if (DEBUG) { final int SIZE = mItems.size(); String log = ""; for (int i = 0; i < SIZE; i++) { final ItemInfo ii = mItems.get(i); log += "," + ii.offset; } log = log.replaceFirst(",", ""); Log.d(TAG, "calculated offsets: " + log); } mNeedCalculatePageOffsets = false; }
From source file:org.fhcrc.cpl.viewer.ms2.commandline.PostProcessPepXMLCLM.java
protected void filterOnQualityScores(FeatureSet featureSet) { //filter on feature attributes if (minPeptideProphet > 0f) { List<Feature> featuresToKeep = new ArrayList<Feature>(); int numFeaturesStripped = 0; for (Feature feature : featureSet.getFeatures()) { if (MS2ExtraInfoDef.getPeptideProphet(feature) >= minPeptideProphet) featuresToKeep.add(feature); else/*from w w w .j a va 2 s .c o m*/ numFeaturesStripped++; } featureSet.setFeatures(featuresToKeep.toArray(new Feature[0])); ApplicationContext.infoMessage( "\tStripped " + numFeaturesStripped + " features with PeptideProphet < " + minPeptideProphet); } if (maxExpect < Float.MAX_VALUE) { List<Feature> featuresToKeep = new ArrayList<Feature>(); int numFeaturesStripped = 0; for (Feature feature : featureSet.getFeatures()) { try { Float expectScore = Float.parseFloat(MS2ExtraInfoDef.getSearchScore(feature, "expect")); if (expectScore <= maxExpect) featuresToKeep.add(feature); else numFeaturesStripped++; } catch (Exception e) { } } featureSet.setFeatures(featuresToKeep.toArray(new Feature[0])); ApplicationContext .infoMessage("\tStripped " + numFeaturesStripped + " features with expect > " + maxExpect); } }
From source file:com.brantapps.viewpagerindicator.vertical.VerticalViewPager.java
private void calculatePageOffsets(ItemInfo curItem, int curIndex, ItemInfo oldCurInfo) { final int N = mAdapter.getCount(); // BrantApps Change: Renamed width to height and changed method call to get the value final int height = getHeight(); final float marginOffset = height > 0 ? (float) mPageMargin / height : 0; // Fix up offsets for later layout. if (oldCurInfo != null) { final int oldCurPosition = oldCurInfo.position; // Base offsets off of oldCurInfo. if (oldCurPosition < curItem.position) { int itemIndex = 0; ItemInfo ii = null;//from ww w . j a v a2 s .co m float offset = oldCurInfo.offset + oldCurInfo.heightFactor + marginOffset; for (int pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < mItems.size(); pos++) { ii = mItems.get(itemIndex); while (pos > ii.position && itemIndex < mItems.size() - 1) { itemIndex++; ii = mItems.get(itemIndex); } while (pos < ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. // NOTE: still calls PagerAdapter getPageWidth() to avoid having to create a VerticalPagerAdapter offset += mAdapter.getPageWidth(pos) + marginOffset; pos++; } ii.offset = offset; offset += ii.heightFactor + marginOffset; } } else if (oldCurPosition > curItem.position) { int itemIndex = mItems.size() - 1; ItemInfo ii = null; float offset = oldCurInfo.offset; for (int pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) { ii = mItems.get(itemIndex); while (pos < ii.position && itemIndex > 0) { itemIndex--; ii = mItems.get(itemIndex); } while (pos > ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset -= mAdapter.getPageWidth(pos) + marginOffset; pos--; } offset -= ii.heightFactor + marginOffset; ii.offset = offset; } } } // Base all offsets off of curItem. final int itemCount = mItems.size(); float offset = curItem.offset; int pos = curItem.position - 1; mFirstOffset = curItem.position == 0 ? curItem.offset : -Float.MAX_VALUE; mLastOffset = curItem.position == N - 1 ? curItem.offset + curItem.heightFactor - 1 : Float.MAX_VALUE; // Previous pages for (int i = curIndex - 1; i >= 0; i--, pos--) { final ItemInfo ii = mItems.get(i); while (pos > ii.position) { offset -= mAdapter.getPageWidth(pos--) + marginOffset; } offset -= ii.heightFactor + marginOffset; ii.offset = offset; if (ii.position == 0) mFirstOffset = offset; } offset = curItem.offset + curItem.heightFactor + marginOffset; pos = curItem.position + 1; // Next pages for (int i = curIndex + 1; i < itemCount; i++, pos++) { final ItemInfo ii = mItems.get(i); while (pos < ii.position) { offset += mAdapter.getPageWidth(pos++) + marginOffset; } if (ii.position == N - 1) { mLastOffset = offset + ii.heightFactor - 1; } ii.offset = offset; offset += ii.heightFactor + marginOffset; } }
From source file:SIFT_Volume_Stitching.java
/** Compute the best transformation model given a SIFT object @param image processor//from w ww. ja v a2s.c om @param sift object @return best transformation model */ public AbstractAffineModel2D<?> searchBestModel(ImageProcessor ipb, SIFT ijSIFT) { fsb.clear(); ijSIFT.extractFeatures(ipb, fsb); System.out.print("identifying correspondences using brute force ..."); Vector<PointMatch> candidates = FloatArray2DSIFT.createMatches(fsb, fsf, 1.5f, null, Float.MAX_VALUE, p.rod); Vector<PointMatch> inliers = new Vector<PointMatch>(); AbstractAffineModel2D<?> BestModel; switch (p.modelIndex) { case 0: BestModel = new TranslationModel2D(); break; case 1: BestModel = new RigidModel2D(); break; case 2: BestModel = new SimilarityModel2D(); break; case 3: BestModel = new AffineModel2D(); break; default: BestModel = new RigidModel2D(); } try { modelFound = BestModel.filterRansac(candidates, inliers, 1000, p.maxEpsilon, p.minInlierRatio); } catch (Exception e) { modelFound = false; System.err.println(e.getMessage()); } return BestModel; }
From source file:org.lockss.util.ObjectSerializerTester.java
/** * <p>Builds a sample {@link org.lockss.util.TypedEntryMap} * ready to marshal in tests.</p>/*from w ww.jav a2 s . c o m*/ * <p>If subclasses override this method, they must make sure to * create a TypedEntryMap full of many data types to maximize the * difficulty of the test.</p> * @return A newly allocated * {@link org.lockss.util.TypedEntryMap} filled with * many interesting keys and values. */ protected TypedEntryMap makeSample_TypedEntryMap() throws Exception { TypedEntryMap tmap = new TypedEntryMap(); /* Basic data types */ tmap.putBoolean("boolean.true", true); tmap.putBoolean("boolean.false", false); tmap.putDouble("double.Math.PI", Math.PI); tmap.putDouble("double.Math.E", Math.E); tmap.putFloat("float.Float.MAX_VALUE", Float.MAX_VALUE); tmap.putFloat("float.0.12345f", 0.12345f); tmap.putInt("int.Integer.MIN_VALUE", Integer.MIN_VALUE); tmap.putInt("int.Integer.12345", 12345); tmap.putLong("long.Long.MAX_VALUE", Long.MAX_VALUE); tmap.putLong("long.6507245723L", 6507245723L); tmap.putString("string.\"LOCKSS rocks\"", "LOCKSS rocks"); tmap.putString("string.\"\"", ""); tmap.putUrl("url.\"http://www.lockss.org/\"", new URL("http://www.lockss.org/")); tmap.putUrl("url.\"http://www.stanford.edu/\"", new URL("http://www.stanford.edu/")); /* Collections */ tmap.putCollection("collection.list.homogeneous", ListUtil.list("E", "F", "G", "H")); tmap.putCollection("collection.list.heterogeneous", ListUtil.list(new Float(1.0), "two", new Long(3))); return tmap; }
From source file:org.jenkinsci.plugins.structs.describable.DescribableModelTest.java
@Issue("JENKINS-31967") @Test// ww w .j a v a 2s.c o m public void testJavaStandardTypes() throws Exception { // check instantiate with not default values roundTrip(AllJavaStandardTypesClass.class, map("booleanValue1", Boolean.TRUE, "byteValue1", Byte.MAX_VALUE, "shortValue1", Short.MAX_VALUE, "intValue1", Integer.MAX_VALUE, "longValue1", Long.MAX_VALUE, "floatValue1", Float.MAX_VALUE, "doubleValue1", Double.MAX_VALUE)); // check with default values roundTrip(AllJavaStandardTypesClass.class, map("booleanValue1", false, "byteValue1", (byte) 0, "shortValue1", (short) 0, "intValue1", 0, "longValue1", (long) 0, "floatValue1", (float) 0.0, "doubleValue1", 0.0)); }
From source file:com.scliang.bquick.view.BqViewPager.java
private void calculatePageOffsets(ItemInfo curItem, int curIndex, ItemInfo oldCurInfo) { final int N = mAdapter.getCount(); final int width = getWidth(); final float marginOffset = width > 0 ? (float) mPageMargin / width : 0; // Fix up offsets for later layout. if (oldCurInfo != null) { final int oldCurPosition = oldCurInfo.position; // Base offsets off of oldCurInfo. if (oldCurPosition < curItem.position) { int itemIndex = 0; ItemInfo ii = null;//from w w w. j av a 2 s. c o m float offset = oldCurInfo.offset + oldCurInfo.widthFactor + marginOffset; for (int pos = oldCurPosition + 1; pos <= curItem.position && itemIndex < mItems.size(); pos++) { ii = mItems.get(itemIndex); while (pos > ii.position && itemIndex < mItems.size() - 1) { itemIndex++; ii = mItems.get(itemIndex); } while (pos < ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset += mAdapter.getPageWidth(pos) + marginOffset; pos++; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } } else if (oldCurPosition > curItem.position) { int itemIndex = mItems.size() - 1; ItemInfo ii = null; float offset = oldCurInfo.offset; for (int pos = oldCurPosition - 1; pos >= curItem.position && itemIndex >= 0; pos--) { ii = mItems.get(itemIndex); while (pos < ii.position && itemIndex > 0) { itemIndex--; ii = mItems.get(itemIndex); } while (pos > ii.position) { // We don't have an item populated for this, // ask the adapter for an offset. offset -= mAdapter.getPageWidth(pos) + marginOffset; pos--; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; } } } // Base all offsets off of curItem. final int itemCount = mItems.size(); float offset = curItem.offset; int pos = curItem.position - 1; mFirstOffset = curItem.position == 0 ? curItem.offset : -Float.MAX_VALUE; mLastOffset = curItem.position == N - 1 ? curItem.offset + curItem.widthFactor - 1 : Float.MAX_VALUE; // Previous pages for (int i = curIndex - 1; i >= 0; i--, pos--) { final ItemInfo ii = mItems.get(i); while (pos > ii.position) { offset -= mAdapter.getPageWidth(pos--) + marginOffset; } offset -= ii.widthFactor + marginOffset; ii.offset = offset; if (ii.position == 0) mFirstOffset = offset; } offset = curItem.offset + curItem.widthFactor + marginOffset; pos = curItem.position + 1; // Next pages for (int i = curIndex + 1; i < itemCount; i++, pos++) { final ItemInfo ii = mItems.get(i); while (pos < ii.position) { offset += mAdapter.getPageWidth(pos++) + marginOffset; } if (ii.position == N - 1) { mLastOffset = offset + ii.widthFactor - 1; } ii.offset = offset; offset += ii.widthFactor + marginOffset; } // mNeedCalculatePageOffsets = false; }