Skip to content
Snippets Groups Projects
Commit b1bf6732 authored by Patrick Imbo's avatar Patrick Imbo
Browse files

No commit message

No commit message
parent 70fb31d3
No related branches found
No related tags found
No related merge requests found
......@@ -417,7 +417,6 @@ bool CAIImageIO::CanWriteFile( const char * filename )
NbColonnes,
NbLignes,
"LABEL");
if (lCai == NULL)
{
formatFound = false;
......@@ -455,7 +454,7 @@ void CAIImageIO::Read(void* buffer)
unsigned long lTailleBuffer = (unsigned long)(m_NbOctetPixel)*lNbPixels;
unsigned char* value = new unsigned char[lTailleBuffer];
otbMsgDebugMacro( << "CAIImageIO::Read() IORegion Start["<<this->GetIORegion().GetIndex()[0]<<","<<this->GetIORegion().GetIndex()[1]<<"] Size ["<<this->GetIORegion().GetSize()[0]<<","<<this->GetIORegion().GetSize()[1]<<"] on Image size ["<<m_Dimensions[0]<<","<<m_Dimensions[1]<<"]");
otbMsgDevMacro( << "CAIImageIO::Read() IORegion Start["<<this->GetIORegion().GetIndex()[0]<<","<<this->GetIORegion().GetIndex()[1]<<"] Size ["<<this->GetIORegion().GetSize()[0]<<","<<this->GetIORegion().GetSize()[1]<<"] on Image size ["<<m_Dimensions[0]<<","<<m_Dimensions[1]<<"]");
// Mise a jour du step
step = step * (unsigned long)(m_NbOctetPixel);
......@@ -574,9 +573,10 @@ void CAIImageIO::ReadImageInformation()
}
otbMsgDebugMacro( << "Driver: CAI - "<<CaiFormat);
otbMsgDebugMacro(<< " Use files : "<< m_FileName.c_str()<<" ("<<CaiFileName.c_str()<<").");
otbMsgDebugMacro( <<" Size : "<<m_Dimensions[0]<<","<<m_Dimensions[1]);
otbMsgDebugMacro( <<" ComponentType : "<<this->GetComponentType() );
otbMsgDebugMacro(<< " Use files : "<< m_FileName.c_str()<<" ("<<CaiFileName.c_str()<<").");
otbMsgDebugMacro( <<" Size : "<<m_Dimensions[0]<<","<<m_Dimensions[1]);
otbMsgDebugMacro( <<" ComponentType : "<<this->GetComponentType() );
otbMsgDebugMacro( <<" SetNumberOfComponents : "<<this->GetNumberOfComponents() );
//Stock le pointer CAI
......@@ -585,6 +585,17 @@ otbMsgDebugMacro( <<" ComponentType : "<<this->GetComponentType() );
void CAIImageIO::WriteImageInformation(void)
{
}
void CAIImageIO::OpenCAIFileForWriting()
{
CAI_IMAGE * lCai = NULL;
//Recupere pointeur sur structure CAI_IMAGE
lCai = (CAI_IMAGE *)m_ptrCai;
if(lCai == NULL)
{
int NbCanaux; /* Nombre de canaux de l'image */
int NbLignes; /* Nombre de lignes de l'image */
int NbColonnes; /* Nombre de colonnes de l'image */
......@@ -635,8 +646,9 @@ void CAIImageIO::WriteImageInformation(void)
NbLignes = m_Dimensions[1];
NbCanaux = this->GetNumberOfComponents();
NbOctetPixel = m_NbOctetPixel;
CAI_IMAGE * lCai = NULL;
otbMsgDebugMacro( << "CAIImageIO::WriteImageInformation() : Dimensions de l'image cree : "<<m_Dimensions[0]<<","<<m_Dimensions[1]);
otbMsgDevMacro( << "CAIImageIO::OpenCAIFileForWriting() : Dimensions de l'image cree : "<<m_Dimensions[0]<<","<<m_Dimensions[1]);
otbMsgDevMacro( << "CAIImageIO::OpenCAIFileForWriting() : NbCanaux : "<<NbCanaux);
lCai = cai_ouvre_creation_image( (char *)CaiFileName.c_str(),
(char *)CaiFormat.c_str(), // Detection automatique
......@@ -645,20 +657,22 @@ otbMsgDebugMacro( << "CAIImageIO::WriteImageInformation() : Dimensions de l'imag
NbColonnes,
NbLignes,
"CAI Image generate by OTB");
if (lCai == NULL)
{
itkExceptionMacro(<< "Impossible d'ecrire les informations sur l'image (cai_ouvre_creation_image) " << m_FileName.c_str() <<" ("<<CaiFileName.c_str()<<";"<<CaiFormat.c_str()<<") : ("<<CAI_ERREUR<<").");
}
//Stock le pointer CAI
m_ptrCai = (char*)lCai;
}
}
/** The write function is not implemented */
void CAIImageIO::Write( const void* buffer)
{
// Cration de l'image avant
// this->WriteImageInformation();
// checking if the Data file is open
this->OpenCAIFileForWriting();
const unsigned char * p = static_cast<const unsigned char *>(buffer);
unsigned long l=0;
......@@ -678,7 +692,7 @@ void CAIImageIO::Write( const void* buffer)
lPremiereLigne = 1;
}
otbMsgDebugMacro( << "CAIImageIO::Write() IORegion Start["<<this->GetIORegion().GetIndex()[0]<<","<<this->GetIORegion().GetIndex()[1]<<"] Size ["<<this->GetIORegion().GetSize()[0]<<","<<this->GetIORegion().GetSize()[1]<<"] on Image size ["<<m_Dimensions[0]<<","<<m_Dimensions[1]<<"]");
otbMsgDevMacro( << "CAIImageIO::Write() IORegion Start["<<this->GetIORegion().GetIndex()[0]<<","<<this->GetIORegion().GetIndex()[1]<<"] Size ["<<this->GetIORegion().GetSize()[0]<<","<<this->GetIORegion().GetSize()[1]<<"] on Image size ["<<m_Dimensions[0]<<","<<m_Dimensions[1]<<"]");
unsigned long lNbPixels = (unsigned long)(lNbColonnes*lNbLignes);
unsigned long lTailleBuffer = (unsigned long)(m_NbOctetPixel)*lNbPixels;
......@@ -695,6 +709,10 @@ otbMsgDebugMacro( << "CAIImageIO::Write() IORegion Start["<<this->GetIORegion().
for ( int nbComponents = 0 ; nbComponents < this->GetNumberOfComponents() ; nbComponents++)
{
// Recopie dans le buffer
otbMsgDevMacro( << "CAIImageIO::Write() nbComponents "<<nbComponents << " / "<< this->GetNumberOfComponents());
otbMsgDevMacro( << "CAIImageIO::Write() lPremiereLigne "<<lPremiereLigne );
otbMsgDevMacro( << "CAIImageIO::Write() lNbLignes "<<lNbLignes );
otbMsgDevMacro( << "CAIImageIO::Write() lNbColonnes "<<lNbColonnes );
unsigned long cpt(0);
cpt = (unsigned long )(nbComponents)* (unsigned long)(m_NbOctetPixel);
for ( unsigned long i=0 ; i < lTailleBuffer ; i = i+m_NbOctetPixel )
......
......@@ -100,6 +100,8 @@ private:
bool DetermineFormatSpot (char typspot, const char * str_repertoire ,
char * str_debut );
void OpenCAIFileForWriting();
/** Pointer sur la structure CAI */
char * m_ptrCai;
/** Nombre d'octets par pixel */
......
......@@ -152,7 +152,7 @@ ADD_TEST(coTvMultiChannelROI_3c_BSQ ${COMMON_TESTS}
--compare-binary ${BASELINE}/coMultiChannelExtractROI_RGB2NG_PNG_poupees_303_2_134_330_channels_345.c1
${TEMP}/coMultiChannelExtractROI_RGB2NG_PNG_poupees_303_2_134_330_channels_345.c1
otbMultiChannelExtractROI
${TEMP}/coMultiChannelExtractROI_RGB2NG_PNG_poupees_303_2_134_330_channels_1232.hd
${TEMP}/coMultiChannelExtractROI_RGB2NG_PNG_poupees_303_2_134_330_channels_12321.hd
${TEMP}/coMultiChannelExtractROI_RGB2NG_PNG_poupees_303_2_134_330_channels_345.hd
-startX 0 -startY 0 -sizeX 134 -sizeY 330 -channels 3 4 5 )
......
......@@ -104,6 +104,7 @@ int generic_otbMultiChannelExtractROI( int argc, char ** argv, const char * inpu
reader->Update(); //Necessaire pour connaitre le nombre de canaux dans l'image
writer->SetFileName( outputFilename );
extractROIFilter->SetInput( reader->GetOutput() );
extractROIFilter->Update();
writer->SetInput( extractROIFilter->GetOutput() );
writer->Update();
......
......@@ -394,9 +394,9 @@ ADD_TEST(ioTvMultiChannelROI_QuickbirdPAN2PNG ${COMMON_TESTS}
# ${TEMP}/ioExtractROI_QuickbirdPAN2PNG_100_100_77_300.png
otbMultiChannelExtractROI
${IMAGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF
${TEMP}/ioExtractROI_QuickbirdPAN2PNG_100_100_77_300.png
${TEMP}/ioExtractROI_QuickbirdXS2PNG_100_100_77_300.png
-startX 100 -startY 100 -sizeX 77 -sizeY 300
-channels 1)
-channels 1 2 3)
# --- Quickbird XS ---
ADD_TEST(ioTvMultiChannelROI_QuickbirdXS2PNG ${COMMON_TESTS}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment