Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Array::Array2dScalarUInt8* Impala::Core::ImageSet::ImageSet::GetImageData ( int  fileId  )  [inline]

experimental, necessary for ImageSet::FixSizes

Definition at line 188 of file ImageSet.h.

References GetArchive(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Database::RawDataSet::GetDirIdOfFile(), Impala::Core::Database::RawDataSet::GetFilePathImageData(), Impala::Core::Database::RawDataSet::GetFirstFileId(), Impala::Core::Array::ImageArchive::GetImageData(), GetImageLocator(), Impala::Util::Database::GetIOBuffer(), ILOG_ERROR, mUseArchive, mUseSplitArchive, Impala::Util::IOBuffer::Read(), and Impala::Util::IOBuffer::Size().

00189     {
00190         UInt8* dataPtr=0;
00191         size_t dataSize=0;
00192         if (mUseArchive)
00193         {
00194             int dirId;
00195             int imIdx;
00196             if (mUseSplitArchive)
00197             {
00198                 dirId = GetDirIdOfFile(fileId);
00199                 imIdx = fileId - GetFirstFileId(dirId);
00200             }
00201             else
00202             {
00203                 dirId = 0;
00204                 imIdx = fileId;
00205             }
00206 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00207             Array::ImageArchiveFile* ar = GetArchive(dirId);
00208 #else // REPOSITORY_USED
00209             Array::ImageArchive* ar = GetArchive(dirId);
00210 #endif // REPOSITORY_USED
00211             if (ar)
00212                 dataPtr = ar->GetImageData(imIdx, dataSize);
00213         }
00214         else
00215         {
00216 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00217             String path = GetFilePathImageData(fileId, false, false);
00218             Util::Database* db = GetDatabase();
00219             Util::IOBuffer* ioBuf = db->GetIOBuffer(path, true, false, "", 0, true);
00220             if (!ioBuf)
00221             {
00222                 ILOG_ERROR("Unable to open file " << path);
00223                 return 0;
00224             }
00225 #else // REPOSITORY_USED
00226             Persistency::ImageLocator loc = GetImageLocator(fileId);
00227             Util::IOBuffer* ioBuf =
00228                 Persistency::ImageRepositoryInFile().GetReadBuffer(loc);
00229 #endif // REPOSITORY_USED
00230             dataSize = ioBuf->Size();
00231             dataPtr = new UInt8[dataSize];
00232             Int64 nrRead = ioBuf->Read(dataPtr, dataSize);
00233             delete ioBuf;
00234             if(nrRead != dataSize)
00235                 ILOG_ERROR("not all data read from ioBuf");
00236         }
00237         Array::Array2dScalarUInt8* im =
00238             Array::MakeFromData<Array::Array2dScalarUInt8>(dataPtr, dataSize, 1);
00239         delete dataPtr;
00240         return im;
00241     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:14:28 2010 for ImpalaSrc by  doxygen 1.5.1