Commit 6cbc9962 authored by Kasper Marstal's avatar Kasper Marstal
Browse files

ENH: Add support for displacement fields of different sizes and in different...

ENH: Add support for displacement fields of different sizes and in different world coordinate systems
parent dbd019cd
......@@ -344,13 +344,16 @@ def compose_displacement_fields(superelastix, disp_field_file_name_0, disp_field
output_image_file_name = output_image_base_name + '_inverse_consistency' + "." + output_image_ext
try:
stdout = subprocess.check_output([superelastix,
'--conf', os.path.join(os.path.dirname(os.path.realpath(__file__)), 'compose_displacement_fields.json'),
'--in', 'WarpingDisplacementField=%s' % disp_field_file_name_0,
'DisplacementField=%s' % disp_field_file_name_1,
'--out', 'DisplacementFieldSink=%s' % output_image_file_name,
'--loglevel', 'trace',
'--logfile', os.path.splitext(output_image_file_name)[0] + '.log'])
cmd = [superelastix,
'--conf', os.path.join(os.path.dirname(os.path.realpath(__file__)), 'compose_displacement_fields.json'),
'--in', 'WarpingDisplacementField=%s' % disp_field_file_name_0,
'DisplacementField=%s' % disp_field_file_name_1,
'--out', 'DisplacementFieldSink=%s' % output_image_file_name,
'--loglevel', 'trace',
'--logfile', os.path.splitext(output_image_file_name)[0] + '.log']
logging.debug(' '.join(cmd))
stdout = subprocess.check_output(cmd)
except Exception as e:
logging.error('Failed to compose blueprints %s and %s' % (disp_field_file_name_0, disp_field_file_name_1))
raise e
......
......@@ -23,7 +23,7 @@
#include "selxSuperElastixComponent.h"
#include "selxItkObjectInterfaces.h"
#include "itkComposeDisplacementFieldsImageFilter.h"
#include "selxComposeDisplacementFieldsImageFilter.h"
namespace selx {
......@@ -55,7 +55,7 @@ public:
using WarpingDisplacementFieldType = typename WarpingDisplacementFieldInterfaceType::ItkDisplacementFieldType;
using WarpingDisplacementFieldPointer = typename WarpingDisplacementFieldType::Pointer;
using ComposeDisplacementFieldsImageFilterType = typename itk::ComposeDisplacementFieldsImageFilter< DisplacementFieldType, DisplacementFieldType >;
using ComposeDisplacementFieldsImageFilterType = ComposeDisplacementFieldsImageFilter< DisplacementFieldType, DisplacementFieldType >;
using ComposeDisplacementFieldsImageFilterPointer = typename ComposeDisplacementFieldsImageFilterType::Pointer;
// Accept interfaces
......
......@@ -55,9 +55,14 @@ void
ItkDisplacementFieldComposerComponent< Dimensionality, TPixel, CoordRepType >
::BeforeUpdate()
{
this->m_DisplacementField->UpdateOutputInformation();
this->m_DisplacementField->Update();
this->m_WarpingDisplacementField->Update();
// TODO: By default, the output region is copied to all inputs. Find out where it happens,
// and disable this behaviour
this->m_ComposeDisplacementFieldsImageFilter->SetDisplacementField( this->m_DisplacementField );
this->m_WarpingDisplacementField->UpdateOutputInformation();
this->m_ComposeDisplacementFieldsImageFilter->SetWarpingField( this->m_WarpingDisplacementField );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment