edu.mbl.jif.camera.camacq
Class CamAcq
java.lang.Object
edu.mbl.jif.camera.camacq.CamAcq
public class
CamAcq
extends
java.lang.Object
edu.mbl.jig.camera.CamAcq
CamAcq:
Creates Camera, Display, Acquisitioner, DataRecorder, objects
and
wraps them in a
set of methods for easy access - eg. for access by ImageJ
plugins....
Calling
getInstance() creates the singleton instance of
CamAcq,
starts the
Application, sets itself as an
ApplicationListener,
and waits for it
to complete (when applicationDidInit is
called).
It also
initializes the camera and opens the CamAcqJ user
interface.
|
static int
|
DEPTH_BYTE
|
|
static int
|
DEPTH_SHORT
|
|
long
|
acquireImage
(java.lang.Object imageArray)
returns
acquisition time
|
|
void
|
addParms(java.awt.image.BufferedImage img,
java.lang.String timeDate)
|
|
void
|
addParms(ImageProcessor ip,
java.lang.String timeDate)
|
|
void
|
addSliceIfNecessary
(ImageStack _stack, int n)
Adds
a slice to an ImageStack if currently has < n
slices
|
|
void
|
|
|
void
|
|
|
boolean
|
|
|
void
|
cancel()
Cancel
any pending operations
|
|
void
|
|
|
void
|
captureImageToStack
(ImageStack _stack,
int _slice)
Acquire
an image and append it to the specified ImagePlus stack at the
specified slice.
|
|
void
|
captureImageToStack
(int _slice)
Acquire
an image and append/insert it to the current ImagePlus stack at the
specified slice.
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
captureStackFinish
(java.lang.String name)
Finish
the capture of an ImageStack Saves the file, updates the scale, and
displays the window.
|
|
void
|
|
|
long
|
|
|
boolean
|
checkDirOK(java.lang.String path)
Check
to see that a directory exists
|
|
void
|
|
|
void
|
|
|
static void
|
dataStripe(java.awt.image.BufferedImage bImage,
java.lang.String data)
|
|
void
|
displayClose
() Close
and dispose the live camera display frame.
|
|
boolean
|
displayIsOn()
Is
the live camera display open and streaming? Display
control
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
|
|
java.lang.String
|
|
|
boolean
|
|
|
int
|
|
|
CameraInterface
|
|
|
java.awt.Rectangle
|
getCameraROI
() Get
the current camera Region of Interest (ROI)
|
|
int
|
getDepth()
Get
image bit-depth for acquistion Acquisition
control
|
|
DisplayLiveCamera
|
getDisplay()
Gets
the live camera display (a DisplayLiveCamera, which extends JFrame)
Display control
|
|
double
|
|
|
double
|
|
|
double
|
|
|
int
|
|
|
java.lang.String
|
getFilePrefix
() Get
the prefix string used for auto-naming files
|
|
double
|
getGain()
Get
the current camera gain.
|
|
int
|
getHeight()
Get
current height of image returned from camera.
|
|
java.lang.String
|
|
|
int
|
getImagesInSequence
() Set
the number of images (intervals) when acquiring a sequence of
images.
|
|
double
|
getInitDelay
() Get
the initial delay for acquiring a sequence of
images.
|
|
|
|
|
double
|
|
|
int
|
getMultiFrame
() Get
number of exposures for Multi-frame acquisition Acquisition
control
|
|
int
|
getOffset()
Get
the current camera offset (absolute)
|
|
java.awt.Rectangle
|
|
|
double
|
getSpeed()
Get
the current camera readout speed
|
|
int
|
getWidth()
Get
current width of image returned from camera.
|
|
boolean
|
|
|
boolean
|
isAveraging()
Is
averaging set for multi-frame acquisition.
|
|
boolean
|
|
|
boolean
|
|
|
boolean
|
|
|
boolean
|
|
|
boolean
|
|
|
void
|
|
|
java.lang.String
|
makeFilename
() Creates
a new filename for an image based on currently selected naming
scheme.
|
|
ImagePlus
|
|
|
ImagePlus
|
newCaptureStackByte
(int numberOfSlices)
Creates
a new ImagePlus with numberOfSlices in preparation for image
capture.
|
|
ImagePlus
|
newCaptureStackShort
() Creates
a new ImagePlus with numberOfSlices in preparation for image
capture.
|
|
ImagePlus
|
newCaptureStackShort
(int numberOfSlices)
Creates
a new ImagePlus with numberOfSlices in preparation for image
capture.
|
|
void
|
|
|
void
|
|
|
void
|
reset()
Reset
everything to its default values.
|
|
void
|
setAutoSave(boolean t)
Set
Auto-saving of images as they are acquired
|
|
void
|
setAveraging
(boolean b)
Set
averaging or integration for multi-frame
acquisition.
|
|
void
|
setBinning(int _binning)
Set
the camera binning 1x1, 2x2, or 4x4
|
|
void
|
setCameraROI
(java.awt.Rectangle roi)
Set
camera Region of Interest, ROI
|
|
void
|
|
|
void
|
setDeBug(boolean t)
Enable
debugging output.
|
|
void
|
setDepth(int _depth)
Set
image bit-depth for acquistion Acquisition
control
|
|
void
|
setExposure(double _exposure)
Set
the exposure time (milliseconds) for the camera
|
|
void
|
setExposureAcq
(double _exposure)
Set
the exposure time (milliseconds) for the camera for image
acquisition
|
|
void
|
setExposureStream
(double _exposure)
Set
camera exposure time (in microseconds) for the camera when
streaming
|
|
void
|
setFileCounter
(int _fileCount)
Sets
the value of the file counter for file naming using when
prefix.
|
|
void
|
setFilePrefix
(java.lang.String _prefix)
Sets
the file prefix, used to label image files.
|
|
void
|
setGain(float _gain)
Set
camera gain, normalized (for acq.)
|
|
void
|
setGainAcq(float _gain)
Set
the current camera gain for acquisition.
|
|
void
|
setGainSteam
(float _gain)
Set
the current camera gain for streaming.
|
|
void
|
setImageDirectory
(java.lang.String _dir)
Set
the directory/folder for saving image data.
|
|
void
|
|
|
void
|
setImagesInSequence
(int n)
Set
the number of images (intervals) when acquiring a sequence of
images.
|
|
void
|
setInitDelay
(double i)
Set
the initial delay when acquiring a sequence of
images.
|
|
void
|
setInterval(double i)
Set
the time interval for acquiring a sequence of
images.
|
|
void
|
setMirrorImage
(boolean t)
Enable
mirroring of image both for display and
acquisition.
|
|
void
|
setMultiFrame
(int n)
Set
number of exposures for Multi-frame acquisition (May or may not be
averaged, see setAveraging()) Acquisition
control
|
|
void
|
setOffset(int _offset)
Set
camera absolute Offset.
|
|
void
|
setPutOnDesk
(boolean t)
Put
the acquired image in a window on the desktop
|
|
void
|
|
|
void
|
setScale(ImagePlus _imp)
setScale
-- Scales the ImageJ image for display 0-255 for byte type 0-4095
for short type
|
|
void
|
setSelectedROI
(java.awt.Rectangle roi)
Sets
the ROI in the live display.
|
|
void
|
setSpeed(double _speed)
Set
camera readout speed, in megaHertz
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
terminate()
Called
to shutdown the camera and display when
exiting.
|
|
void
|
wait(int msecs)
Wait
for n milliseconds
|
|
Methods inherited
from class java.lang.Object
|
|
clone, equals,
finalize, getClass, hashCode, notify, notifyAll, toString, wait,
wait, wait
|
DEPTH_BYTE
public static
final int DEPTH_BYTE
See Also:
DEPTH_SHORT
public static
final int DEPTH_SHORT
See Also:
getInstance
public
staticCamAcqgetInstance()
Returns the instance
of CamAcq. CamAcq is a Singleton... do not try to instantiate.
Instead, use CamAcq.getInstance().
Returns:
The singleton
instance of CamAcq
applicationDidInit
public void
applicationDidInit()
Notification from
Application that initialization has completed. For implementation
of ApplicationListener.
canApplicationExit
public boolean
canApplicationExit()
Called by
Application when exiting to assure complete shutdown. For
implementation of ApplicationListener.
Returns:
Gives the
Application permission to exit.
applicationExiting
public void
applicationExiting()
Notification from
the Application that it is exiting. For implementation of
ApplicationListener.
isCameraOpen
public boolean
isCameraOpen()
Is the camera
open?
Returns:
Is camera
open
getCamera
public
CameraInterface getCamera()
Get the
camera.
Returns:
Camera attached to
CamAcq
closeCamera
public void
closeCamera()
Close the camera and
driver.
getWidth
public int
getWidth()
Get current width of
image returned from camera.
Returns:
image
width
getHeight
public int
getHeight()
Get current height
of image returned from camera.
Returns:
image
height
getExposure
public double
getExposure()
Get current camera
exposure setting
Returns:
exposure
setExposureStream
public void
setExposureStream(double _exposure)
Set camera exposure
time (in microseconds) for the camera when
streaming
Parameters:
_exposure-
exposure
setExposureAcq
public void
setExposureAcq(double _exposure)
Set the exposure
time (milliseconds) for the camera for image
acquisition
Parameters:
_exposure-
exposure
setExposure
public void
setExposure(double _exposure)
Set the exposure
time (milliseconds) for the camera
Parameters:
_exposure- exposure
time
getExposureMin
public double
getExposureMin()
Get minimum
allowable camera exposure setting
Returns:
minimum
exposure
getExposureMax
public double
getExposureMax()
Get minimum
allowable camera exposure setting
Returns:
maximum
exposure
getGain
public double
getGain()
Get the current
camera gain.
Returns:
Normalized Gain.
Expressed in micro units
setGainSteam
public void
setGainSteam(float _gain)
Set the current
camera gain for streaming.
Parameters:
_gain- Normalized
gain
setGainAcq
public void
setGainAcq(float _gain)
Set the current
camera gain for acquisition.
Parameters:
_gain- Normalized
gain
setGain
public void
setGain(float _gain)
Set camera gain,
normalized (for acq.)
Parameters:
_gain- Normalized gain
>=1.0
getOffset
public int
getOffset()
Get the current
camera offset (absolute)
Returns:
Absolute
offset
setOffset
public void
setOffset(int _offset)
Set camera absolute
Offset. Default 0.
Parameters:
_offset- Absolute Offset,
default 0
getBinning
public int
getBinning()
Get the current
camera binning.
Returns:
binning
setBinning
public void
setBinning(int _binning)
Set the camera
binning 1x1, 2x2, or 4x4
Parameters:
_binning- Binning: 1, 2 or
4.
getSpeed
public double
getSpeed()
Get the current
camera readout speed
Returns:
readout
speed
setSpeed
public void
setSpeed(double _speed)
Set camera readout
speed, in megaHertz
Parameters:
_speed- Readout speed,
MHz: 20, 10, 5 or 2.5
getCameraROI
public
java.awt.Rectangle getCameraROI()
Get the current
camera Region of Interest (ROI)
Returns:
ROI
rectangle
setCameraROI
public void
setCameraROI(java.awt.Rectangle roi)
Set camera Region of
Interest, ROI
Parameters:
roi- ROI
rectangle
clearCameraROI
public void
clearCameraROI()
Clear the camera
Region of Interest, ROI
isCoolerActive
public boolean
isCoolerActive()
Is camera cooler
active?
Returns:
Active or
not.
setCoolerActive
public void
setCoolerActive(boolean _coolerActive)
Set camera cooler
active
Parameters:
_coolerActive- true or
false
getDisplay
public
DisplayLiveCamera getDisplay()
Gets the live camera
display (a DisplayLiveCamera, which extends JFrame) Display
control
Returns:
DisplayLiveCamera
displayOpen
public void
displayOpen()
Open the live camera
display. Display control
displaySuspend
public void
displaySuspend()
Suspend streaming to
the the live display. Display control
displayResume
public void
displayResume()
Resume streaming to
the the live display. Display control
displayClose
public void
displayClose()
Close and dispose
the live camera display frame. Display
control
displayIsOn
public boolean
displayIsOn()
Is the live camera
display open and streaming? Display
control
Returns:
Is
on.
getSelectedROI
public
java.awt.Rectangle getSelectedROI()
ROI currently
selected in display. Returns (0,0,0,0) in no selection or no
display open. Display control
Returns:
ROI
rectangle
setSelectedROI
public void
setSelectedROI(java.awt.Rectangle roi)
Sets the ROI in the
live display. Display control
Parameters:
roi- ROI
rectangle
isROISelected
public boolean
isROISelected()
Is a ROI selected in
the live display. Display control
Returns:
true or
false
setMirrorImage
public void
setMirrorImage(boolean t)
Enable mirroring of
image both for display and acquisition.
Parameters:
t- Enable (true) or
disable (false) mirroring
isMirrorImage
public boolean
isMirrorImage()
Is Mirroring
enabled?
Returns:
Is mirroring
on
setMultiFrame
public void
setMultiFrame(int n)
Set number of
exposures for Multi-frame acquisition (May or may not be averaged,
see setAveraging()) Acquisition control
Parameters:
n- Number of
frames/exposures
getMultiFrame
public int
getMultiFrame()
Get number of
exposures for Multi-frame acquisition Acquisition
control
Returns:
Number of
frames/exposures to average or integrate
setAveraging
public void
setAveraging(boolean b)
Set averaging or
integration for multi-frame acquisition. Acquisition
control
Parameters:
b- true: average;
false: integrate
isAveraging
public boolean
isAveraging()
Is averaging set for
multi-frame acquisition. Acquisition
control
Returns:
true: averaging;
false: integrating
getDepth
public int
getDepth()
Get image bit-depth
for acquistion Acquisition control
Returns:
8-bit or
12-bit
setDepth
public void
setDepth(int _depth)
Set image bit-depth
for acquistion Acquisition control
Parameters:
_depth- 8 or
12
getAddParms
public boolean
getAddParms()
setAutoSave
public void
setAutoSave(boolean t)
Set Auto-saving of
images as they are acquired
Parameters:
t- true or
false
isAutoSave
public boolean
isAutoSave()
setPutOnDesk
public void
setPutOnDesk(boolean t)
Put the acquired
image in a window on the desktop
Parameters:
t-
isPutOnDesk
public boolean
isPutOnDesk()
setImageDirectory
public void
setImageDirectory(java.lang.String _dir)
Set the
directory/folder for saving image data.
Parameters:
_dir- Folder in which to
save image data files
getImageDirectory
public
java.lang.String getImageDirectory()
Get image date
path/directory
Returns:
Image data
path
setFilePrefix
public void
setFilePrefix(java.lang.String _prefix)
Sets the file
prefix, used to label image files. File name will be the file
prefix followed by the file counter and the file will have a
‘tif’ extension. The whole file name will be
‘file_PrefixfileCounter.tif’
Parameters:
_prefix- filename
prefix
getFilePrefix
public
java.lang.String getFilePrefix()
Get the prefix
string used for auto-naming files
Returns:
File name
prefix
setFileCounter
public void
setFileCounter(int _fileCount)
Sets the value of
the file counter for file naming using when prefix. Typically reset
to zero.
Parameters:
_fileCount- serial number
counter value
getFileCounter
public int
getFileCounter()
Gets the value of
the file counter for file naming
Returns:
current number of
the file counter (serial number)
See
Also:
setFilePrefix
makeFilename
public
java.lang.String makeFilename()
Creates a new
filename for an image based on currently selected naming
scheme.
Returns:
New
filename
checkDirOK
public boolean
checkDirOK(java.lang.String path)
Check to see that a
directory exists
Parameters:
path- Path to
check
Returns:
true if path exists,
else false.
recordMsg
public void
recordMsg(java.lang.String s)
setRecordToFile
public void
setRecordToFile(java.lang.String file)
setImagesInSequence
public void
setImagesInSequence(int n)
Set the number of
images (intervals) when acquiring a sequence of
images.
Parameters:
n- Number of images
to acquire in sequence
getImagesInSequence
public int
getImagesInSequence()
Set the number of
images (intervals) when acquiring a sequence of
images.
Returns:
Number of images in
sequence
setInterval
public void
setInterval(double i)
Set the time
interval for acquiring a sequence of images.
Parameters:
i- Time interval in
seconds
getInterval
public double
getInterval()
Get time interval
for sequence
setInitDelay
public void
setInitDelay(double i)
Set the initial
delay when acquiring a sequence of images.
Parameters:
i- Initial delay in
seconds
getInitDelay
public double
getInitDelay()
Get the initial
delay for acquiring a sequence of images.
Returns:
initial delay in
seconds
setupSequence
public void
setupSequence(int _numImages,
double _interval)
setupSequence
public void
setupSequence(int _numImages,
double _interval,
int _initDelay)
startAcq
public void
startAcq()
acquireImage
public long
acquireImage(java.lang.Object imageArray)
returns acquisition
time
finishAcq
public void
finishAcq()
captureSingleImage
public void
captureSingleImage(java.lang.Object imageArray)
captureToImagePlus
public void
captureToImagePlus()
captureToImagePlus
public long
captureToImagePlus(ImagePlus iPlus)
putInImagePlus
public void
putInImagePlus(java.lang.Object imageArray,
long acqTime)
newCaptureStackByte
public ImagePlus
newCaptureStackByte()
Creates a new
ImagePlus with 2 slices in preparation for image capture. It is
named using the currently specified filenaming
scheme.
newCaptureStackByte
public ImagePlus
newCaptureStackByte(int numberOfSlices)
Creates a new
ImagePlus with numberOfSlices in preparation for image capture. It
is named using the currently specified filenaming
scheme.
Parameters:
numberOfSlices- Number of slices
in new ImagePlus
Returns:
ImagePlus with
specified number of slices
newCaptureStackShort
public ImagePlus
newCaptureStackShort()
Creates a new
ImagePlus with numberOfSlices in preparation for image capture. It
is named using the currently specified filenaming
scheme.
Returns:
ImagePlus with 2
slices
newCaptureStackShort
public ImagePlus
newCaptureStackShort(int numberOfSlices)
Creates a new
ImagePlus with numberOfSlices in preparation for image capture. It
is named using the currently specified filenaming
scheme.
Parameters:
numberOfSlices- Number of
slices
Returns:
ImagePlus with
stack
setImagePlusForCapture
public void
setImagePlusForCapture(ImagePlus _imgPlus)
Make the specified
ImagePlus the destination for acquired image.
Parameters:
_imgPlus- ImagePlus for
images
captureImageToStack
public void
captureImageToStack()
Acquire an image and
append it to the current ImagePlus stack.
captureImageToStack
public void
captureImageToStack(ImageStack _stack,
int _slice)
Acquire an image and
append it to the specified ImagePlus stack at the specified
slice.
Parameters:
_stack- The
stack
_slice- The
slice
captureImageToStack
public void
captureImageToStack(int _slice)
Acquire an image and
append/insert it to the current ImagePlus stack at the specified
slice.
Parameters:
_slice- The
slice
addSliceIfNecessary
public void
addSliceIfNecessary(ImageStack _stack,
int n)
Adds a slice to an
ImageStack if currently has < n slices
Parameters:
_stack-
ij.ImageStack
n- number of slices
necessary
captureStackFinish
public void
captureStackFinish(java.lang.String name)
Finish the capture
of an ImageStack Saves the file, updates the scale, and displays
the window.
Parameters:
name-
captureStackFinish
public void
captureStackFinish()
captureSequenceToStack
public void
captureSequenceToStack()
Capture a series
into an ImageJ Stack using the current
settings.
setScale
public void
setScale(ImagePlus _imp)
setScale -- Scales
the ImageJ image for display 0-255 for byte type 0-4095 for short
type
Parameters:
_imp- ImagePlus to
scale
getAcqParms
public
java.lang.String getAcqParms()
Returns:
addParms
public void
addParms(java.awt.image.BufferedImage img,
java.lang.String timeDate)
Parameters:
img-
timeDate-
addParms
public void
addParms(ImageProcessor ip,
java.lang.String timeDate)
Parameters:
ip-
timeDate-
dataStripe
public static void
dataStripe(java.awt.image.BufferedImage bImage,
java.lang.String data)
Parameters:
bImage-
data-
wait
public void
wait(int msecs)
Wait for n
milliseconds
listAllParameters
public void
listAllParameters()
List all
parameters
showParameters
public void
showParameters()
Show
parameters...
terminate
public void
terminate()
Called to shutdown
the camera and display when exiting.
cancel
public void
cancel()
Cancel any pending
operations
reset
public void
reset()
Reset everything to
its default values.
setDeBug
public void
setDeBug(boolean t)
Enable debugging
output.
Parameters:
t-
enable