/** * This method takes in the batch InstanceID and subsequently gets the parsedXMLFile. Then it * fetches all the Pages from it as they are with a document type unknown. and it classifies all * the pages based on Image comparison. In the end the result is put in the batch.xml file. * * @param batchInstanceIdentifier {@link String} * @param sBatchFolder {@link String} * @throws IOException for any input output exception * @throws DCMAApplicationException for any other type of exception that occurs. */ public void classifyAllImgsOfBatch(String batchInstanceIdentifier, String sBatchFolder) throws IOException, DCMAApplicationException { // Initialize properties LOGGER.info("Initializing properties..."); Batch parsedXmlFile = batchSchemaService.getBatch(batchInstanceIdentifier); String batchClassIdentifier = parsedXmlFile.getBatchClassIdentifier(); LOGGER.info("batchClassIdentifier = " + batchClassIdentifier); String sampleBaseFolderPath = batchSchemaService.getImageMagickBaseFolderPath(batchClassIdentifier, false); String imMetric = pluginPropertiesService.getPropertyValue( batchInstanceIdentifier, ImageMagicKConstants.CLASSIFY_IMAGES_PLUGIN, ImageMagicProperties.CLASSIFY_IMAGES_COMP_METRIC); String imFuzz = pluginPropertiesService.getPropertyValue( batchInstanceIdentifier, ImageMagicKConstants.CLASSIFY_IMAGES_PLUGIN, ImageMagicProperties.CLASSIFY_IMAGES_FUZZ_PERCNT); String maxVal = pluginPropertiesService.getPropertyValue( batchInstanceIdentifier, ImageMagicKConstants.CLASSIFY_IMAGES_PLUGIN, ImageMagicProperties.CLASSIFY_IMAGES_MAX_RESULTS); LOGGER.info( "Properties Initialized Successfully, sampleBaseFolderPath = " + sampleBaseFolderPath); // Get list of Page names from parsedXmlFile. List<String> listOfUnclasifiedPgPth = new LinkedList<String>(); Map<String, Integer> unclassifiedPgIndexMap = new HashMap<String, Integer>(); getPathOfPagesOfBatch( parsedXmlFile, listOfUnclasifiedPgPth, unclassifiedPgIndexMap, sBatchFolder); Map<String, CustomValueSortedMap> finalUnclasifiedPageConfidenceMap = performClassification( maxVal, imMetric, imFuzz, sampleBaseFolderPath, listOfUnclasifiedPgPth); List<Document> listOfDocuments = parsedXmlFile.getDocuments().getDocument(); Document docuemnt = listOfDocuments.get(0); Pages pages = docuemnt.getPages(); List<Page> listOfPages = pages.getPage(); updateXmlObject(finalUnclasifiedPageConfidenceMap, unclassifiedPgIndexMap, listOfPages); batchSchemaService.updateBatch(parsedXmlFile); }
/** * This method takes in the batch InstanceID and subsequently gets the parsedXMLFile. Then it * fetches all the Pages from it as they are with a document type unknown. and it classifies all * the pages based on Image comparison. In the end the result is put in the batch.xml file. * * @param maxVal {@link String} * @param imMetric {@link String} * @param imFuzz {@link String} * @param batchInstanceIdentifier {@link String} * @param batchClassIdentifier {@link String} * @param sBatchFolder {@link String} * @param listOfPages {@link List<Page>} * @throws IOException for any input output exception * @throws DCMAApplicationException for any other type of exception that occurs. */ public void classifyAllImgsOfBatchInternal( String maxVal, String imMetric, String imFuzz, String batchInstanceIdentifier, String batchClassIdentifier, String sBatchFolder, List<Page> listOfPages) throws IOException, DCMAApplicationException { // Initialize properties LOGGER.info("Initializing properties..."); LOGGER.info("batchClassIdentifier = " + batchClassIdentifier); String sampleBaseFolderPath = batchSchemaService.getImageMagickBaseFolderPath(batchClassIdentifier, false); LOGGER.info( "Properties Initialized Successfully, sampleBaseFolderPath = " + sampleBaseFolderPath); // Get list of Page names from parsedXmlFile. List<String> listOfUnclasifiedPgPth = new LinkedList<String>(); Map<String, Integer> unclassifiedPgIndexMap = new HashMap<String, Integer>(); processPageList(listOfPages, listOfUnclasifiedPgPth, unclassifiedPgIndexMap, sBatchFolder); Map<String, CustomValueSortedMap> finalUnclasifiedPageConfidenceMap = performClassification( maxVal, imMetric, imFuzz, sampleBaseFolderPath, listOfUnclasifiedPgPth); updateXmlObject(finalUnclasifiedPageConfidenceMap, unclassifiedPgIndexMap, listOfPages); }