-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
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,61 @@ | ||
#include "F3DColorMapTools.h" | ||
|
||
#include "image.h" | ||
|
||
#include <filesystem> | ||
|
||
// todo: remove | ||
#include <iostream> | ||
|
||
namespace fs = std::filesystem; | ||
|
||
namespace F3DColorMapTools | ||
{ | ||
std::string Find(const std::string& str) | ||
{ | ||
if (fs::exists(str)) | ||
{ | ||
// already full path; | ||
return str; | ||
} | ||
|
||
// todo: stem, find file in standard paths | ||
|
||
return {}; | ||
} | ||
|
||
std::vector<double> Read(const std::string& path) | ||
{ | ||
try | ||
{ | ||
f3d::image img(path); | ||
|
||
if (img.getChannelCount() < 3) | ||
{ | ||
// TODO: warning | ||
return {}; | ||
} | ||
|
||
int w = img.getWidth(); | ||
|
||
std::vector<double> cm; | ||
cm.resize(4 * w); | ||
|
||
for (int i = 0; i < w; i++) | ||
{ | ||
cm[4 * i] = static_cast<double>(i) / w; | ||
for (int j = 0; j < 3; j++) | ||
{ | ||
cm[4 * i + j + 1] = img(i, 0, j); | ||
} | ||
} | ||
|
||
return cm; | ||
} | ||
catch (const f3d::image::read_exception&) | ||
{ | ||
// TODO | ||
return {}; | ||
} | ||
} | ||
} |
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,19 @@ | ||
/** | ||
* @class F3DColorMapReader | ||
* @brief A class used to convert images to libf3d colormap option | ||
* | ||
*/ | ||
|
||
#ifndef F3DColorMapReader_h | ||
#define F3DColorMapReader_h | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace F3DColorMapTools | ||
{ | ||
std::string Find(const std::string& str); | ||
std::vector<double> Read(const std::string& path); | ||
} | ||
|
||
#endif |
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.