How to capture screen from multiple monitor in ActionScript 3? - actionscript-3

I want to capture screen in my second monitor, Currently i am using CmdCapture.exe application to take screenshot in certain time interval but it is only capturing the screen from primary monitor so i have no knowledge how to capture screen from secondary monitor using CmdCapture.exe.
I am using the following codes to take screenshot:
var cmdScreenCaputeLocation:File = File.applicationDirectory.resolvePath("assets\\CmdCapture.exe");
var nativeProcessStartInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartInfo.executable = cmdScreenCaputeLocation;
var args: Vector.<String> = new Vector.<String>();
var uid:String = "tempImg"+imgCounter+"";
args.push("/f", (uid+".jpg"),"/d",""+screencaptureDir+"", "/q 70");
nativeProcessStartInfo.arguments = args;
var nativeProcess:NativeProcess = new NativeProcess();
nativeProcess.addEventListener(NativeProcessExitEvent.EXIT,screenCaptureNativeProcessComplated);
nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,screenCapturOonErrorS);
nativeProcess.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR,screenCaptureOnError);
nativeProcess.start(nativeProcessStartInfo);
imgCounter++;
So anybody have an idea how to take screenshot from secondary monitor using CmdCapture.exe or using any other applications which can be run in actionscript nativeprocess command, please help me.

Regarding BoxCutter docs...
Usage : boxcutter [OPTIONS] [OUTPUT_FILENAME]
OPTIONS
-c, = coords X1,Y1,X2,Y2 capture the rectangle (X1,Y1)-(X2,Y2).
-f, = fullscreen capture the full screen.
-h, = help display help message.
usage : boxcutter -c -AA,BB,CC,DD testgrab.png
Where numbers for :
AA is starting origin along X-axis (left/right)
BB is starting origin along Y-axis (up/down)
CC is grab width along X-axis (left/right)
DD is grab height along Y-axis (up/down)
As an example let's test : Screen 1 is w=1280 & h=800, Screen 2 is w=1024 & h=768.
grabbing examples :
for monitor 1 only use: boxcutter -c 0,0,1280,800 testgrab.png
for monitor 2 only use: boxcutter -c 1280,0,2304,768 testgrab.png
for both monitors 1 & 2 together use: boxcutter -c 0,0,2304,800 testgrab.png
Note that Screen 2 begins after the width of Screen 1 ends. So to grab both screens at same time CC must be total of added widths of Screen 1 + Screen 2. For height DD must use biggest height (from one of those two screens) to avoid any unwanted cropping.
Try this in your code
args.push("-c");
args.push("0", "0", "myWidth", "myHeight");
args.push("testgrab.png");
where : myWidth & myHeight = required width & height of grab area. .
PS : Check this Article since it might help you with settings for multiple monitors...

Related

Calibrating FITS multiple FITs files

I am relatively new to Python. I need to calibrate a large number of FITS files. I have tried to get pixel counts per image using the following
dirname = 'Users\Mark\OneDrive\Python\MWtes'
for filename in glob.glob(os.path.join(dirname,'*.fits')):
with fits.open(filename) as hdulist:
hdu = hdulist[0]
image_file = get_pkg_data_filename('*.fits')
image_data = fits.getdata(image_file, ext=0)
image_data = np.array(image_data)
image_data.astype(float)
c = np.mean(image_data)
print (c)
But I get the message back that c is undefined. Any assistance would be greatly appreciated

ITK Filter Error: "Inputs do not occupy the same physical space" after affine registration

