View Issue Details

IDProjectCategoryView StatusLast Update
0003753Slicer4Module LabelStatisticspublic2014-09-03 07:29
Reporterfedorov Assigned Topieper  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.4.0Fixed in VersionSlicer 4.3.1 
Summary0003753: LabelStatistics reports incorrect stats when label image pixel order is different from that of the image volume
Description

Example datasets are attached. The two labels look identical in slicer, but the results are different. This should probably be fixed by LabelStatistics doing resampling of the input label volume to the raster of the image volume.

TagsNo tags attached.

Activities

2014-07-01 09:26

 

2014-07-01 09:26

 

2014-07-01 09:27

 

good_label.nrrd (71,131 bytes)

2014-07-01 09:27

 

bad_label.nii.gz (140,904 bytes)

2014-07-01 09:29

 

fedorov

fedorov

2014-07-01 09:33

developer   ~0012116

Unable to upload the image volume, file too big. Use TCIABrowser extension to download LIDC-IDRI-00314 volume used in the illustration.

wangk

wangk

2014-07-18 10:22

developer   ~0012195

Hi Andrey,

We have encountered similar issue in the past regarding using different labelmap for statistics. the solution is to resample the labelmap according to input image.

We have created a utility function in SlicerRT for this purpose. see [1]. the intention is to integrate this into Slicer's Volumes module logic. if you think it is useful after you review it, then we can start the process to integrate it into trunk.

Thanks,

Kevin

[1] https://www.assembla.com/code/slicerrt/subversion/nodes/1872/trunk/SlicerRt/src/SlicerRtCommon/vtkVolumesOrientedResampleUtility.cxx
[2] http://www.na-mic.org/Wiki/index.php/Common_resampling_and_conversion_utility_functions_in_Slicer
[3] https://www.assembla.com/spaces/slicerrt/tickets/303#/activity/ticket:

fedorov

fedorov

2014-07-18 11:07

developer   ~0012197

Kevin, thank you for adding this information, I was not aware of that project. I think the right thing is to get Steve on board, since he is the author of LabelStatistics and has a vision what is the right thing to do for the trunk. I know Steve added error checks to LabelStatistics to ensure orientation is consistent, but I am not sure if he would prefer to add the resampling function. I will assign to Steve.

pieper

pieper

2014-07-18 11:15

administrator   ~0012199

Yes, it seems logical to add this resampling directly to the LabelStatistics module and invoke if if the geometries are different.

I had used the brains resample cli with an identity transform to fix this when it came up for Andrey, but I agree it would be better for users if it happened automatically.

I don't have plans to work on LabelStatistics right now, but probably will later when the qiicr pet/ct metrics are ready to integrate. If someone else wants to make a patch and pull request I'd be happy to review it.

wangk

wangk

2014-07-18 12:06

developer   ~0012200

Hi Steve,

Thanks for your info. I was not aware of using brains resample cli for this purpose. seems you have already found a solution.

so now there are 2 options:
option 1: transfer the resampling code (based on VTK) in SlicerRT to the Volumes module logic class.
option 2: using brains resample cli (based on ITK) in labelstatistics module logic class.

option 2 requires minimal changes to slicer trunk which seems to be less work and requires less maintenance.

option 1 is good if this utility function is required in a lot of c++ loadable modules then direct access is more convenient.

so which one do you guys prefer? once decided, I can work on the solution and create a pull request.

Thanks,
-Kevin

pieper

pieper

2014-07-18 12:23

administrator   ~0012201

Hi Kevin - I agree that your option 1 is a more general solution - I think the issue comes up often enough that people would want to use it for various purposes (I've written such a utility a couple times myself and never put it in volumes logic -- shame on me!).

But if you would consider doing the integration using your existing SlicerRT code that would be great.

wangk

wangk

2014-07-21 10:47

developer   ~0012213

Hi Steve,

Thanks for the comments. I will start to work on a topic branch and ask you to review it once it is ready.

Kevin

wangk

wangk

2014-07-22 11:12

developer   ~0012218

Topic pushed to https://github.com/kevinwangcanada/Slicer/tree/3753-LabelStatistics-reports-incorrect-stats

Can you guys review it please?

Thanks,

Kevin

pieper

pieper

2014-07-23 13:17

administrator   ~0012237

I added some comments on the commit -- generally looks good though.

wangk

wangk

2014-07-24 07:36

developer   ~0012243

Thanks Steve for the quick review. I have changed code accordingly. in summary, I added a new method to clone the volume without copy the imagedata as I did not want to change the API. if it works ok, then we can discuss how to refactor the code to have a single clonevolume logic.

I have pushed the code to github: https://github.com/kevinwangcanada/Slicer/tree/3753-LabelStatistics-reports-incorrect-stats

pieper

pieper

2014-07-29 14:22

administrator   ~0012280

committed in r23491 and r23492.

Thanks Kevin!

wangk

wangk

2014-08-01 06:25

developer   ~0012326

Thanks Steve for quick integration.

wangk

wangk

2014-08-01 06:56

developer   ~0012327

Hi Steve,

sorry there is a mistake in the patch. I forgot to declare the method static. could you please fix that?

Thanks,

Kevin

wangk

wangk

2014-08-01 06:58

developer   ~0012328

Hi Steve,

sorry there is a mistake in the patch. I forgot to declare the method static. could you please fix that?

Thanks,

Kevin

pieper

pieper

2014-08-01 07:19

administrator   ~0012329

Done: http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=23534

wangk

wangk

2014-08-01 07:24

developer   ~0012330

thanks for the quick fix!

fedorov

fedorov

2014-08-06 08:19

developer   ~0012357

Thanks a lot for working on this! Sorry I am unable to test to confirm resolution and close the issue, since Slicer is unusable on Mac at the moment. Does not start up.

Issue History

Date Modified Username Field Change
2014-07-01 09:24 fedorov New Issue
2014-07-01 09:26 fedorov File Added: Screen Shot 2014-07-01 at 1.17.24 PM.png
2014-07-01 09:26 fedorov File Added: Screen Shot 2014-07-01 at 1.17.35 PM.png
2014-07-01 09:27 fedorov File Added: good_label.nrrd
2014-07-01 09:27 fedorov File Added: bad_label.nii.gz
2014-07-01 09:29 fedorov File Added: Screenshot at Jul 01 13-20-19.png
2014-07-01 09:33 fedorov Note Added: 0012116
2014-07-18 10:22 wangk Note Added: 0012195
2014-07-18 11:07 fedorov Note Added: 0012197
2014-07-18 11:07 fedorov Status new => assigned
2014-07-18 11:07 fedorov Assigned To => pieper
2014-07-18 11:15 pieper Note Added: 0012199
2014-07-18 12:06 wangk Note Added: 0012200
2014-07-18 12:23 pieper Note Added: 0012201
2014-07-21 10:47 wangk Note Added: 0012213
2014-07-22 11:12 wangk Note Added: 0012218
2014-07-23 13:17 pieper Note Added: 0012237
2014-07-24 07:36 wangk Note Added: 0012243
2014-07-29 14:22 pieper Note Added: 0012280
2014-07-29 14:22 pieper Status assigned => resolved
2014-07-29 14:22 pieper Fixed in Version => Slicer 4.4.0
2014-07-29 14:22 pieper Resolution open => fixed
2014-08-01 06:25 wangk Note Added: 0012326
2014-08-01 06:56 wangk Note Added: 0012327
2014-08-01 06:58 wangk Note Added: 0012328
2014-08-01 06:58 wangk Status resolved => assigned
2014-08-01 07:19 pieper Note Added: 0012329
2014-08-01 07:24 wangk Note Added: 0012330
2014-08-01 07:24 wangk Status assigned => resolved
2014-08-01 08:02 jcfr Target Version => Slicer 4.4.0
2014-08-06 08:19 fedorov Note Added: 0012357
2014-09-03 07:29 fedorov Status resolved => closed
2014-09-03 07:29 fedorov Fixed in Version Slicer 4.4.0 => Slicer 4.3.1