Add ability to read MIE4NITF files#59
Conversation
mwoehlke-kitware
left a comment
There was a problem hiding this comment.
So far I have only done a fairly superficial review... the style inconsistencies are rather distracting from the actual code. When adding code to any project, please try to follow the prevailing style of the surrounding code.
| } | ||
| } | ||
|
|
||
| bool add_mie4nitf_subdatasets (const QString &path, QStringList &list) { |
There was a problem hiding this comment.
Uh... your code style is rather all over the place. Please try to conform to the existing style. (n.b. T& x, not T &x, and Allman braces. Fortunately this is not one of the files still using historic VTK-style braces. Your indenting is also inconsistent.)
|
|
||
| if (!dataset) | ||
| { | ||
| qWarning().nospace()<< "GDAL could not load file." << |
There was a problem hiding this comment.
Why is nospace() needed here? Also, please put << at the start of the next line, not the end of a line, and align with the prior <<.
| if (!dataset) | ||
| { | ||
| qWarning().nospace()<< "GDAL could not load file." << | ||
| path.toStdString().c_str(); |
There was a problem hiding this comment.
Besides that this is the locale-incorrect way to convert to std::string (that would be stdString) or char* (that would be qPrintable), why are you doing this at all? Just pass the QString...
|
|
||
| const QRegExp rgx = QRegExp("SUBDATASET_\\d+_NAME"); | ||
|
|
||
| if(key.contains(rgx)) |
| while (!file.atEnd()) | ||
| { | ||
| const auto line = file.readLine(); | ||
| QString line = file.readLine().trimmed(); |
| // use glob to get more than one frames, we use the prefix `MIE4NITF:` | ||
| // to indicate that this file contains more than one frame in NITF | ||
| // format. | ||
| const QString mie4nitf_prefix = "MIE4NITF:"; |
| // For ex., in MIE4NITF, frame # 3 inside `/A.ntf` (0-indexed) is | ||
| // stored in: | ||
| // `NITF_IM:2:/A.ntf`. | ||
| QString path_to_check; |
There was a problem hiding this comment.
Please use camelCase for variable names.
| this->ReleaseData(); | ||
|
|
||
| this->GDALData = (GDALDataset*) GDALOpen(fileName.c_str(), GA_ReadOnly); | ||
| std::cout << "Using GDAL reader to open file: " << fileName << std::endl; |
There was a problem hiding this comment.
I wonder how useful this is?
|
@mwoehlke-kitware, we have transferred the files to the following gitlab, I have addressed the comments there: |
To read an MIE4NITF file, we do the following:
test_project.prj, we specify the absolute path to an image list file.MIE4NITF:.For example:
Note that
/home/chaturvedi/images/may contain more files than what are used.