Skip to content

Commit

Permalink
feat(viewer): Core Implementation for Nextcloud DICOM Viewer v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ayselafsar committed Mar 19, 2024
1 parent 8e8e7db commit 1ce8614
Show file tree
Hide file tree
Showing 238 changed files with 26,855 additions and 21,643 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
js/*
acanio-viewer/*
node_modules/*
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
globals: {
"t": true,
"n": true,
"OC": true,
"OCA": true,
"Files": true,
"FileList": true,
"XMLHttpRequest": true,
"window": true,
"navigator": true,
"document": true,
"history": true
},
extends: [
'@nextcloud',
]
}
33 changes: 12 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4']
php-versions: ['8.2']
databases: ['oci']
server-versions: ['stable21']
server-versions: ['stable28']

name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}

Expand All @@ -31,39 +31,34 @@ jobs:
- "1521:1521"

steps:
- name: Use Node 12
uses: actions/setup-node@v1
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: 12
node-version: 20

- name: Checkout server
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: nextcloud/server
submodules: 'recursive'
ref: ${{ matrix.server-versions }}

- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout app
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: 'recursive'
path: apps/${{ env.APP_NAME }}

- name: Set up PHPUnit and Build
- name: Build
working-directory: apps/${{ env.APP_NAME }}
run: composer i && make
run: make

- name: Set up php ${{ matrix.php-versions }}
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-versions }}"
extensions: mbstring, iconv, fileinfo, intl, oci8
tools: phpunit:8.5.2
tools: phpunit
coverage: none

- name: Set up Nextcloud
Expand All @@ -72,7 +67,3 @@ jobs:
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
php -f index.php
./occ app:enable --force ${{ env.APP_NAME }}
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}/tests
run: phpunit -c phpunit.xml
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ jobs:
APP_ID: dicomviewer
runs-on: ubuntu-latest
steps:
- name: Use Node 12
uses: actions/setup-node@v1
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: 12
node-version: 20

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
extensions: mbstring, intl, sqlite3
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: php-cs-fixer, phpunit

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build project
id: build_release
Expand All @@ -46,7 +48,7 @@ jobs:
sudo apt install make openssl -y
echo "###### installing nextcloud"
mkdir ~/html
git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b stable21 ~/html/nextcloud
git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b stable28 ~/html/nextcloud
sed -i $'s|if (substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|if (is_string($root) and substr($fullPath, 0, strlen($root) + 1) === $root . \'/\')|g' ~/html/nextcloud/lib/autoloader.php
cp -r $GITHUB_WORKSPACE ~/html/nextcloud/apps/${APP_ID}
php ~/html/nextcloud/occ maintenance:install --database "sqlite" --admin-user "admin" --admin-pass "password"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
node_modules
.npm
npm-debug.log
package-lock.json
vendor
build
js/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "acanio-viewer"]
path = acanio-viewer
url=https://github.com/acanio/acanio-viewer.git
18 changes: 18 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->notPath('build')
->notPath('l10n')
->notPath('node_modules')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;
12 changes: 12 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
filter:
excluded_paths:
- 'acanio-viewer/*'
- 'vendor/*'
- 'tests/*'

imports:
- javascript
- php

tools:
external_code_coverage: true
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
Empty file modified LICENSE
100644 → 100755
Empty file.
39 changes: 15 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
# Makefile for building the project

app_name=dicomviewer
project_dir=$(CURDIR)
src_js_dir=$(CURDIR)/src
build_dir=$(project_dir)/build
appstore_build_dir=/tmp/build
appstore_sign_dir=/tmp/sign
cert_dir=$(HOME)/.nextcloud/certificates
webpack=node_modules/.bin/webpack

jssources=$(wildcard js/*) $(wildcard js/*/*) $(wildcard css/*/*) $(wildcard css/*)
othersources=$(wildcard appinfo/*) $(wildcard css/*/*) $(wildcard controller/*/*) $(wildcard templates/*/*) $(wildcard log/*/*)
build:
npm install
npm run build

all: build

clean:
rm -rf $(build_dir)
rm -rf vendor
rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules

build: $(jssources)
cd $(src_js_dir) && yarn install
cd $(src_js_dir) && yarn lint
cd $(src_js_dir) && yarn build

appstore: clean build package

package: build $(othersources)
appstore: build
rm -rf $(appstore_build_dir)
mkdir -p $(appstore_build_dir)
rm -rf $(appstore_sign_dir)
Expand All @@ -38,14 +19,24 @@ package: build $(othersources)
--exclude=.idea \
--exclude=.github \
--exclude=.tx \
--exclude=acanio-viewer \
--exclude=node_modules \
--exclude=src \
--exclude=screenshots \
--exclude=tests \
--exclude=.eslintignore \
--exclude=.eslintrc.js \
--exclude=.gitignore \
--exclude=.gitmodules \
--exclude=.l10nignore \
--exclude=.php-cs-fixer.dist.php \
--exclude=.scrutinizer.yml \
--exclude=.travis.yml \
--exclude=Makefile \
--exclude=babel.config.js \
--exclude=composer.* \
--exclude=Makefile \
--exclude=stylelint.config.js \
--exclude=webpack.config.js \
../$(app_name) $(appstore_sign_dir)
@if [ -f $(cert_dir)/$(app_name).key ]; then \
sudo chown $(webserveruser) $(appstore_sign_dir)/$(app_name)/appinfo ;\
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

# DICOM Viewer

It is a DICOM viewer which uses [cornerstonejs](https://github.com/cornerstonejs) library to display DICOM files in Nextcloud.
It is a medical imaging viewer which was built on top of OHIF Viewer v3 for viewing DICOM files in Nextcloud.
It renders DICOM data sets in 2D, 3D, and reconstructed representations; allows for the manipulation, annotation,
and serialization of observations; supports internationalization, hotkeys, and many more features.

For more information, see the blog post [Nextcloud in Digital Imaging](https://nextcloud.com/blog/digital-imaging-for-medicine-in-nextcloud/)

Expand All @@ -18,9 +20,8 @@ For more information, see the blog post [Nextcloud in Digital Imaging](https://n

### Features

* **Viewer:** A DICOM viewer which displays images grouped by study and series in selected folders and allows to manipulate images with imaging tools.
* **DICOM Dump:** A list of DICOM attributes displayed on the sidebar with image thumbnail.
* **Translation:** The ability to use localized languages. Translators are encouraged to contribute.
* **DICOM Viewer:** A medical imaging viewer for loading and viewing DICOM files with advanced imaging tools, including MPR, in Nextcloud.
* **DICOM Sidebar:** A sidebar component for viewing and searching DICOM attributes with an image thumbnail for DICOM files in Nextcloud.


### Quick Start
Expand All @@ -32,9 +33,8 @@ On your Nextcloud, simply navigate to Apps > Multimedia > DICOM Viewer, and enab

#### Pre-requisites

- make
- [NodeJS](https://nodejs.org)
- [Nextcloud Server](https://nextcloud.com/install/#instructions-server)
- [NodeJS 20+](https://nodejs.org)
- [Nextcloud Server 28+](https://nextcloud.com/install/#instructions-server)
* Docker options including docker-compose is [here](https://github.com/nextcloud/docker) and Docker images are [here](https://hub.docker.com/_/nextcloud/)
* You can easily find VM and other options [here](https://nextcloud.com)

Expand All @@ -46,7 +46,7 @@ You can build the source code with the following steps:

2. Change into the directory you have cloned this repository

3. Run `make` command to build source code
3. Run `npm run install` command to build source code

4. Enable the DICOM Viewer app in Nextcloud

Expand All @@ -57,5 +57,6 @@ Thanks to our all contributors and sponsors!
<table>
<tr>
<td><a href="https://nextcloud.com"><img src="https://user-images.githubusercontent.com/8215016/70382026-f51b2200-1922-11ea-9121-6bbbb9fb2a6f.png" height="50px;" alt="Nextcloud"/></td>
<td><a href="https://acanio.com"><img src="https://github.com/ayselafsar/dicomviewer/assets/8215016/75d7bcf7-9d20-48b4-ba2f-7fe82138010b" height="40px;" alt="Acanio"/></td>
</tr>
</table>
1 change: 1 addition & 0 deletions acanio-viewer
Submodule acanio-viewer added at 3a2d36
Loading

0 comments on commit 1ce8614

Please sign in to comment.