I'm attempting to perform diffeomorphic demon registration of two MRI images. The processing pipeline has been this so far:
Skull-stripping
Anisotropic Diffusion (smoothing)
Histogram Matching
Affine registration
Diffeomorphic Demons Registration
I didn't come up with the process, just fixing and cleaning up a Slicer software tool several researchers have built. I'm a summer student and quite unfamiliar with domain, however I've started to more less understand what's going on. The problem I've been unable to solve for the past several weeks is this error:
itk::ExceptionObject (0x1231130)
Location: "void itk::ImageToImageFilter<TInputImage, TOutputImage>::VerifyInputInformation() [with TInputImage = itk::Image<itk::Vector<float, 3u>, 3u>; TOutputImage = itk::Image<itk::Vector<float, 3u>, 3u>]"
File: /home/parallels/Desktop/Slicer-SuperBuild/ITKv4/Modules/Core/Common/include/itkImageToImageFilter.hxx
Line: 241
Description: itk::ERROR: DiffeomorphicDemonsRegistrationFilter(0x13870b0): Inputs do not occupy the same physical space!
InputImage Origin: [7.9639916e+01, -1.1042095e+02, -1.0426932e+02], InputImageMovingImage Origin: [-8.8678563e+01, -1.4923204e+02, 1.2193930e+02]
Tolerance: 1.5000000e-05
InputImage Spacing: [1.5000000e+01, 1.5000000e+01, 1.9199951e+01], InputImageMovingImage Spacing: [1.5154560e+01, 1.5108180e+01, 1.9319538e+01]
Tolerance: 1.5000000e-05
InputImage Direction: 1.5926319e-08 1.4070701e-08 -1.0000000e+00
9.9237583e-01 -1.2324859e-01 1.4070700e-08
1.2324859e-01 9.9237583e-01 1.5926320e-08
, InputImageMovingImage Direction: -0.0000000e+00 5.5205551e-10 1.0000000e+00
5.5205551e-10 1.0000000e+00 -5.5205553e-10
-1.0000000e+00 5.5205551e-10 0.0000000e+00
Tolerance: 1.0000000e-06
From what I understand, the diffeomorphic registration relies on the two images being coincident, hence the affine registration step beforehand. For some reason though, the affine transformation doesn't line up the two images properly. As a result, they don't occupy the same physical space. I'm clearly missing something but can't seem to figure out what it is.
The affine registration is performed with this file (I made some edits on my local copy to comply with the Slicer module's way of input/output but they're nearly identical). The transform that was created had the following characteristics:
Optimizer stop condition: RegularStepGradientDescentOptimizerv4: Step too small after 33 iterations. Current step (9.76563e-05) is less than minimum step (0.0001).
Result =
Center X = -1.95155
Center Y = 11.6381
Center Z = 36.5165
Translation X = 1.09423
Translation Y = 0.021133
Translation Z = -0.0154539
Iterations = 34
Metric value = 8974.52
Scale 1 = 1.15384
Scale 2 = 1.08962
Angle (degrees) = -5.6116
The following code was used to save the transform to a file:
// Write the transform to a file
itk::TransformFileWriter::Pointer transformWriter = itk::TransformFileWriter::New();
transformWriter->SetInput( registration->GetOutput()->Get() );
transformWriter->SetFileName( outputMatrix.c_str() );
transformWriter->Update();
And the demon registration is performed with this file (Made a few edits but mostly the same as well). The affine transform is loaded at line 799.
Reading transform from transform input file.
Found: AffineTransform (0x1e0c0b0)
RTTI typeinfo: itk::AffineTransform<double, 3u>
Reference Count: 3
Modified Time: 1322
Debug: Off
Object Name:
Observers:
none
Matrix:
1.01338 0.0887047 0.0223631
-0.11891 1.09423 0.021133
-0.0154539 0.0302253 1.14062
Offset: [-0.256888, -34.7809, -17.895]
Center: [-1.95155, 11.6381, 36.5165]
Translation: [1.56597, -32.6804, -12.3781]
Inverse:
0.977286 -0.0787352 -0.0177019
0.105999 0.905809 -0.0188607
0.0104321 -0.0250698 0.876975
Singular: 0
Edit: Commenting out the following line does not change anything in the resulting output. ie the initial displacement is not being applied at all. Still don't know why.
typedef typename itk::MultiResolutionPDEDeformableRegistration <ImageType, ImageType, DeformationFieldType, PixelType > MultiResRegistrationFilterType;
typename MultiResRegistrationFilterType::Pointer multires = MultiResRegistrationFilterType::New();
// Commenting out this line doesn't change anything
multires->SetArbitraryInitialDisplacementField ( inputDefField );
It looks like the Diffeomorphic Demons Registration code you are using requires that Fixed and Moving images have the same physical space, meaning:
Origin
Spacing
Dimensions
Did you try to resample your moving image to the fixed image space, and then call the Diffeomorphic Demons Registration with this resampled moving image and fixed image?
I didn't know this EZminc code but it looks like it requires both inputs to be in the same space somehow.

