Commit 9500c9e3 authored by Gregory C. Sharp's avatar Gregory C. Sharp

Hardened linear warping now fully supported

parent a47a3e53
......@@ -4345,8 +4345,8 @@ set_tests_properties (plm-warp-pointset-c PROPERTIES DEPENDS landmark-warp-c)
## plm warp b: xf = bspline, algorithm = native
## plm warp c: xf = bspline, algorithm = itk, interp = nn
## plm warp d: xf = bspline, algorithm = native, interp = nn
## plm warp f: xf = translation, harden transform
## plm warp g: xf = translation, force resample
## plm warp f: xf = itk-affine-a, harden transform
## plm warp g: xf = itk-affine-b, force resample
## plm warp h: xf = translation, force resample, ushort images
## plm warp i: xf = translation, force resample, double images
## -------------------------------------------------------------------------
......@@ -4450,40 +4450,40 @@ set_tests_properties (plm-warp-d-check PROPERTIES DEPENDS plm-warp-d-stats)
plm_add_test (
"plm-warp-f"
${PLM_PLASTIMATCH_PATH}/plastimatch
"warp;--xf;${PLM_TESTING_DATA_DIR}/xf-translation-1.txt;--input;${PLM_BUILD_TESTING_DIR}/gauss-1.mha;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-f-img.nrrd;--default-value;0;--harden-linear-xf"
"warp;--xf;${PLM_TESTING_DATA_DIR}/itk-affine-a.tfm;--input;${PLM_BUILD_TESTING_DIR}/rect-3.mha;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-f-img.nrrd;--default-value;0;--harden-linear-xf"
)
plm_add_test (
"plm-warp-f-stats-1"
${PLM_PLASTIMATCH_PATH}/plastimatch
"stats;plm-warp-f-img.nrrd"
"header;plm-warp-f-img.nrrd"
)
plmtest_check_interval ("plm-warp-f-check-1"
"${PLM_BUILD_TESTING_DIR}/plm-warp-f-stats-1.stdout.txt"
"AVE *([-0-9.]*)"
"-675.5"
"-674.5"
"Direction = *[-0-9.]* *[-0-9.]* *([-0-9.]*)"
"-0.379"
"-0.378"
)
set_tests_properties (plm-warp-f PROPERTIES DEPENDS gauss-1)
set_tests_properties (plm-warp-f PROPERTIES DEPENDS rect-3)
set_tests_properties (plm-warp-f-stats-1 PROPERTIES DEPENDS plm-warp-f)
set_tests_properties (plm-warp-f-check-1 PROPERTIES DEPENDS plm-warp-f-stats-1)
plm_add_test (
"plm-warp-g"
${PLM_PLASTIMATCH_PATH}/plastimatch
"warp;--xf;${PLM_TESTING_DATA_DIR}/xf-translation-1.txt;--input;${PLM_BUILD_TESTING_DIR}/gauss-1.mha;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-g-img.nrrd;--default-value;0;--resample-linear-xf"
"warp;--xf;${PLM_TESTING_DATA_DIR}/itk-affine-a.tfm;--input;${PLM_BUILD_TESTING_DIR}/rect-3.mha;--output-img;${PLM_BUILD_TESTING_DIR}/plm-warp-g-img.nrrd;--default-value;0;--resample-linear-xf"
)
plm_add_test (
"plm-warp-g-stats-1"
${PLM_PLASTIMATCH_PATH}/plastimatch
"stats;plm-warp-g-img.nrrd"
"stats;${PLM_BUILD_TESTING_DIR}/plm-warp-g-img.nrrd"
)
plmtest_check_interval ("plm-warp-g-check-1"
"${PLM_BUILD_TESTING_DIR}/plm-warp-g-stats-1.stdout.txt"
"AVE *([-0-9.]*)"
"-675.5"
"-674.5"
"-764.0"
"-763.6"
)
set_tests_properties (plm-warp-g PROPERTIES DEPENDS gauss-1)
set_tests_properties (plm-warp-g PROPERTIES DEPENDS rect-3)
set_tests_properties (plm-warp-g-stats-1 PROPERTIES DEPENDS plm-warp-g)
set_tests_properties (plm-warp-g-check-1 PROPERTIES DEPENDS plm-warp-g-stats-1)
......
#Insight Transform File V1.0
#Transform 0
Transform: AffineTransform_double_3_3
Parameters: 0.925416578398323 0.1631759111665347 0.3420201433256686 0.018028311236297216 0.8825641192593854 -0.46984631039295405 -0.3785223063697923 0.4409696105298823 0.8137976813493736 2.257079707543866 31.926954809339303 -19.37976129358149
FixedParameters: 0 0 0
......@@ -1639,6 +1639,12 @@ Plm_image::set_header (const Plm_image_header* pih)
}
}
void
Plm_image::set_header (const Plm_image_header& pih)
{
this->set_header (&pih);
}
/* Printing debug information */
void
Plm_image::print ()
......
......@@ -163,6 +163,7 @@ public:
float origin (size_t);
float spacing (size_t);
void set_header (const Plm_image_header*);
void set_header (const Plm_image_header&);
/* debug */
void print ();
......
......@@ -60,6 +60,9 @@ public:
float spacing (int d) const;
void set_dim (const plm_long dim[3]);
void set_origin (const float origin[3]);
void set_origin (const OriginType& origin) {
m_origin = origin;
}
void set_spacing (const float spacing[3]);
void set_direction_cosines (
const float direction_cosines[9]);
......
......@@ -166,22 +166,23 @@ plm_warp_linear (
/* Rotate and translate origin */
itk::Vector<double,3> off_inv = itk_aff_inv->GetOffset ();
itk::Vector<double,3> new_origin =
itk::Point<double,3> new_origin =
mat_inv * pih->GetOrigin().GetVectorFromOrigin() + itk_aff_inv->GetOffset ();
/* Clone the image voxels */
im_warped = im_in->clone ();
/* Set the geometry */
#if defined (commentout)
/* GCS FIX LEFT OFF HERE */
pih->set_origin (new_origin);
pih->set_direction_cosines (new_dc);
im_warped->set_header (pih);
#endif
Plm_image_header new_pih (im_in);
new_pih.set_origin (new_origin);
new_pih.set_direction_cosines (new_dc);
im_warped->set_header (new_pih);
#if defined (commentout)
printf ("Cowardly exiting.\n");
exit (0);
#endif
}
......
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