Giter Site home page Giter Site logo

fedorov / multivolumeimporter Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 25.0 229 KB

A 3D Slicer module to support import of multi-volume data from non-DICOM sources, and provide plugin for importing such data from images saved in DICOM.

Home Page: http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/MultiVolumeImporter

License: Other

Python 94.61% CMake 5.39%

multivolumeimporter's Introduction

multivolumeimporter's People

Contributors

adamrankin avatar cpinter avatar drw25 avatar fedorov avatar jamesobutler avatar jcfr avatar lassoan avatar mikebind avatar millerjv avatar phcerdan avatar pieper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

multivolumeimporter's Issues

Loading multiframe dicoms from a folder

Hello,
I am trying to load a multivolume diacom folder with well over 100 images that restart in original location every x number of images. I tried loading w/ and without frame identifier of SliceLocation and get the following error:

Successfully read 0 frames
Traceback (most recent call last):
File "C:/Users/rfran/AppData/Local/NA-MIC/Slicer 5.1.0-2022-05-04/bin/../lib/Slicer-5.1/qt-scripted-modules/MultiVolumeImporter.py", line 235, in onImportButtonClicked
mvImage.SetExtent(frame0Extent)
UnboundLocalError: local variable 'frame0Extent' referenced before assignment

I tried saving the images as an nrrd from 3d slicer and then importing that, but then it says it is only a single frame sequence. Tried this with and without SliceLocation as a frame identifier as well

Ideally, I would be able to create multiple frames using the SliceLocation but am stumbling. Any thoughts?

"Could not load <dir> - as a 3 frames MultiVolume by B.standard value"

The MultiVolumeImporterPlugin breaks when trying to load the data. Sometimes only.

The data has been 'manipulated' to stitch 4 different sections with 138 images each.
This process of stitching generates a directory with all the images (138x4) as a single sequence.
Loading these generated directories as data, sometimes works and sometimes breaks, which might mean that the stitching process is weak and does not check well that the tags modified contained proper information.
The only fields I am modifying in the DICOM files in the stitching process are
['Image Type', 'Series Time', 'Series Description',
'Series Instance UID', 'Series Number', 'Instance Number',
'SAR', 'Frame of Reference UID', 'Slice Location']
I do not discard that the original, unmodified files have tags with missing information for the 3D volume....

========================

The three 2D views are displayed. This is working well with 70% of the data files I am loading...

Environment
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Session start time .......: 2021-09-25 02:21:14
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Slicer version ...........: 4.11.20210226 (revision 29738 / 7a593c8) win-amd64 - installed release
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Operating system .........: Windows / Professional / (Build 18363, Code Page 65001) - 64-bit
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Memory ...................: 32574 MB physical, 37438 MB virtual
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - CPU ......................: GenuineIntel , 8 cores, 8 logical processors
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - VTK configuration ........: OpenGL2 rendering, TBB threading
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Qt configuration .........: version 5.15.1, with SSL, requested OpenGL 3.2 (compatibility profile)
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Developer mode enabled ...: no
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Prefer executable CLI ....: yes
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Application path .........: C:/Users/ignac/AppData/Local/NA-MIC/Slicer 4.11.20210226/bin
[DEBUG][Qt] 25.09.2021 02:21:14 [] (unknown:0) - Additional module paths ..: NA-MIC/Extensions-29738/SlicerOpenCV/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/DeepInfer/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SlicerJupyter/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/SlicerJupyter/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SlicerDMRI/lib/Slicer-4.11/cli-modules, NA-MIC/Extensions-29738/SlicerDMRI/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/SlicerDMRI/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/UKFTractography/lib/Slicer-4.11/cli-modules, NA-MIC/Extensions-29738/UKFTractography/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/UKFTractography/lib/Slicer-4.11/qt-scripted-modules
[DEBUG][Python] 25.09.2021 02:21:16 [Python] (C:\Users\ignac\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Python\Lib\site-packages\pydicom\datadict.py:432) - Reversing DICOM dictionary so can look up tag from a keyword...
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "", line 1, in
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "C:\Users\ignac\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Python\Lib\imp.py", line 170, in load_source
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - module = _exec(spec, sys.modules[name])
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "", line 618, in _exec
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "", line 678, in exec_module
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "", line 219, in _call_with_frames_removed
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - File "C:/Users/ignac/AppData/Local/NA-MIC/Slicer 4.11.20210226/NA-MIC/Extensions-29738/DeepInfer/lib/Slicer-4.11/qt-scripted-modules/DeepInfer.py", line 1, in
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - import Queue
[CRITICAL][Stream] 25.09.2021 02:21:17 [] (unknown:0) - ModuleNotFoundError: No module named 'Queue'
[CRITICAL][Qt] 25.09.2021 02:21:17 [] (unknown:0) - loadSourceAsModule - Failed to load file "C:/Users/ignac/AppData/Local/NA-MIC/Slicer 4.11.20210226/NA-MIC/Extensions-29738/DeepInfer/lib/Slicer-4.11/qt-scripted-modules/DeepInfer.py" as module "DeepInfer" !
[CRITICAL][Qt] 25.09.2021 02:21:17 [] (unknown:0) - Fail to instantiate module "DeepInfer"
[CRITICAL][Qt] 25.09.2021 02:21:17 [] (unknown:0) - The following modules failed to be instantiated:
[CRITICAL][Qt] 25.09.2021 02:21:17 [] (unknown:0) - DeepInfer
[DEBUG][Python] 25.09.2021 02:21:18 [Python] (C:\Users\ignac\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: Annotations
[DEBUG][Python] 25.09.2021 02:21:20 [Python] (C:\Users\ignac\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentEditor
[DEBUG][Python] 25.09.2021 02:21:20 [Python] (C:\Users\ignac\AppData\Local\NA-MIC\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentStatistics
[DEBUG][Qt] 25.09.2021 02:21:20 [] (unknown:0) - Switch to module: "Welcome"
[DEBUG][Qt] 25.09.2021 02:21:41 [] (unknown:0) - Switch to module: ""

NameError: global name 're' is not defined

I am seeing this error when building against Slicer/Slicer@36eaeaf

Adding the following to MultiVolumeImporter.py solves the issue:

import re

Here is the entire error:

Traceback (most recent call last):
File "/home/rortiz/Projects/NIRViewSlicer/build/S-bld/Slicer-build/lib/Slicer-4.4/qt-scripted-modules/MultiVolumeImporter.py", line 189, in onImportButtonClicked
self.humanSort(fileNames)
File "/home/rortiz/Projects/NIRViewSlicer/build/S-bld/Slicer-build/lib/Slicer-4.4/qt-scripted-modules/MultiVolumeImporter.py", line 155, in humanSort
l.sort( key=alphanum_key )
File "/home/rortiz/Projects/NIRViewSlicer/build/S-bld/Slicer-build/lib/Slicer-4.4/qt-scripted-modules/MultiVolumeImporter.py", line 154, in
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
NameError: global name 're' is not defined

Custom handling of timing assignment for Bruker DCE

Need to update the parsing strategy to better handle Bruker DCE import.

As suggested by @speled, the strategy can be as follows:

I believe the multivolume loader uses the field [0018,0080] RepetitionTime
as the frame time. It should be utilizing also [0018,0089] NumberOfPhaseEncodingSteps
The correct frame time in this case (2D FLASH sequence) is: RepetitionTime x NumberOfPhaseEncodingSteps
The solution may be different for different pulse sequences and for different versions of the Paravision software.

Any suggestions how to identify whether this applies in a given dataset?
Well, if:

  1. the manufacturer is Bruker
    [0008,0070] Manufacturer Bruker BioSpin MRI GmbH
  2. the Paravision software version is
    [0018,1020] SoftwareVersions [2] ParaVision Acquisition 6.0.1, ParaVision 6.0.1 LO 46
  3. the sequence is FLASH
    [0018,0024] SequenceName Bruker:FLASH SH 12
  4. the acquisition is 2D
    [0018,0023] MRAcquisitionType 2D CS 2
    Then this should work….

We could have timestamps assigned even when not all the software conditions are met, but with lower confidence. If all conditions are met, confidence can be 1.

Integrate DSC support and make sure existing types are not broken

By the way, I also did some tests on sample data of DCE, 4D Trace, QIN prostate T1 mapping, QIBA T1 mapping phantom and MGH T1 mapping.
It also works for DCE, 4D Trace, QIN prostate T1 mapping and MGH T1 mapping.
However, it might have some small issues when I tried to load QIBA T1 mapping phantom data (attached). The err message is


Traceback (most recent call last):
File "C:\Program Files\Slicer 4.4.0-2015-05-15\lib\Slicer-4.4\qt-scripted-modules\DICOMLib\DICOMWidgets.py", line 708, in loadCheckedLoadables
self.proceedWithReferencedLoadablesSelection()
File "C:\Program Files\Slicer 4.4.0-2015-05-15\lib\Slicer-4.4\qt-scripted-modules\DICOMLib\DICOMWidgets.py", line 751, in proceedWithReferencedLoadablesSelection
if not plugin.load(loadable):
File "C:/Program Files/Slicer 4.4.0-2015-05-15/lib/Slicer-4.4/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 397, in load
mvImageArray.T[frameNumber] = frameImageArray
ValueError: setting an array element with a sequence.


As a result the status bar of loading images cannot reach 100%. But the result was correct. One of the volume was loaded as multi-volume data.

Implement RepetitionTime + InstanceNumber heuristics

In some situations, all time-stamps may be missing, and the following strategy may be needed, as discussed by Tom Chenevert/UMich in the context of QIN DSC analysis challenge:

From: Chenevert, Tom
Date: Mon, Jan 25, 2016 at 11:51 AM
Subject: RE: QIN DSC challenge
To: "Andrey Fedorov", "Schmainda, Kathleen"
Cc: "Malyarenko, Dariya" , "Prah, Melissa"

Hi Andrey;
Regarding temporal sorting of images in the DSC challenge, here is what I did (right or wrong). I (think I?) relied on InstanceNumber for overall sorting, but I still was unsure of slice acq order within a TR interval so I simply set them all to the same time. That is all slices within a given dynamic were acquired simultaneously, given by TR*(nth dynamic - 1). I know this is not physically possible, but it is what I did.

Use SliceLocation to identify frames

This approach can potentially be more robust and generic than using pre-defined fixed tags. The tags across the frames that correspond to the same slice location can be diffed to find the tag that is changing.

Plugin not functional as of Dec 2

Hi Andriy,

I noticed that multi-volume plugin doesn't work on today's nightly version. It doesn't detect any mv loadable and doesn't give any error on python interactor.

Thanks,
Alireza

update importer for sequences in slicer core

importer now fails due to restructuring of sequences now that they are in the core.

Loading a sequence gives this error:

DICOM plugin failed to load 'dMRI_dir107_PA - as a 108 frames Volume Sequence by ImagePositionPatient+InstanceNumber' as a 'MultiVolume'.
Traceback (most recent call last):
  File "/home/researcher/Downloads/Slicer-4.11.0-2020-04-19-linux-amd64/bin/../lib/Slicer-4.11/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 700, in load
    sequenceBrowserModule = slicer.modules.sequencebrowser
AttributeError: module 'modules' has no attribute 'sequencebrowser'

Error happens after successful import.

https://github.com/fedorov/MultiVolumeImporter/blob/master/MultiVolumeImporterPlugin.py#L699

Also see discussion here: Slicer/Slicer#4873

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.