Skip to content

Commit

Permalink
Removing temporary "writeNiftiRgb" entry-point
Browse files Browse the repository at this point in the history
  • Loading branch information
jonclayden committed Oct 25, 2019
1 parent ee0660e commit 3efb459
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/main.cpp
Expand Up @@ -176,37 +176,6 @@ BEGIN_RCPP
END_RCPP
}

RcppExport SEXP writeNiftiRgb (SEXP _red, SEXP _green, SEXP _blue, SEXP _file, SEXP _reference)
{
BEGIN_RCPP
const NiftiImage reference(_reference, false, true);
NiftiImage image = reference;
NumericVector red(_red);
NumericVector green(_green);
NumericVector blue(_blue);

image->datatype = DT_RGB24;
nifti_datatype_sizes(DT_RGB24, &image->nbyper, &image->swapsize);

unsigned char *data = (unsigned char *) calloc(image->nvox, 3);
for (size_t i=0; i<image->nvox; i++)
{
data[3*i] = static_cast<unsigned char>(red[i] * 255.0);
data[3*i+1] = static_cast<unsigned char>(green[i] * 255.0);
data[3*i+2] = static_cast<unsigned char>(blue[i] * 255.0);
}

image->data = (void *) data;
image->scl_slope = 0.0;
image->scl_inter = 0.0;
image->cal_min = 0.0;
image->cal_max = 0.0;

image.toFile(as<std::string>(_file));
return R_NilValue;
END_RCPP
}

RcppExport SEXP updateNifti (SEXP _image, SEXP _reference, SEXP _datatype)
{
BEGIN_RCPP
Expand Down Expand Up @@ -657,7 +626,6 @@ static R_CallMethodDef callMethods[] = {
{ "niftiVersion", (DL_FUNC) &niftiVersion, 1 },
{ "readNifti", (DL_FUNC) &readNifti, 3 },
{ "writeNifti", (DL_FUNC) &writeNifti, 3 },
{ "writeNiftiRgb", (DL_FUNC) &writeNiftiRgb, 5 },
{ "updateNifti", (DL_FUNC) &updateNifti, 3 },
{ "niftiHeader", (DL_FUNC) &niftiHeader, 1 },
{ "analyzeHeader", (DL_FUNC) &analyzeHeader, 1 },
Expand Down

0 comments on commit 3efb459

Please sign in to comment.