Hi Mark,
Thank you very much for the quick response. I modified my code to read how you have it. I also realized that my NDArraySize was off by a factor of 2 (did not take into account sizeof(USHORT)).
The AD Tiff plugin now works (earlier I would get a pop up dialog- I forget exactly what it said but something along the lines of "Error opening tiff". )
ImageJ Viewer still isn't working but I was just using it as a test to see if my driver was working. It is the latest version (same as one currently on github). I checked in my ioc and EPICS_CA_MAX_ARRAY_BYTES is 300000000 (i bumped it up a factor of 10 earlier to be sure).
I restarted ImageJ but it still doesnt work, but getting the IJ viewer working is low priority seeing how much work I have left in this driver. I am just happy to have the arrays reading out now.
Thanks!
Andrew
________________________________________
From: Mark Rivers [[email protected]]
Sent: Sunday, June 08, 2014 9:43 PM
To: Gomella, Andrew (NIH/NHLBI) [F]; [email protected]
Subject: RE: Writing areadetector driver- Getting array data to NDArray properly?
Hi Andrew,
Note that while what you are doing should work (unless there is a problem I am missing), it is not the most efficient way to do it. You can avoid allocating 2 arrays and the memcpy operation if you change the order of operations as follows:
this->pArrays[0] = this->pNDArrayPool->alloc(2, dims, NDUInt16, 0, NULL);
pImage = this->pArrays[0];
vip_get_image(this->ModeNumber, VIP_CURRENT_IMG_RAW, this->sensorWidth, this->sensorHeight,
(USHORT *)pImage->pData);
So you pass the NDArray data pointer directly to their DLL.
Mark
________________________________________
From: [email protected] [[email protected]] on behalf of Gomella, Andrew (NIH/NHLBI) [F] [[email protected]]
Sent: Sunday, June 08, 2014 7:12 PM
To: [email protected]
Subject: Writing areadetector driver- Getting array data to NDArray properly?
Hi Everyone,
I am writing a driver for a Varian 3024m flat panel detector. I am having trouble in my driver getting the data from the panel into NDArrays.
To get the data from the panel it is fairly simple, I pass a pointer to the dll (with the call vip_get_image) and it populates it with ushorts. It looks like this:
USHORT *pFrame = new USHORT[this->sensorSize];
vip_get_image(this->ModeNumber, VIP_CURRENT_IMG_RAW, this->sensorWidth, this->sensorHeight, pFrame);
Next I attempt to get this data to NDPluginStdArrays with:
(This is just one of many attempts, I tried my best to follow examples from other areadetector drivers, mainly Prosilica and PerkinElmer).
NDArray *pImage;
dims[0] = this->sensorWidth;
dims[1] = this->sensorHeight;
if (this->pArrays[0])
this->pArrays[0]->release();
this->pArrays[0] = this->pNDArrayPool->alloc(2, dims, NDUInt16, 0, NULL);
pImage = this->pArrays[0];
pImage->getInfo(&arrayInfo);
memcpy(pImage->pData, pFrame, arrayInfo.totalBytes);
pImage->getInfo(&arrayInfo);
setIntegerParam(NDArraySize, arrayInfo.totalBytes);
setIntegerParam(NDArraySizeX, arrayInfo.xSize);
setIntegerParam(NDArraySizeY, arrayInfo.ySize);
setIntegerParam(NDDataType, dataType);
setIntegerParam(NDColorMode, colorMode);
getIntegerParam(NDArrayCallbacks, &arrayCallbacks);
if (arrayCallbacks) {
this->unlock();
doCallbacksGenericPointer(pImage, NDArrayData, 0);
this->lock();
}
Testing this, Tiff plugin gives me an error about not being able to open it and the Imagej Plugin just shows a black window with a "UpdateImage got exception: pendIO timed out" error. My EPICS_MAX_CA_ARRAY_BYTES is set to 30MB, and all appropriate array callback/ image callbacks are enabled for this test. System is Windows x64, i7 processor, 16gb ram. Area detector 1-9-1.
My other attempts, which there are too numerous to mention here result in the app crashing.
Any help is greatly appreciated.
Thanks,
Andrew Gomella
Imaging Physics Lab, NIH
- Replies:
- RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- References:
- Writing areadetector driver- Getting array data to NDArray properly? Gomella, Andrew (NIH/NHLBI) [F]
- RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- Navigate by Date:
- Prev:
RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- Next:
RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- Next:
RE: Writing areadetector driver- Getting array data to NDArray properly? Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|