rsApplyTransformationParameters *rsApplyTransformationInitParameters() { rsApplyTransformationParameters *p = (rsApplyTransformationParameters*)rsMalloc(sizeof(rsApplyTransformationParameters)); p->inputpath = NULL; p->outputpath = NULL; p->referencepath = NULL; p->headerReferencePath = NULL; p->antsPath = NULL; p->callString = NULL; p->verbose = FALSE; p->keepFiles = FALSE; p->input = NULL; p->output = NULL; p->threads = 1; p->transform = NULL; p->nTransformations = 0; p->specs = NULL; p->parametersValid = FALSE; p->progressCallback = NULL; p->coordinateSpaceTypeInput = NULL; p->coordinateSpaceType = -1; p->defaultValue = log(-1.0); // NaN p->interpolationMethod = "LanczosWindowedSinc"; return p; }
void RSConfig::_loadConfig() { const char *confPath = CONFIG_PATH"/rstools.conf"; ifstream c(confPath); int n = 1; string line; while (getline(c, line)) { if ( line[0] == '#' || line.find("=")==string::npos ) { continue; } size_t delimiter = line.find("="); if ( delimiter == string::npos ) { fprintf(stderr, "Error while parsing config '%s' on line %d:\n%s\n", confPath, n, line.c_str()); exit(EXIT_FAILURE); } string key = line.substr(0, delimiter); string value = line.substr(delimiter+1); rsArgument *arg = (rsArgument*)rsMalloc(sizeof(rsArgument)); arg->key = rsString(key.c_str()); arg->value = rsString(value.c_str()); arguments.push_back(arg); n++; } }
double *rsReadRegressorFromStream(FILE *stream, unsigned int *nValues) { char *line = NULL; size_t len = 0; ssize_t read; double value; unsigned int nBuffer = 10; *nValues = 0; double *regressor = (double*)rsMalloc(nBuffer * sizeof(double)); while ((read = getline(&line, &len, stream)) != -1) { value = atof(line); regressor[*nValues] = value; *nValues = *nValues + 1; // Check if we're running out of memory and extend the array if necessary if ( *nValues + 1 >= nBuffer ) { nBuffer = nBuffer + 10; double* tmpRegressor = realloc(regressor, nBuffer * sizeof(double)); if (tmpRegressor) { regressor = tmpRegressor; } else { fprintf(stderr, "Could not allocate enough memory to save the regressor.\n"); exit(EXIT_FAILURE); } } } if (line) free(line); return regressor; }
void Smoothing::_run() { params->progressCallback = (rsReportProgressCallback*)rsMalloc(sizeof(rsReportProgressCallback)); params->progressCallback->cb = (rsReportProgressCallback_t) RSTool::showProgressCallback; params->progressCallback->data = (void*)oc; rsSmoothingRun(params); rsFree(params->progressCallback); }
void Correlation::_run() { params->progressCallback = (rsReportProgressCallback*)rsMalloc(sizeof(rsReportProgressCallback)); params->progressCallback->cb = (rsReportProgressCallback_t) RSTool::showProgressCallback; params->progressCallback->data = (void*)oc; rsCorrelationRun(params); rsFree(params->progressCallback); }
rsDeobliqueParameters *rsDeobliqueInitParameters() { rsDeobliqueParameters *p = (rsDeobliqueParameters*)rsMalloc(sizeof(rsDeobliqueParameters)); p->inputpath = NULL; p->outputpath = NULL; p->transformationpath = NULL; p->callString = NULL; p->verbose = FALSE; p->input = NULL; p->output = NULL; p->transform = NULL; p->parametersValid = FALSE; return p; }
rsOrientationParameters *rsOrientationInitParameters() { rsOrientationParameters *p = (rsOrientationParameters*)rsMalloc(sizeof(rsOrientationParameters)); p->inputpath = NULL; p->outputpath = NULL; p->dicompath = NULL; p->orientation = NULL; p->phaseencdir = NULL; p->callString = NULL; p->verbose = FALSE; p->input = NULL; p->dicom = NULL; p->output = NULL; p->parametersValid = FALSE; return p; }
void Normalization::_init() { rsArgument *input = this->getTask()->getArgument("input"); if ( input == NULL ) { fprintf(stderr, "An input needs to be specified!\n"); this->executionSuccessful = false; } // add number of threads to the list of job arguments char *threads = (char*)rsMalloc(sizeof(char)*5); sprintf(threads, "%d", this->threads); rsArgument *arg = (rsArgument*)malloc(sizeof(rsArgument)); arg->key = rsString("threads"); arg->value = threads; getUnixTask()->addArgument(arg); }
rsFitParameters *rsFitInitParameters() { rsFitParameters *p = (rsFitParameters*)rsMalloc(sizeof(rsFitParameters)); p->inputpath = NULL; p->targetpath = NULL; p->betaspath = NULL; p->callString = NULL; p->verbose = FALSE; p->input = NULL;; p->betas = NULL; p->target = NULL; p->parametersValid = FALSE; p->threads = 1; p->interface = NULL; return p; }
rsInfoParameters* rsInfoInitParameters() { rsInfoParameters *p = (rsInfoParameters*)rsMalloc(sizeof(rsInfoParameters)); p->inputpath = NULL; p->dicompath = NULL; p->extensionSource = NULL; p->parametersValid = FALSE; p->input = NULL; p->output = NULL; p->extensionInput = NULL; p->dicom = NULL; p->showComments = FALSE; p->showInfo = FALSE; p->infoKey = NULL; p->interface = NULL; return p; }
bool ArgumentsModel::setData(const QModelIndex & index, const QVariant & value, int role) { if (role == Qt::EditRole) { QString result = value.toString(); QByteArray result2 = result.toLatin1(); char *v = rsString(result2.data()); bool insertedRow = false; vector<rsArgument*> args = job->getArguments(); if ( index.row() >= (int)args.size() ) { //beginInsertRows(index, 0, 1); rsArgument* arg = (rsArgument*)rsMalloc(sizeof(rsArgument)); arg->key = rsString("<empty>"); arg->value = rsString(""); job->addArgument(arg); insertedRow = true; //endInsertRows(); } args = job->getArguments(); rsArgument* arg = args[index.row()]; if ( index.column() == 0 ) { arg->key = v; } else { arg->value = v; } if ( insertedRow ) { beginResetModel(); endResetModel(); } else { emit editCompleted(result); } } return true; }
rsZeropaddingParameters *rsZeropaddingInitParameters() { rsZeropaddingParameters *p = (rsZeropaddingParameters*)rsMalloc(sizeof(rsZeropaddingParameters)); p->inputpath = NULL; p->outputpath = NULL; p->padding[0] = 0; p->padding[1] = 0; p->padding[2] = 0; p->padding[3] = 0; p->padding[4] = 0; p->padding[5] = 0; p->paddingValue = 0.0; p->mirroredPadding = FALSE; p->callString = NULL; p->verbose = FALSE; p->input = NULL; p->output = NULL; p->parametersValid = FALSE; return p; }