CamAcq JavaDoc
edu.mbl.jif.camera.camacq
Class CamAcq
java.lang.Object
  edu.mbl.jif.camera.camacq.CamAcq
graphic
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.
graphic
Field Summary
static int
DEPTH_BYTE
           
static int
DEPTH_SHORT
           
 
Method Summary
 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
applicationDidInit ()
          Notification from Application that initialization has completed.
 void
applicationExiting ()
          Notification from the Application that it is exiting.
 boolean
canApplicationExit ()
          Called by Application when exiting to assure complete shutdown.
 void
cancel()
          Cancel any pending operations
 void
captureImageToStack ()
          Acquire an image and append it to the current ImagePlus stack.
 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
captureSequenceToStack ()
          Capture a series into an ImageJ Stack using the current settings.
 void
captureSingleImage (java.lang.Object imageArray)
           
 void
captureStackFinish ()
           
 void
captureStackFinish (java.lang.String name)
          Finish the capture of an ImageStack Saves the file, updates the scale, and displays the window.
 void
captureToImagePlus ()
           
 long
captureToImagePlus (ImagePlus iPlus)
           
 boolean
checkDirOK(java.lang.String path)
          Check to see that a directory exists
 void
clearCameraROI ()
          Clear the camera Region of Interest, ROI
 void
closeCamera()
          Close the camera and driver.
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
displayOpen()
          Open the live camera display.
 void
displayResume ()
          Resume streaming to the the live display.
 void
displaySuspend ()
          Suspend streaming to the the live display.
 void
finishAcq()
           
 java.lang.String
getAcqParms()
           
 boolean
getAddParms()
           
 int
getBinning()
          Get the current camera binning.
 CameraInterface
getCamera()
          Get the camera.
 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
getExposure()
          Get current camera exposure setting
 double
getExposureMax ()
          Get minimum allowable camera exposure setting
 double
getExposureMin ()
          Get minimum allowable camera exposure setting
 int
getFileCounter ()
          Gets the value of the file counter for file naming
 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
getImageDirectory ()
          Get image date path/directory
 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.
static CamAcq
getInstance()
          Returns the instance of CamAcq.
 double
getInterval()
          Get time interval for sequence
 int
getMultiFrame ()
          Get number of exposures for Multi-frame acquisition Acquisition control
 int
getOffset()
          Get the current camera offset (absolute)
 java.awt.Rectangle
getSelectedROI ()
          ROI currently selected in display.
 double
getSpeed()
          Get the current camera readout speed
 int
getWidth()
          Get current width of image returned from camera.
 boolean
isAutoSave()
           
 boolean
isAveraging()
          Is averaging set for multi-frame acquisition.
 boolean
isCameraOpen ()
          Is the camera open?
 boolean
isCoolerActive ()
          Is camera cooler active?
 boolean
isMirrorImage ()
          Is Mirroring enabled?
 boolean
isPutOnDesk()
           
 boolean
isROISelected ()
          Is a ROI selected in the live display.
 void
listAllParameters ()
          List all parameters
 java.lang.String
makeFilename ()
          Creates a new filename for an image based on currently selected naming scheme.
 ImagePlus
newCaptureStackByte ()
          Creates a new ImagePlus with 2 slices in preparation for image capture.
 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
putInImagePlus (java.lang.Object imageArray, long acqTime)
           
 void
recordMsg(java.lang.String s)
           
 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
setCoolerActive (boolean _coolerActive)
          Set camera cooler active
 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
setImagePlusForCapture (ImagePlus _imgPlus)
          Make the specified ImagePlus the destination for acquired image.
 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
setRecordToFile (java.lang.String file)
           
 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
setupSequence (int _numImages, double _interval)
           
 void
setupSequence (int _numImages, double _interval, int _initDelay)
           
 void
showParameters ()
          Show parameters...
 void
startAcq()
           
 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
 
