Skip to content

Commit

Permalink
(gh-181) Add automatic imagej package following migration
Browse files Browse the repository at this point in the history
Maintanence for the package was migated from anthonymastrean but there
was no source available for the imagej package.  The package has been
added and built from scratch inline with repository standards.
  • Loading branch information
dgalbraith committed Sep 4, 2022
1 parent 3d96ff9 commit 37cc989
Show file tree
Hide file tree
Showing 8 changed files with 297 additions and 0 deletions.
54 changes: 54 additions & 0 deletions automatic/imagej/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# [<img src="https://cdn.jsdelivr.net/gh/dgalbraith/chocolatey-packages@a306a1daa4f210fa0a5421f2a3c996804629256a/icons/imagej.png" width="48" height="48" />ImageJ - Image Processing and Analysis in Java](https://chocolatey.org/packages/imagej)

[![Software license](https://img.shields.io/badge/License-Public%20Domain-brightgreen.svg)](https://imagej.nih.gov/ij/disclaimer.html)
[![Maintenance status](https://img.shields.io/badge/maintained%3F-yes-green.svg)](https://gitHub.com/dgalbraith/chocolatey-packages/graphs/commit-activity)
[![AppVeyor build](https://img.shields.io/appveyor/ci/dgalbraith/chocolatey-packages)](https://ci.appveyor.com/project/dgalbraith/chocolatey-packages)
[![Software version](https://img.shields.io/badge/Source-v1.52-blue)](http://wsr.imagej.net/distros/win/ij152-win-java8.zip)
[![Chocolatey package version](https://img.shields.io/chocolatey/v/imagej?label=Chocolatey)](https://chocolatey.org/packages/imagej)

Public domain software for processing and analyzing scientific images – a.k.a. ImageJ 1.x.

## Features

* Display, edit, analyze, process, save, and print 8-bit color and grayscale, 16-bit integer, and 32-bit
floating point images

* Read many image file formats, including TIFF, PNG, GIF, JPEG, BMP, DICOM, and FITS, as well as raw formats

* Supports image stacks, a series of images that share a single window, and it is multithreaded, so
time-consuming operations can be performed in parallel on multi-CPU hardware

* Calculate area and pixel value statistics of user-defined selections and intensity-thresholded objects

* Measure distances and angles

* Create density histograms and line profile plots

* Supports standard image processing functions such as logical and arithmetical operations between images,
contrast manipulation, convolution, Fourier analysis, sharpening, smoothing, edge detection, and median
filtering

* Geometric transformations such as scaling, rotation, and flips

* Supports any number of images simultaneously, limited only by available memory

![screenshot](https://cdn.jsdelivr.net/gh/dgalbraith/chocolatey-packages@3d96ff972ea781c5e7ddf915b56f74c7b4baf5a4/automatic/imagej/screenshot.png)

## Package Parameters

The following package parameter can be set:

* `/AddToDesktop` - add a desktop shortcut for ImageJ. By default the shortcut will be added for all users
* `/AddToStartMenu` - add a start menu entry for ImageJ. By default the shortcut will be added for all users

eg. `choco install -y imagej --package-parameters="/AddToDesktop /AddToStartMenu"`

* `/User` - where the user parameter is specified any shortcuts created (`/AddToDesktop`, `/AddToStartMenu`)
will only be added for the current user

eg. `choco install -y imagej --package-parameters="/AddToDesktop /AddToStartMenu /User"`

## Notes

* This package is automatically updated using the [Chocolatey Automatic Package Update Model (AU)](https://github.com/majkinetor/au/blob/master/README.md).
If you find it is out of date by more than a day or two, please contact the maintainer(s) and let them know the package is no longer updating correctly.
80 changes: 80 additions & 0 deletions automatic/imagej/imagej.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>imagej</id>
<version>1.52</version>
<packageSourceUrl>https://github.com/dgalbraith/chocolatey-packages/tree/master/automatic/imagej</packageSourceUrl>
<owners>dgalbraith</owners>
<title>ImageJ - Image Processing and Analysis in Java</title>
<authors>Wayne Rasband</authors>
<projectUrl>https://imagej.nih.gov/ij</projectUrl>
<iconUrl>https://cdn.jsdelivr.net/gh/dgalbraith/chocolatey-packages@a306a1daa4f210fa0a5421f2a3c996804629256a/icons/imagej.png</iconUrl>
<copyright>ImageJ is dedicated to the public domain</copyright>
<licenseUrl>https://imagej.nih.gov/ij/disclaimer.html</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/imagej/ImageJ</projectSourceUrl>
<docsUrl>https://imagej.nih.gov/ij/docs/index.html</docsUrl>
<mailingListUrl>https://imagej.nih.gov/ij/list.html</mailingListUrl>
<bugTrackerUrl>https://github.com/imagej/ImageJ/issues</bugTrackerUrl>
<tags>imagej computer-vision image-analysis image-processing</tags>
<summary>Image processing and analysis in Java</summary>
<description><![CDATA[
Public domain software for processing and analyzing scientific images – a.k.a. ImageJ 1.x.
## Features
* Display, edit, analyze, process, save, and print 8-bit color and grayscale, 16-bit integer, and 32-bit
floating point images
* Read many image file formats, including TIFF, PNG, GIF, JPEG, BMP, DICOM, and FITS, as well as raw formats
* Supports image stacks, a series of images that share a single window, and it is multithreaded, so
time-consuming operations can be performed in parallel on multi-CPU hardware
* Calculate area and pixel value statistics of user-defined selections and intensity-thresholded objects
* Measure distances and angles
* Create density histograms and line profile plots
* Supports standard image processing functions such as logical and arithmetical operations between images,
contrast manipulation, convolution, Fourier analysis, sharpening, smoothing, edge detection, and median
filtering
* Geometric transformations such as scaling, rotation, and flips
* Supports any number of images simultaneously, limited only by available memory
![screenshot](https://cdn.jsdelivr.net/gh/dgalbraith/chocolatey-packages@3d96ff972ea781c5e7ddf915b56f74c7b4baf5a4/automatic/imagej/screenshot.png)
## Package Parameters
The following package parameter can be set:
* `/AddToDesktop` - add a desktop shortcut for ImageJ. By default the shortcut will be added for all users
* `/AddToStartMenu` - add a start menu entry for ImageJ. By default the shortcut will be added for all users
eg. `choco install -y imagej --package-parameters="/AddToDesktop /AddToStartMenu"`
* `/User` - where the user parameter is specified any shortcuts created (`/AddToDesktop`, `/AddToStartMenu`)
will only be added for the current user
eg. `choco install -y imagej --package-parameters="/AddToDesktop /AddToStartMenu /User"`
## Notes
* This package is automatically updated using the [Chocolatey Automatic Package Update Model (AU)](https://github.com/majkinetor/au/blob/master/README.md).
If you find it is out of date by more than a day or two, please contact the maintainer(s) and let them know the package is no longer updating correctly.
]]>
</description>
<releaseNotes>https://imagej.nih.gov/ij/notes.html</releaseNotes>
<dependencies />
</metadata>
<files>
<file src="legal\**" target="legal" />
<file src="tools\**" target="tools" />
</files>
</package>
9 changes: 9 additions & 0 deletions automatic/imagej/legal/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ImageJ Disclaimer

ImageJ was developed at the National Institutes of Health by an employee of the
Federal Government in the course of his official duties. Pursuant to Title 17,
Section 105 of the United States Code, this software is not subject to
copyright protection and is in the public domain. ImageJ is an experimental
system. NIH assumes no responsibility whatsoever for its use by other parties,
and makes no guarantees, expressed or implied, about its quality, reliability,
or any other characteristic.
28 changes: 28 additions & 0 deletions automatic/imagej/legal/VERIFICATION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
VERIFICATION

Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

The application has been downloaded from the official distribution and can
be verified by:

1. Go to the binary distribution page

http://wsr.imagej.net/distros/win/

and download the installer ij152-win-java8.zip using the relevant links in the
asset section of the distribution page.

Alternatively the distribution can be downloaded directly from

http://wsr.imagej.net/distros/win/ij152-win-java8.zip

2. The archive can be validated by comparing checksums
- Use powershell function 'Get-Filehash' - Get-Filehash ij152-win-java8.zip
- Use chocolatey utility 'checksum.exe' - checksum -t sha256 -f ij152-win-java8.zip

File: ij152-win-java8.zip
ChecksumType: sha256
Checksum: ACE9FAEDCB0BCCD9EE821A956CE52CAB295F781E70D7F62F0F6807EA98999ED9

Contents of file LICENSE.txt is obtained from https://imagej.nih.gov/ij/disclaimer.html
20 changes: 20 additions & 0 deletions automatic/imagej/tools/chocolateyBeforeModify.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$ErrorActionPreference = 'Stop'

$link = 'imagej.lnk'
$desktop = [Environment]::GetFolderPath('Desktop')
$commonDesktop = [Environment]::GetFolderPath('CommonDesktopDirectory')
$startMenu = [Environment]::GetFolderPath('StartMenu')
$commonStartMenu = [Environment]::GetFolderPath('CommonStartMenu')

$paths = @(
(Join-Path $desktop $link),
(Join-Path $commonDesktop $link),
(Join-Path $startMenu $link),
(Join-Path $commonStartMenu $link)
)

$paths.GetEnumerator() | ForEach-Object {
if (Test-Path -Path $_) {
Remove-Item $_ -ErrorAction SilentlyContinue -Force | Out-Null
}
}
47 changes: 47 additions & 0 deletions automatic/imagej/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$ErrorActionPreference = 'Stop'

$toolsDir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
$archive = Join-Path $toolsDir 'ij152-win-java8.zip'
$installDir = Get-ToolsLocation

$packageArgs = @{
PackageName = $env:ChocolateyPackageName
FileFullPath = $archive
Destination = $installDir
}

Get-ChocolateyUnzip @packageArgs

$executable = Get-ChildItem $installDir -include ImageJ.exe -recurse

$pp = Get-PackageParameters

if ($pp.AddToDesktop) {
if ($pp.User) {
$desktopPath = [Environment]::GetFolderPath('Desktop')
} else {
$desktopPath = [Environment]::GetFolderPath('CommonDesktopDirectory')
}

$shortcutPath = Join-Path $desktopPath 'imagej.lnk'

Install-ChocolateyShortcut -ShortcutFilePath $shortcutPath -TargetPath $executable

Write-Host("Added {0} desktop shortcut pointed at {1}" -f $shortcutPath, $executable)
}

if ($pp.AddToStartMenu) {
if ($pp.User) {
$startMenuPath = [Environment]::GetFolderPath('StartMenu')
} else {
$startMenuPath = [Environment]::GetFolderPath('CommonStartMenu')
}

$shortcutPath = Join-Path $startMenuPath 'imagej.lnk'

Install-ChocolateyShortcut -ShortcutFilePath $shortcutPath -TargetPath $executable

Write-Host("Added {0} start menu entry pointed at {1}" -f $shortcutPath, $executable)
}

Install-Binfile -Name 'imagej' -Path $executable -UseStart
5 changes: 5 additions & 0 deletions automatic/imagej/tools/chocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$ErrorActionPreference = 'Stop'

Uninstall-Binfile -name 'imagej' -path 'imagej.exe'

Uninstall-ChocolateyZipPackage 'imagej' 'ij152-win-java8.zip'
54 changes: 54 additions & 0 deletions automatic/imagej/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import-module au

$ErrorActionPreference = 'Stop'

$releases = "https://imagej.nih.gov/ij/download.html"

$reArchive = "(?<=\/|\s|')(?<Filename>(ij.+win.+zip))"
$reChecksum = '(?<=Checksum:\s*)((?<Checksum>([^\s].+)))'
$reRawVersion = '(?<RawVersion>(?<=ij)(?<Major>[\d]{1})(?<Minor>[\d]{2}))'
$reVersion = '(?<=v)(?<Version>([\d]{1}\.[\d]{2}\.?[\d]*))'


function global:au_BeforeUpdate {
Get-RemoteFiles -Purge -NoSuffix
}

function global:au_SearchReplace {
@{
".\README.md" = @{
"$($reVersion)" = "$($Latest.Version)"
}

".\legal\VERIFICATION.txt" = @{
"$($reArchive)" = "$($Latest.FileName64)"
"$($reChecksum)" = "$($Latest.Checksum64)"
}

".\tools\chocolateyInstall.ps1" = @{
"$($reArchive)" = "$($Latest.FileName64)"
}

".\tools\chocolateyUninstall.ps1" = @{
"$($reArchive)" = "$($Latest.FileName64)"
}
}
}

function global:au_GetLatest {
$downloadPage = Invoke-WebRequest -UseBasicParsing -Uri $releases

$url64 = $downloadPage.links | where-object href -match $reArchive | select-object -expand href
$fileName64 = $url64 -split '/' | select-object -last 1

$version = $url64 -match $reRawVersion | foreach-object { '{0}.{1}' -f $Matches.Major, $Matches.Minor }

return @{
Url64 = $url64
FileName64 = $fileName64
FileType = 'zip'
Version = $version
}
}

update -ChecksumFor none -NoReadme

0 comments on commit 37cc989

Please sign in to comment.