View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002466 | Slicer4 | Core: CLI infrastructure | public | 2012-09-03 09:50 | 2018-03-02 11:06 |
Reporter | fedorov | Assigned To | inorton | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | |||||
Target Version | Slicer 4.5.0-1 | Fixed in Version | Slicer 4.5.0-1 | ||
Summary | 0002466: CLIs that use DVW nodes crash in MRMLIDImageIO | ||||
Description | // --------- EDIT by Jc based on Francois comment 12656 Steps to reproduce the error: At this point I have a crash: Thread 4 Crashed: | ||||
Tags | No tags attached. | ||||
related to | 0001859 | closed | fbudin | ResampleDTI does not handle the measurement frame |
has duplicate | 0004053 | closed | inorton | slicer 4.4.4 crashes with DTI resampling (Windows 10) |
has duplicate | 0004030 | closed | inorton | Can't read back DWI nodes with MRML IO (shared library) |
related to | 0002400 | closed | alexy | Rename the "Create and rename new Node" command to "Create new Node as..." |
Demian, you commented out bvalue computation on line 853 in MRMLIDImageIO |
|
Demian can also help sort this out. |
|
I am pretty sure the problem comes from Slicer, but I could be wrong. When I run this module in a terminal, it seems to work perfectly. However, from within Slicer4, it crashes, or gives a bad output. |
|
I just tried to replicate this bug on a build of the current trunk (r22207). I followed the steps listed above but got no crash and the result looked reasonable (mac, debug build). |
|
I just realized some tests with the nightly build for linux64 (r22208) and here are my results: |
|
I was able to reproduce this. I'm using a mac with a developer build of the current trunk (r22209). Steps:
|
|
@Demian - Can you have another look at what you did in this commit: https://github.com/Slicer/Slicer/commit/bc3f4d6b You commented out a block of code (why?) that included the line which populates the bvalues vector: https://github.com/Slicer/Slicer/blob/master/Libs/MRML/IDImageIO/itkMRMLIDImageIO.cxx#L859 As a result, when I run the steps from my previous note in the debugger, it crashes at line 875 because it accesses past the end of the vector: https://github.com/Slicer/Slicer/blob/master/Libs/MRML/IDImageIO/itkMRMLIDImageIO.cxx#L875 Thanks in advance, |
|
Reminder sent to: demian @Demian: What do you think of Steve remark ? (see note 9128) |
|
I had commented that because it was performing the normalization of the gradients. And, in some cases incurr in a divided by 0 error on line 884 and also generated a discrepancy when loading and saving the same file without modificationts. https://github.com/Slicer/Slicer/blob/master/Libs/MRML/IDImageIO/itkMRMLIDImageIO.cxx#L884 The gradients of the DWI image should be normalized by its specification so, including a new normalization seemed like something that should not have been done here. Probably a better idea would have been to throw an exception and force the code making use of this of this IO to perform the normalization on the outside. What do you think? |
|
I forgot to say that the NRRD spec is that there is only 1 reference b-value and then the norm of each gradient times that b-value is the actual b-value of the DWI image. When I looked at the code to handle this in ITK, this was the case but maybe it was update to a different scheme now? It is not clearly documented if we should keep that (meaning erasing line 895) or normalize all gradients again. I'm currently off site. I can check this beter next week. @Francois, could you check how is that you are feeding the gradient directions into the output? Are they according to the NRRD standard? (1 reference bvalue and the b-value of each gradient is the norm of the gradient times the reference one) Thanks |
|
Reminder sent to: fbudin @Francois: Could you comment. Thanks |
|
In ResampleScalarVectorDWIVolume, when transforming a DWI, the transform is applied directly to the gradient vector. The vector is not normalized. This, as far as I understand follows the NRRD specifications that Demian was mentioning. See: The gradient directions are then just written in the output image metadata dictionary as they were in the input image. Warning: obviously, the user has to be careful to only apply a rotation or a translation transform (rigid transform in ITK3), otherwise the output image will be meaningless. |
|
Did we get a final resolution on this? |
|
@pieper: the steps provided in the original report crash Slicer as before, so nothing changed as far as the user is concerned |
|
The problem is still the same. Seem my comment (0009106) above. Slicer4 still does not offer to choose the type of the output node for a CLI. In Slicer3, the user had to choose. In Slicer4, to select the output of the CLI, the user can either create a new volume (scalar, no choice), or use an existing volume. |
|
We think we have a plan:
|
|
Reminder sent to: finetjul @j2 - can you comment on this plan? |
|
It seems feedback from Julian is needed. |
|
Seems like a good plan. The baseName property could become a QStringList to support multiple node types that can be created by the combobox. |
|
Resolving the issue since I am not able to reproduce this problem using Slicer r23759. Please, re-open if this is still a problem. |
|
Steps to reproduce the error: Additional note: If you run the module with a scalar image, it will work correctly. The problem is that Resample Scalar/Vector/DWI Volume can create different types of output depending on the input image. In Slicer3, the user would select the type of the output node when creating a new output volume. In Slicer4, this is not the case anymore. The output volume created is always a scalar volume, which will lead to Slicer crashing if you run this module with a vector image or a DWI. |
|
Looking at this issue, I tried the following: Then, if I either wait or click on "Cancel", it crashed in the function "MRMLIDImageIO::SetDWNodeValues". The function tried to get the values of the "bvalues" vector never filled with values. See [1] This regression was most likely introduced by r20150 (BUG: Fixed bug 0002062, 0001781: problem when loading and saving DWI files) in an attempt to address 0002062 and 0001781 |
|
We revisited this issue as part of our developer hangout [1]. Looking at the code that was commented out [2] it seems that (1) the b-values are needed in order to avoid the crash reported here (2) the gradients should be normalized for a mrml diffusion weighted volume node [3] (3) there seems to be a mistake in the commented out code that it is missing a factor of 2 compared to the documentation [4]. That is, if the reference b-value is 1000, a vector 1,1,0 should have a b-value 1000 and a vector .707,.707,0 should have a b-value of 500, but the code in the block that is comment out [2] doesn't account for that factor of 2. [1] http://www.slicer.org/slicerWiki/index.php/Developer_Meetings/20150922#To_Discuss |
|
I don't think this issue should be assigned to me. It is a problem in Slicer, not in ResampleScalarVectorDWIVolume. |
|
Hi Francois, I guess it was assigned to you because the problem initially happen when using ResampleScalarVectorDWIVolume. That said, what do you think of the comment in http://www.na-mic.org/Bug/view.php?id=2466#c13303 ? |
|
To answer Demian's question, ResampleScalarVectorDWIVolume does not much with the gradients. If the input image contains gradients (i.e. it is a DWI), it transforms them if the given transform is invertible. If the transform is not invertible, it gives a warning/error message. So if the input DWI respects the NRRD standard, the output DWI will also respect the NRRD standard. One should not use this module to resample a DWI with an affine transform. Even though this module will give an output, the output is not going to be correct. |
|
Hi guys. I see this is assigned to me but I am confused. Is there still a crash in this module as in the initial bug? Or is the bug now that the expected behavior is not produced when the DWI volume is inside an affine transform? As another note, I believe the documentation [4] mentioned by Steve is incorrect, as I noticed looking at it recently, so this should be revisited. I believe the numbers in the example are wrong (the .707 should either be squared or the square root, or similar. I forget exactly what now). |
|
Thanks for your comment. And do you have any feedback regarding the specific issue reported in http://www.na-mic.org/Bug/view.php?id=2466#c13303 |
|
Thanks JC. I see now where I should look. I will have to look into this more next week when I am back from MICCAI. |
|
I don't have any additional comment. The only thing that is dangerous with Slicer though is that if you let the user choose the type of output volume like in ResampleScalarVectorDWIVolume, even if everything goes well during the computation and that the problem mention above is corrected, Slicer might still crash if the user chooses the wrong type of output (e.g. if the user chooses a DTI or scalar output node when the input was actually a DWI). But that is a different issue. |
|
I agree with Francois that we should look at how to handle this polymorphic case in the execution model. Lauren, maybe you and I can talk about it at some point. I agree that documentation in [4] surprised me. |
|
I believe what is wrong in [4] is that the b-value in the NRRD header should be 500 as it would have the b-vectors corresponding to b=500 normalized (which they are) and the b-vectors corresponding to b=1000 with a norm that is larger than one [norm_7 = 1 sqrt (1000/500) = sqrt(2) = sqrt( 11 + 00 + 11 ) ]. Otherwise the norm of the b-vectors that correspond to b-val=1000 should be normalized and the norm of the vector corresponding to b-val=500 should be smaller than 1 (sqrt(1/2)), and therefore DWMRI_gradient_0001:=.5 0 .5 |
|
Fixed in r24724 |
|
Import 2017-06-07 23:51:09: master 832654c9 2015-11-11 16:12:13 Details Diff |
BUG: Fix 0002466, MRMLIDImageIO crashes with DWMRI volume http://www.na-mic.org/Bug/view.php?id=2466 Restore handling of b-values and gradients, and make code consistent with DWIConvert: use the `sqrt(b/b_max)` scaling factor as documented on the NA-MIC wiki page: http://wiki.na-mic.org/Wiki/index.php/NAMIC_Wiki:DTI:Nrrd_format Reviewed-by: Francois Budin <fbudin@unc.edu> Reviewed-by: Lauren O'Donnell <odonnell@bwh.harvard.edu> Reviewed-by: Steve Pieper <pieper@isomics.com> Tested-by: Isaiah Norton <inorton@bwh.harvard.edu> From: Isaiah Norton <inorton@bwh.harvard.edu> git-svn-id: http://svn.slicer.org/Slicer4/trunk@24724 3bd1e089-480b-0410-8dfb-8563597acbee |
||
mod - Libs/MRML/Core/vtkMRMLNRRDStorageNode.cxx | Diff File | ||
mod - Libs/MRML/IDImageIO/itkMRMLIDImageIO.cxx | Diff File | ||
mod - Libs/vtkTeem/vtkNRRDWriter.cxx | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-09-03 09:50 | fedorov | New Issue | |
2012-09-03 09:50 | fedorov | Status | new => assigned |
2012-09-03 09:50 | fedorov | Assigned To | => millerjv |
2012-10-30 10:38 | pieper | Assigned To | millerjv => alexy |
2012-12-08 10:10 | jcfr | Target Version | => Slicer 4.2.3 |
2012-12-18 06:08 | alexy | Note Added: 0007521 | |
2012-12-18 06:08 | alexy | Assigned To | alexy => demian |
2013-01-10 07:58 | demian | Relationship added | related to 0001859 |
2013-02-12 09:37 | jcfr | Target Version | Slicer 4.2.3 => Slicer 4.3.0 |
2013-07-16 11:23 | pieper | Assigned To | demian => fbudin |
2013-07-16 11:23 | pieper | Note Added: 0009076 | |
2013-07-16 11:23 | pieper | Status | assigned => feedback |
2013-07-17 11:41 | fbudin | Note Added: 0009106 | |
2013-07-17 14:11 | pieper | Note Added: 0009115 | |
2013-07-18 05:48 | fbudin | Note Added: 0009123 | |
2013-07-18 06:09 | pieper | Note Added: 0009125 | |
2013-07-18 06:32 | pieper | Status | feedback => assigned |
2013-07-18 06:32 | pieper | Assigned To | fbudin => demian |
2013-07-18 06:36 | pieper | Note Added: 0009128 | |
2013-07-31 20:49 | jcfr | Note Added: 0009324 | |
2013-08-06 08:33 | demian | Note Added: 0009399 | |
2013-08-06 08:42 | demian | Note Added: 0009401 | |
2013-08-06 08:47 | jcfr | Note Added: 0009402 | |
2013-08-07 09:14 | fbudin | Note Added: 0009421 | |
2013-08-27 11:54 | pieper | Note Added: 0009640 | |
2013-08-27 12:07 | jcfr | Status | assigned => feedback |
2013-09-02 19:15 | jcfr | Target Version | Slicer 4.3.0 => Slicer 4.3.1 |
2013-09-03 03:32 | fedorov | Note Added: 0009815 | |
2013-09-03 03:33 | fedorov | Status | feedback => assigned |
2013-10-04 00:52 | jcfr | Target Version | Slicer 4.3.1 => Slicer 4.3.2 |
2014-03-06 10:15 | nicole | Target Version | Slicer 4.3.2 => Slicer 4.4.0 |
2014-03-06 10:20 | nicole | Assigned To | demian => alexy |
2014-03-06 10:47 | fbudin | Note Added: 0011256 | |
2014-03-07 05:56 | pieper | Note Added: 0011320 | |
2014-03-07 05:56 | pieper | Note Added: 0011321 | |
2014-03-07 05:56 | pieper | Status | assigned => feedback |
2014-03-07 06:47 | pieper | Relationship added | related to 0002400 |
2014-06-13 09:55 | alexy | Note Added: 0012058 | |
2014-06-13 09:55 | alexy | Assigned To | alexy => finetjul |
2014-06-16 04:34 | finetjul | Note Added: 0012070 | |
2014-10-28 21:54 | jcfr | Note Added: 0012655 | |
2014-10-28 21:54 | jcfr | Status | feedback => resolved |
2014-10-28 21:54 | jcfr | Fixed in Version | => Slicer 4.4.0 |
2014-10-28 21:54 | jcfr | Resolution | open => unable to reproduce |
2014-10-29 06:11 | fbudin | Status | resolved => confirmed |
2014-10-29 06:18 | fbudin | Note Added: 0012656 | |
2014-10-29 08:08 | jcfr | Description Updated | |
2014-10-29 08:09 | jcfr | Assigned To | finetjul => jcfr |
2014-10-29 08:09 | jcfr | Description Updated | |
2014-11-02 03:31 | jcfr | Target Version | Slicer 4.4.0 => Slicer 4.4.1 |
2015-09-09 08:28 | jcfr | Target Version | Slicer 4.4.1 => Slicer 4.5.0-1 |
2015-09-22 09:46 | jcfr | Note Added: 0013294 | |
2015-09-22 09:47 | jcfr | Assigned To | jcfr => fbudin |
2015-09-22 09:47 | jcfr | Status | confirmed => feedback |
2015-09-22 09:47 | jcfr | Description Updated | |
2015-09-22 11:52 | pieper | Note Added: 0013303 | |
2015-10-06 07:23 | fbudin | Note Added: 0013338 | |
2015-10-06 09:42 | jcfr | Note Added: 0013340 | |
2015-10-06 09:42 | jcfr | Status | feedback => assigned |
2015-10-06 09:42 | jcfr | Assigned To | fbudin => lauren |
2015-10-06 09:42 | jcfr | Status | assigned => feedback |
2015-10-06 09:57 | fbudin | Note Added: 0013341 | |
2015-10-06 10:13 | lauren | Note Added: 0013342 | |
2015-10-06 10:31 | jcfr | Note Added: 0013343 | |
2015-10-06 10:49 | lauren | Note Added: 0013344 | |
2015-10-06 13:47 | fbudin | Note Added: 0013348 | |
2015-10-07 00:09 | pieper | Note Added: 0013358 | |
2015-10-07 07:31 | fbudin | Note Added: 0013361 | |
2015-11-04 06:26 | inorton | Status | feedback => assigned |
2015-11-04 06:26 | inorton | Assigned To | lauren => inorton |
2015-11-11 08:39 | inorton | Relationship added | has duplicate 0004053 |
2015-11-11 08:41 | inorton | Relationship added | has duplicate 0004030 |
2015-11-11 11:50 | jcfr | Note Added: 0013592 | |
2015-11-11 11:50 | jcfr | Status | assigned => resolved |
2015-11-11 11:50 | jcfr | Fixed in Version | Slicer 4.4.0 => Slicer 4.5.0-1 |
2015-11-11 11:50 | jcfr | Resolution | unable to reproduce => fixed |
2017-06-10 08:51 | jcfr | Changeset attached | => Slicer master 832654c9 |
2018-03-02 11:06 | jcfr | Status | resolved => closed |