@SuppressWarnings("unchecked") @Override public Region<E> close(Region<E> reg) { // return erode(dilate(reg)); try { CubeHistogram<E> ch = new CubeHistogram<E>((PixelCube<E, BaseIndex>) reg); Erosion<E> er = new Erosion<E>((StructureElement<E>) se); er.initFunction(ch); Dilation<E> dil = new Dilation<E>((StructureElement<E>) se); dil.initFunction(ch); reg.setIterationPattern(IP_DEFAULT); reg.setIndexing(BASE_INDEXING); Region<E> out = new Region<E>((PixelCube<E, ?>) reg.clone(), (StructureElement<E>) se); // out.setIterationPattern(IP_DEFAULT); // out.setIndexing(BASE_INDEXING); final ZonalProcessor zp = reg.getProcessor(); final VectorCube<E> ve = reg.getVectorCube(); // System.out.println(ve); // final double limbodil=0;s // Pair<Number,Number> p= (Pair<Number, Number>) ch.getMinMax(); // final double limboer=p.second.doubleValue(); Access<E> accessOut = out.getAccess(); BoundaryCondition<int[]> bc = reg.getBoundaryCondition(); final int n = (int) accessOut.length(); int offset = Util.cumprod(se.getDimensions()) + 1; // (int)ve.size(); System.out.println("offset: " + offset); for (int i = 0; i < n + offset; i++) { if (i < n) { final E elem = zp.elementTransformCond(ve, dil, bc, i); accessOut.putE(i, elem); } if (i >= offset) { final int z = i - offset; // System.out.println("z: "+ z); final E elem = zp.elementTransformCond(ve, er, bc, z); accessOut.putE(z, elem); } } // } // end if return out; } catch (UnsupportedTypeException e) { e.printStackTrace(); } return null; }
/** This function is called at this end of the function run(). */ public void done() { GnwGuiSettings global = GnwGuiSettings.getInstance(); // For each subnet found, a structure or dynamical model item is created // and place on the desktop for (int i = 0; i < output_.length; i++) { if (output_[i] instanceof ImodNetwork) { StructureElement structure = new StructureElement(output_[i].getId(), global.getNetworkDesktop()); structure.setNetwork((ImodNetwork) output_[i]); structure.setFather(item_); item_.addChild(structure); } else if (output_[i] instanceof GeneNetwork) { DynamicalModelElement dynamicNetwork = new DynamicalModelElement(output_[i].getId(), global.getNetworkDesktop()); dynamicNetwork.setGeneNetwork((GeneNetwork) output_[i]); dynamicNetwork.setFather(item_); item_.addChild(dynamicNetwork); } } // Display all the subnets found on the desktop as children of the mother network // used to generate them. global.getNetworkDesktop().displayChildrenOf(item_); snake_.stop(); myCardLayout.show(cards, runButton_.getName()); // close the window SubnetExtraction.this.escapeAction(); // If some sunet sizes < size_, the user should be informed. // if (extractor_.getUnderSized()) { // JOptionPane.showMessageDialog(global.getGnwGui().getFrame(), "<html>At least one network // generated is under-sized, " + // "<br>i.e. extraction of a module not linked with the rest of the network.</html>"); // } log.log(Level.INFO, "Done!"); }
@SuppressWarnings("unchecked") public MorphoProcessorXD(Region<?> reg) throws UnsupportedTypeException { se = new StructureElement<E>((VectorCube<E>) reg.getVectorCube()); region = reg; type = reg.getType(); CubeHistogram<E> ch = new CubeHistogram<E>((PixelCube<E, ?>) region); // System.out.println(ch); // System.out.println("min max :"+se.getMinMax()); se.setMinMax(ch); scaled = true; // System.out.println("scaling ... \n " +se); }
public MorphoProcessorXD(StructureElement<?> ase) { se = ase; type = se.getType(); }