Skip to content
Snippets Groups Projects
Commit 04d278fb authored by Jakub Kolman's avatar Jakub Kolman
Browse files

[#81] documentation: adding java docs

parent a88d1df4
No related branches found
No related tags found
No related merge requests found
Showing
with 56 additions and 215 deletions
...@@ -3,6 +3,7 @@ package cz.fidentis.analyst.feature; ...@@ -3,6 +3,7 @@ package cz.fidentis.analyst.feature;
import java.io.Serializable; import java.io.Serializable;
/** /**
* Class with basic structure of feature point
* *
* @author Jakub Kolman * @author Jakub Kolman
*/ */
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cz.fidentis.analyst.feature.provider; package cz.fidentis.analyst.feature.provider;
import cz.fidentis.analyst.feature.FeaturePointType; import cz.fidentis.analyst.feature.FeaturePointType;
...@@ -11,6 +6,7 @@ import java.util.HashMap; ...@@ -11,6 +6,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Feature point type provider class
* *
* @author Jakub Kolman * @author Jakub Kolman
*/ */
...@@ -19,7 +15,10 @@ public class FeaturePointTypeProvider { ...@@ -19,7 +15,10 @@ public class FeaturePointTypeProvider {
private final Map<Integer, FeaturePointType> featurePointTypesById; private final Map<Integer, FeaturePointType> featurePointTypesById;
private final Map<String, FeaturePointType> featurePointTypesByCode; private final Map<String, FeaturePointType> featurePointTypesByCode;
// provide thread safe singleton /**
* provide thread safe singleton
* @author Jakub Kolman
*/
private static class InstanceHolder { private static class InstanceHolder {
public static FeaturePointTypeProvider instance = new FeaturePointTypeProvider(); public static FeaturePointTypeProvider instance = new FeaturePointTypeProvider();
......
...@@ -11,12 +11,19 @@ import java.util.logging.Logger; ...@@ -11,12 +11,19 @@ import java.util.logging.Logger;
/** /**
* Class used to export feature points to file of csv format * Class used to export feature points to file of csv format
* *
* @author Jakub Kolman * @author Jakub Kolman
*/ */
public class FeaturePointCsvExporter { public class FeaturePointCsvExporter {
public static void exportFeaturePointsToCSV(List<FeaturePoint> featurePointList, String objectName) throws IOException { /**
* Exports a file to default location in csv format
*
* @param featurePointList
* @param objectName
* @throws IOException
*/
public static void exportFeaturePointsToCSV(List<FeaturePoint> featurePointList, String objectName) throws IOException {
File csvOutputFile = new File(String.format("%s_landmarks.csv", objectName)); File csvOutputFile = new File(String.format("%s_landmarks.csv", objectName));
// CSV is a normal text file, need a writer // CSV is a normal text file, need a writer
try (BufferedWriter bw = new BufferedWriter(new FileWriter(csvOutputFile))) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(csvOutputFile))) {
......
...@@ -11,8 +11,6 @@ import java.nio.charset.StandardCharsets; ...@@ -11,8 +11,6 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream; import java.util.stream.Stream;
/** /**
...@@ -25,6 +23,14 @@ public class FeaturePointCsvLoader { ...@@ -25,6 +23,14 @@ public class FeaturePointCsvLoader {
private static final String COLUMN_DELIMETER = ","; private static final String COLUMN_DELIMETER = ",";
private static final String CODE_PREFIX_DELIMETER = " "; private static final String CODE_PREFIX_DELIMETER = " ";
/**
* Loads feature points from file of csv format
* @param path
* @param fileName
* @return
* @throws FileNotFoundException
* @throws IOException
*/
public static List<FeaturePoint> loadFeaturePoints(String path, String fileName) throws FileNotFoundException, IOException { public static List<FeaturePoint> loadFeaturePoints(String path, String fileName) throws FileNotFoundException, IOException {
FileResourcesUtils app = new FileResourcesUtils(); FileResourcesUtils app = new FileResourcesUtils();
try (InputStreamReader streamReader try (InputStreamReader streamReader
......
...@@ -8,40 +8,38 @@ import java.util.List; ...@@ -8,40 +8,38 @@ import java.util.List;
/** /**
* Class used for exporting feature points from file * Class used for exporting feature points from file
*
for more details @see cz.fidentis.analyst.feature.services.FeaturePointCsvExporter or @see cz.fidentis.analyst.feature.services.FeaturePointFpExporter * for more details @see
* * cz.fidentis.analyst.feature.services.FeaturePointCsvExporter or @see
* cz.fidentis.analyst.feature.services.FeaturePointFpExporter
*
* @author Jakub Kolman * @author Jakub Kolman
*/ */
public class FeaturePointExportService { public class FeaturePointExportService {
/** /**
* Method calls either @see FeaturePointCsvExporter or @see * Method calls either @see FeaturePointCsvExporter or @see
FeaturePointFpExporter based on the format given as parameter * FeaturePointFpExporter based on the format given as parameter
* *
* @param featurePointList * @param featurePointList
* @param objectName * @param objectName
* @param format * @param format
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws IOException * @throws IOException
*/ */
public void exportFeaturePoints(List<FeaturePoint> featurePointList, String objectName, String format) throws FileNotFoundException, IOException { public void exportFeaturePoints(List<FeaturePoint> featurePointList, String objectName, String format) throws FileNotFoundException, IOException {
switch (format) { switch (format) {
case FeaturePointFileFormatTypes.FORMAT_TYPE_CSV: case FeaturePointFileFormatTypes.FORMAT_TYPE_CSV:
FeaturePointCsvExporter csvExporter = new FeaturePointCsvExporter(); FeaturePointCsvExporter.exportFeaturePointsToCSV(featurePointList, objectName);
csvExporter.exportFeaturePointsToCSV(featurePointList, objectName);
break; break;
case FeaturePointFileFormatTypes.FORMAT_TYPE_FP: case FeaturePointFileFormatTypes.FORMAT_TYPE_FP:
FeaturePointFpExporter fpExporter = new FeaturePointFpExporter(); FeaturePointFpExporter.exportFeaturePointsToFP(featurePointList, objectName);
fpExporter.exportFeaturePointsToFP(featurePointList, objectName);
break; break;
default: default:
break; break;
} }
} }
} }
...@@ -17,6 +17,14 @@ import java.util.logging.Logger; ...@@ -17,6 +17,14 @@ import java.util.logging.Logger;
*/ */
public class FeaturePointFpExporter { public class FeaturePointFpExporter {
/**
* Exports feature points to file format fp at default location
*
* @param featurePointList
* @param objectName
* @throws FileNotFoundException
* @throws IOException
*/
public static void exportFeaturePointsToFP(List<FeaturePoint> featurePointList, String objectName) throws FileNotFoundException, IOException { public static void exportFeaturePointsToFP(List<FeaturePoint> featurePointList, String objectName) throws FileNotFoundException, IOException {
File csvOutputFile = new File(String.format("%s_landmarks.fp", objectName)); File csvOutputFile = new File(String.format("%s_landmarks.fp", objectName));
// CSV is a normal text file, need a writer // CSV is a normal text file, need a writer
......
...@@ -11,7 +11,6 @@ import java.io.InputStreamReader; ...@@ -11,7 +11,6 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
/** /**
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cz.fidentis.analyst.feature.services; package cz.fidentis.analyst.feature.services;
import cz.fidentis.analyst.feature.FeaturePoint; import cz.fidentis.analyst.feature.FeaturePoint;
......
...@@ -2,8 +2,10 @@ package cz.fidentis.analyst.feature.services; ...@@ -2,8 +2,10 @@ package cz.fidentis.analyst.feature.services;
import cz.fidentis.analyst.feature.FeaturePointType; import cz.fidentis.analyst.feature.FeaturePointType;
import cz.fidentis.analyst.feature.utils.FileResourcesUtils; import cz.fidentis.analyst.feature.utils.FileResourcesUtils;
import java.io.BufferedReader;
import java.io.*; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
...@@ -51,6 +53,7 @@ public class FeaturePointTypesService { ...@@ -51,6 +53,7 @@ public class FeaturePointTypesService {
/** /**
* Creates map of feature point types * Creates map of feature point types
* @param featurePointTypes
* @return Optional map of feature point types mapped by code * @return Optional map of feature point types mapped by code
*/ */
public Map<String, FeaturePointType> getFeaturepointTypesByCode(Map<Integer, FeaturePointType> featurePointTypes) { public Map<String, FeaturePointType> getFeaturepointTypesByCode(Map<Integer, FeaturePointType> featurePointTypes) {
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cz.fidentis.analyst.feature.utils; package cz.fidentis.analyst.feature.utils;
/** /**
* Currently are available csv and fp formats. Rest can be added later.
* *
* @author Jakub Kolman * @author Jakub Kolman
*/ */
public class FeaturePointFileFormatTypes { public class FeaturePointFileFormatTypes {
public static final String FORMAT_TYPE_OBJ = "OBJ"; public static final String FORMAT_TYPE_OBJ = "OBJ";
public static final String FORMAT_TYPE_STL = "STL"; public static final String FORMAT_TYPE_STL = "STL";
public static final String FORMAT_TYPE_PLY = "PLY"; public static final String FORMAT_TYPE_PLY = "PLY";
...@@ -22,9 +18,12 @@ public class FeaturePointFileFormatTypes { ...@@ -22,9 +18,12 @@ public class FeaturePointFileFormatTypes {
public static final String FORMAT_TYPE_PNG = "PNG"; public static final String FORMAT_TYPE_PNG = "PNG";
public static final String FORMAT_TYPE_FID = "FID"; public static final String FORMAT_TYPE_FID = "FID";
public static final String FORMAT_TYPE_NONE = "NONE"; public static final String FORMAT_TYPE_NONE = "NONE";
/**
enum formatType { * enum containing all possible file formats of feature points
* @author Jakub Kolman
*/
enum FormatType {
OBJ, OBJ,
STL, STL,
PLY, PLY,
......
...@@ -7,10 +7,6 @@ import java.nio.charset.StandardCharsets; ...@@ -7,10 +7,6 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.List; import java.util.List;
/**
*
* @author Jakub Kolman
*/
public class FileResourcesUtils { public class FileResourcesUtils {
......
<!--Saved by software Fidentis Analyst--><facialPoints model="test_file">
<facialPoint type="1">
<x>-45.329800</x>
<y>37.146600</y>
<z>-40.541500</z>
<facialPoint type="2">
<x>44.303300</x>
<y>36.255000</y>
<z>-42.623000</z>
<facialPoint type="3">
<x>-18.513400</x>
<y>33.233600</y>
<z>-36.792100</z>
<facialPoint type="4">
<x>16.188000</x>
<y>32.637900</y>
<z>-37.219700</z>
<facialPoint type="5">
<x>-34.336300</x>
<y>41.530600</y>
<z>-33.656400</z>
<facialPoint type="6">
<x>33.828800</x>
<y>39.563400</y>
<z>-34.253100</z>
<facialPoint type="7">
<x>-34.413200</x>
<y>31.901700</y>
<z>-35.264200</z>
<facialPoint type="8">
<x>33.582700</x>
<y>30.789000</y>
<z>-36.755000</z>
<facialPoint type="9">
<x>0.129590</x>
<y>51.885300</y>
<z>-14.423500</z>
<facialPoint type="10">
<x>-0.035611</x>
<y>-13.082700</y>
<z>-16.998300</z>
<facialPoint type="11">
<x>-16.662300</x>
<y>-4.058840</y>
<z>-19.179800</z>
<facialPoint type="12">
<x>15.503800</x>
<y>-4.973230</y>
<z>-21.183600</z>
<facialPoint type="13">
<x>0.044336</x>
<y>39.423600</y>
<z>-19.185300</z>
<facialPoint type="14">
<x>-0.029147</x>
<y>0.258132</y>
<z>-0.140334</z>
<facialPoint type="15">
<x>-0.090110</x>
<y>-29.103900</y>
<z>-16.707600</z>
<facialPoint type="16">
<x>0.055705</x>
<y>-35.751100</y>
<z>-21.781900</z>
<facialPoint type="17">
<x>0.028509</x>
<y>-44.879100</y>
<z>-21.185200</z>
<facialPoint type="18">
<x>-28.153700</x>
<y>-35.880200</y>
<z>-32.267700</z>
<facialPoint type="19">
<x>24.470200</x>
<y>-34.656400</y>
<z>-34.317000</z>
<facialPoint type="20">
<x>-5.681640</x>
<y>-26.782700</y>
<z>-16.818400</z>
<facialPoint type="21">
<x>5.631710</x>
<y>-26.317300</y>
<z>-17.441300</z>
<facialPoint type="22">
<x>0.040378</x>
<y>-52.287900</y>
<z>-27.004100</z>
<facialPoint type="23">
<x>0.098163</x>
<y>-80.282700</y>
<z>-43.523300</z>
<facialPoint type="24">
<x>-57.080600</x>
<y>-39.890600</y>
<z>-118.469000</z>
<facialPoint type="25">
<x>50.448200</x>
<y>-38.958000</y>
<z>-118.260000</z>
<facialPoint type="26">
<x>-63.254000</x>
<y>40.895100</y>
<z>-53.951000</z>
<facialPoint type="27">
<x>59.710700</x>
<y>38.768200</y>
<z>-58.102400</z>
<facialPoint type="28">
<x>0.046802</x>
<y>-61.437600</y>
<z>-25.988100</z>
<facialPoint type="29">
<x>-78.370200</x>
<y>26.048000</y>
<z>-120.740000</z>
<facialPoint type="30">
<x>70.653400</x>
<y>28.112500</y>
<z>-122.519000</z>
<facialPoint type="31">
<x>-91.268900</x>
<y>55.537700</y>
<z>-137.688000</z>
<facialPoint type="32">
<x>87.563100</x>
<y>56.411700</y>
<z>-137.202000</z>
<facialPoint type="33">
<x>-75.636800</x>
<y>-4.455820</y>
<z>-120.828000</z>
<facialPoint type="34">
<x>70.477600</x>
<y>-1.817100</y>
<z>-120.704000</z>
<facialPoint type="35">
<x>-93.242100</x>
<y>34.181200</y>
<z>-155.155000</z>
<facialPoint type="36">
<x>90.044900</x>
<y>35.834900</y>
<z>-155.402000</z>
<facialPoint type="37">
<x>-82.709900</x>
<y>46.637500</y>
<z>-123.483000</z>
<facialPoint type="38">
<x>76.087000</x>
<y>46.789100</y>
<z>-123.211000</z>
<facialPoint type="39">
<x>-72.065100</x>
<y>-5.472070</y>
<z>-119.272000</z>
<facialPoint type="40">
<x>64.199200</x>
<y>-3.958970</y>
<z>-118.937000</z>
<facialPoint type="41">
<x>-83.352100</x>
<y>40.131400</y>
<z>-121.805000</z>
<facialPoint type="42">
<x>75.374700</x>
<y>40.026300</y>
<z>-121.781000</z>
</facialPoints>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment