Search in sources :

Example 1 with ExtensionFileFilter

use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.

the class ScalePageCoordinatesToImageDimension method heldenbuch300to600dpi.

private static void heldenbuch300to600dpi() throws JAXBException, IOException {
    File input = new File("/tmp/Ambraser_Heldenbuch/Ambraser_Heldenbuch/page");
    File output = new File("/tmp/Ambraser_Heldenbuch/page_edited");
    if (!output.isDirectory()) {
        output.mkdirs();
    }
    File[] files = input.listFiles(new ExtensionFileFilter("xml", true, false));
    for (File f : files) {
        System.out.println("Processing file: " + f.getName());
        PcGtsType pc = PageXmlUtils.unmarshal(f);
        TrpPageTypeUtils.applyAffineTransformation(pc.getPage(), 0, 0, 2, 2, 0);
        final String filename;
        if (f.getName().contains("_")) {
            filename = f.getName().split("_")[1];
        } else {
            filename = f.getName();
        }
        System.out.println("Writing file: " + filename);
        PageXmlUtils.marshalToFile(pc, new File(output.getAbsolutePath() + File.separator + filename));
    }
}
Also used : File(java.io.File) ExtensionFileFilter(eu.transkribus.core.io.util.ExtensionFileFilter) PcGtsType(eu.transkribus.core.model.beans.pagecontent.PcGtsType)

Example 2 with ExtensionFileFilter

use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.

the class ScalePageCoordinatesToImageDimension method fixAltoFilenames.

private static void fixAltoFilenames() throws IOException {
    final String path = "/media/daten/Dokumente/newseye_testdata/alto/";
    ExtensionFileFilter filt = new ExtensionFileFilter("xml", true, false);
    File[] files = new File(path).listFiles(filt);
    for (File f : files) {
        File target = new File(f.getAbsolutePath().replaceAll("-gt2", ""));
        Files.move(f, target);
    }
}
Also used : ExtensionFileFilter(eu.transkribus.core.io.util.ExtensionFileFilter) File(java.io.File)

Example 3 with ExtensionFileFilter

use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.

the class ScalePageCoordinatesToImageDimension method heldenbuch600to300dpi.

private static void heldenbuch600to300dpi() throws JAXBException, IOException {
    File input = new File("/tmp/Heldenbuch_600dpi/Heldenbuch_600dpi/page");
    File output = new File("/tmp/Heldenbuch_600dpi/page_edited");
    if (!output.isDirectory()) {
        output.mkdirs();
    }
    File[] files = input.listFiles(new ExtensionFileFilter("xml", true, false));
    for (File f : files) {
        System.out.println("Processing file: " + f.getName());
        PcGtsType pc = PageXmlUtils.unmarshal(f);
        TrpPageTypeUtils.applyAffineTransformation(pc.getPage(), 0, 0, 0.5, 0.5, 0);
        final String filename;
        if (f.getName().contains("_")) {
            filename = f.getName().split("_")[1];
        } else {
            filename = f.getName();
        }
        System.out.println("Writing file: " + filename);
        PageXmlUtils.marshalToFile(pc, new File(output.getAbsolutePath() + File.separator + filename));
    }
}
Also used : File(java.io.File) ExtensionFileFilter(eu.transkribus.core.io.util.ExtensionFileFilter) PcGtsType(eu.transkribus.core.model.beans.pagecontent.PcGtsType)

Aggregations

ExtensionFileFilter (eu.transkribus.core.io.util.ExtensionFileFilter)3 File (java.io.File)3 PcGtsType (eu.transkribus.core.model.beans.pagecontent.PcGtsType)2