Home › Forums › TWAIN Classic › Capability Negotiation – TW_IMAGELAYOUT, TW_FRAMES
- This topic has 0 replies, 1 voice, and was last updated 14 years, 7 months ago by karlhoover.
- AuthorPosts
Hi!
I’m putting Twain 2.0 support into our microscope software. It is working fine and I want to release the software soon. HOWEVER, I’ve got one problem which has so far been insurmountable. If I use the camera’s proprietary GUI and pick a capture size smaller than the full sensor, I have not been able to clear this selection back to the full sensor using the Twain API. I can GET, SET, RESET the image layout. Indeed the frame inside the layout is correctly setup for the entire sensor. For at least one of the cameras, the ICAP_(X,Y)RESOLUTION also shows be the correct full size of the sensor. I’m expliciting setting the layout with MSG_SET so according to chapter 4 of the specification I should be able to subsequently do MSG_GETCURRENT for the TW_FRAME. But any attempt to GETCURRENT, GET, SET, RESET, for the TW_FRAME give me an 11 (TWCC_SEQERROR). When I go ahead and get the image, I also see that that the layout is the entire sensor, but the IMAGEINFO and the image size embedded in the image header are the old image capture size.
Any insight into this problem would be appreciated. Below is a little fragment of the code where I’m having the problem…. (the part where I try to do GETCURRENT of the TW_FRAME)
Karl Hoover
Programmer
UCSFP.S. ALL the calls work except for those pertaining to TW_FRAME:
TW_FIX32 xresolution, yresolution;
float xr, yr;
t_CAPABILITY _cap;
bool succ;
memset(&_cap, 0, sizeof(TW_CAPABILITY));
_cap.Cap = ICAP_XRESOLUTION;
succ = GetCapability_TWAIN(_cap, &xresolution, sizeof(TW_FIX32));
xr = TwainSpecUtilities::FIX32ToFloat(xresolution);
memset(&_cap, 0, sizeof(TW_CAPABILITY));
_cap.Cap = ICAP_YRESOLUTION;
succ = GetCapability_TWAIN(_cap, &yresolution, sizeof(TW_FIX32));
yr = TwainSpecUtilities::FIX32ToFloat(yresolution);
succ = ResetCapability(ICAP_XRESOLUTION);
succ = ResetCapability(ICAP_YRESOLUTION);
memset(&_cap, 0, sizeof(TW_CAPABILITY));
// twain spec says ‘resolution’ is pixels / pixel unit but also states that ‘many sources like to put the maximum number of pixels here’
_cap.Cap = ICAP_XRESOLUTION;
succ = GetCapability_TWAIN(_cap, &xresolution, sizeof(TW_FIX32));
if (succ)
succ = set_CapabilityOneValue(ICAP_XRESOLUTION, xresolution);
xr = TwainSpecUtilities::FIX32ToFloat(xresolution);memset(&_cap, 0, sizeof(TW_CAPABILITY));
_cap.Cap = ICAP_YRESOLUTION;
succ = GetCapability_TWAIN(_cap, &yresolution, sizeof(TW_FIX32));
if(succ)
succ = set_CapabilityOneValue(ICAP_YRESOLUTION, yresolution);
yr = TwainSpecUtilities::FIX32ToFloat(yresolution);succ = ResetCapability(ICAP_FRAMES);
TW_IMAGELAYOUT layout0;
memset(&layout0,0, sizeof(layout0));
succ = TwainCall(&appId_, &source_, DG_IMAGE, DAT_IMAGELAYOUT, MSG_GET,(TW_MEMREF)&layout0);
if(!succ)
{
pcamera_->LogMessage(“source is not Twain-compliant: not able to retrieve layout”);
}
else
{
succ = TwainCall(&appId_, &source_, DG_IMAGE, DAT_IMAGELAYOUT, MSG_SET,(TW_MEMREF)&layout0);
if(succ)
{
TW_FRAME f;
memset(&f, 0, sizeof(f));
memset(&_cap, 0, sizeof(TW_CAPABILITY));
_cap.Cap = ICAP_FRAMES;
succ = GetCapability_TWAIN(_cap, &f, sizeof(f), MSG_GETCURRENT );
const char* perror = “source is not Twain-compliant: not able to get current frame”;
if(!succ) pcamera_->LogMessage(perror);
OutputDebugString(succ ? “get reset frame n” : perror);
}
}- AuthorPosts