Skip to content

Commit

Permalink
Updating documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiikurisu committed Apr 26, 2017
1 parent e4b4113 commit 5fe7063
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ It will generate an `edf.jar` file on the `target` folder. This Jarfile can be i

## Development ##

The current workings of JEDF are destined to a `v0.3`, which must save the EDF file to the CSV format, mimicking [the analogous Golang implementation of this package](https://github.com/ishiikurisu/edf). `v0.4` must be able to convert the EDF both to CSV and back to the EDF format, so the programmer can make changes on the EDF file and save it back to later concerns.
The current workings of JEDF are destined to a `v0.4`, which must enable the programmer to convert the EDF both to CSV and back to the EDF format, so they can make changes on the EDF file and save it back to later concerns.

Future ideas include the implementation of a on-time access to the data: the `EDF` class would know where to find certain parts of the file and load them whenever needed instead of storing the whole file's contents on RAM memory.

Expand All @@ -36,67 +36,79 @@ Those are the currently available methods for this class.

### Methods ###

#### `public EDF(String filePath)` ####
#### `EDF(String filePath)` ####

This is the constructor. It requires a string that describes the path to the
This is the constructor. It requires a string that describes the path to the EDF file.

#### `public String getFile()` ####
#### `String getFile()` ####

- Gets the file path.
- Return: the file path;

#### `public HashMap getHeader()` ####
#### `HashMap getHeader()` ####

- Gets raw EDF header.

#### `public HashMap getRecords()` ####
#### `HashMap getRecords()` ####

- Gets raw EDF records

#### `public String[] getLabels()` ####
#### `String[] getLabels()` ####

- Get the labels contained in this EDF file.

#### `public int getSamplingRate()` ####
#### `int getSamplingRate()` ####

- Gets the sampling rate of the recording.


#### `public void toAscii(String filePath) throws IOException` ####
#### `void toAscii(String filePath) throws IOException` ####

- Formats the read records into the ASCII format and saves it into memory.
- Paramter `filePath`: the path to the file to be written.

#### `public void toSingleChannelAscii(String filePath, String channel) throws IOException` ####
#### `void toSingleChannelAscii(String filePath, String channel) throws IOException` ####

* Writes a determined record to a file.
* Parameter `filePath`: the path to the file to be written
* Parameter `channel`: the label of the record to be saved on memory


#### `public String[] getAnnotations() throws NoSuchFieldException` ####
#### `String[] getAnnotations() throws NoSuchFieldException` ####

* Gets a list of the annotations on the EDF file, lest there are annotations.
* Returns an array containing one annotation for each entry.

#### `public double getConvertionFactor(String label)` ####
#### `double getConvertionFactor(String label)` ####

* Gets the convertion factor related to the given label
* Paramter `label`: the channel's label whose convertion factor we want
* Parameter `label`: the channel's label whose convertion factor we want
* Returns the convertion factor.

#### `public double[] getSignal(String label)` ####
#### `double[] getSignal(String label)` ####

* Get a signal based on its label.
* Parameter `label`: the signal label.
* Returns the translated record.

#### `void toCsv(String filePath) throws IOException` ####

* Translates the loaded EDF file into a CSV table.
* Parameter `filePath`: the file name on which the data must be saved

## The `EDFUtil` class

Mostly holds some utility functions to help with EDF processing.

### Methods

#### `public static String[] separateString(String inlet, int numChops)`
#### `static String[] separateString(String inlet, int numChops)`

* Separates a string into equal length chops.

#### `static String joinStrings(String[] inlet, String sep)` ####

* Creates a new string uniting strings with a separator in the middle.
* Parameter `inlet`: the String array to be united.
* Parameter `sep`: the String that will appear in the middle of the other strings.
* Returns the united string.
9 changes: 4 additions & 5 deletions java/br/unb/biologiaanimal/edf/EDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

import java.util.HashMap;
import java.util.Set;
import java.text.MessageFormat;
import java.io.IOException;

/**
* The class to hold the EDF file information.
* @author Cristiano Silva Jr. cristianoalvesjr@gmail.com
* @version 0.2.0
* @version 0.3.0
*/
public class EDF
{
Expand Down Expand Up @@ -150,7 +149,7 @@ public void toAscii(String filePath)
* Writes a determined record to a file.
* @param filePath the path to the file to be written
* @param channel the label of the record to be saved on memory
* @throws java.util.IOException
* @throws java.io.IOException
*/
public void toSingleChannelAscii(String filePath, String channel)
throws IOException
Expand All @@ -166,9 +165,10 @@ public void toSingleChannelAscii(String filePath, String channel)
writer.close();
}

// TODO Translate data to CSV table
/**
* Translated the loaded EDF file into a CSV table
* @param filePath the file name on which the data must be saved
* @throws java.io.IOException
*/
public void toCsv(String filePath)
throws IOException
Expand All @@ -184,7 +184,6 @@ public void toCsv(String filePath)
(String) header.get("starttime") + ";");
writer.write("sampling:" + Integer.toString(getSamplingRate()) + ";");
writer.write("subject:" + (String) header.get("patient") + ";");
// TODO Get labels
writer.write("labels:" + EDFUtil.joinStrings(getLabels(), "\t") + ";");
writer.write("chan:" + (String) header.get("numbersignals") + ";");
// TODO Get units
Expand Down
2 changes: 1 addition & 1 deletion manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Specification-Title: "EDF+ format implementation"
Specification-Version: "1.1"
Specification-Vendor: "European Data Format"
Implementation-Title: "br.unb.biologiaanimal.edf"
Implementation-Version: "0.3"
Implementation-Version: "0.3.0"
Implementation-Vendor: "Laboratory of Neuroscience and Behavior"
Binary file modified target/edf.jar
Binary file not shown.

0 comments on commit 5fe7063

Please sign in to comment.