[Insight-users] Incorrect deformation field using paraview
motes motes
mort.motes at gmail.com
Tue Nov 3 17:38:09 EST 2009
I have now located the error. It happens when I try to move the below
code out to a function:
// Read the parameters from file
const unsigned int numberOfParameters =
bsplineTransform->GetNumberOfParameters();
const unsigned int numberOfNodes = numberOfParameters / SpaceDimension;
ParametersType parameters( numberOfParameters );
std::ifstream infile;
infile.open(coeff_file.c_str());
for( unsigned int n=0; n < numberOfNodes; n++ ) {
infile >> parameters[n];
infile >> parameters[n+numberOfNodes];
}
infile.close();
bsplineTransform->SetParameters(parameters);
...
...
writeDeformedImage();
writeDeformationField();
I have an idea that it might be the parameters array that gives the
problem since it will be created locally in the function.
On Tue, Nov 3, 2009 at 5:50 PM, Karthik Krishnan
<karthik.krishnan at kitware.com> wrote:
> Indeed the values are bogus, indicating that your field has bogus values.
> What I am going to suggest is that you first try the example provided in teh
> SoftwareGuide. (It also shows how you can display the field in paraview,
> which you've figured out by now). You can try either DeformableRegistration4
> or DeformableRegistration2. The command line args for the latter are in the
> sourcefile DeformableRegistration2.cxx.
>
> That way you can convince yourself that you can display a field in paraview
> and then focus on what went wrong with your deformation field.
>
> On Tue, Nov 3, 2009 at 10:24 AM, motes motes <mort.motes at gmail.com> wrote:
>>
>> Ah found it thanks! So now I do:
>>
>> MetaImage_X*iHat+MetaImage_Y*jHat+0*kHat
>>
>> where MetaImage_X and MetaImage_Y are selected from the scalars menu.
>>
>> Next I add a glyph filter, but when I press apply a empty 3D
>> coordinate system appears - not a single deformation vector shows up -
>> even though Max num of points = 5000.
>>
>> When I press the Information tab in the Glyph filter I can see that:
>>
>> Data Arrays:
>>
>> Name Data Type Data Ranges
>> MetaImage float [-inf, -1e+38], [-inf, -1e+38]
>> GlyphVector float [ 1e+38, -1e+38], [ 1e+38, -1e+38],
>> [ 1e+38, -1e+38]
>>
>> Could this maybe have something to do with the lack of deformation
>> vectors?
>>
>>
>>
>> On Tue, Nov 3, 2009 at 4:11 PM, Karthik Krishnan
>> <karthik.krishnan at kitware.com> wrote:
>> > On Tue, Nov 3, 2009 at 9:59 AM, motes motes <mort.motes at gmail.com>
>> > wrote:
>> >>
>> >> On Tue, Nov 3, 2009 at 3:40 PM, Karthik Krishnan
>> >> <karthik.krishnan at kitware.com> wrote:
>> >> > On Tue, Nov 3, 2009 at 9:33 AM, motes motes <mort.motes at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> But when I view the .mhd file in paraview I just get:
>> >> >>
>> >> >> http://37133.vs.webtropia.com/apache2-default/test/test0.png
>> >> >>
>> >> >>
>> >> >> In paraview I load the .mhd file. Then I add a calculator and type:
>> >> >>
>> >> >> coordsX*iHat+coordsY*jHat+0*kHat
>> >> >
>> >> > It should read
>> >> >
>> >> > MetaImage_0*iHat + MetaImage_1*jHat + 0*kHat
>> >> >
>> >> > Choose MetaImage_* from the pull down menu on the calculator. You
>> >> > chose
>> >> > coords (which are simply coordinates of the points, not the scalar
>> >> > values of
>> >> > the their components) which perfectly explains the image you see.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Its not possible to choose MetaImage_* from any menus in the
>> >> calculator.
>> >
>> > It is there in the the "Scalars" pull down menu on the Calculator tab,
>> > not
>> > in the attribute menu.
>> >
>> >>
>> >> From the "attribute mode" drop down menu I can choose:
>> >>
>> >> Point data
>> >> cell data
>> >>
>> >> If I manullay type:
>> >>
>> >> MetaImage_0*iHat + MetaImage_1*jHat + 0*kHat
>> >>
>> >> into the expression editor and press apply I just get a bunch of error:
>> >
>> > Think its the spaces. In any case, use the menu and select what appears.
>> >
>> >
>> >
>
>
>
More information about the Insight-users
mailing list