-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Read EXR files from memory #1733
Open
gapry
wants to merge
19
commits into
f3d-app:master
Choose a base branch
from
gapry:pr-1448
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+148
−10
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
911aeb4
resolve rebase conflicts manually
gapry fbc487d
resolve rebase conflicts manually
nabielkandiel 69f3a60
clean up file
nabielkandiel 68dcfc4
fixed CI issues
nabielkandiel ec7f2be
moved class to cpp file and added unit tests
nabielkandiel e508fb0
add comment with image file source
nabielkandiel bd32458
remove unused function
nabielkandiel a851a44
resolve rebase conflicts manually
nabielkandiel 03a0ae4
default initialize value
nabielkandiel f22a8f1
add license for testing data
nabielkandiel 64aa7a1
change return for test
nabielkandiel 944887b
update formatting
nabielkandiel 8875363
update tests
nabielkandiel 33eecbf
update tests
nabielkandiel 07f604f
Cleanup
nabielkandiel ad3aafd
add the links for small.usdz dataset license
gapry 979a052
remove the duplicate license claim
gapry 36145e1
remove the unnecessary exception throwing
gapry 4d6779a
use c++ copy_n to replace the c library memcpy
gapry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <vtkImageData.h> | ||
#include <vtkNew.h> | ||
|
||
#include "vtkF3DEXRReader.h" | ||
|
||
#include <fstream> | ||
#include <iostream> | ||
#include <vector> | ||
|
||
bool readFileToVector(const std::string& filename, std::vector<char>& buffer) | ||
{ | ||
std::ifstream file(filename, std::ios::binary | std::ios::ate); | ||
if (!file) | ||
{ | ||
return false; | ||
} | ||
|
||
std::streamsize size = file.tellg(); | ||
file.seekg(0, std::ios::beg); | ||
buffer.resize(size); | ||
return file.read(buffer.data(), size) ? true : false; | ||
} | ||
|
||
int TestF3DEXRMemReader(int argc, char* argv[]) | ||
{ | ||
vtkNew<vtkF3DEXRReader> reader; | ||
|
||
std::string actual_filename = std::string(argv[1]) + "data/Rec709.exr"; | ||
std::string filename = "readFromMem.exr"; | ||
reader->SetFileName(filename.c_str()); | ||
std::vector<char> buff; | ||
readFileToVector(actual_filename, buff); | ||
reader->SetMemoryBuffer(buff.data()); | ||
reader->SetMemoryBufferLength(buff.size()); | ||
reader->Update(); | ||
|
||
reader->Print(cout); | ||
|
||
vtkImageData* img = reader->GetOutput(); | ||
|
||
int* dims = img->GetDimensions(); | ||
|
||
if (dims[0] != 610 && dims[1] != 406) | ||
{ | ||
std::cerr << "Incorrect EXR image size." << dims[0] << ":" << dims[1] << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the filename should be set here.