Field Detail
DEPTH_BYTE
public static final int DEPTH_BYTE
See Also:
graphic
DEPTH_SHORT
public static final int DEPTH_SHORT
See Also:
Method Detail
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
graphic
applicationDidInit
public void applicationDidInit()
Notification from Application that initialization has completed. For implementation of ApplicationListener.
graphic
canApplicationExit
public boolean canApplicationExit()
Called by Application when exiting to assure complete shutdown. For implementation of ApplicationListener.
Returns:
Gives the Application permission to exit.
graphic
applicationExiting
public void applicationExiting()
Notification from the Application that it is exiting. For implementation of ApplicationListener.
graphic
isCameraOpen
public boolean isCameraOpen()
Is the camera open?
Returns:
Is camera open
graphic
getCamera
public CameraInterface getCamera()
Get the camera.
Returns:
Camera attached to CamAcq
graphic
closeCamera
public void closeCamera()
Close the camera and driver.
graphic
getWidth
public int getWidth()
Get current width of image returned from camera.
Returns:
image width
graphic
getHeight
public int getHeight()
Get current height of image returned from camera.
Returns:
image height
graphic
getExposure
public double getExposure()
Get current camera exposure setting
Returns:
exposure
graphic
setExposureStream
public void setExposureStream(double _exposure)
Set camera exposure time (in microseconds) for the camera when streaming
Parameters:
_exposure- exposure
graphic
setExposureAcq
public void setExposureAcq(double _exposure)
Set the exposure time (milliseconds) for the camera for image acquisition
Parameters:
_exposure- exposure
graphic
setExposure
public void setExposure(double _exposure)
Set the exposure time (milliseconds) for the camera
Parameters:
_exposure- exposure time
graphic
getExposureMin
public double getExposureMin()
Get minimum allowable camera exposure setting
Returns:
minimum exposure
graphic
getExposureMax
public double getExposureMax()
Get minimum allowable camera exposure setting
Returns:
maximum exposure
graphic
getGain
public double getGain()
Get the current camera gain.
Returns:
Normalized Gain. Expressed in micro units
graphic
setGainSteam
public void setGainSteam(float _gain)
Set the current camera gain for streaming.
Parameters:
_gain- Normalized gain
graphic
setGainAcq
public void setGainAcq(float _gain)
Set the current camera gain for acquisition.
Parameters:
_gain- Normalized gain
graphic
setGain
public void setGain(float _gain)
Set camera gain, normalized (for acq.)
Parameters:
_gain- Normalized gain >=1.0
graphic
getOffset
public int getOffset()
Get the current camera offset (absolute)
Returns:
Absolute offset
graphic
setOffset
public void setOffset(int _offset)
Set camera absolute Offset. Default 0.
Parameters:
_offset- Absolute Offset, default 0
graphic
getBinning
public int getBinning()
Get the current camera binning.
Returns:
binning
graphic
setBinning
public void setBinning(int _binning)
Set the camera binning 1x1, 2x2, or 4x4
Parameters:
_binning- Binning: 1, 2 or 4.
graphic
getSpeed
public double getSpeed()
Get the current camera readout speed
Returns:
readout speed
graphic
setSpeed
public void setSpeed(double _speed)
Set camera readout speed, in megaHertz
Parameters:
_speed- Readout speed, MHz: 20, 10, 5 or 2.5
graphic
getCameraROI
public java.awt.Rectangle getCameraROI()
Get the current camera Region of Interest (ROI)
Returns:
ROI rectangle
graphic
setCameraROI
public void setCameraROI(java.awt.Rectangle roi)
Set camera Region of Interest, ROI
Parameters:
roi- ROI rectangle
graphic
clearCameraROI
public void clearCameraROI()
Clear the camera Region of Interest, ROI
graphic
isCoolerActive
public boolean isCoolerActive()
Is camera cooler active?
Returns:
Active or not.
graphic
setCoolerActive
public void setCoolerActive(boolean _coolerActive)
Set camera cooler active
Parameters:
_coolerActive- true or false
graphic
getDisplay
public DisplayLiveCamera getDisplay()
Gets the live camera display (a DisplayLiveCamera, which extends JFrame) Display control
Returns:
DisplayLiveCamera
graphic
displayOpen
public void displayOpen()
Open the live camera display. Display control
graphic
displaySuspend
public void displaySuspend()
Suspend streaming to the the live display. Display control
graphic
displayResume
public void displayResume()
Resume streaming to the the live display. Display control
graphic
displayClose
public void displayClose()
Close and dispose the live camera display frame. Display control
graphic
displayIsOn
public boolean displayIsOn()
Is the live camera display open and streaming? Display control
Returns:
Is on.
graphic
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
graphic
setSelectedROI
public void setSelectedROI(java.awt.Rectangle roi)
Sets the ROI in the live display. Display control
Parameters:
roi- ROI rectangle
graphic
isROISelected
public boolean isROISelected()
Is a ROI selected in the live display. Display control
Returns:
true or false
graphic
setMirrorImage
public void setMirrorImage(boolean t)
Enable mirroring of image both for display and acquisition.
Parameters:
t- Enable (true) or disable (false) mirroring
graphic
isMirrorImage
public boolean isMirrorImage()
Is Mirroring enabled?
Returns:
Is mirroring on
graphic
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
graphic
getMultiFrame
public int getMultiFrame()
Get number of exposures for Multi-frame acquisition Acquisition control
Returns:
Number of frames/exposures to average or integrate
graphic
setAveraging
public void setAveraging(boolean b)
Set averaging or integration for multi-frame acquisition. Acquisition control
Parameters:
b- true: average; false: integrate
graphic
isAveraging
public boolean isAveraging()
Is averaging set for multi-frame acquisition. Acquisition control
Returns:
true: averaging; false: integrating
graphic
getDepth
public int getDepth()
Get image bit-depth for acquistion Acquisition control
Returns:
8-bit or 12-bit
graphic
setDepth
public void setDepth(int _depth)
Set image bit-depth for acquistion Acquisition control
Parameters:
_depth- 8 or 12
graphic
getAddParms
public boolean getAddParms()
graphic
setAutoSave
public void setAutoSave(boolean t)
Set Auto-saving of images as they are acquired
Parameters:
t- true or false
graphic
isAutoSave
public boolean isAutoSave()
graphic
setPutOnDesk
public void setPutOnDesk(boolean t)
Put the acquired image in a window on the desktop
Parameters:
t-
graphic
isPutOnDesk
public boolean isPutOnDesk()
graphic
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
graphic
getImageDirectory
public java.lang.String getImageDirectory()
Get image date path/directory
Returns:
Image data path
graphic
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
graphic
getFilePrefix
public java.lang.String getFilePrefix()
Get the prefix string used for auto-naming files
Returns:
File name prefix
graphic
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
graphic
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
graphic
makeFilename
public java.lang.String makeFilename()
Creates a new filename for an image based on currently selected naming scheme.
Returns:
New filename
graphic
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.
graphic
recordMsg
public void recordMsg(java.lang.String s)
graphic
setRecordToFile
public void setRecordToFile(java.lang.String file)
graphic
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
graphic
getImagesInSequence
public int getImagesInSequence()
Set the number of images (intervals) when acquiring a sequence of images.
Returns:
Number of images in sequence
graphic
setInterval
public void setInterval(double i)
Set the time interval for acquiring a sequence of images.
Parameters:
i- Time interval in seconds
graphic
getInterval
public double getInterval()
Get time interval for sequence
graphic
setInitDelay
public void setInitDelay(double i)
Set the initial delay when acquiring a sequence of images.
Parameters:
i- Initial delay in seconds
graphic
getInitDelay
public double getInitDelay()
Get the initial delay for acquiring a sequence of images.
Returns:
initial delay in seconds
graphic
setupSequence
public void setupSequence(int _numImages,
                          double _interval)
graphic
setupSequence
public void setupSequence(int _numImages,
                          double _interval,
                          int _initDelay)
graphic
startAcq
public void startAcq()
graphic
acquireImage
public long acquireImage(java.lang.Object imageArray)
returns acquisition time
graphic
finishAcq
public void finishAcq()
graphic
captureSingleImage
public void captureSingleImage(java.lang.Object imageArray)
graphic
captureToImagePlus
public void captureToImagePlus()
graphic
captureToImagePlus
public long captureToImagePlus(ImagePlus iPlus)
graphic
putInImagePlus
public void putInImagePlus(java.lang.Object imageArray,
                           long acqTime)
graphic
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.
graphic
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
graphic
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
graphic
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
graphic
setImagePlusForCapture
public void setImagePlusForCapture(ImagePlus _imgPlus)
Make the specified ImagePlus the destination for acquired image.
Parameters:
_imgPlus- ImagePlus for images
graphic
captureImageToStack
public void captureImageToStack()
Acquire an image and append it to the current ImagePlus stack.
graphic
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
graphic
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
graphic
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
graphic
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-
graphic
captureStackFinish
public void captureStackFinish()
graphic
captureSequenceToStack
public void captureSequenceToStack()
Capture a series into an ImageJ Stack using the current settings.
graphic
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
graphic
getAcqParms
public java.lang.String getAcqParms()
Returns:
graphic
addParms
public void addParms(java.awt.image.BufferedImage img,
                     java.lang.String timeDate)
Parameters:
img-
timeDate-
graphic
addParms
public void addParms(ImageProcessor ip,
                     java.lang.String timeDate)
Parameters:
ip-
timeDate-
graphic
dataStripe
public static void dataStripe(java.awt.image.BufferedImage bImage,
                              java.lang.String data)
Parameters:
bImage-
data-
graphic
wait
public void wait(int msecs)
Wait for n milliseconds
graphic
listAllParameters
public void listAllParameters()
List all parameters
graphic
showParameters
public void showParameters()
Show parameters...
graphic
terminate
public void terminate()
Called to shutdown the camera and display when exiting.
graphic
cancel
public void cancel()
Cancel any pending operations
graphic
reset
public void reset()
Reset everything to its default values.
graphic
setDeBug
public void setDeBug(boolean t)
Enable debugging output.
Parameters:
t- enable
graphic