Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
3c2b0b49
Commit
3c2b0b49
authored
Aug 04, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added processing of GPS tags for both JP4 and Tiff, changed Tiff tags
processing to match JP4 ones
parent
e24b8d2f
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
182 additions
and
46 deletions
+182
-46
ElphelJp4Reader.java
src/main/java/com/elphel/imagej/readers/ElphelJp4Reader.java
+15
-4
ElphelTiffReader.java
...main/java/com/elphel/imagej/readers/ElphelTiffReader.java
+167
-42
No files found.
src/main/java/com/elphel/imagej/readers/ElphelJp4Reader.java
View file @
3c2b0b49
...
@@ -45,6 +45,7 @@ import com.drew.metadata.Metadata;
...
@@ -45,6 +45,7 @@ import com.drew.metadata.Metadata;
import
com.drew.metadata.Tag
;
import
com.drew.metadata.Tag
;
import
com.drew.metadata.exif.ExifIFD0Directory
;
import
com.drew.metadata.exif.ExifIFD0Directory
;
import
com.drew.metadata.exif.ExifSubIFDDirectory
;
import
com.drew.metadata.exif.ExifSubIFDDirectory
;
import
com.drew.metadata.exif.GpsDirectory
;
import
loci.common.ByteArrayHandle
;
import
loci.common.ByteArrayHandle
;
import
loci.common.Location
;
import
loci.common.Location
;
...
@@ -69,7 +70,7 @@ public class ElphelJp4Reader extends ImageIOReader{
...
@@ -69,7 +70,7 @@ public class ElphelJp4Reader extends ImageIOReader{
public
static
final
String
ELPHEL_PROPERTY_PREFIX
=
"ELPHEL_"
;
public
static
final
String
ELPHEL_PROPERTY_PREFIX
=
"ELPHEL_"
;
public
static
final
String
CONTENT_FILENAME
=
"CONTENT_FILENAME"
;
public
static
final
String
CONTENT_FILENAME
=
"CONTENT_FILENAME"
;
public
static
final
boolean
REORDER
=
true
;
// false;
public
static
final
boolean
REORDER
=
true
;
// false;
public
static
final
String
[][]
REPLACEMENT_TAGS
=
// to/from!
public
static
final
String
[][]
REPLACEMENT_TAGS
=
// to/from!
TODO: check/add for GPS?
{{
"SUBSEC_TIME_ORIGINAL"
,
"Sub-Sec Time Original"
},
{{
"SUBSEC_TIME_ORIGINAL"
,
"Sub-Sec Time Original"
},
{
"DATE_TIME_ORIGINAL"
,
"Date/Time Original"
},
{
"DATE_TIME_ORIGINAL"
,
"Date/Time Original"
},
{
"Instrument_Make"
,
"Make"
},
{
"Instrument_Make"
,
"Make"
},
...
@@ -92,6 +93,7 @@ public class ElphelJp4Reader extends ImageIOReader{
...
@@ -92,6 +93,7 @@ public class ElphelJp4Reader extends ImageIOReader{
private
byte
[]
image_bytes
=
null
;
private
byte
[]
image_bytes
=
null
;
private
ExifSubIFDDirectory
directory
;
private
ExifSubIFDDirectory
directory
;
private
ExifIFD0Directory
directory_ifd0
;
private
ExifIFD0Directory
directory_ifd0
;
private
GpsDirectory
directory_gps
;
private
HashMap
<
String
,
String
>
REPLACEMENT_TAG_MAP
=
null
;
// per instance
private
HashMap
<
String
,
String
>
REPLACEMENT_TAG_MAP
=
null
;
// per instance
...
@@ -238,6 +240,7 @@ public class ElphelJp4Reader extends ImageIOReader{
...
@@ -238,6 +240,7 @@ public class ElphelJp4Reader extends ImageIOReader{
Metadata
metadata
=
ImageMetadataReader
.
readMetadata
(
jpegFile
);
Metadata
metadata
=
ImageMetadataReader
.
readMetadata
(
jpegFile
);
directory
=
metadata
.
getFirstDirectoryOfType
(
ExifSubIFDDirectory
.
class
);
directory
=
metadata
.
getFirstDirectoryOfType
(
ExifSubIFDDirectory
.
class
);
directory_ifd0
=
metadata
.
getFirstDirectoryOfType
(
ExifIFD0Directory
.
class
);
directory_ifd0
=
metadata
.
getFirstDirectoryOfType
(
ExifIFD0Directory
.
class
);
directory_gps
=
metadata
.
getFirstDirectoryOfType
(
GpsDirectory
.
class
);
}
}
catch
(
Throwable
e
)
{
catch
(
Throwable
e
)
{
throw
new
ServiceException
(
"Could not read EXIF data"
,
e
);
throw
new
ServiceException
(
"Could not read EXIF data"
,
e
);
...
@@ -271,6 +274,16 @@ public class ElphelJp4Reader extends ImageIOReader{
...
@@ -271,6 +274,16 @@ public class ElphelJp4Reader extends ImageIOReader{
}
}
}
}
}
}
if
(
directory_gps
!=
null
)
{
for
(
Tag
tag
:
directory_gps
.
getTags
())
{
String
tag_name
=
tag
.
getTagName
();
if
(
REPLACEMENT_TAG_MAP
.
containsKey
(
tag_name
))
{
tags
.
put
(
REPLACEMENT_TAG_MAP
.
get
(
tag_name
),
tag
.
getDescription
());
}
else
{
tags
.
put
(
tag
.
getTagName
(),
tag
.
getDescription
());
}
}
}
// remove "sec" from exposure
// remove "sec" from exposure
if
(
tags
.
containsKey
(
EXPOSURE_TIME
)){
if
(
tags
.
containsKey
(
EXPOSURE_TIME
)){
tags
.
put
(
EXPOSURE_TIME
,
tags
.
get
(
EXPOSURE_TIME
).
split
(
" "
)[
0
]);
tags
.
put
(
EXPOSURE_TIME
,
tags
.
get
(
EXPOSURE_TIME
).
split
(
" "
)[
0
]);
...
@@ -321,8 +334,6 @@ public class ElphelJp4Reader extends ImageIOReader{
...
@@ -321,8 +334,6 @@ public class ElphelJp4Reader extends ImageIOReader{
// LOGGER.debug("initStandardMetadata() - got "+tags.length+" tags");
// LOGGER.debug("initStandardMetadata() - got "+tags.length+" tags");
}
}
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
CONTENT_FILENAME
,
content_fileName
);
addGlobalMeta
(
ELPHEL_PROPERTY_PREFIX
+
CONTENT_FILENAME
,
content_fileName
);
}
}
...
...
src/main/java/com/elphel/imagej/readers/ElphelTiffReader.java
View file @
3c2b0b49
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment