void defineParams() { produces_an_output = true; get_image_info = false; XmippMetadataProgram::defineParams(); addUsageLine("Operate with image files headers. By default in Xmipp, geometrical transformations"); addUsageLine("coming in images files headers are ignored. Instead this information is read from"); addUsageLine("the images metadata if exist. With this program geometrical transformations can be"); addUsageLine("extracted to a metadata or assigned to header, also allows print or reset image file headers."); addParamsLine("[ --print <decompose=0>] : Print the geometrical transformations in image file headers."); addParamsLine(" : if input is stack and decompose=1 print header of each individual image."); addParamsLine(" alias -p;"); addParamsLine("or --extract : The output is a selfile with geometrical transformations read from image file headers."); addParamsLine(" alias -e;"); addParamsLine(" requires -o;"); addParamsLine("or --assign : Write the geometrical transformations from selfile to the image file headers."); addParamsLine(" alias -a;"); addParamsLine("or --reset : Reset the geometrical transformations in image file headers."); addParamsLine(" alias -r;"); addParamsLine("or --tree : Print the tree scheme from file containers as hdf5 files."); addParamsLine(" alias -t;"); addParamsLine("or --sampling_rate <Ts=-1> : Change the sampling rate (in Angstrom units) in the image file header."); addParamsLine(" : If no value is passed then current value in header is print."); addParamsLine(" alias -s;"); addParamsLine(" [--round_shifts] :Round shifts to integers"); addExampleLine("Print the header of the images in metadata: ", false); addExampleLine("xmipp_image_header -i images.sel"); addExampleLine("Extract geometrical transformations from image file headers: ", false); addExampleLine("xmipp_image_header -i smallStack.stk --extract -o header.doc"); addExampleLine("Assign the geometrical transformations from the metadata to header: ", false); addExampleLine("xmipp_image_header -i header.doc --assign"); addSeeAlsoLine("transform_geometry"); addKeywords("header, geometric, transformation, print"); }
/** Writes in the xml file an 'pubmedArticle' node containing the advanced metadata given of an article @param articleId: id of the article to add to the xml documment @param abstract: abstract of the article to add @param keywords: vector with the keywords of the article to add @param references: vector with the ids of the articles referenced by the article to add */ void ExtendedArticlesXMLGenerator::addArticle(int articleId, const string &abstract, const string &articleBody, const vector<string> &keywords, const vector<int> &references) { //Add openning tag addOpenningTag(aXMLFile, "extendedArticle"); //Add nodes addArticleId(articleId); addKeywords(keywords); addAbstract(abstract); addArticleBody(articleBody); addReferences(references); //Add closing tag addClosingTag(aXMLFile, "extendedArticle"); }
void defineParams() { each_image_produces_an_output = true; addUsageLine("Adjust the grey level value of the pixels to a specified range."); addKeywords("mask, normalization"); addSeeAlsoLine("transform_normalize"); XmippMetadataProgram::defineParams(); addParamsLine(" --range <min_val> <max_val> : Output minimum and maximum values."); addParamsLine(" alias -r;"); addParamsLine(" [--noise <sigma=0>] : Variation of the limit range values."); mask_prm.defineParams(this,INT_MASK, NULL, "Pixels in the mask area are guaranteed to be into the specified range."); addExampleLine("Adjust an image in the range [-1, 1]:", false); addExampleLine("xmipp_transform_range_adjust -i image.xmp -o image_adjust.xmp --range -1 1"); addExampleLine("Adjust images in a stack applying a circular mask:", false); addExampleLine("xmipp_transform_range_adjust -i images.stk -o image_adjust.stk --range -1 1 --mask circular -32"); addExampleLine("Adjust a selection file in the range [-100, 100] with sigma noise 10:", false); addExampleLine("xmipp_transform_range_adjust -i selection.sel --oroot images/im_adjust:spi -o selection_adjust.sel --range -100 100 --noise 10"); }
//parse void data::parse(){ cout << "parse" << endl; //prep the particiapnt xml file participantXML.pushTag("Document"); //iterate through all keywords in the XML file and generate a list of all the keywords used and their frequencies //add keyword to keyword list if it is not already in the list //go to first row with data in it XML.pushTag("Document"); // XML.pushTag("Worksheet"); // XML.pushTag("Table"); int numRows = XML.getNumTags("Row"); for (int rCnt = 1;rCnt < numRows ;rCnt++){ XML.pushTag("Row",rCnt); //now i need to iterate through all the cells of the row and look for the one with the correct index of 86 // int numCells = XML.getNumTags("Cell"); // bool collectKeywords = false; // for (int cCnt = 0;cCnt< numCells;cCnt++){ // if(XML.getAttribute("Cell", "ss:Index", 0, cCnt) == 86){ // collectKeywords = true; //} //get all keywords in cells starting at cell 86 // if(collectKeywords){ // XML.pushTag("Cell",cCnt);//col with keywords // string kws = XML.getValue("Field_85","");//this should return the keywords that need to be split at the return addKeywords(XML.getValue("Field_85","")); addKeywords(XML.getValue("Field_86","")); addKeywords(XML.getValue("Field_87","")); addKeywords(XML.getValue("Field_88","")); XML.popTag(); // } // } // XML.popTag(); } //keyword list has been generated, let's see it! /*cout << endl << endl << "KEYWORD LIST: " << endl; for (int kCnt = 0; kCnt<keywords.size(); kCnt++){ //cout << keywords[kCnt].first << ", "<< keywords[kCnt].second << endl; }*/ //sort the list struct sort_pred { bool operator()(const std::pair<string,int> &left, const std::pair<string,int> &right) { return left.second > right.second; } }; std::sort(keywords.begin(), keywords.end(), sort_pred()); //std::sort(keywords.begin(), keywords.end(), boost::bind(&std::pair<string, int>::second, _1) < boost::bind(&std::pair<string, int>::second, _2)); //now return the sorted list... cout << endl << endl << "KEYWORD LIST: " << endl; for (int kCnt = 0; kCnt<keywords.size(); kCnt++){ cout << keywords[kCnt].first << ", "<< keywords[kCnt].second << endl; } }
bool QgsLayerMetadata::readMetadataXml( const QDomElement &metadataElement ) { QDomNode mnl; QDomElement mne; // set identifier mnl = metadataElement.namedItem( QStringLiteral( "identifier" ) ); mIdentifier = mnl.toElement().text(); // set parent identifier mnl = metadataElement.namedItem( QStringLiteral( "parentidentifier" ) ); mParentIdentifier = mnl.toElement().text(); // set language mnl = metadataElement.namedItem( QStringLiteral( "language" ) ); mLanguage = mnl.toElement().text(); // set type mnl = metadataElement.namedItem( QStringLiteral( "type" ) ); mType = mnl.toElement().text(); // set title mnl = metadataElement.namedItem( QStringLiteral( "title" ) ); mTitle = mnl.toElement().text(); // set abstract mnl = metadataElement.namedItem( QStringLiteral( "abstract" ) ); mAbstract = mnl.toElement().text(); // set keywords QDomNodeList keywords = metadataElement.elementsByTagName( QStringLiteral( "keywords" ) ); mKeywords.clear(); for ( int i = 0; i < keywords.size(); i++ ) { QStringList keywordsList; mnl = keywords.at( i ); mne = mnl.toElement(); QDomNodeList el = mne.elementsByTagName( QStringLiteral( "keyword" ) ); for ( int j = 0; j < el.size(); j++ ) { keywordsList.append( el.at( j ).toElement().text() ); } addKeywords( mne.attribute( QStringLiteral( "vocabulary" ) ), keywordsList ); } // set fees mnl = metadataElement.namedItem( QStringLiteral( "fees" ) ); mFees = mnl.toElement().text(); // constraints QDomNodeList constraintsList = metadataElement.elementsByTagName( QStringLiteral( "constraints" ) ); mConstraints.clear(); for ( int i = 0; i < constraintsList.size(); i++ ) { mnl = constraintsList.at( i ); mne = mnl.toElement(); addConstraint( QgsLayerMetadata::Constraint( mne.text(), mne.attribute( QStringLiteral( "type" ) ) ) ); } // rights QDomNodeList rightsNodeList = metadataElement.elementsByTagName( QStringLiteral( "rights" ) ); QStringList rightsList; for ( int i = 0; i < rightsNodeList.size(); i++ ) { mnl = rightsNodeList.at( i ); mne = mnl.toElement(); rightsList.append( mne.text() ); } setRights( rightsList ); // licenses QDomNodeList licensesNodeList = metadataElement.elementsByTagName( QStringLiteral( "license" ) ); QStringList licensesList; for ( int i = 0; i < licensesNodeList.size(); i++ ) { mnl = licensesNodeList.at( i ); mne = mnl.toElement(); licensesList.append( mne.text() ); } setLicenses( licensesList ); // encoding mnl = metadataElement.namedItem( QStringLiteral( "encoding" ) ); mEncoding = mnl.toElement().text(); // crs mnl = metadataElement.namedItem( QStringLiteral( "crs" ) ); if ( !mCrs.readXml( mnl ) ) mCrs = QgsCoordinateReferenceSystem(); // extent mnl = metadataElement.namedItem( QStringLiteral( "extent" ) ); QgsLayerMetadata::Extent metadataExtent; // spatial extent QDomNodeList spatialList = mnl.toElement().elementsByTagName( QStringLiteral( "spatial" ) ); QList< QgsLayerMetadata::SpatialExtent > metadataSpatialExtents; for ( int i = 0; i < spatialList.size(); i++ ) { mnl = spatialList.at( i ); mne = mnl.toElement(); QgsLayerMetadata::SpatialExtent se = QgsLayerMetadata::SpatialExtent(); se.extentCrs = QgsCoordinateReferenceSystem( mne.attribute( QStringLiteral( "crs" ) ) ); se.bounds = QgsBox3d(); se.bounds.setXMinimum( mne.attribute( QStringLiteral( "minx" ) ).toDouble() ); se.bounds.setYMinimum( mne.attribute( QStringLiteral( "miny" ) ).toDouble() ); se.bounds.setZMinimum( mne.attribute( QStringLiteral( "minz" ) ).toDouble() ); se.bounds.setXMaximum( mne.attribute( QStringLiteral( "maxx" ) ).toDouble() ); se.bounds.setYMaximum( mne.attribute( QStringLiteral( "maxy" ) ).toDouble() ); se.bounds.setZMaximum( mne.attribute( QStringLiteral( "maxz" ) ).toDouble() ); metadataSpatialExtents.append( se ); } metadataExtent.setSpatialExtents( metadataSpatialExtents ); // temporal extent mnl = metadataElement.namedItem( QStringLiteral( "extent" ) ); QDomNodeList temporalList = mnl.toElement().elementsByTagName( QStringLiteral( "temporal" ) ); QList<QgsDateTimeRange> metadataDates; for ( int j = 0; j < temporalList.size(); j++ ) { mnl = temporalList.at( j ); QDomNodeList instantList = mnl.toElement().elementsByTagName( QStringLiteral( "instant" ) ); for ( int i = 0; i < instantList.size(); i++ ) { mnl = instantList.at( i ); QDateTime d = QDateTime().fromString( mnl.toElement().text(), Qt::ISODate ); QgsDateTimeRange date = QgsDateTimeRange( d, d ); metadataDates << date; } QDomNodeList periodList = mnl.toElement().elementsByTagName( QStringLiteral( "period" ) ); for ( int i = 0; i < periodList.size(); i++ ) { QDomNode begin = periodList.at( i ).namedItem( QStringLiteral( "start" ) ); QDomNode end = periodList.at( i ).namedItem( QStringLiteral( "end" ) ); QDateTime beginDate = QDateTime().fromString( begin.toElement().text(), Qt::ISODate ); QDateTime endDate = QDateTime().fromString( end.toElement().text(), Qt::ISODate ); QgsDateTimeRange date = QgsDateTimeRange( beginDate, endDate ); metadataDates << date; } } metadataExtent.setTemporalExtents( metadataDates ); setExtent( metadataExtent ); // contact QDomNodeList contactsList = metadataElement.elementsByTagName( QStringLiteral( "contact" ) ); mContacts.clear(); for ( int i = 0; i < contactsList.size(); i++ ) { mnl = contactsList.at( i ); mne = mnl.toElement(); QgsLayerMetadata::Contact oneContact; oneContact.name = mne.namedItem( QStringLiteral( "name" ) ).toElement().text(); oneContact.organization = mne.namedItem( QStringLiteral( "organization" ) ).toElement().text(); oneContact.position = mne.namedItem( QStringLiteral( "position" ) ).toElement().text(); oneContact.voice = mne.namedItem( QStringLiteral( "voice" ) ).toElement().text(); oneContact.fax = mne.namedItem( QStringLiteral( "fax" ) ).toElement().text(); oneContact.email = mne.namedItem( QStringLiteral( "email" ) ).toElement().text(); oneContact.role = mne.namedItem( QStringLiteral( "role" ) ).toElement().text(); QList< QgsLayerMetadata::Address > addresses; QDomNodeList addressList = mne.elementsByTagName( QStringLiteral( "contactAddress" ) ); for ( int j = 0; j < addressList.size(); j++ ) { QDomElement addressElement = addressList.at( j ).toElement(); QgsLayerMetadata::Address oneAddress; oneAddress.address = addressElement.namedItem( QStringLiteral( "address" ) ).toElement().text(); oneAddress.administrativeArea = addressElement.namedItem( QStringLiteral( "administrativearea" ) ).toElement().text(); oneAddress.city = addressElement.namedItem( QStringLiteral( "city" ) ).toElement().text(); oneAddress.country = addressElement.namedItem( QStringLiteral( "country" ) ).toElement().text(); oneAddress.postalCode = addressElement.namedItem( QStringLiteral( "postalcode" ) ).toElement().text(); oneAddress.type = addressElement.namedItem( QStringLiteral( "type" ) ).toElement().text(); addresses << oneAddress; } oneContact.addresses = addresses; addContact( oneContact ); } // links mnl = metadataElement.namedItem( QStringLiteral( "links" ) ); mne = mnl.toElement(); mLinks.clear(); QDomNodeList el = mne.elementsByTagName( QStringLiteral( "link" ) ); for ( int i = 0; i < el.size(); i++ ) { mne = el.at( i ).toElement(); QgsLayerMetadata::Link oneLink; oneLink.name = mne.attribute( QStringLiteral( "name" ) ); oneLink.type = mne.attribute( QStringLiteral( "type" ) ); oneLink.url = mne.attribute( QStringLiteral( "url" ) ); oneLink.description = mne.attribute( QStringLiteral( "description" ) ); oneLink.format = mne.attribute( QStringLiteral( "format" ) ); oneLink.mimeType = mne.attribute( QStringLiteral( "mimeType" ) ); oneLink.size = mne.attribute( QStringLiteral( "size" ) ); addLink( oneLink ); } // history QDomNodeList historyNodeList = metadataElement.elementsByTagName( QStringLiteral( "history" ) ); QStringList historyList; for ( int i = 0; i < historyNodeList.size(); i++ ) { mnl = historyNodeList.at( i ); mne = mnl.toElement(); historyList.append( mne.text() ); } setHistory( historyList ); return true; }