Jump to content

rbrown

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by rbrown

  1. Also tried $filename = 'B4IBG5A0'; $mode = 'LO'; $prefix = '0x'; $chars =array("(", ")", " "); $sql = "SELECT * FROM premier_dicom.dicom_data WHERE VR = '".$mode."' "; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { $row['Tag'] = str_replace($chars, "", $row['Tag']); $tag_value = explode(',', $row['Tag']); $tag_value_1 = $prefix.$tag_value['0']; $tag_value_2 = $prefix.$tag_value['0']; echo $tag_value_1.'<br>'; echo $tag_value_2.'<br>'; $myarray[$row['Attribute_Name']] = $dicom->value($tag_value_1, $tag_value_2); try { $dicom = Nanodicom::factory($filename); $dicom->parse(); print_r($myarray); foreach($myarray as $key => $value) { echo $key.': '.$value."<br>"; //echo 'Patient ID: '.$dicom->value(0x0010,0x0020)."<br>"; unset($dicom); } } catch (Nanodicom_Exception $e) { echo 'File failed. '.$e->getMessage()."\n"; } } Get: Notice: Undefined variable: dicom in C:\a\UniServer\www\includes\dicom_test.php on line 24 And can see the two values before the script stops. So then I moved the setting for the array to inside the class: $filename = 'B4IBG5A0'; $mode = 'LO'; $prefix = '0x'; $chars =array("(", ")", " "); $sql = "SELECT * FROM premier_dicom.dicom_data WHERE VR = '".$mode."' "; $rs = mysql_query($sql); try { $dicom = Nanodicom::factory($filename); $dicom->parse(); while($row = mysql_fetch_array($rs)) { $row['Tag'] = str_replace($chars, "", $row['Tag']); $tag_value = explode(',', $row['Tag']); $tag_value_1 = $prefix.$tag_value['0']; $tag_value_2 = $prefix.$tag_value['0']; echo $tag_value_1.'<br>'; echo $tag_value_2.'<br>'; $myarray[$row['Attribute_Name']] = $dicom->value($tag_value_1, $tag_value_2); } print_r($myarray); foreach($myarray as $key => $value) { echo $key.': '.$value."<br>"; //echo 'Patient ID: '.$dicom->value(0x0010,0x0020)."<br>"; unset($dicom); } } catch (Nanodicom_Exception $e) { echo 'File failed. '.$e->getMessage()."\n"; } Then I get: all the values showing... 0x0040 0x0040 0x0028 0x0028 etc... and the print_r show the $key being set but not the $value part of the array. Array ( [Acquisition Device Processing Code] => [Acquisition Device Processing Description] => [Admission ID] => [Admitting Diagnoses Description] => [Application Setup Manufacturer] => [Application Setup Name] => etc.... and then it shows the $keys Acquisition Device Processing Description: Admission ID: Admitting Diagnoses Description: Application Setup Manufacturer: Application Setup Name: Applicator Description: Attenuation Correction Method: Authorization Equipment Certification Number: Beam Name: etc.... So being able to set the values inside the class value is where the problem is.
  2. When I run the code, All it is ouputting is: Patient ID: And it should be: Patient ID: 2507 so it's not liking the: $dicom->value($tag_value_1, $tag_value_2) part of: echo $row['Attribute_Name'].': '.$dicom->value($tag_value_1, $tag_value_2)."<br>"; but it doesn't throw an error. If I just use: echo 'Patient ID: '.$dicom->value(0x0010,0x0020)."<br>"; OR If I create an array like this: $myArray['Patient ID'] =$dicom->value(0x0010,0x0020); $myArray['Patient Name'] =$dicom->value(0x0010, 0x0010); and loop trough it, that works... to but that it defeats the purpose of having the database I would have to type in all 1500 plus settings. So it's ignoring the $tag_value_1, $tag_value_2 values when I set it that way. I can't send the test dicom file because it is a real patient file I'm testing with... HIPPA laws. The sample files I have don't have any patient data in them.
  3. Here is the orginal example code I'm playing with: // 5) Load simple and print certain value try { echo "5) Load simple and print certain value\n"; $dicom = Nanodicom::factory($filename); $dicom->parse(); echo $dicom->profiler_diff('parse')."\n"; echo 'Patient Name: '.$dicom->value(0x0010, 0x0010)."\n"; // Patient Name if exists unset($dicom); } catch (Nanodicom_Exception $e) { echo 'File failed. '.$e->getMessage()."\n"; } So I have a the database with 3 fields with data like this. Attribute_Name RV Tag Patient ID LO (0010,0020) Patient Orientation CS (0020,0020) Patient Orientation Code Sequence SQ (0054,0410) Patient Orientation Modifier Code Sequence SQ (0054,0412) Patient Position CS (0018,5100) Patient Setup Number IS (300A,0182) Patient Setup Sequence SQ (300A,0180) Patient State LO (0038,0500) Patient Support Angle DS (300A,0122) Patient Support Angle Tolerance DS (300A,004C) Patient Support Rotation Direction CS (300A,0123) Patient Transport Arrangements LO (0040,1004) Patient's Name PN (0010,0010) Patient's Primary Language Code Modifier Sequence SQ (0010,0102) Patient's Primary Language Code Sequence SQ (0010,0101) Patient's Telephone Numbers SH (0010,2154) Patient's Address LO (0010,1040) Patient's Age AS (0010,1010) Patient's Birth Date DA (0010,0030) Patient's Birth Name PN (0010,1005) Patient's Birth Time TM (0010,0032) And here is the code on how I want it to work: $mode = 'LO'; $prefix = '0x'; $chars =array("(", ")", " "); $sql = "SELECT * FROM premier_forms.dicom WHERE RV = '$Mode' "; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { $row['Tag'] = str_replace($chars, "", $row['Tag']); $tag_value = explode(',', $row['Tag']); $tag_value_1 = $prefix.$tag_value['0']; $tag_value_2 = $prefix.$tag_value['0']; try { $dicom = Nanodicom::factory($filename); $dicom->parse(); echo $row['Attribute_Name'].': '.$dicom->value($tag_value_1, $tag_value_2)."<br>"; unset($dicom); } catch (Nanodicom_Exception $e) { echo 'File failed. '.$e->getMessage()."\n"; } } Does that make more sense?
  4. Another idea is just looking through the database based on the students ranking for each question instead of the point system. If no exact match, then deindex each student answer by -1 until you get a match. Or you could allow a +-1 "find" range for each question and if no match then expand the range by 1. So the second time around would be +-2. And so on. That way you are only testing 10 variables at a time in instead of calculating a ton of variables for each school. And with your point system the logic to match the 10 different variables would be a pain or if you calculated like below if you may not get the correct results... Student a=9 b=1 c=0 d=9 = 19 Schools a=5 b=6 c=5 d=3 = 19 a=1 b=9 c=9 d=0 = 19 Not even close to what they would want...
  5. Thanks... But I needed to do this to get it to work: $myArray['PatientName'] = $dicom->value(0x0010, 0x0010); foreach($myArray as $key => $value) { echo $key.': '.$value."<br>"; } Wasn't planning on having to have the "$dicom->value" in the array. Can't get it to work any other way than above. I'm not getting the difference between the above and this... $myArray['PatientName'] = '0x0010, 0x0010'; foreach($myArray as $key => $value) { $show_it = $dicom->value($value); echo $key.': '.$show_it.'<br>'; } the above doesn't work and I tried a bunch of ways with the () in the array and out and ' " qoutes and trying to set the "$show_it" var different ways, and the echo statement without the "$show_it" var thinking maybe that was it. If i have to, then I have to add "$dicom->value" to the array, but I was trying to get away from adding it to the array. I wanted to build the array based on the "VR" I need from the list of over 1500 values. also the actual DICOM dictionary values don't contain the "0x" prefix he has that in there for the parsing. Example: Attribute Name, VR, Tag Patient ID, LO, (0010,0020) so to make it easier when they add to the DICOM dictionary I would like to have it so I can just up date the database without having to parse the dictionary and adding a ton of stuff to it. So I really wanted to build it on the fly. So once I get the "VR" set from the database, I can parse the "Tag" and output something like this: $parsed_tag1 = $prefix.$Parsed_tag1; $parsed_tag2 = $prefix.$Parsed_tag2; echo $key.': '.$dicom->value(.$parsed_tag1.', '.$parsed_tag1.); Hope this makes sense....
  6. oops I flipped the "if" statement... or add a ! in front of in_array and drop the . in front of the = sorry... Wouldn't let me reedit...
  7. I would do it based on thier "user id" otherwise if they could disconnect from the internet and get another ip or spoof their ip or if you did it with cookies they could move off the site and destroy the cookie and come back to your site and keep voting. I guess it depends on how critical you want to be on enforcing the voting... If you are allowing them to just vote then you will need to do it by ip. Either way I would do it where you have a table indexed by "ip" or "user id" and a field for "votes" then as they vote it would append the "article id" to to the "vote" field using a delimiter some thing like this: 1^4^22^200^3000 etc... then when they go to vote, lookup their "ip" or "user id" and grab the "votes" and explode it based on your delimiter then use in_array to check if they already voted or not on the article. $voting = explode('^', $votes); if (in_array($article_id, $voting)) { Code to allow them to vote and add the "article id" to the "vote" field $votes .= $votes.'^'.$article_id; update database with new vote } else { echo "sorry you all ready voted on this article!" } either way... depending on the traffic for your site... the database table could get huge. So you would need to keep an eye on it. Or if that could be a problem, then have "user id" or "ip" "article id" and date then dump the data after x amount of days or months or years. Or you could trim the votes after x amount of votes so say after voting for 100 articles it would dump the first one listed then add to the end. Lots of ways to skin the cat... Bob
  8. I just started playing with pdf's and after looking at a bunch of them the one that looked easy to get what I want without doing a ton of reading on the PDF formatting is... (And it has an ecryptor class with it.) http://www.rustyparts.com/pdf.php HTML_ToPDF is a PHP class that makes it easy to convert HTML documents to PDF files on the fly. HTML_ToPDF grew out of the need to convert HTML files (which are easy to create) to PDF files (which are not so easy to create) fast and easily. It has the following features: * The ability to convert images in the webpage to images embedded in the PDF. The script tries to convert relative image paths in to absolute ones as well. * The ability to use the CSS in the HTML file in the creation of the PDF. This includes remote CSS files as well. * The ability to convert remote files * The ability to convert links into embedded clickable links in the PDF file. * The ability to scale the HTML page. * Easy setting of any of these options through the methods of the class. * Tries to fix quirks in html pages which break html2ps. * Works on both Unix/Linux and Windows.
  9. Check this tutorial out... http://manda.com/frames/ Once you understand frames they are pretty easy... but they aren't very good for seo... So you may want to rethink your design depending on what you are doing. Bob
  10. I think this is what it is called... I having a brain fart... And I don't play with classes that much... Plus I have been playing with trying to get pdf's to output correctly so my brain is toasty.... I'm trying to parse DICOM (medical file format) files and I have this class and I want to setup an array to pull what fields I want. <?php require '../dicomparser/nanodicom.php'; $filename = 'B4IBG5A0'; // 5) Load simple and print certain value try { //echo "5) Load simple and print certain value\n"; $dicom = Nanodicom::factory($filename); $dicom->parse(); //echo $dicom->profiler_diff('parse').'<br>'; echo 'Patient Name: '.$dicom->value(0x0010, 0x0010).'<br>'; echo 'Operators Name: '.$dicom->value(0x0010, 0x0040).'<br>'; echo 'Patient ID: '.$dicom->value(0x0010,0x0020).'<br>'; unset($dicom); } catch (Nanodicom_Exception $e) { echo 'File failed. '.$e->getMessage()."\n"; } //} ?> So what I want to do is have the array contain 'Patient Name' => '(0x0010, 0x0010)' etc... And have it something like this so I don't have to echo all the lines I want. foreach ($array as $key => $value) { echo $key': '.$dicom->value.$value.'<br>'; } I can't get it to work... I remember figuring it out once before but that was over a year ago... And I don't have the code I wrote. I know it's something simple stupid. like $$ or [] i'm not getting the combination right. Thanks in advance...
  11. rbrown

    preg_match

    Thanks Crayon... As always... you rule... Bob
  12. rbrown

    preg_match

    I'm trying to us a preg_match where if the string contains spaces, dashes, underscores, A-z, a-z, 0-9 it will let it pass. If it has any other character it won't. I got the it to work with the underscore, A-z, a-z, 0-9 but trying to add the dash and space I'm just not getting it right. And I'm running out of hair... example file names: GittlingerBaier_AnnMarie_19707_04_06_11.pdf --- this works Gittlinger-Baier_Ann Marie_19707_04_06_11.pdf --- want this to pass Gittlinger,Baier_Ann%Marie_19707_04_06_11.pdf --- want this to fail This below works. But it doesn't allow spaces or dashes $file_name_exploded_extension = explode('.',$file['name']); if (preg_match("/^[a-z0-9_]+$/i", $file_name_exploded_extension['0']) ) { Thanks, Bob
  13. It sounds like the script you are calling in the cron is making the files. I have scripts that create database backups daily and it stores them below the public folders so no one can "see" them and also can email them to me. So you need to look in your scripts first and adjust the scripts for your needs.
  14. In that case you would have to have them submit the form, then allow them to make another selection after it stored or used that information to pull the next set of options. You would need to split up the form because you can't run a form inside a form. I have a one page form that reorders the data up or down, edits, inserts anywhere in the list, moves it anywhere, or deletes the record, based on what they type in or select. And that has four different forms on the page. and four buttons "Up", "dn", "edit", and one "add/insert /move/delete/edit" button. With a lot of switches and ifelse statements for error checking. And for each selection there has to be submit and a page refresh. No other way around it. unless you use ajax or javascript. So you would either have the the add fields at the bottom or the top of the form or have it skip showing any of the other data previously posted like name address or whatever. From what you are describing I would try and get an ajax solution to make it less frustrating and faster for your end users to be able to wade through adding or selecting options or waiting for page refreshes.
  15. ic... I thought you needed someway to get the selected data back to display the options so once it stored into the db they can select it for their choice. How are you planning on getting the data, if you don't query the database for whatever they have submitted so far? You keep saying "fields" so do you have a script that creates new "field" in your db or are you talking about just adding another row of data the the database? If you are talking form fields then if they can create custom form fields then how are you storing the data into the db? I'm just not getting what you are trying to do here... Otherwise you will need to ask them how many "fields" they want and then they hit submit to build the form with the extra fields using an array to store the data until submitted or use ajax to do it dynamically without a page refresh. If the latter is the case then post you question in a ajax forum.
  16. try this: $sql = "INSERT INTO members (username, email, IP) VALUES ('".$adduser."', '".$email."','".$IP."')";
  17. What about some thing like this? <?php $query = "SELECT * FROM your_db_table WHERE whatever = '".$whatever."' ORDER BY your_column_name ASC"; $result = mysql_query($query) or die(mysql_error()); echo '<select name="whatever_name[]" multiple="multiple">'; while ($row = mysql_fetch_array($result)) { echo '<option value="">Select one or more</option>'; if ($row['value'] == $value) { echo '<option value="'.$row['value'].'" SELECTED>'.$row['name'].'</option>'; } else { echo '<option value="'.$row['value'].'">'.$row['name'].'</option>'; } } echo '</select>'; ?> of course you will need to check to make sure that they select something. and then to parse it... $test=$_POST['whatever_name']; if ($test){ foreach ($test as $t){ coding to insert into db } }
  18. changed it around and it works.... Duh... I have been looking at it too long... Thanks... A pair of fresh eyes really helps sometimes...
  19. well you have to post the data in order to get it into the database so that they can select that option and any others... So you will need to have them post the form first, then take them to a form to select the groups they want. before letting them finish signing up.
  20. Since you are using ajax already.... Check this out... http://roshanbh.com.np/2008/01/populate-triple-drop-down-list-change-options-value-from-database-using-ajax-and-php.html
  21. Been trying to find an answer and keep running around in circles... I have: ( left test echos in there) if ($r['left_house_number'] != '') { /* Now see what they are supposed to get */ $left_customer_query = "SELECT * FROM customer WHERE house_number ='".$r['left_house_number']."' AND street = '".$r['left_house_street']."' AND route_number = '".$_SESSION['route_number']."'"; // echo "SELECT * FROM customer WHERE house_number ='".$r['left_house_number']."' AND street = '".$r['left_house_street']."' AND route_number = '".$_SESSION['route_number']."'"; $left_customer_result = mysql_query($left_customer_query) or die(mysql_error()); $left_customer_result_count = mysql_num_rows($left_customer_result); echo $r['left_house_number'].' =lhn1'; while ($lrow = mysql_fetch_array($left_customer_result)) { echo $r['left_house_number'].' =lhn2'; /* See if there is any customer if not display blank row */ echo $left_customer_result_count.' = count '; if ($left_customer_result_count < 1) { echo $r['left_house_number'].' =lhn3'; echo '<span class="delivery_nothing">'.$r['left_house_number'].' </span> 1<span class="delivery_nothing">'.$r['left_house_street'].' '; } else { /* Have a customer, now check to see if they are supposed to get something */ if ($lrow['status'] != "AC" && $lrow['status'] != "VH") { /* Customer is stopped or on vacation so show house number and street not bolded */ echo '<span class="delivery_nothing">'.$r['left_house_number'].'</span>2<span class="delivery_nothing">'.$r['left_house_street']; echo $r['left_house_number'].' =lhn4'; } else { /* Now check for correct delivery day and return data */ if (Show_Product($lrow['product']) == '1') { echo $r['left_house_number'].' =lhn5'; echo '<span class="delivery_bold">'.$lrow['house_number'].'</span><span class="delivery_bold">'.$lrow['placement'].'</span><span class="delivery_bold">'.$lrow['street'].'</span>'; echo Product_Formater($lrow['product']); } I have tried... if ($left_customer_result_count < 1) { if ($left_customer_result_count == 0) { if ($left_customer_result_count == '') { if ($left_customer_result_count === 0) { And I can't get it to work. the count "test echo" is either blank or 1 If I echo the sql statement with values I know aren't in the db and paste it into phpmyadmin: SELECT * FROM customer WHERE house_number = '3333' AND street = 'Chili Avenue' AND route_number = '68-24-630' I get: "MySQL returned an empty result set" And if I change it to something that is in the db: SELECT * FROM customer WHERE house_number = '3019' AND street = 'Chili Avenue' AND route_number = '68-24-630' I get: "Showing rows 0 - 0 (1 total, Query took 0.0012 sec)" So what do I have to do to get this to work right? What does it actually output when there are no results returned? thanks,
  22. Yep... DUH... that is what it is doing.... After you mentioned it, I deleted the one row then noticed another record went missing... I have been working on this script (other parts) since 6am and it now midnight... So maybe I should take a nap... So I can think straight... Thanks...
  23. Anyone run into this problem? I have this line... "SELECT * FROM customer ORDER BY street ASC" and it shows all the records but one which should be the the first record. But if I change it to this: "SELECT * FROM customer ORDER BY street DESC" the one missing record shows up as the last record... The script shows all the records on one page. So there isn't any logic between the query and the output or if I change the ORDER BY to: state, city, or zip it shows that one record either way.... So I'm pulling my hair out here.... Thanks...
  24. you have this.... <?php echo $options?> it needs to be this... <?php echo $options;?> When programming use this below, it will tell you when you have something mistyped... Just paste into the top of a page that gets called for every page like your functions page then when you are done just comment out the lines, in case you need it again you can just uncomment it. ini_set('display_errors', 'on'); error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
  25. rbrown

    reorder rows

    Also in case you are wondering how to insert the data where you want, James Trowbridge gave me this answer this over at: http://forums.codewalkers.com /* Prepare the table to accept a new route_order '6' right after '5' */ UPDATE table1 SET route_order = route_order+1 WHERE route_order>=6; /* INSERT the new house with route_order 6 */ INSERT INTO table1 (route_order) VALUES (6); Now with both ways I can write a way to move the data up and down or be able to insert any where in the table. Thanks again to both of you...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.