Image
New Image
Example 1
Summary: Process of applying a negative filter to an image and displaying it alongside a bivariate plot, utilizing JMP's image processing capabilities.
Code:
Names Default To Here( 1 );
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
img2 = New Image();
img2 << Set Pixels( img << Get Pixels() );
img2 << Filter( "negate" );
dt = Open("data_table.jmp");
w = New Window( "Neg filter", H List Box( img2, biv = dt << Run Script( "Bivariate" ) ) );
w << Save Window Report( "$TEMP/image.jrp", embed data( 0 ) );
w << Close Window;
Open( "$TEMP/image.jrp" );
Code Explanation:
- Set default names scope.
- Open image file.
- Create new image object.
- Copy pixels from original image.
- Apply negative filter to image.
- Open data table.
- Create new window.
- Display image and bivariate plot.
- Save window report.
- Close window and reopen saved report.
Example 2
Summary: Process of applying a negate filter to an image and running Bivariate analysis on data, then saves the window report as a JRP file.
Code:
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
img2 = New Image();
img2 << Set Pixels( img << Get Pixels() );
img2 << Filter( "negate" );
dt = Open("data_table.jmp");
w = New Window( "Neg filter", H List Box( img2, biv = dt << Run Script( "Bivariate" ) ) );
w << Save Window Report( "$TEMP/image.jrp", embed data( 0 ) );
w << Close Window;
Code Explanation:
- Open image file.
- Create new image object.
- Copy pixels from original image.
- Apply negate filter to image.
- Open data table.
- Create new window for display.
- Add negated image to window.
- Run Bivariate analysis on data.
- Save window report as JRP file.
- Close the window.
Image using Run Script
Summary: Creates a web report by running two scripts, adding reports and an image, and setting index properties.
Code:
dt1 = Open("data_table1.jmp");
dt2 = Open("data_table2.jmp");
rpt1 = dt1 << Run Script( "Bubble Plot with Local Data Filter" );
rpt2 = dt2 << Run Script( "Logistic" );
webrpt = New Web Report();
webrpt << Add Reports( {rpt1, rpt2} );
webrpt << Add Image( File( "$SAMPLE_IMAGES/black rhino footprint.jpg" ), Title( "Black Rhino Footprint" ) );
webrpt << Index(
Title( "Create Web Report Baseline test" ),
Description( "Description of Create Web Report Baseline test" ),
Timestamp( 1 ),
Font( "Arial Narrow", "Bold Italic" ),
Logo( "$SAMPLE_IMAGES/pi.gif" ),
Theme( "Blue" ),
Style( "Grid" )
);
rptPath = webrpt << Save( "$TEMP", Publish Data( 1 ) );
If(
Host is( "Windows" ), folderPath = Substr( rptPath, 1, Length( Convert File Path( "$TEMP" ) ) + 35 ),
Host is( "Mac" ), folderPath = Substr( rptPath, 1, Length( Convert File Path( "$TEMP" ) ) + 36 )
);
Delete Directory( folderPath );
Code Explanation:
- Open data_table1 data
- Open data_table2 data
- Run Bubble Plot script on data_table1.
- Run Logistic script on data_table2.
- Create new web report.
- Add reports to web report.
- Add image to web report.
- Set index properties for web report.
- Save web report to temporary location.
- Delete temporary directory.
Image using If
Example 1
Summary: Creates and processes image files from a data table, utilizing JMP's scripting capabilities to generate MSWord documents.
Code:
allowWindows = 1;
If( allowWindows,
temp path = "$TEMP";
If( !Directory Exists( temp path ),
Create Directory( temp path )
);
dt = Open("data_table.jmp");
dist = dt << Run Script( "Distribution" );
dist << save MSWord( temp path || "\dist_DOC.doc" );
f = Files In Directory( temp path );
j = 0;
For( i = 1, i <= N Items( f ), i++,
If( Contains( f[i], "dist_DOC_img" ),
j = j + 1;
img = New Image( temp path || "\" || f[i] );
Column( imgDt, 2 )[j] = img;
s = Pixel_Comparison( imgDt, 1 );
)
);
);
Code Explanation:
- Set allowWindows to 1.
- Check if allowWindows is true.
- Assign temp path to "$TEMP".
- Check if temp path exists.
- Create temp directory if it doesn't exist.
- Open data table.
- Run Distribution script on data table.
- Save distribution as MSWord document.
- Get files in temp directory.
- Loop through files to find image files.
- Count and process image files.
- Compare pixel values of images.
Example 2
Summary: Process of generating a distribution report in Microsoft Word, utilizing JMP's scripting capabilities to run a script and save output as an image.
Code:
allowWindows = 1;
If( allowWindows,
temp path = "$TEMP";
dt = Open("data_table.jmp");
dist = dt << Run Script( "Distribution" );
dist << save MSWord( temp path || "\dist_DOC.doc" );
f = Files In Directory( temp path );
j = 0;
For( i = 1, i <= N Items( f ), i++,
If( Contains( f[i], "dist_DOC_img" ),
j = j + 1;
img = New Image( temp path || "\" || f[i] );
Column( imgDt, 2 )[j] = img;
s = Pixel_Comparison( imgDt, 1 );
)
);
);
Code Explanation:
- Allow Windows usage.
- Set temporary path.
- Open data table.
- Run Distribution script.
- Save output to Word.
- List files in temp directory.
- Initialize counter.
- Loop through files.
- Check for image files.
- Process and compare images.
Example 3
Summary: Generates a presentation from a data table, utilizing the Distribution script and saving it as PNG images.
Code:
allowWindows = 1;
If( allowWindows,
temp path = "$TEMP";
dt = Open("data_table.jmp");
dist = dt << Run Script( "Distribution" );
dist << save Presentation( temp path || "\dist_PPTX.pptx", "PNG" );
f = Files In Directory( temp path );
j = 0;
For( i = 1, i <= N Items( f ), i++,
If( Contains( f[i], "dist_PPTX_img" ),
j = j + 1;
img = New Image( temp path || "\" || f[i] );
Column( imgDt, 2 )[j] = img;
s = Pixel_Comparison( imgDt, 1 );
)
);
);
Code Explanation:
- Allow Windows.
- Set temporary path.
- Open data table.
- Run Distribution script.
- Save presentation as PNG.
- List files in directory.
- Initialize counter.
- Loop through files.
- Check for image files.
- Compare pixel values.
Example 4
Summary: Generates a presentation from a data table, including running a Bivariate analysis and saving images to a temporary directory.
Code:
allowWindows = 1;
If( allowWindows,
temp path = "$TEMP";
dt = Open("data_table.jmp");
dist = dt << Run Script( "Bivariate" );
dist << save Presentation( temp path || "\dist_PPTX.pptx", "PNG" );
f = Files In Directory( temp path );
j = 0;
For( i = 1, i <= N Items( f ), i++,
If( Contains( f[i], "dist_PPTX_img" ),
j = j + 1;
img = New Image( temp path || "\" || f[i] );
Column( imgDt, 2 )[j] = img;
s = Pixel_Comparison( imgDt, 1 );
)
);
);
Code Explanation:
- Allow Windows execution.
- Set temporary path.
- Open data table.
- Run Bivariate analysis.
- Save presentation to PPTX.
- List files in temp directory.
- Initialize counter.
- Loop through files.
- Check for image files.
- Compare pixel images.
Image using Create Directory
Summary: Saves picture column values from a data table to individual image files on the desktop.
Code:
Names Default To Here( 1 );
Create Directory( "$DESKTOP/BCF" );
dt = Open("data_table.jmp");
lstPics = :picture << Get Values;
For Each( {i, j}, lstPics,
i << save image( "$DESKTOP/BCF/" || Char( j ) || ".jpg", "jpg" )
);
Code Explanation:
- Set default name scope.
- Create directory on desktop.
- Open data table.
- Retrieve picture column values.
- Loop through each picture value.
- Save picture to file.