Skip to content

Commit

Permalink
Merge pull request #35 from anibalsolon/develop
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
anibalsolon authored Nov 26, 2022
2 parents 83161b8 + c959827 commit 34e2f88
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 297 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ on:

jobs:
analyze:
if: "!startsWith(github.event.head_commit.message, '[RELEASE]')"
if: |
!startsWith(github.event.head_commit.message, '[RELEASE]') &&
!startsWith(github.event.head_commit.message, '[PRERELEASE]')
name: Analyze
runs-on: ubuntu-latest
permissions:
Expand Down
58 changes: 56 additions & 2 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ name: Build
jobs:

test:
if: "!startsWith(github.event.head_commit.message, '[RELEASE]') && !contains(github.event.head_commit.message, '[SKIP:test]')"
if: |
!startsWith(github.event.head_commit.message, '[RELEASE]') &&
!startsWith(github.event.head_commit.message, '[PRERELEASE]') &&
!contains(github.event.head_commit.message, '[SKIP:test]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -30,14 +33,64 @@ jobs:
DISPLAY: ':99.0'
- run: rm -f ./.coveralls.yml

prerelease:
if: |
github.event.ref == 'refs/heads/develop' &&
!startsWith(github.event.head_commit.message, '[RELEASE]') &&
!startsWith(github.event.head_commit.message, '[PRERELEASE]') &&
!contains(github.event.head_commit.message, '[SKIP:prerelease]')
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: git config --global user.name `jq -r '.author.name' package.json`
- run: git config --global user.email `jq -r '.author.email' package.json`
- run: git status
- run: |
VERSION=$(npm version prerelease --no-git-tag-version)
git add package.json package-lock.json
git commit -m "[PRERELEASE] ${VERSION}"
git push
npm run vscode:package
VVERSION=$(echo "$VERSION" | sed 's/^v//g')
gh release create ${VERSION} --target develop --prerelease "neuro-viewer-${VVERSION}.vsix"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
if: github.event.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, '[RELEASE]') && !contains(github.event.head_commit.message, '[SKIP:deploy]')
if: |
github.event.ref == 'refs/heads/main' &&
!startsWith(github.event.head_commit.message, '[RELEASE]') &&
!contains(github.event.head_commit.message, '[SKIP:deploy]')
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}

- run: |
npm run vscode:vsce -- verify-pat -p "$PAT"
env:
PAT: ${{ secrets.VSCE_PAT }}
# Not yet available
# - run: |
# npm run vscode:ovsx -- verify-pat -p "$PAT"
# env:
# PAT: ${{ secrets.VSCE_PAT }}

- uses: actions/cache@v3
with:
path: ~/.npm
Expand All @@ -47,6 +100,7 @@ jobs:
- run: npm install
- run: git config --global user.name `jq -r '.author.name' package.json`
- run: git config --global user.email `jq -r '.author.email' package.json`

- run: git status
- run: npm version patch -m "[RELEASE] %s"
- run: npm run vscode:package
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### [0.0.14]

* Better support for code-server, thanks to @TinasheMTapera for input
* Fix image loading when the affine is zeroed, thanks to @nx10 and @pierre-nedelec for helping debugging it
* Fix file access when running on Windows, thanks to @nx10 for providing with a fix for it

### [0.0.13]

* Adjusts colors for high contrast themes
Expand Down
121 changes: 0 additions & 121 deletions extension-vscode/provider.ts

This file was deleted.

10 changes: 0 additions & 10 deletions extension-web/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion extension/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class NiftiDocument extends Disposable implements vscode.CustomDocument {
super();
this._uri = uri;
this._uuid = v4();
this._fd = fd || fs.openSync(uri.path, 'r');
this._fd = fd || fs.openSync(uri.fsPath, 'r');
}

public get uri() { return this._uri; }
Expand Down
73 changes: 0 additions & 73 deletions extension/fileserver.ts

This file was deleted.

8 changes: 4 additions & 4 deletions extension/formats/nifti/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export namespace NiftiDataType {
export interface NiftiHeader {
endianness: 'BE' | 'LE',
dimensions: number[],
pixelSizes: number[],
voxelSize: number[],
affine: number[][],
dataType: NiftiDataType,
dataOffset: number,
Expand Down Expand Up @@ -225,7 +225,7 @@ export abstract class Nifti {

protected abstract _dims(buffer: Buffer): number[];

protected abstract _pixelSizes(buffer: Buffer, ndims: number): number[];
protected abstract _voxelSize(buffer: Buffer, ndims: number): number[];

protected abstract _affine(buffer: Buffer): number[][];

Expand Down Expand Up @@ -260,7 +260,7 @@ export abstract class Nifti {
const ndims = dims[0];
const dimensions = dims.slice(1, 1 + ndims);

const pixelSizes = this._pixelSizes(buffer, ndims).slice(1, 1 + ndims);
const voxelSize = this._voxelSize(buffer, ndims).slice(1, 1 + ndims);
const affine = this._affine(buffer);
const qOffset = this._qOffset(buffer);

Expand Down Expand Up @@ -289,7 +289,7 @@ export abstract class Nifti {
formCodes,
orientation,
intentName,
pixelSizes,
voxelSize,
dataType,
dataOffset: offset,
dataBits: bits,
Expand Down
8 changes: 4 additions & 4 deletions extension/formats/nifti/nifti1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export class Nifti1 extends Nifti {
return dims;
}

protected _pixelSizes(buffer: Buffer, ndims: number): number[] {
const pixelSizes = <[number]> new Array(ndims + 1);
protected _voxelSize(buffer: Buffer, ndims: number): number[] {
const voxelSize = <[number]> new Array(ndims + 1);
for (let d = 1; d <= ndims; d++) {
const index = 76 + (d * 4);
pixelSizes[d] = this.read(buffer, NiftiDataType.FLOAT32, index);
voxelSize[d] = this.read(buffer, NiftiDataType.FLOAT32, index);
}
return pixelSizes;
return voxelSize;
}

protected _affine(buffer: Buffer): number[][] {
Expand Down
8 changes: 4 additions & 4 deletions extension/formats/nifti/nifti2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export class Nifti2 extends Nifti {
return dims;
}

protected _pixelSizes(buffer: Buffer, ndims: number): number[] {
const pixelSizes = <[number]> new Array(ndims + 1);
protected _voxelSize(buffer: Buffer, ndims: number): number[] {
const voxelSize = <[number]> new Array(ndims + 1);
for (let d = 1; d <= ndims; d++) {
const index = 104 + (d * 8);
pixelSizes[d] = this.read(buffer, NiftiDataType.FLOAT64, index);
voxelSize[d] = this.read(buffer, NiftiDataType.FLOAT64, index);
}
return pixelSizes;
return voxelSize;
}

protected _affine(buffer: Buffer): number[][] {
Expand Down
Loading

0 comments on commit 34e2f88

Please sign in to comment.