Finding out loading time of webelements in a webpage using selenium webdriver

I have a webpage(HTML 5) in which there are 4 charts, each of which taking different time to load once the static content in the page comes up. The Loading is shown in the webpage using a 'rendering' circle image for all the 4 charts. I want to find out how much time each of the charts were showing the 'rendering' circle. Please help me in getting a solution using selenium webdriver.
It is the crude way but it must work.
Create a infinite loop with 1 second wait and in each iteration check if the chart is loaded or not. Once all four charts are loaded or if you have timeout value come out of loop.
In this case there is possibility of error of 1 sec. If your chart is loading fast or want to reduce the margin of error reduce the wait from 1 sec to 100msec.
Pseudo code :[May use this to write better code]
boolean[] chartLoaded = {false,false,false,false};
int[] chartLoadTime = {0,0,0,0};
int counter = 0;
while(counter < 100)
{
counter++;
if(isLoaded(chart1))
{
chartLoaded[0] = true;
chartLoadTime[0]++;
}
//Do this for other three charts also
if(chartLoaded[0] && chartLoaded[1] && chartLoaded[2] && chartLoaded[3])
break;
}

Tabris UI Controls Demo Indication error on IPad and IPhone

I'm validating the Tabris framework at the moment and stumbled about a few indication errors when I tried the UI Control Code Snippets.
I added the VisualGuideDemo.java to my HelloWorld-Project and added a table to the display with the createTable function. In my browser it is displaying the expected output with 3 columns and 128 rows. When I test the application on an IPad mini or the IPhone Simulator ...
only the first Column is displayed,
it is not possible to scroll through the whole list (i can scroll about 60 items down, then the list "jumps" back)
and the width of the table does not adjust to the fullwidth of the screen.
See attached Screenshots
I also tried to add a TabFolder which uses the full width of the screen. I used the 'createTabFolder' method:
private void createTabFolder() {
final Shell shell = new Shell( display, SWT.NONE );
shell.setLayout( new FillLayout() );
final TabFolder tabFolder = new TabFolder( shell, SWT.NONE );
final TabItem tab0 = new TabItem( tabFolder, SWT.NONE );
tab0.setText( "Tab0" );
final TabItem tab1 = new TabItem( tabFolder, SWT.NONE );
tab1.setText( "Tab1" );
final TabItem tab2 = new TabItem( tabFolder, SWT.NONE );
tab2.setText( "Tab2" );
//shell.setSize( 300, 100 );
shell.open();
}
I uncommented the setSize function, but the TabFolder does not adjust to the full width of the screen (not in browser or on iOS device).
I'm new to SWT, RAP/Tabris so I am wondering if I miss something basic.
EDIT:
I guess several columns in one table are not supported in the mobile clients, but maybe it would be a nice feature to add the missing columns to the end of the list, seperated by listdividers. Is my assumption correct?
I found the solution to the width problem, I just had to call shell.setMaximized(true);

Storing a BLOB in MySQL Database

I have an image uploaded to a server with location like : opt/glassfish/domains/domain1/applications/j2ee-modules/SmartbadgePortal/images/2badge.jpg
I am trying to read the contents of the image rather than the image information. I searched a lot and could get the following solution for it :
File uploadedFile = new File(path);
System.out.println("Uploaded File is *** : " + uploadedFile);
item.write(uploadedFile);
Image image = null;
image = ImageIO.read(uploadedFile);
System.out.println("Image Contents is *** : " + image);
However, the when I used System.out to print "image". I get :
Image Contents is * : BufferedImage#10d7a81: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace#722270 transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 418 height = 387 #numDataElements 3 dataOff[0] = 2|#]
But , this is not what I need. I need the contents of the image and need to store it in a BLOB column in MySQL. Please help as I am been trying various methods like ByteArrayInputStream ,but every time I see only this info rather than image itself.
Although it's not the answer you're looking for, my recommendation is to store the image in your server's file system and saving the file name (and maybe directory) in your DB. Storing an image in a BLOB cell is usually not a good idea unless there's a specific reason.