Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
51268f48
Commit
51268f48
authored
16 years ago
by
Grégoire Mercier
Browse files
Options
Downloads
Patches
Plain Diff
Fix problem of path in the ENVI META FILE format
parent
14a2ca13
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/IO/otbImageSeriesFileReader.txx
+69
-26
69 additions, 26 deletions
Code/IO/otbImageSeriesFileReader.txx
with
69 additions
and
26 deletions
Code/IO/otbImageSeriesFileReader.txx
+
69
−
26
View file @
51268f48
...
...
@@ -52,10 +52,10 @@ ImageSeriesFileReader< TImage >
if ( this->GetNumberOfOutputs() < 1 )
return 0;
if ( idx >= m_
ListReader
->Size() )
if ( idx >= m_
OutputList
->Size() )
return 0;
return static_cast<OutputImageType*>( this->m_
ListReader
->GetNthElement( idx )
->GetOutput()
);
return static_cast<OutputImageType*>( this->m_
OutputList
->GetNthElement( idx ) );
}
template < class TImage >
...
...
@@ -139,6 +139,19 @@ ImageSeriesFileReader< TImage >
ReaderPointerType aReader = ReaderType::New();
aReader->SetFileName( aLine );
try {
aReader->Update();
}
catch ( itk::ImageFileReaderException & e )
{
std::vector< std::string > fullPath;
fullPath.push_back( itksys::SystemTools::GetFilenamePath( m_FileName ) );
fullPath.push_back( "/" );
fullPath.push_back( aLine );
aReader->SetFileName( itksys::SystemTools::JoinPath( fullPath ) );
aReader->Update();
}
/*
* Reading the Band number
*/
...
...
@@ -159,29 +172,59 @@ ImageSeriesFileReader< TImage >
}
int numBand = 0;
inputFile >> numBand;
//std::cerr << "-> '" << numBand << "'\n";
#if 0
// FIXME
// At this step, we do not know how to handle band selection from ENVI META FILE...
//
if( strcmp( this->GetOutput()->GetNameOfClass(), "VectorImage" ) == 0 )
std::vector<int> bands;
int aBand,oldBand=-1;
char sep;
while ( 1 )
{
inputFile >> aBand;
if ( oldBand != -1 )
{
for ( int i = oldBand; i <= aBand; i++ )
bands.push_back( i );
oldBand = -1;
}
else
bands.push_back( aBand );
int posRef = inputFile.tellg();
inputFile >> sep;
if ( sep == '-' )
{
oldBand = aBand+1;
}
else if ( sep != ',' )
{
inputFile.seekg( posRef, std::ios_base::beg );
break;
}
}
#endif
if (
numBand != 1 &&
strcmp( this->GetOutput()->GetNameOfClass(), "Image" ) == 0 )
if ( strcmp( this->GetOutput()->GetNameOfClass(), "Image" ) == 0 )
{
inputFile.close();
itk::OStringStream msg;
msg << "Unable to handle multicomponent file from Image<> class\n";
msg << "\"ENVI META FILE\" FileName: " << m_FileName << "\n";
msg << "Image FileName : " << aReader->GetFileName() << "\n";
ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION);
throw e;
return;
if ( bands.size() != 1 )
{
inputFile.close();
itk::OStringStream msg;
msg << "Unable to handle multicomponent file from Image<> class\n";
msg << "\"ENVI META FILE\" FileName: " << m_FileName << "\n";
msg << "Image FileName : " << aReader->GetFileName() << "\n";
ImageSeriesFileReaderException e(__FILE__, __LINE__,msg.str().c_str(),ITK_LOCATION);
throw e;
return;
}
if ( bands[0] != 1 )
{
std::cerr << "Perform band selection on Image\n";
}
}
else if ( strcmp( this->GetOutput()->GetNameOfClass(), "VectorImage" ) == 0 )
{
if ( bands[ bands.size()-1 ] != bands.size() )
{
std::cerr << "Perform bands selection on VectorImage\n";
}
}
/*
...
...
@@ -214,7 +257,7 @@ ImageSeriesFileReader< TImage >
int beg_line,end_line,beg_col,end_col;
char sep1,sep2,sep3;
inputFile >> beg_col >> sep1 >>
beg_line
>> sep2 >>
end_col
>> sep3 >> end_line;
inputFile >> beg_col >> sep1 >>
end_col
>> sep2 >>
beg_line
>> sep3 >> end_line;
if ( !inputFile.good() )
{
...
...
@@ -229,19 +272,19 @@ ImageSeriesFileReader< TImage >
}
IndexType index;
index[0] = beg_
line
- 1;
index[1] = beg_
col
- 1;
index[0] = beg_
col
- 1;
index[1] = beg_
line
- 1;
SizeType size;
size[0] = end_
line
- beg_
line
;
size[1] = end_
col
- beg_
col
;
size[0] = end_
col
- beg_
col
;
size[1] = end_
line
- beg_
line
;
RegionType region;
region.SetSize( size );
region.SetIndex( index );
/*
* FIXME: it seems that t
e
h region selection is not working as it stands...
* FIXME: it seems that th
e
region selection is not working as it stands...
* May be necessary to use MultiChannelExtractROI...
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment