View Issue Details

IDProjectCategoryView StatusLast Update
0003010Slicer4Core: GUIpublic2017-06-07 23:27
Reporterlassoan Assigned Tofinetjul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0003010: Volume module GUI permanently modifies the spacing of the selected volume
Description

If you have choose a volume in the Volumes GUI and have a look (no editing) and then save the volume, the spacing is modified.

How to reproduce:

  • Start Slicer
  • Download the MRHead sample
  • Save the MRHead as volume1.nrrd
  • Open the Volumes module (it selects MRHead as active volume by default)
  • Save the MRHeas as volume2.nrrd
  • Compare the header of the two saved volumes: volume1.nrrd has a Z spacing of -1.2999954223632813, while volume2.nrrd has a Z spacing of 1.3 => ERROR!

Maybe the spacing value is not computed with enough accuracy in the volumes module or it is incorrectly connected to the GUI.

With latest Slicer nightly release on Windows 7, 64-bit.

TagsNo tags attached.

Relationships

related to 0002869 closedwangk Direction Matrix not exposed in volume info widget 
related to 0003011 assignedfinetjul Inconvenient image spacing and origin editing in Volumes module 

Activities

finetjul

finetjul

2013-03-19 12:41

administrator   ~0008170

Most likely due to 0002869

jcfr

jcfr

2013-03-19 13:17

administrator   ~0008172

Last edited: 2013-03-19 13:19

Hi Kevin, could you have a look ? As reported in previous note, this is most likely due to 0002869

wangk

wangk

2013-03-20 12:13

developer   ~0008181

Last edited: 2013-03-20 12:15

Hi All,

I did a bit investigation and here is what I found. This issue is not due to 0002869. instead, it is something in
void qMRMLVolumeInfoWidget::setVolumeNode(vtkMRMLVolumeNode* volumeNode)

here we have the code look like this:

double* spacing = d->VolumeNode->GetSpacing();
int decimals = qMin(qMax(ctk::significantDecimals(spacing[0]),
                         qMax(ctk::significantDecimals(spacing[1]),
                              ctk::significantDecimals(spacing[2]))),
                    8);
d->ImageSpacingWidget->blockSignals(true);
d->ImageSpacingWidget->setDecimals(decimals);
d->ImageSpacingWidget->blockSignals(false);

so the decimal is set to be the minimum of significant decimals of spacing[0], spacing[1], spacing[2] and 8. in our case, the decimals for spacing[0] and spacing[1] is 1 so it is set to 1 which round 1.2999954223632813 to 1.3

I have changed the code to use maximum and now I can see the spacing to be 1.29999542 as shown in picture.

I think we need to come up with a rule how to set the number of decimals and this might be something we can discuss in the slicer hangout.

2013-03-20 12:14

 

incorrectspacing.png (447,566 bytes)
incorrectspacing.png (447,566 bytes)
lassoan

lassoan

2013-03-21 13:06

developer   ~0008194

Nice catch, Kevin. It's important to not change any data in the MRML nodes unless the user changes something in the GUI - this gives protection agains unwanted changes when someone would like to just view data.

The minimum number of decimal digits for origin values should be at least 3, while for scaling and rotation should be about 8-10.
It's very tough to say what should be the maximum number of decimal digits during editing, because we don't want to see a value like 0.13000000000001 instead of 0.13, but at the same time we want to avoid information loss due to rounding.

jcfr

jcfr

2013-03-21 13:09

administrator   ~0008195

Reminder sent to: finetjul

@Julien: What do you think of this issue ?

blowekamp

blowekamp

2013-08-08 06:25

developer   ~0009428

I created a test which illustrates a catastrophic image information failure when this issue is combined with the precision issues:

https://github.com/blowekamp/Slicer/commit/25cf25f5cc4d7c490fab5c21eb871418c32ab9e6

Initial Origin: [547339, 218860, 20904.4]
Viewed Origin: (10000.0, 10000.0, 10000.0)

lassoan

lassoan

2013-08-08 21:34

developer   ~0009432

I find this whole double editing experience extremely frustrating. The behavior has changed a couple of times during the recent months, but it never worked correctly or intuitively.

For example, in the latest version (4.2.0-2013-08-06):
Clear one of the "Origin" fields and try to enter: 1.55555555555555555555... and the field will be filled with garbage such as 1.5656565656555.
Or try to enter 1.99999999999 and you'll see 2999mm.

I think the main problem is that you try to change the data while the user editing it. Maybe it cause by a loop in the model/GUI update (GUI change->model change->GUI change), which could be fixed by making the direction of the automatic synching between the model and the GUI one-way only: if the user modifies anything in the editbox (viewing only or moving the cursor does not mean modification!) then the synchronization direction would be set to GUI->model; if something (not the editbox!) changes the value in the model then the synchronization direction would be set to model->GUI.

finetjul

finetjul

2013-08-09 12:05

administrator   ~0009450

Keeping precision (0003010) is fixed in r22281
Large numbers in Origin (0009428) are fixed in r22282
Odd decimal behavior (0009432) is fixed in r22281

blowekamp

blowekamp

2013-08-10 04:00

developer   ~0009460

Looks like a good fix for my issue.

What about my patch which adds a test for the issue? I don't see any other tests added to check this issue. Is there something wrong with my style or approach there?

finetjul

finetjul

2013-08-15 09:47

administrator   ~0009475

you're patch a great, I'll integrate it asap

jcfr

jcfr

2014-03-06 05:21

administrator   ~0011167

Closing resolved issues that have not been updated in more than 3 months

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file a60cec7a

2013-08-09 15:50:53

finetjul

Details Diff
BUG: Support volume origin and spacing larger than 100000

Issue 0003010 @0009428

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22282 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Widgets/Resources/UI/qMRMLVolumeInfoWidget.ui Diff File
mod - SuperBuild/External_CTK.cmake Diff File

Issue History

Date Modified Username Field Change
2013-03-14 07:35 lassoan New Issue
2013-03-14 07:35 lassoan Status new => assigned
2013-03-14 07:35 lassoan Assigned To => kikinis
2013-03-14 07:46 lassoan Relationship added related to 0003011
2013-03-14 09:37 kikinis Assigned To kikinis => finetjul
2013-03-19 12:41 finetjul Relationship added related to 0002869
2013-03-19 12:41 finetjul Note Added: 0008170
2013-03-19 12:42 finetjul Assigned To finetjul => alexy
2013-03-19 13:16 jcfr Assigned To alexy => wangk
2013-03-19 13:17 jcfr Note Added: 0008172
2013-03-19 13:19 jcfr Note Edited: 0008172
2013-03-20 12:13 wangk Note Added: 0008181
2013-03-20 12:14 wangk File Added: incorrectspacing.png
2013-03-20 12:15 wangk Note Edited: 0008181
2013-03-21 13:06 lassoan Note Added: 0008194
2013-03-21 13:09 jcfr Note Added: 0008195
2013-08-08 06:25 blowekamp Note Added: 0009428
2013-08-08 15:03 finetjul Assigned To wangk => finetjul
2013-08-08 21:34 lassoan Note Added: 0009432
2013-08-09 12:03 finetjul Target Version => Slicer 4.3.0
2013-08-09 12:05 finetjul Note Added: 0009450
2013-08-09 12:05 finetjul Status assigned => resolved
2013-08-09 12:05 finetjul Fixed in Version => Slicer 4.3.0
2013-08-09 12:05 finetjul Resolution open => fixed
2013-08-10 04:00 blowekamp Note Added: 0009460
2013-08-15 09:47 finetjul Note Added: 0009475
2014-03-06 05:21 jcfr Note Added: 0011167
2014-03-06 05:23 jcfr Status resolved => closed
2017-06-07 23:27 finetjul Changeset attached => Slicer 2145-support-for-installing-extension-from-file a60cec7a