OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.1k stars 3.26k forks source link

[EPIC] Nifti Support #3492

Open james-hanks opened 1 year ago

james-hanks commented 1 year ago

Nifti support in OHIF requires additional requirements gathering

Below are nifti csjs support tickets

james-hanks commented 1 year ago

CS branch: https://github.com/cornerstonejs/cornerstone3D/tree/feat/nifti-loader

To do: Update OHIF implementation requirements

sedghi commented 1 year ago

PR for the cornerstone side: https://github.com/cornerstonejs/cornerstone3D/pull/696

yarikoptic commented 1 year ago

Thank you for looking into this issue. I am new to your initiative/project and yet to figure out how to make use of it ;) but in my academic world we work primarily with NIfTIs (after converting and organizing them into BIDS datasets like e.g. http://datasets.datalad.org/?dir=/dbic/QA), and thus this issue of primary interest for me.

It might be not of any value, but here is a https://bioimagesuiteweb.github.io/webapp/ which is somewhat similar in vein and does support working with niftis, e.g. sample nifti loaded https://bioimagesuiteweb.github.io/webapp/viewer.html?image=https://datasets.datalad.org/dbic/QA/sub-emmet/ses-20180531/anat/sub-emmet_ses-20180531_acq-MPRAGE_T1w.nii.gz . Just thought to mention if it gives some implementation/reuse ideas.

sedghi commented 1 year ago

Hey @yarikoptic So the engine behind OHIF is cornerstone3D, and I recently merged the nifti loader package along with two examples

So kind of the hard part is done, the rest is figuring out how the worklist in OHIF should render studies from different data sources (nifti and dicom) and if there is conflict how to resolve it

yarikoptic commented 1 year ago

That is great! I indeed also wondered how to "expose" a source with NIfTIs. Part of the problem I guess is that nifti is really dumb format barely having any metadata, so by itself it provides no metadata about study/subject etc. But if we have a collection of BIDS datasets (besides the one above you can explore more among http://datasets.datalad.org/?dir=/openneuro which is a "clone" of https://github.com/OpenNeuroDatasets), we can get LOTS of nice metadata with participants information for each of the studies etc. Also each .nii.gz in those could be accompanied with side car .json file which would provide some standardized (in BIDS) fields many of which have 1-to-1 correspondence to DICOM fields, or have some ad-hoc extracts of them. E.g. see http://datasets.datalad.org/dbic/QA/sub-emmet/ses-20180531/anat/sub-emmet_ses-20180531_acq-MPRAGE_T1w.json which accompanies the http://datasets.datalad.org/dbic/QA/sub-emmet/ses-20180531/anat/sub-emmet_ses-20180531_acq-MPRAGE_T1w.nii.gz . So may be there could be smth like bids2dicomjson or alike? But feel welcome to stop me right here -- probably it is worth a separate issue/discussion ;-)

sedghi commented 1 year ago

Yeah as you say the metadata is another problem, with our POC we kind of had another end point to grab the metadata but BIDS seem to be interesting to me.

The json example you sent can be easily be mapped into a dicomjson as you mentioned.

So how much have BIDS been adopted worldwide? is there any other alternative to BIDS? is there commandline tools to grab the dicom folder/study and generate BIDS I guess? And is there any study-level and series level metadata that BIDS can generate and store at the correct directory?

fedorov commented 1 year ago

The json example you sent can be easily be mapped into a dicomjson as you mentioned.

I was reluctant to comment on this thread, but ... if the above is the case, why not just convert NIfTI to DICOM and reuse existing infrastructure from Google Healthcare, dcm4chee and like for the server to feed OHIF - at least for this specific use case?

I think it makes sense to have this question here at least for the record that this was raised.

yarikoptic commented 1 year ago

So how much have BIDS been adopted worldwide?

It is slowly by steadily taking over academic neuroscience as THE standard for datasets (study) organization/metadata annotation.

I would recommend you a fresh pre-print https://arxiv.org/abs/2309.05768 "The Past, Present, and Future of the Brain Imaging Data Structure (BIDS)" which has more interesting information and stats

image

is there any other alternative to BIDS?

not really. For https://dandiarchive.org we support our ad-hoc DANDI layout which is pretty much a simplified BIDS. I am not aware of any formalization in neuroimaging. There was "openfmri layout" (openfmri is precursor to openneuro; they + BIDS were instigated/lead by the same PI @poldrack) as the prototype for initial BIDS.

is there commandline tools to grab the dicom folder/study and generate BIDS I guess?

from the aforementioned publication in the "stumbling points" section:

image

  1. https://bids.neuroimaging.io/benefits#converters .

NB I am maintainer/developer of https://heudiconv.readthedocs.io/ (tool) and http://reproin.repronim.org/ ( convention + heuristic) to automate conversion into BIDS. The aforementioned http://datasets.datalad.org/?dir=/dbic/QA is an example of such automatically converted dataset. Underlying tool is https://github.com/rordenlab/dcm2niix which does

And is there any study-level and series level metadata that BIDS can generate and store at the correct directory?

I might not be understanding fully but I think the answer is/should be yes . May be we would need to produce some UUIDs if tools rely on UUIDs (as opposed to some other arbitrary unique ids).
Could you point me to the metadata record specification we should produce?

yarikoptic commented 1 year ago

if the above is the case, why not just convert NIfTI to DICOM and reuse existing infrastructure from Google Healthcare, dcm4chee and like for the server to feed OHIF - at least for this specific use case?

there is indeed https://github.com/tomaroberts/nii2dcm/ and probably others which could do smth like that. But something needs to provide missing metadata (subject/session etc metadata) or just lack that. But then you would need some service to do such conversion first, which would probably cause performance hit etc.

sedghi commented 1 year ago

@yarikoptic Thanks for your thorough response on the adoption of BIDS. We have one more item to cover in OHIF before we can add nifti support, namely mixing data sources in the worklist and showing studies from DICOM + Nifti together.

Trenser-SandeepNayathil commented 5 months ago

@sedghi Currently as per the Nifti examples, Nifti supports loading in volume viewport. Is there any plan for loading Nifti in stack viewport? so that users can draw the annotations and track it from OHIF viewer.