View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002982 | Slicer4 | Module BRAINS | public | 2013-02-26 04:08 | 2017-12-07 17:00 |
Reporter | finetjul | Assigned To | hjmjohnson | ||
Priority | low | Severity | major | Reproducibility | always |
Status | closed | Resolution | won't fix | ||
Product Version | Slicer 4.2.2-1 | ||||
Target Version | Fixed in Version | ||||
Summary | 0002982: Resize Image module shifts the image | ||||
Description | When changing the spacing of an image, its origin should be changed as well. | ||||
Steps To Reproduce | Start Slicer | ||||
Additional Information | a) Same problem in "Resample Image" module d) There is no documentation link in the Help & Acknowledgement section. e) The Pixel Type works only with "float" f) all the other resample modules are likely to have the same issue. It is not user friendly to have to manually "offset" the origin when specifying a new spacing. | ||||
Tags | No tags attached. | ||||
2013-02-26 04:09
|
DEBUG_Cube-2.nrrd (334 bytes) |
JC, This is a bug that I would want to get fixed. Can you tell me the name of the program that does this? Hans |
|
In Slicer, the faulty module is: "Resize Image (BRAINS)". |
|
Reminder sent to: finetjul, hjmjohnson, pieper Hi Hans, While we are all attending the project week, would be great to discuss which approach should be considered to fix the issue reported by Julien. |
|
I think to make sure that everybody understand the problem, and agrees on the definition of the different important terms here, some small drawings would be important. Indeed, is the origin of an image defined by the corner of its first voxel or by its center. Does a resampling factor of 2 means interpolating between all the existing points (eg from 10 to 19 points) or doubling the number of points (eg from 10 to 20). What is the convention for ITK? There used to be an option in ITK3 (ITK_USE_CENTERED_PIXEL_COORDINATES_CONSISTENTLY) that was dealing with centered or non-centered voxels. What is the situation in ITK4? |
|
I agree - this is a crucial thing to agree on. Let's try to get the interested parties to sit around by a blackboard today and work out the details. We want slicer to have the origin at the center of the voxel: http://www.slicer.org/slicerWiki/index.php/Coordinate_systems#Image_coordinate_system we can use the DataProbe to confirm this with data. Probably we should write some tests to confirm this stays constant through resamplings. |
|
I agree. We should invite Brad Lowekamp as well. The sub-sampling operation has a bit of ambiguity in how you interpret what should happen to the origin. Brad has some examples that he made previously that may be useful in determining what to do. I'd be happy to meet, but today is already pretty packed for me. |
|
There are two things relevant here: a) Where is the origin? In Slicer 4, DICOM [2], and apparently ITK, the origin is in the voxel center (on the sampling point), while in MeVisLab, it is at the voxel corner [3,4]. [2] http://nipy.org/nibabel/dicom/dicom_orientation.html b) Where is the interpolated image sampled? If the sampling grid is given, there is no ambiguity, but if you just give a resampling factor / changed spacing, the main question is whether you make the outermost new sampling points coincide with the outermost old sampling (which makes most sense from an interpolation and data loss prevention perspective), or whether you want the outermost voxel /sides/ to stay the same (i.e. "the area covered by the voxels should not change". Ideally, everybody would accept that the outermost voxels are displayed with a different (smaller) size, then we would only have to interpolate between sampling points. (This is also related to the big, religious discussion about what a voxel is - is it a box? a point? something in between? There is no unique answer to that and I don't want to get this discussion started here.) Now back to the bug report: The origin should not change, if it denotes the voxel center, and the new resampling grid is "sane". With "sane" I mean that if the voxel spacing is decreased by an integer factor, the old sampling points (and thus their values, since we're interpolating them) will be retained. This is highly desirable, because that means that even with linear interpolation, there is no information loss. On the other hand, that means that the new image size is not an integer multiple of the old one, but e.g. new_width = (old_width - 1) factor + 1. In other words, reducing the spacing by a factor of two would turn a (128x128) image into a (255x255) one. That's good, but often unexpected to people who did not think about this (cf. the "Ideally, everybody would accept..." sentence). () (*) Do you remember this math question from school? "Bert is building a fence along the street with 12 posts that he puts 10m apart each. How long is the fence?" (OK, it might've been 30feet each for you. ;-) ) |
|
@hjmjohnson: Do you think the steps reported by Julien leads to a valid result ? If not, it should probably be investigated. If not time for 4.3 release, let me know and we will re-target. Thanks |
|
2013-08-20 13:07
|
18991230_010000s098a098.nii (2,352 bytes) |
2013-08-22 12:50
|
|
I talked this over with Julien and then with Jim and here is where we stand: 1) The Resample Scalar Volume module uses the input origin as the output origin. 2) Based on this experiment, I would say that both the ITK resampler and the slicer visualization 3) The Resample Scalar Volume module should arguably be changed to adjust the origin of the 4) This is unlikely to be an issue in practice because the correct thing to do would be to use 5) The sample data that Julien provided (18991230_010000s098a098.nii) is an odd special case |
|
I changed the priority to low. Unless someone disagrees with my point four above I will take this off the 4.3 target list. |
|
3) How about adding a boolean option to conditionally adjust the origin ? 4&5) The issue originally happened when trying to upsample a labelmap (with no underlying scan) |
|
If no reference volume is provided, I would suggest to adjust the origin. That way no boolean would be required. Pros: Simple Cons: break backward compatibility |
|
I agree with JC; that would be a clear bug fix and backwards compatibility should not be a real issue here. (The alternative could've been to change the definition of the resampling grid such that the origin stays the same, but that would be much more invasive, i.e. change the image data.) I also agree with Steve's point 4; in practice, most users will resample to a given image's grid. Nevertheless, there is the case of initial upsampling, e.g. for better accuracy. |
|
This issue has been extensively reviewed. Several proposals were made to address specific use cases by individuals, but no implementation has been provided. I'd be happy to review and accept patches that address an individuals concerns, but I do not have resources to attempt to add features for which I do not have testable use cases. |
|
Reference data and further information requested but not provided. We do not have necessary information. Closing stale issue. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2013-02-26 04:08 | finetjul | New Issue | |
2013-02-26 04:08 | finetjul | Status | new => assigned |
2013-02-26 04:08 | finetjul | Assigned To | => hjmjohnson |
2013-02-26 04:09 | finetjul | File Added: DEBUG_Cube-2.nrrd | |
2013-02-26 04:11 | finetjul | Additional Information Updated | |
2013-02-26 10:42 | hjmjohnson | Note Added: 0008049 | |
2013-02-26 10:50 | finetjul | Note Added: 0008050 | |
2013-06-18 20:03 | jcfr | Note Added: 0008784 | |
2013-06-18 20:25 | fbudin | Note Added: 0008785 | |
2013-06-19 03:06 | pieper | Note Added: 0008786 | |
2013-06-19 03:11 | hjmjohnson | Note Added: 0008787 | |
2013-06-19 07:02 | hans_meine | Note Added: 0008788 | |
2013-08-20 12:56 | jcfr | Note Added: 0009535 | |
2013-08-20 13:07 | finetjul | File Added: 18991230_010000s098a098.nii | |
2013-08-22 12:50 | pieper | File Added: MRHead-first resampled to 10mm then that resampled to 1mm.png | |
2013-08-22 13:16 | pieper | Note Added: 0009551 | |
2013-08-22 13:17 | pieper | Priority | high => low |
2013-08-22 13:18 | pieper | Note Added: 0009552 | |
2013-08-22 13:33 | finetjul | Note Added: 0009553 | |
2013-08-22 13:39 | jcfr | Note Added: 0009554 | |
2013-08-22 19:44 | hans_meine | Note Added: 0009559 | |
2013-08-27 12:13 | jcfr | Target Version | Slicer 4.3.0 => Slicer 4.4.0 |
2014-07-19 06:13 | hjmjohnson | Note Added: 0012204 | |
2014-07-19 06:13 | hjmjohnson | Status | assigned => closed |
2014-07-19 06:13 | hjmjohnson | Resolution | open => won't fix |
2014-07-19 08:37 | jcfr | Status | closed => feedback |
2014-07-19 08:37 | jcfr | Target Version | Slicer 4.4.0 => |
2015-01-09 07:08 | hjmjohnson | Note Added: 0012870 | |
2015-01-09 07:08 | hjmjohnson | Status | feedback => closed |
2017-12-07 17:00 | jcfr | File Added: 2013.08.20_Hangout_sketchpad.png |