void JXImage::SetImageData ( const JSize colorCount, const JColorIndex* colorTable, unsigned short** imageData, const JBoolean hasMask, const unsigned long maskColor ) { const JCoordinate w = GetWidth(); const JCoordinate h = GetHeight(); PrepareForImageData(); // convert color table to X pixel values unsigned long* xColorTable = new unsigned long [ colorCount ]; assert( xColorTable != NULL ); for (JIndex i=0; i<colorCount; i++) { if (!hasMask || i != maskColor) { xColorTable[i] = colorTable[i]; } } // put data into image for (JCoordinate x=0; x<w; x++) { for (JCoordinate y=0; y<h; y++) { const unsigned short color = imageData[x][y]; if (hasMask && color == maskColor) { if (itsMask == NULL) { itsMask = new JXImageMask(itsDisplay, w,h, kJTrue); assert( itsMask != NULL ); } itsMask->RemovePixel(x,y); XPutPixel(itsImage, x,y, 0); } else { XPutPixel(itsImage, x,y, xColorTable[color]); } } } // clean up delete [] xColorTable; ImageDataFinished(); }
int FLIMData::GetRegionData(int thread, int group, int region, int px, float* region_data, float* intensity_data, float* r_ss_data, float* acceptor_data, int* irf_idx, float* local_decay, int n_thread) { int s = 0; if ( global_mode == MODE_IMAGEWISE ) { s = GetMaskedData(thread, group, region, region_data, intensity_data, r_ss_data, acceptor_data, irf_idx); } else if ( global_mode == MODE_GLOBAL ) { s = 0; int start = GetRegionPos(0, region); // we want dynamic with a chunk size of 1 as the data is being pulled from VM in order #pragma omp parallel for reduction(+:s) schedule(dynamic, 1) num_threads(n_thread) for(int i=0; i<n_im_used; i++) { if (!status->terminate) { // This thread index will only be used if we're not streaming data, // make sure that we pass the right one in int r_thread; if (n_thread == 1) r_thread = thread; else r_thread = omp_get_thread_num(); int pos = GetRegionPos(i, region) - start; if (GetRegionCount(i, region) > 0) s += GetMaskedData(r_thread, i, region, region_data + pos*n_meas, intensity_data + pos, r_ss_data + pos, acceptor_data + pos, irf_idx + pos); ImageDataFinished(i); } } } memset(local_decay,0, n_meas * sizeof(float)); for(int i=0; i<s; i++) for(int j=0; j<n_meas; j++) local_decay[j] += region_data[i*n_meas + j]; for(int j=0; j<n_meas; j++) local_decay[j] /= s; return s; }