brahmakurre
November 12, 2007, 07:37:39
hi every body
my requirement is to get raw image buffer for multi-frames at a time into the disk....
i have used code like this
long gRows,gCols;
Grabber grabber;
grabber.setOverlayBitmapPathPosition( ePP_NONE );
tFrameHandlerSinkPtr pSink = FrameHandlerSink::create( eRGB32,500 );
pSink->setSnapMode( true );
grabber.setSinkType( pSink );
FrameTypeInfo info;
pSink->getOutputFrameType( info );
BYTE* pBuf[500];
for( int i = 0; i < 500; ++i )
{
pBuf[i] = new BYTE[info.buffersize];
}
tMemBufferCollectionPtr pCollection = MemBufferCollection::create( info, 500, pBuf );
if( pCollection == 0 || !pSink->setMemBufferCollection( pCollection ) )
{
std::cerr << "Could not set the new MemBufferCollection, because types do not match.";
return -1;
}
grabber.startLive( true );
pSink->snapImages( 500 );
gRows = grabber.getAcqSizeMaxY();
gCols = grabber.getAcqSizeMaxX();
FILE *fp;
for(i = 0; i < 500; ++i )
{
fp = fopen("C:\\snap.raw","a+");
fwrite((pSink->getMemBufferCollection()->getBuffer( i ))->getPtr(),1,gRows * gCols * 1,fp);
}
fclose(fp);
grabber.stopLive();
grabber.closeDev();
for( int j = 0; j < 500; ++j )
{
delete pBuf[j];
}
in this way iam writing raw buffer into the disk with some file name..... it is working
please advise me is this the correct way...
after that we have to convert that file as a dicom image and we have to use in our pacs
it would be very greatful if i some body advise me the correct way
my requirement is to get raw image buffer for multi-frames at a time into the disk....
i have used code like this
long gRows,gCols;
Grabber grabber;
grabber.setOverlayBitmapPathPosition( ePP_NONE );
tFrameHandlerSinkPtr pSink = FrameHandlerSink::create( eRGB32,500 );
pSink->setSnapMode( true );
grabber.setSinkType( pSink );
FrameTypeInfo info;
pSink->getOutputFrameType( info );
BYTE* pBuf[500];
for( int i = 0; i < 500; ++i )
{
pBuf[i] = new BYTE[info.buffersize];
}
tMemBufferCollectionPtr pCollection = MemBufferCollection::create( info, 500, pBuf );
if( pCollection == 0 || !pSink->setMemBufferCollection( pCollection ) )
{
std::cerr << "Could not set the new MemBufferCollection, because types do not match.";
return -1;
}
grabber.startLive( true );
pSink->snapImages( 500 );
gRows = grabber.getAcqSizeMaxY();
gCols = grabber.getAcqSizeMaxX();
FILE *fp;
for(i = 0; i < 500; ++i )
{
fp = fopen("C:\\snap.raw","a+");
fwrite((pSink->getMemBufferCollection()->getBuffer( i ))->getPtr(),1,gRows * gCols * 1,fp);
}
fclose(fp);
grabber.stopLive();
grabber.closeDev();
for( int j = 0; j < 500; ++j )
{
delete pBuf[j];
}
in this way iam writing raw buffer into the disk with some file name..... it is working
please advise me is this the correct way...
after that we have to convert that file as a dicom image and we have to use in our pacs
it would be very greatful if i some body advise me the correct way