Thanks for your reply. Sorry but I am still stuck in setting the mask related to my problem.
Left is the fixed image and I only want to focus on the breast ROI which needs to subtract (tumor+1) region for tumor resection. I need to know how the rest of the breast tissue move and determine the location of contour of tumor+2(or further) in moving image through registration. Right is the moving image. Doctors have already contoured the removed tumor region and breast ROI (although not exactly the same range as in fixed image).
I want to set the breast-(tumor+1) as fixed mask (=1) and parameter file “ErodeFixedMask false”. But I am not sure about the moving mask and the ErodeMovingMask setting.
I have tried setting breast-tumorbed (tumorbed means removed tumor region) and whole-tumorbed (which just maskout the noncorresponding tumorbed region in whole moving image) to mask (=1). And (1)when I set breast-tumorbed to mask=1, both ErodeMovingMask setting (true or false) run in error. [Description: itk::ERROR: AdvancedMattesMutualInformationMetric(00000000037437E0): Too many samples map outside moving image buffer: 0 / 34491] (2)when I set whole-tumorbed to mask=1, both setting can run without error. But “ErodeFixedMask false” setting seems not to consider my moving mask (the log file indicates that “Setting the moving masks took: 0 ms”).
Now I can run with fixed mask=breast-(tumor+1) (=1) and “ErodeFixedMask false”; moving mask=whole-tumorbed (=1) and “ErodeMovingMask true”. And I just don’t know the difference, especially the “true” setting. How does it consider the mask region?
I have looked through the elastix manual 5.4 Masks but still have no idea. The details are shown below.
Description
Sometimes you are specifically interested in aligning only a part of the image. A possibility to focus on this
part is to crop the image. Cropping, however, restricts the region of interest (ROI) to be a square (2D) or
cube (3D) only. If you need an irregular shaped ROI, you can use masks. A mask is a binary image, filled
with 0’s and 1’s. If you use a mask, you only perform registration on the part of the image that is within
the masks, i.e. where the mask has 1’s.
You can/should use a mask
• when your image contains an artificial edge that has no real meaning. The registration might be
tempted to align these artificial edges, thereby neglecting the meaningful edges. The conic beam edge
in ultrasound images is an example of such an artificial edge.
• when the image contains structures in the neighbourhood of your ROI that may influence the registration
within your ROI. This is for example the case when matching lung data. Usually, you are
interested in the lungs, and not if the rib cage is well aligned. However, the ribs are structures that
for example in CT can have a strong influence on the similarity metric, especially if you use the MSD
metric. In that case, the rib cage may be well aligned at the cost of vessels structures near the border
of the lung with the rib cage. In this case it will help you if you use a dilated lung segmentation as a
mask.
Masks can be used both for the fixed and the moving image. A fixed image mask is sufficient to focus
the registration on a ROI, since samples are drawn from the fixed image. You only want to use a mask for
the moving image when your moving image contains nonsense grey values near the ROI.
In case you are using a mask to prevent bad karma from an artificial edge, you also need to set the
parameter:
(ErodeMask “true”)
If not, then when performing multi-resolution, information from the artificial edge will flow into you ROI
due to the smoothing step. In case the edge around your ROI is meaningful, e.g. in the lung example, you
should set it to false, because this edge will help to guide the registration.
A common exception that elastix throws when drawing samples is: “Could not find enough image
samples within reasonable time. Probably the mask is too small.” The probable cause for this is that your
fixed image mask is too small. See the FAQ for more information.
Do you have any suggestions about my case? Your help is highly appreciated.
Crayon