-
Notifications
You must be signed in to change notification settings - Fork 149
Transformation map not working #30
Comments
The output you see is just transformix telling you what is doing while it is running (useful for debugging). |
@kaspermarstal No unfortunately transformix doesn't warp the image. See the output above:
I am attaching the 2 test images that I am trying to register for your convenience. Thanks! |
Thanks for the images. The
Perhaps you can make a mean image of fixed and moving images and a mean image of fixed and result images to confirm that a transformation takes place? |
I should add a section to the documentation on how to interpret the log, I'd give you that 😊 |
@kaspermarstal Thanks for clarifying. After testing the output of the transformix I saw that it has indeed applied the warping. It looked as if it hadn't applied it because it was so close to each other :) |
@kaspermarstal So I am following I perform registration on 2 images and then I apply the transformation map on a 3rd image "image.nii" and I get the following messages on the console:
Here is code. I don't understand what I need to pass to
transformix
other than the transformation map calculated previously.`public void simpleelastixtest() {
CastImageFilter caster = new CastImageFilter();
caster.setOutputPixelType(PixelIDValueEnum.sitkFloat32);
// Instantiate SimpleElastix
org.itk.simple.SimpleElastix elastix = new org.itk.simple.SimpleElastix();
// Read input
org.itk.simple.ImageFileReader reader1 = new org.itk.simple.ImageFileReader();
reader1.setFileName("brain1.png");
Image castImage1 = caster.execute(reader1.execute());
elastix.setFixedImage(castImage1);
org.itk.simple.ImageFileReader reader2 = new org.itk.simple.ImageFileReader();
reader2.setFileName("brain2.png");
Image castImage2 = caster.execute(reader2.execute());
elastix.setMovingImage(castImage2);
elastix.setParameterMap(elastix.getDefaultParameterMap("nonrigid"));
elastix.logToConsoleOn();
elastix.logToFolder("\elastixtestlogs");
// Perform registration
elastix.execute();
// Write result image
ImageFileWriter writer = new org.itk.simple.ImageFileWriter();
writer.execute(elastix.getResultImage(),"output.nii",false);
//Apply transformation map
org.itk.simple.ImageFileReader reader3 = new org.itk.simple.ImageFileReader();
reader3.setFileName("image.nii");
org.itk.simple.SimpleTransformix transformix = new org.itk.simple.SimpleTransformix();
transformix.logToFolder("\elastixtestlogs");
transformix.setInputImage(reader3.execute());
transformix.setTransformParameterMap(elastix.getTransformParameterMap());
org.itk.simple.Image resultMask = transformix.execute()
writer.execute(resultMask, "result.nii", false);
}`
The text was updated successfully, but these errors were encountered: