Search in sources :

Example 1 with Parallel

use of org.twak.utils.Parallel in project chordatlas by twak.

the class MiniStandalone2d method bulk.

// upload to /media/data/guerrero/projects/greeble/data/facade_sources/features
private void bulk() {
    File parentFile = new File("/media/twak/8bc5e750-9a70-4180-8eee-ced2fbba6484/data/small");
    File outDir = new File("/media/twak/8bc5e750-9a70-4180-8eee-ced2fbba6484/data/f2");
    try {
        List<File> togo = Files.walk(parentFile.toPath()).map(p -> p.toFile()).filter(f -> f.isDirectory() && new File(f, FeatureCache.PARAMETERS_YML).exists()).collect(Collectors.toList());
        new Parallel<File, Integer>(togo, new Work<File, Integer>() {

            public Integer work(File f) {
                renderAll(new MegaFeatures(f), new File(outDir, parentFile.toPath().relativize(f.toPath()).toString()).getPath());
                return 1;
            }
        }, null, true);
    // togo , new Work<File, Integer>() {
    // 
    // }, new Parallel.Complete<Integer>() {
    // 
    // Files.walk( parentFile.toPath() ).
    // map( p -> p.toFile() ).
    // filter( f -> f.isDirectory() && new File (f, "parameters.yml").exists() ).
    // forEach( f -> );
    // }, true );
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : JButton(javax.swing.JButton) ImageFeatures(org.twak.tweed.gen.FeatureCache.ImageFeatures) BufferedImage(java.awt.image.BufferedImage) Files(java.nio.file.Files) Parallel(org.twak.utils.Parallel) ListDownLayout(org.twak.utils.ui.ListDownLayout) Work(org.twak.utils.Parallel.Work) IOException(java.io.IOException) MegaFeatures(org.twak.tweed.gen.FeatureCache.MegaFeatures) Plot(org.twak.utils.ui.Plot) Collectors(java.util.stream.Collectors) File(java.io.File) List(java.util.List) JSlider(javax.swing.JSlider) ImageIO(javax.imageio.ImageIO) JCheckBox(javax.swing.JCheckBox) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) Feature(org.twak.viewTrace.facades.MiniFacade.Feature) JPanel(javax.swing.JPanel) FeatureCache(org.twak.tweed.gen.FeatureCache) MegaFeatures(org.twak.tweed.gen.FeatureCache.MegaFeatures) Parallel(org.twak.utils.Parallel) IOException(java.io.IOException) File(java.io.File)

Aggregations

BorderLayout (java.awt.BorderLayout)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 IOException (java.io.IOException)1 Files (java.nio.file.Files)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 ImageIO (javax.imageio.ImageIO)1 JButton (javax.swing.JButton)1 JCheckBox (javax.swing.JCheckBox)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1 JSlider (javax.swing.JSlider)1 FeatureCache (org.twak.tweed.gen.FeatureCache)1 ImageFeatures (org.twak.tweed.gen.FeatureCache.ImageFeatures)1 MegaFeatures (org.twak.tweed.gen.FeatureCache.MegaFeatures)1 Parallel (org.twak.utils.Parallel)1 Work (org.twak.utils.Parallel.Work)1 ListDownLayout (org.twak.utils.ui.ListDownLayout)1 Plot (org.twak.utils.ui.Plot)1