bool interpolate(const double * pts, unsigned int npts, std::vector<double> &out )
{
out.clear();
for(unsigned int i = 0; i < 2*npts; ++i )
{
const unsigned int j = i / 2;
if( i % 2 )
{
if( j != npts - 1 )
{
assert( 3*j+5 < 3*npts );
const double midpointx = (pts[3*j+0] + pts[3*j+3]) / 2;
const double midpointy = (pts[3*j+1] + pts[3*j+4]) / 2;
const double midpointz = (pts[3*j+2] + pts[3*j+5]) / 2;
out.push_back( midpointx );
out.push_back( midpointy );
out.push_back( midpointz );
}
}
else
{
assert( j < npts );
out.push_back( pts[3*j+0] );
out.push_back( pts[3*j+1] );
out.push_back( pts[3*j+2] );
}
}
assert( out.size() == 2 * npts * 3 - 3 );
return true;
}
int main(int argc, char *argv[])
{
if( argc < 3 )
{
std::cerr << argv[0] << " input.dcm output.dcm" << std::endl;
return 1;
}
const char *filename = argv[1];
const char *outfilename = argv[2];
{
return 1;
}
{
std::cerr << "Failed to change: " << filename << std::endl;
return 1;
}
{
return 0;
}
{
return 0;
}
ncontourpoints.
Set( nestedds2 );
std::vector<double> out( pts, pts + npts * 3 );
std::vector<double> out2;
const unsigned int niter = 8;
for( unsigned int i = 0; i < niter; ++i)
{
interpolate(&out[0], out.size() / 3, out2);
out = out2;
out2.clear();
}
assert( out.size() % 3 == 0 );
at_interpolate.SetNumberOfValues( out.size() / 3 );
at_interpolate.
SetValues( &out[0], out.size() );
ncontourpoints.
SetValue( at_interpolate.GetNumberOfValues() / 3 );
nestedds2.
Replace( at_interpolate.GetAsDataElement() );
de.SetByteValue( tsuid, strlen(tsuid) );
{
return 1;
}
return 0;
}