// process a single acquisition int RtDataViewer::process(ACE_Message_Block *mb) { ACE_TRACE(("RtDataViewer::process")); RtStreamMessage *msg = (RtStreamMessage*) mb->rd_ptr(); // get the current time unsigned int time = msg->getCurrentData()->getDataID().getTimePoint(); // debug getDataStore().getAvailableData(); RtDataID id; // find all data requested for(vector<string>::iterator i = dataIds.begin(); i != dataIds.end(); i++) { id.setFromString(*i); if(id.getTimePoint() != DATAID_NUM_UNSET_VALUE && id.getTimePoint() != DATAID_NUM_WILDCARD_VALUE) { id.setTimePoint(time); } cout << "RtDataViewer::process: searching for " << id << " from " << *i << endl; // find the data with the right ID RtData *dat = getDataStore().getData(id); if(dat == NULL) { cout << "RtDataViewer::process: could not find " << id << endl; if(logOutput) { stringstream logs(""); logs << "RtDataViewer::process: could not find " << id << endl; log(logs); } } else { cout << "RtDataViewer::process: found " << dat->getDataID() << endl; if(logOutput) { stringstream logs(""); logs << "RtDataViewer::process: found " << dat->getDataID() << endl; log(logs); } } } return 0; }
// update the design matrix for a new timepoint // NOTE: this should be called after all events and artifacts have been // added (through addEvent and addArtifact) and motion has been added to the // datastore for this timepoint. usually this function will be called from // RtModelFit::process() // in // tr of the timepoint to update for bool RtDesignMatrix::updateAtTr(unsigned int thisTr) { if (!isBuilt()) { cerr << "WARNING: can't update() a design matrix that hasn't been build()t." << endl; return false; } // check bounds if (thisTr >= numMeas) { cerr << "WARNING: RtDesignMatrix::update trying to process tr out of range (" << thisTr << ")" << endl; return false; } // copy the motion parameters if (modelMotionParameters) { RtDataID motID(templateDataID); motID.setModuleID("motion"); RtMotion *mot = static_cast<RtMotion*> (getDataStore().getData(motID)); if (mot != NULL) { unsigned int motionCol = getNumConditionBases() + maxTrendOrder; vnl_matrix<double> motionMat(mot->getMotion(), 1, NUM_MOTION_DIMENSIONS); update(motionMat, thisTr, motionCol); } } return true; }
bool TdbHdf5Module::setErrorCode(const SharemindModuleApi0x1SyscallContext * ctx, const std::string & dsName, SharemindTdbError code) { // Get error store SharemindDataStore * const errors = getDataStore(ctx, "mod_tabledb/errors", m_logger); if (!errors) return false; // Remove existing error code, if any errors->remove(errors, dsName.c_str()); // Set the new error code if (!errors->set(errors, dsName.c_str(), new SharemindTdbError(code), &destroy<SharemindTdbError>)) { m_logger.error() << "Failed to set error code."; return false; } return true; }
xme_status_t xme_core_dataHandler_databaseTestProbe_endAttributeManipulation ( xme_core_dataManager_dataStoreID_t dataStoreID, uint32_t offset, uint32_t attributeKey ) { xme_core_dataHandler_database_dataStore_t* dataStore; xme_core_dataHandler_database_attribute_t* attribute; void* databaseAddress; uintptr_t dataAddress; xme_status_t status; XME_ASSERT(NULL != xme_core_dataHandler_database); // Get the data packet information. XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_NOT_FOUND); XME_CHECK(XME_STATUS_SUCCESS == getAttribute(dataStore, attributeKey, &attribute), XME_STATUS_INVALID_PARAMETER); if (offset > attribute->attributeValueSize) { return XME_STATUS_INVALID_CONFIGURATION; } databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, XME_CORE_DATAHANDLER_DATABASE_INDEX_SHADOW - 1U); XME_CHECK(0U != databaseAddress, XME_STATUS_NOT_FOUND); dataAddress = (((uintptr_t) databaseAddress) + attribute->attributeOffset + offset); status = removeManipulation(dataStoreID, dataAddress); XME_CHECK(XME_STATUS_SUCCESS == status, status); if (0U == getNumberOfManipulationsForDataStore(dataStoreID)) { dataStore->manipulated = false; // Activate master database. dataStore->activeDatabaseIndex = XME_CORE_DATAHANDLER_DATABASE_INDEX_MASTER; } else { status = copyBetweenMemoryRegionCopies ( dataStoreID, XME_CORE_DATAHANDLER_DATABASE_INDEX_MASTER, XME_CORE_DATAHANDLER_DATABASE_INDEX_SHADOW ); XME_CHECK(XME_STATUS_SUCCESS == status, status); status = reapplyManipulations(dataStore->dataStoreID); XME_CHECK(XME_STATUS_SUCCESS == status, status); } return XME_STATUS_SUCCESS; }
//******************************************************************************// // FIXME: Remove. xme_status_t xme_core_dataHandler_databaseTestProbe_setActiveDatabase ( xme_core_dataManager_dataPacketId_t dataStoreID, uint16_t databaseIndex ) { xme_core_dataHandler_database_dataStore_t* dataStore; XME_ASSERT(NULL != xme_core_dataHandler_database); XME_CHECK(XME_CORE_DATAHANDLER_DATABASE_INDEX_DEFAULT != databaseIndex, XME_STATUS_INVALID_PARAMETER); XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_NOT_FOUND); XME_CHECK(databaseIndex <= dataStore->memoryRegion->numOfCopies, XME_STATUS_INVALID_CONFIGURATION); dataStore->activeDatabaseIndex = databaseIndex; return XME_STATUS_SUCCESS; }
xme_status_t xme_core_dataHandler_databaseTestProbe_startAttributeManipulation ( xme_core_dataManager_dataStoreID_t dataStoreID, uint32_t offset, uint32_t attributeKey ) { xme_core_dataHandler_database_dataStore_t* dataStore; xme_core_dataHandler_database_attribute_t* attribute; xme_status_t status; XME_ASSERT(NULL != xme_core_dataHandler_database); // Get the data packet information. XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_NOT_FOUND); XME_CHECK(XME_STATUS_SUCCESS == getAttribute(dataStore, attributeKey, &attribute), XME_STATUS_INVALID_PARAMETER); if (offset > attribute->attributeValueSize) { return XME_STATUS_INVALID_CONFIGURATION; } if (!dataStore->manipulated) { status = copyBetweenMemoryRegionCopies ( dataStoreID, XME_CORE_DATAHANDLER_DATABASE_INDEX_MASTER, XME_CORE_DATAHANDLER_DATABASE_INDEX_SHADOW ); XME_CHECK(XME_STATUS_SUCCESS == status, status); status = reapplyManipulations(dataStore->dataStoreID); XME_CHECK(XME_STATUS_SUCCESS == status, status); dataStore->manipulated = true; } return XME_STATUS_SUCCESS; }
xme_status_t copyBetweenMemoryRegionCopies ( xme_core_dataManager_dataStoreID_t dataStoreID, uint16_t sourceDatabaseIndex, uint16_t targetDatabaseIndex ) { uintptr_t sourceDataAddress; uintptr_t sinkDataAddress; xme_core_dataHandler_database_dataStore_t* dataStore; uint32_t transferSizeInBytes; uint32_t totalOffset; void* returnAddress; void* sourceDatabaseAddress; void* sinkDatabaseAddress; XME_ASSERT(NULL != xme_core_dataHandler_database); // Get the data packet information. XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_INVALID_HANDLE); // Calculate the total offsets to add. totalOffset = dataStore->topicOffset; // Calculate the position in the queue for the source and sink address. if (dataStore->queueSize > 1) { totalOffset += dataStore->dataStoreSize * dataStore->currentCBWritePosition; } // Get the number of bytes to use in the transfer operation. transferSizeInBytes = getBytesToCopy(dataStore->topicSize, dataStore->topicSize, 0U); // Get source database address from the source database copy. sourceDatabaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, sourceDatabaseIndex - 1U); // Get source database address from the source database copy. sinkDatabaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, targetDatabaseIndex - 1U); // Check that the database addresses contain correct values. XME_CHECK(0U != sourceDatabaseAddress, XME_STATUS_NOT_FOUND); XME_CHECK(0U != sinkDatabaseAddress, XME_STATUS_NOT_FOUND); if (dataStore->dataAvailable) { // Add the offset corresponding to the source and sink addresses. sourceDataAddress = ((uintptr_t) sourceDatabaseAddress + totalOffset); sinkDataAddress = ((uintptr_t) sinkDatabaseAddress + totalOffset); // Do the transfer for the current copy of the database-> returnAddress = xme_hal_mem_copy((void*) sinkDataAddress, (void*) sourceDataAddress, transferSizeInBytes); XME_CHECK(returnAddress == (void*) sinkDataAddress, XME_STATUS_INTERNAL_ERROR); } // Try the transfer for all attributes as well. XME_HAL_SINGLYLINKEDLIST_ITERATE_BEGIN(dataStore->attributes, xme_core_dataHandler_database_attribute_t, attribute); { if (attribute->dataAvailable == true) { // If the attribute exists in the target data packet. uint32_t totalAttributeOffset; uintptr_t sourceAttributeAddress; uintptr_t sinkAttributeAddress; uint32_t totalAttributeSizeInBytes; // Calculate the total offsets to add. totalAttributeOffset = attribute->attributeOffset; // Calculate the position in the queue for the source and sink address. if (dataStore->queueSize > 1) { totalAttributeOffset += dataStore->dataStoreSize * dataStore->currentCBWritePosition; } // Get trasnfer bytes to copy. totalAttributeSizeInBytes = getBytesToCopy(attribute->attributeValueSize, attribute->attributeValueSize, 0U); // Add the offset corresponding to the source and sink addresses. sourceAttributeAddress = ((uintptr_t) sourceDatabaseAddress + totalAttributeOffset); sinkAttributeAddress = ((uintptr_t) sinkDatabaseAddress + totalAttributeOffset); // Do the transfer for the current copy of the database-> returnAddress = xme_hal_mem_copy((void*) sinkAttributeAddress, (void*) sourceAttributeAddress, totalAttributeSizeInBytes); XME_CHECK(returnAddress == (void*) sinkAttributeAddress, XME_STATUS_INTERNAL_ERROR); } } XME_HAL_SINGLYLINKEDLIST_ITERATE_END(); return XME_STATUS_SUCCESS; }
xme_status_t xme_core_dataHandler_databaseTestProbe_readAttribute ( xme_core_dataHandler_database_index_t databaseIndex, xme_core_dataManager_dataPacketId_t dataStoreID, uint32_t attributeKey, uint32_t offsetInBytes, void* const targetBuffer, size_t targetBufferSizeInBytes, uint32_t* const readBytes ) { uintptr_t attributeAddress; size_t attributeSizeInBytes; xme_core_dataHandler_database_dataStore_t* dataStore; xme_core_dataHandler_database_attribute_t* attribute; uint32_t totalOffset; void* returnAddress; void* databaseAddress; XME_ASSERT(NULL != xme_core_dataHandler_database); XME_ASSERT(NULL != readBytes); *readBytes = 0U; // Obtain first the data packet and then the attribute. XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_INVALID_HANDLE); XME_CHECK(XME_STATUS_SUCCESS == getAttribute(dataStore, attributeKey, &attribute), XME_STATUS_INVALID_PARAMETER); XME_CHECK(databaseIndex <= dataStore->memoryRegion->numOfCopies, XME_STATUS_INVALID_CONFIGURATION); XME_CHECK(attribute->dataAvailable, XME_STATUS_NO_SUCH_VALUE); // Return an error if an attempt is made to read outside the bounds of the data packet XME_CHECK(offsetInBytes < attribute->attributeValueSize, XME_STATUS_INVALID_PARAMETER); // Calculate the total offset to add. totalOffset = attribute->attributeOffset + offsetInBytes; // Add queue write position. if (dataStore->queueSize > 1) { totalOffset += (dataStore->dataStoreSize * dataStore->currentCBReadPosition); } // Get the number of bytes to use in the read operation. attributeSizeInBytes = getBytesToCopy(attribute->attributeValueSize, targetBufferSizeInBytes, offsetInBytes); if (((xme_core_dataHandler_database_index_t)XME_CORE_DATAHANDLER_DATABASE_INDEX_DEFAULT) == databaseIndex) { // Get database address from the active database in the data packet. databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, dataStore->activeDatabaseIndex - 1U); } else { // Get database address from the provided database index. databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, databaseIndex - 1U); } // Check that the database address and size contains correct values. XME_CHECK(0U != databaseAddress, XME_STATUS_NOT_FOUND); // Add the offset. attributeAddress = ((uintptr_t) databaseAddress + totalOffset); if (targetBufferSizeInBytes > attributeSizeInBytes) { uintptr_t bufferToCopy; bufferToCopy = ((uintptr_t) targetBuffer + (targetBufferSizeInBytes - attributeSizeInBytes)); returnAddress = xme_hal_mem_copy(targetBuffer, (void*) bufferToCopy, attributeSizeInBytes); XME_CHECK(returnAddress == (void*) targetBuffer, XME_STATUS_INTERNAL_ERROR); } else { // Do the read operation returnAddress = xme_hal_mem_copy(targetBuffer, (void*) attributeAddress, attributeSizeInBytes); XME_CHECK(returnAddress == (void*) targetBuffer, XME_STATUS_INTERNAL_ERROR); } // Set the effectively read bytes. *readBytes = attributeSizeInBytes; // Check that the target buffer is not null-valued. XME_CHECK(NULL != targetBuffer, XME_STATUS_INVALID_CONFIGURATION); return XME_STATUS_SUCCESS; }
xme_status_t xme_core_dataHandler_databaseTestProbe_readData ( xme_core_dataHandler_database_index_t databaseIndex, xme_core_dataManager_dataPacketId_t dataStoreID, uint32_t offsetInBytes, void* const targetBuffer, size_t targetBufferSizeInBytes, uint32_t* const readBytes ) { uintptr_t dataAddress; size_t dataSizeInBytes; xme_core_dataHandler_database_dataStore_t* dataStore; uint32_t totalOffset; void* returnAddress; void* databaseAddress; XME_ASSERT(NULL != xme_core_dataHandler_database); XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_INVALID_HANDLE); XME_CHECK(databaseIndex <= dataStore->memoryRegion->numOfCopies, XME_STATUS_INVALID_CONFIGURATION); if (!dataStore->dataAvailable) { *readBytes = 0U; return XME_STATUS_NO_SUCH_VALUE; } if (offsetInBytes >= dataStore->topicSize) { // We can not read outside the limit of the data packet. An error is returned. *readBytes = 0U; return XME_STATUS_INVALID_PARAMETER; } // Calculate the total offset to add. totalOffset = dataStore->topicOffset + offsetInBytes; // Add queue write position. if (dataStore->queueSize > 1) { totalOffset += (dataStore->dataStoreSize * dataStore->currentCBReadPosition); } // Get the number of bytes to use in the read operation. dataSizeInBytes = getBytesToCopy(dataStore->topicSize, targetBufferSizeInBytes, offsetInBytes); if (((xme_core_dataHandler_database_index_t)XME_CORE_DATAHANDLER_DATABASE_INDEX_DEFAULT) == databaseIndex) { // Get database address from the active database in the data packet. databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, dataStore->activeDatabaseIndex - 1U); } else { // Get database address from the provided database index. databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, databaseIndex - 1U); } // Check that the database address and size contains correct values. XME_CHECK(0U != databaseAddress, XME_STATUS_NOT_FOUND); // Add the offset. dataAddress = ((uintptr_t) databaseAddress + totalOffset); if (targetBufferSizeInBytes > dataSizeInBytes) { uintptr_t bufferToCopy; bufferToCopy = ((uintptr_t) targetBuffer + (targetBufferSizeInBytes - dataSizeInBytes)); returnAddress = xme_hal_mem_copy((void*) bufferToCopy, (void*) dataAddress, dataSizeInBytes); XME_CHECK(returnAddress == (void*) bufferToCopy, XME_STATUS_INTERNAL_ERROR); } else { // Do the read operation returnAddress = xme_hal_mem_copy(targetBuffer, (void*) dataAddress, dataSizeInBytes); XME_CHECK(returnAddress == (void*) targetBuffer, XME_STATUS_INTERNAL_ERROR); } // Set the effectively read bytes. *readBytes = dataSizeInBytes; return XME_STATUS_SUCCESS; }
xme_status_t xme_core_dataHandler_databaseTestProbe_writeAttribute ( uint16_t databaseIndex, xme_core_dataManager_dataPacketId_t dataStoreID, uint32_t attributeKey, uint32_t offsetInBytes, const void* const sourceBuffer, size_t sourceBufferSizeInBytes, uint32_t* const writtenBytes ) { uintptr_t attributeAddress; size_t attributeSizeInBytes; xme_core_dataHandler_database_dataStore_t* dataStore; xme_core_dataHandler_database_attribute_t* attribute; uint32_t totalOffset; void* returnAddress; void* databaseAddress; XME_ASSERT(NULL != xme_core_dataHandler_database); // Obtain first the data packet and then the attribute. XME_CHECK(XME_STATUS_SUCCESS == getDataStore(dataStoreID, &dataStore), XME_STATUS_INVALID_HANDLE); XME_CHECK(XME_STATUS_SUCCESS == getAttribute(dataStore, attributeKey, &attribute), XME_STATUS_INVALID_PARAMETER); XME_CHECK(databaseIndex <= dataStore->memoryRegion->numOfCopies, XME_STATUS_INVALID_CONFIGURATION); if (offsetInBytes >= attribute->attributeValueSize) { // We can not write outside the limit of the data packet. An error is returned. *writtenBytes = 0U; return XME_STATUS_INVALID_PARAMETER; } // Calculate the total offset to add. totalOffset = attribute->attributeOffset + offsetInBytes; // Add queue write position. if (dataStore->queueSize > 1) { totalOffset += (dataStore->dataStoreSize * dataStore->currentCBWritePosition); } // Get the number of bytes to use in the write operation. attributeSizeInBytes = getBytesToCopy(attribute->attributeValueSize, sourceBufferSizeInBytes, offsetInBytes); XME_CHECK(XME_CORE_DATAHANDLER_DATABASE_INDEX_DEFAULT != databaseIndex, XME_STATUS_INVALID_PARAMETER); // Get database address. databaseAddress = getAddressFromMemoryCopy(dataStore->memoryRegion, databaseIndex - 1U); // Check that the data address and size contains correct values. XME_CHECK(0U != databaseAddress, XME_STATUS_NOT_FOUND); // Add the offset. attributeAddress = ((uintptr_t) databaseAddress + totalOffset); // Do the copy operation returnAddress = xme_hal_mem_copy((void*) attributeAddress, sourceBuffer, attributeSizeInBytes); XME_CHECK(returnAddress == (void*) attributeAddress, XME_STATUS_INTERNAL_ERROR); // Set the effectively written bytes. *writtenBytes = attributeSizeInBytes; // Check that the target buffer is not null-valued. XME_CHECK(NULL != sourceBuffer, XME_STATUS_INVALID_CONFIGURATION); // Set attribute availability to true. XME_CHECK(XME_STATUS_SUCCESS == setAttributeAvailability(attribute, true), XME_STATUS_INVALID_CONFIGURATION); if (XME_CORE_DATAHANDLER_DATABASE_INDEX_SHADOW == databaseIndex) { // Add the manipulation. uint32_t* value = (uint32_t*) sourceBuffer; xme_status_t status = addManipulation(dataStoreID, attributeAddress, *value); XME_CHECK(XME_STATUS_SUCCESS == status, XME_STATUS_INVALID_CONFIGURATION); // Activate the shadow database. dataStore->activeDatabaseIndex = XME_CORE_DATAHANDLER_DATABASE_INDEX_SHADOW; } return XME_STATUS_SUCCESS; }
// process a single acquisition int RtCurrentActivation::process(ACE_Message_Block *mb) { ACE_TRACE(("RtCurrentActivation::process")); timer tim; if(printTiming) { tim.start(); } // get pointer to message RtStreamMessage *msg = (RtStreamMessage*) mb->rd_ptr(); // get the current image to operate on RtMRIImage *dat = (RtMRIImage*) msg->getCurrentData(); // check for validity of data if (dat == NULL) { cerr << "RtCurrentActivation::process: data passed is NULL" << endl; if(logOutput) { stringstream logs(""); logs << "RtCurrentActivation::process: data passed is NULL" << endl; log(logs); } return 0; } // get mask from msg RtMaskImage *mask = getMaskFromMessage(*msg); // check validity of mask if (mask == NULL) { cerr << "RtCurrentActivation::process: mask is NULL" << endl; if(logOutput) { stringstream logs(""); logs << "RtCurrentActivation::process: mask is NULL at tr " << dat->getDataID().getTimePoint() << endl; log(logs); } return 0; } // initialize the computation if necessary if (needsInit) { initEstimation(*dat, mask); } // get design // TODO this may not work if there are more than one design matrix RtDataID tempDataID; tempDataID.setDataName(NAME_DESIGN); // debug // getDataStore().getAvailableData(); RtDesignMatrix *design = static_cast<RtDesignMatrix*>( getDataStore().getData(tempDataID)); if(design == NULL) { cerr << "error: could not find design matrix in datastore!" << endl; cerr << "searched for design matrix id: " << tempDataID << endl; return 0; } // allocate a new data image for the stats RtActivation *currentActivation = new RtActivation(*dat); // setup the data id currentActivation->getDataID().setFromInputData(*dat, *this); currentActivation->getDataID().setDataName(NAME_ACTIVATION); currentActivation->getDataID().setRoiID(modelFitRoiID); currentActivation->initToNans(); // get the residual and the beta images for discounting nuissance // signals // find the betas RtActivation **betas = new RtActivation*[design->getNumColumns()]; for(unsigned int j = 0; j < design->getNumColumns(); j++) { betas[j] = (RtActivation*) msg->getData(modelFitModuleID, string(NAME_BETA) + "_" + design->getColumnName(j), modelFitRoiID); // check for found if (betas[j] == NULL) { cerr << "RtCurrentActivation:process: beta " << j << " is null" << endl; if(logOutput) { stringstream logs(""); logs << "RtCurrentActivation::process: beta " << j << " is NULL at tr " << dat->getDataID().getTimePoint() << endl; log(logs); } return 0; } } // get residual from message if timepoint is less than // numDataPointsForErrEst otherwise use the steady state // residual value RtActivation *residual; if (dat->getDataID().getTimePoint() < numDataPointsForErrEst) { // get residual off of msg residual = (RtActivation *) msg->getData(modelFitModuleID, NAME_RESIDUAL_MSE, modelFitRoiID); // save off residual steadyStateResidual = residual; } else { // post-numDataPointsForErrEst, use saved residual residual = steadyStateResidual; } // check that residual is not null if (residual == NULL) { cerr << "RtCurrentActivation:process: residual is null" << endl; if(logOutput) { stringstream logs(""); logs << "RtCurrentActivation::process: residual is NULL at tr " << dat->getDataID().getTimePoint() << endl; log(logs); } return 0; } // get this design matrix row vnl_vector<double> Xrow = design->getRow(dat->getDataID().getTimePoint()-1); // include this timepoint for each voxel RtElementAccess datAc(dat, mask); RtElementAccess resAc(residual, mask); vector<unsigned int> inds = datAc.getElementIndices(); for(vector<unsigned int>::iterator it = inds.begin(); it != inds.end(); it++) { // get voxel intensity double y = datAc.getDoubleElement(*it); double *betavals = new double[Xrow.size()]; // compute error double err = y; for (unsigned int j = 0; j < Xrow.size(); j++) { if (!design->isColumnOfInterest(j)) { double beta = betas[j]->getPixel(*it); err -= beta * Xrow[j]; betavals[j] = beta; } else { // for debug output betavals[j] = betas[j]->getPixel(*it); } } // compute the dev and current activation (magic happens here) double dev = sqrt(resAc.getDoubleElement(*it) / (residual->getDataID().getTimePoint())); currentActivation->setPixel(*it, err / dev); if (dumpAlgoVars && dat->getDataID().getTimePoint() > 2) { dumpFile << dat->getDataID().getTimePoint() << " " << *it << " " << y << " " << err << " " << Xrow[0] << " " << residual->getPixel(*it) << " " << dev << " " << currentActivation->getPixel(*it) << " "; for (unsigned int b = 0; b < design->getNumColumns(); b++) { dumpFile << betavals[b] << " "; } dumpFile << endl; } delete [] betavals; } setResult(msg, currentActivation); setResult(msg, residual); delete [] betas; if(printTiming) { tim.stop(); cout << "RtCurrentActivation process at tr " << dat->getDataID().getTimePoint() << " elapsed time: " << tim.elapsed_time()*1000 << "ms" << endl; } if(print) { cout << "RtCurrentActivation: done at tr " << dat->getDataID().getTimePoint() << endl; } if(logOutput) { stringstream logs(""); logs << "RtCurrentActivation: done at tr " << dat->getDataID().getTimePoint() << endl; log(logs); } if(saveResult) { string fn = getExperimentConfig().getVolFilename( dat->getDataID().getSeriesNum(), dat->getDataID().getTimePoint()); string stem = getExperimentConfig().get("study:volumeFileStem").str(); currentActivation->setFilename(fn.replace(fn.rfind(stem), stem.size(), "curact")); currentActivation->save(); } return 0; }
bool remove(const Resource* resource) { return getDataStore(resource->getType())->remove(resource); }
Resource* get(const string& name, Resource::Type type, bool binary) { return getDataStore(type)->get(name, binary); }
bool exists(const string& name, Resource::Type type) { return getDataStore(type)->exists(name); }
Resource* create(const string& name, bool binary) { return getDataStore(Resource::Type::USER)->create(name, binary); }