void drawFloor() { sf::RectangleShape shape; shape.setFillColor(sf::Color::Green); float drawX = 0, drawY = floorHeight; absToRel(drawX, drawY); shape.setPosition(0, drawY); shape.setSize(sf::Vector2f(RES_X, RES_Y-floorHeight)); window->draw(shape); }
/*! * Initialize phi */ void ActiveContourSeed::initializePhi(int protobuf_idx, Protobuf *proto) { // set resolution phi_->setResolution(p_->res_x, p_->res_y, p_->res_z); // initialize image phi_->resize(_dimx_Rel, _dimy_Rel, _dimz_Rel); // get cell centers, previous sparse segmentation from protobuf file Array1D<int> xAbs(cb), yAbs(cb), zAbs(cb); proto->getSparseSegmentationCoordinates("full", protobuf_idx, &xAbs, &yAbs, &zAbs); // if previous sparse segmentation is empty, then initialize phi from single point if (xAbs.size() == 0) { for (int x = 0; x < _dimx_Rel; x++) { for (int y = 0; y < _dimy_Rel; y++) { for (int z = 0; z < _dimz_Rel; z++) { float xRadial = (float) (x - _hszX); float yRadial = (float) (y - _hszY); float zRadial = (float) (z - _hszZ); (*phi_)(x, y, z) = sqrtf( xRadial * xRadial + yRadial * yRadial + zRadial * zRadial) - p_->r; } } } // otherwise, initialize phi using distance transform on previous segmentation } else { // get previous binary segmentation, store in phi for (int p = 0; p < xAbs.size(); p++) { int xRel, yRel, zRel; absToRel(xRel, yRel, zRel, xAbs(p), yAbs(p), zAbs(p)); (*phi_)(xRel, yRel, zRel) = 1; } // get perimeter segmentation and store in phi. Store original segmentation in temp Image3D<float> temp(*phi_); perim(phi_, 1); // calculate distance transform bwdist(phi_); // Make distances negative inside the segmentation for (int x = 0; x < _dimx_Rel; x++) { for (int y = 0; y < _dimy_Rel; y++) { for (int z = 0; z < _dimz_Rel; z++) { if (temp(x, y, z) > float(BWTHRESH)) { (*phi_)(x, y, z) = -(*phi_)(x, y, z); } } } } } updateFullSeg(phi_); }
void draw() { if (!isActive) return; sf::CircleShape shape; shape.setFillColor(sf::Color::Yellow); shape.setRadius(radius); shape.setOrigin(radius, radius); float drawX = x, drawY = y; absToRel(drawX, drawY); shape.setPosition(drawX, drawY); window->draw(shape); }
void draw() { if (!isActive) return; sf::RectangleShape shape; shape.setFillColor(sf::Color::Blue); shape.setSize(sf::Vector2f(width, height)); shape.setOrigin(width/2, height/2); float drawX = x, drawY = y; absToRel(drawX, drawY); shape.setPosition(drawX, drawY); window->draw(shape); }
void draw() { if (!isActive) return; float radius = 1 + 60*animframe/duration; sf::CircleShape shape; shape.setFillColor(sf::Color::Transparent); shape.setRadius(radius); shape.setOutlineThickness(3); shape.setOutlineColor(sf::Color::Cyan); shape.setOrigin(radius, radius); float drawX = x, drawY = y; absToRel(drawX, drawY); shape.setPosition(drawX, drawY); window->draw(shape); }